diff options
Diffstat (limited to 'decoder/tdict.cc')
-rw-r--r-- | decoder/tdict.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/decoder/tdict.cc b/decoder/tdict.cc index ac590bd8..93f7b0eb 100644 --- a/decoder/tdict.cc +++ b/decoder/tdict.cc @@ -5,23 +5,25 @@ using namespace std; -Vocab* TD::dict_ = new Vocab; - -static const string empty; -static const string space = " "; +//FIXME: valgrind errors (static init order?) +Vocab TD::dict_; unsigned int TD::NumWords() { - return dict_->numWords(); + return dict_.numWords(); } WordID TD::Convert(const std::string& s) { - return dict_->addWord((VocabString)s.c_str()); + return dict_.addWord((VocabString)s.c_str()); } const char* TD::Convert(const WordID& w) { - return dict_->getWord((VocabIndex)w); + return dict_.getWord((VocabIndex)w); } +static const string empty; +static const string space = " "; + + void TD::GetWordIDs(const std::vector<std::string>& strings, std::vector<WordID>* ids) { ids->clear(); for (vector<string>::const_iterator i = strings.begin(); i != strings.end(); ++i) |