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