diff options
author | philblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-29 22:39:47 +0000 |
---|---|---|
committer | philblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-29 22:39:47 +0000 |
commit | 5791e37a13c657528588e4d84c588c76065545c7 (patch) | |
tree | 25d2148213e457d88b180091e7b0da019cebf47b | |
parent | 4e1c6e53e121aeb54df2b3ac825548fa4878fed2 (diff) |
Added singleton filter.
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@71 ec762483-ff6d-05da-a07a-a48fb63a330f
-rw-r--r-- | decoder/dict.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/decoder/dict.h b/decoder/dict.h index 1c8ebb67..e0ac9abd 100644 --- a/decoder/dict.h +++ b/decoder/dict.h @@ -32,15 +32,17 @@ class Dict { } } - inline WordID Convert(const std::vector<std::string>& words, bool frozen = false) { + inline WordID Convert(const std::vector<std::string>& words, bool frozen = false) + { return Convert(toString(words), frozen); } + + static inline std::string toString(const std::vector<std::string>& words) { std::string word= ""; for (std::vector<std::string>::const_iterator it=words.begin(); it != words.end(); ++it) { if (it != words.begin()) word += "|||"; word += *it; } - - return Convert(word, frozen); + return word; } inline const std::string& Convert(const WordID& id) const { |