예제 #1
0
파일: vocab.cpp 프로젝트: poetzhangzi/test
	wordID_t Vocab::GetWordID(const std::string& word_str) {
		FactorList factors;
		factors.push_back(0); 
		Word word;
		word.CreateFromString(Input, factors, word_str, false); 
    return GetWordID(word);
  }
예제 #2
0
const Word Vocab::InitSpecialWord( const std::string& word_str)
{
  FactorList factors;
  factors.push_back(0); // store the special word string as the first factor
  Word word;
  // define special word as Input word with one factor and isNonTerminal=false
  word.CreateFromString( Input, factors, word_str, false ); // Input is enum defined in ../typedef.h
  // TODO not sure if this will work properly:
  // 	- word comparison can fail because the last parameter (isNonTerminal)
  // 		in function CreateFromString may not match properly created words
  // 	- special word is Input word but what about Output words?
  // 		- currently Input/Output variable is not stored in class Word, but in the future???
  return word;
}
예제 #3
0
bool Vocab::Load(FileHandler* vcbin)
{
  FactorList factors;
  factors.push_back(0);
  return Load(vcbin, Input, factors);
}