void Word::CreateFromString(const std::string &inString, Vocab &vocab) { if (inString.substr(0, 1) == "[" && inString.substr(inString.size() - 1, 1) == "]") { // non-term m_isNonTerminal = true; string str = inString.substr(1, inString.size() - 2); m_vocabId = vocab.AddVocabId(str); } else { m_isNonTerminal = false; m_vocabId = vocab.AddVocabId(inString); } }
void Word::CreateFromString(const std::string &inString, Vocab &vocab) { if (inString.substr(0, 1) == "[" && inString.substr(inString.size() - 1, 1) == "]") { // non-term m_isNonTerminal = true; } else { m_isNonTerminal = false; } m_factors.resize(1); m_factors[0] = vocab.AddVocabId(inString); }