diff options
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: |