summaryrefslogtreecommitdiff
path: root/decoder/dict.h
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2009-12-18 01:27:19 -0500
committerChris Dyer <redpony@gmail.com>2009-12-18 01:27:19 -0500
commit1aac806af7785ab440d300ca5cfa8833e3ed61d3 (patch)
tree4a2ffa484af029ebc542f2cdf7bb6da93325b29a /decoder/dict.h
parent40ac2d31391c27b168b0294e7683cb69da29f868 (diff)
add support for freezing the feature set to a user-specified list, even if feature detectors create additional features
Diffstat (limited to 'decoder/dict.h')
-rw-r--r--decoder/dict.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/decoder/dict.h b/decoder/dict.h
index bae9debe..0cbc9ff0 100644
--- a/decoder/dict.h
+++ b/decoder/dict.h
@@ -16,9 +16,11 @@ class Dict {
public:
Dict() : b0_("<bad0>") { words_.reserve(1000); }
inline int max() const { return words_.size(); }
- inline WordID Convert(const std::string& word) {
+ inline WordID Convert(const std::string& word, bool frozen = false) {
Map::iterator i = d_.find(word);
if (i == d_.end()) {
+ if (frozen)
+ return 0;
words_.push_back(word);
d_[word] = words_.size();
return words_.size();