diff options
Diffstat (limited to 'decoder/fdict.h')
-rw-r--r-- | decoder/fdict.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/decoder/fdict.h b/decoder/fdict.h index ff491cfb..d05f1706 100644 --- a/decoder/fdict.h +++ b/decoder/fdict.h @@ -6,16 +6,23 @@ #include "dict.h" struct FD { - static Dict dict_; + // once the FD is frozen, new features not already in the + // dictionary will return 0 + static void Freeze() { + frozen_ = true; + } static inline int NumFeats() { return dict_.max() + 1; } static inline WordID Convert(const std::string& s) { - return dict_.Convert(s); + return dict_.Convert(s, frozen_); } static inline const std::string& Convert(const WordID& w) { return dict_.Convert(w); } + static Dict dict_; + private: + static bool frozen_; }; #endif |