void DebugLib::GenerateSentencesOfWordsFromWordLM( const NHPYLM &LanguageModel, int SentEndWordId) { // Id2 word sequence vector for printing std::vector<std::string> Id2WordSequenceVector(LanguageModel.GetId2CharacterSequenceVector()); // generate sentences of words from the word language model std::vector<std::vector<int> > GeneratedSentencesFromWHPYLM = LanguageModel.Generate("WHPYLM", 10000, SentEndWordId, NULL); for (auto &Sentence : GeneratedSentencesFromWHPYLM) { for (auto &Word : Sentence) { if (Word == SentEndWordId) { std::cout << std::endl; } else { // std::cout << Id2CharacterSequenceVector.at(Word) << "[" << Word << "] "; std::cout << Id2WordSequenceVector.at(Word) << " "; } } std::cout << std::endl; } }
void DebugLib::GenerateSentencesOfWordsFromCharLM( const NHPYLM &LanguageModel) { // Id2 Character sequence vector for printing std::vector<std::string> Id2CharacterSequenceVector( LanguageModel.GetId2CharacterSequenceVector()); // generate sentences of words from the Character language model std::vector<std::vector<int> > GeneratedSentencesFromCHPYLM = LanguageModel.Generate("CHPYLM", 100000, -1, NULL); for (auto &Sentence : GeneratedSentencesFromCHPYLM) { for (auto &Character : Sentence) { if (Character == UNKEND_SYMBOLID) { std::cout << " "; } else if (Character == SENTEND_SYMBOLID) { std::cout << std::endl; } else { // std::cout << Id2CharacterSequenceVector.at(Character) << "[" << Character << "] "; std::cout << Id2CharacterSequenceVector.at(Character); } } std::cout << std::endl; } }