blob: 0677cd71b4ed897ada9ffc2e18d197250e516fed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#ifndef LM_COMMON_SPECIAL_H
#define LM_COMMON_SPECIAL_H
#include "lm/word_index.hh"
namespace lm {
class SpecialVocab {
public:
SpecialVocab(WordIndex bos, WordIndex eos) : bos_(bos), eos_(eos) {}
bool IsSpecial(WordIndex word) const {
return word == kUNK || word == bos_ || word == eos_;
}
WordIndex UNK() const { return kUNK; }
WordIndex BOS() const { return bos_; }
WordIndex EOS() const { return eos_; }
private:
WordIndex bos_;
WordIndex eos_;
};
} // namespace lm
#endif // LM_COMMON_SPECIAL_H
|