diff options
Diffstat (limited to 'decoder')
| -rw-r--r-- | decoder/Makefile.am | 1 | ||||
| -rw-r--r-- | decoder/dict.cc | 11 | ||||
| -rw-r--r-- | decoder/dict.h | 8 | 
3 files changed, 13 insertions, 7 deletions
| diff --git a/decoder/Makefile.am b/decoder/Makefile.am index 44d6adc8..fd4589e4 100644 --- a/decoder/Makefile.am +++ b/decoder/Makefile.am @@ -47,6 +47,7 @@ libcdec_a_SOURCES = \    rule_lexer.cc \    fst_translator.cc \    csplit.cc \ +  dict.cc \    translator.cc \    scfg_translator.cc \    hg.cc \ diff --git a/decoder/dict.cc b/decoder/dict.cc new file mode 100644 index 00000000..485fa348 --- /dev/null +++ b/decoder/dict.cc @@ -0,0 +1,11 @@ +#include "dict.h" + +#include <string> +#include <vector> +#include <boost/regex.hpp> +#include <boost/algorithm/string/regex.hpp> + +void Dict::AsVector(const WordID& id, std::vector<std::string>* results) const { +  boost::algorithm::split_regex(*results, Convert(id), boost::regex("\\|\\|\\|")); +} + diff --git a/decoder/dict.h b/decoder/dict.h index 39baf6ed..1c8ebb67 100644 --- a/decoder/dict.h +++ b/decoder/dict.h @@ -8,8 +8,6 @@  #include <vector>  #include <boost/functional/hash.hpp> -#include <boost/regex.hpp> -#include <boost/algorithm/string/regex.hpp>  #include "wordid.h" @@ -51,11 +49,7 @@ 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 AsVector(const WordID& id, std::vector<std::string>* results) const;    void clear() { words_.clear(); d_.clear(); } | 
