diff options
author | philblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-29 17:06:03 +0000 |
---|---|---|
committer | philblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-29 17:06:03 +0000 |
commit | fa91c76321460773e0de7fc077db5a3c919eb89b (patch) | |
tree | 097ba6452ddc389283d1fb2956357dcb9576ea46 /decoder | |
parent | 90f4ede0eea7ec5b73e7167dde4fe590485dcd67 (diff) |
Added different executable for working with context models, changed input/output processing.
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@54 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/dict.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/decoder/dict.h b/decoder/dict.h index bc3a904a..39baf6ed 100644 --- a/decoder/dict.h +++ b/decoder/dict.h @@ -8,6 +8,8 @@ #include <vector> #include <boost/functional/hash.hpp> +#include <boost/regex.hpp> +#include <boost/algorithm/string/regex.hpp> #include "wordid.h" @@ -36,7 +38,7 @@ class Dict { std::string word= ""; for (std::vector<std::string>::const_iterator it=words.begin(); it != words.end(); ++it) { - if (it != words.begin()) word += "__"; + if (it != words.begin()) word += "|||"; word += *it; } @@ -49,6 +51,12 @@ class Dict { return words_[id-1]; } + inline std::vector<std::string> AsVector(const WordID& id) const { + std::vector<std::string> result; + boost::algorithm::split_regex(result, Convert(id), boost::regex("\\|\\|\\|")); + return result; + } + void clear() { words_.clear(); d_.clear(); } private: |