From 1aac806af7785ab440d300ca5cfa8833e3ed61d3 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Fri, 18 Dec 2009 01:27:19 -0500 Subject: add support for freezing the feature set to a user-specified list, even if feature detectors create additional features --- decoder/dict.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'decoder/dict.h') 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_("") { 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(); -- cgit v1.2.3