From 290c227d8e326e80f7c88c35a702fd382c4b0dcc Mon Sep 17 00:00:00 2001 From: "philblunsom@gmail.com" Date: Tue, 29 Jun 2010 22:39:47 +0000 Subject: Added singleton filter. git-svn-id: https://ws10smt.googlecode.com/svn/trunk@71 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/dict.h | 8 +++++--- 1 file 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& words, bool frozen = false) { + inline WordID Convert(const std::vector& words, bool frozen = false) + { return Convert(toString(words), frozen); } + + static inline std::string toString(const std::vector& words) { std::string word= ""; for (std::vector::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 { -- cgit v1.2.3