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 | 290c227d8e326e80f7c88c35a702fd382c4b0dcc (patch) | |
tree | 127cd1d608a05209d290ad2c74a4598d0903495d | |
parent | 32c356e5dd29b6d0ade9423043a44fb52b5e1653 (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 { |