00001 #ifndef LM_COMMON_SPECIAL_H 00002 #define LM_COMMON_SPECIAL_H 00003 00004 #include "lm/word_index.hh" 00005 00006 namespace lm { 00007 00008 class SpecialVocab { 00009 public: 00010 SpecialVocab(WordIndex bos, WordIndex eos) : bos_(bos), eos_(eos) {} 00011 00012 bool IsSpecial(WordIndex word) const { 00013 return word == kUNK || word == bos_ || word == eos_; 00014 } 00015 00016 WordIndex UNK() const { return kUNK; } 00017 WordIndex BOS() const { return bos_; } 00018 WordIndex EOS() const { return eos_; } 00019 00020 private: 00021 WordIndex bos_; 00022 WordIndex eos_; 00023 }; 00024 00025 } // namespace lm 00026 00027 #endif // LM_COMMON_SPECIAL_H