|
Joshua
open source statistical hierarchical phrase-based machine translation system
|
00001 #ifndef LM_ENUMERATE_VOCAB__ 00002 #define LM_ENUMERATE_VOCAB__ 00003 00004 #include "lm/word_index.hh" 00005 #include "util/string_piece.hh" 00006 00007 namespace lm { 00008 namespace ngram { 00009 00010 /* If you need the actual strings in the vocabulary, inherit from this class 00011 * and implement Add. Then put a pointer in Config.enumerate_vocab; it does 00012 * not take ownership. Add is called once per vocab word. index starts at 0 00013 * and increases by 1 each time. This is only used by the Model constructor; 00014 * the pointer is not retained by the class. 00015 */ 00016 class EnumerateVocab { 00017 public: 00018 virtual ~EnumerateVocab() {} 00019 00020 virtual void Add(WordIndex index, const StringPiece &str) = 0; 00021 00022 protected: 00023 EnumerateVocab() {} 00024 }; 00025 00026 } // namespace ngram 00027 } // namespace lm 00028 00029 #endif // LM_ENUMERATE_VOCAB__ 00030