diff options
author | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-23 18:29:55 +0000 |
---|---|---|
committer | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-23 18:29:55 +0000 |
commit | 3f6de721b089823ac15f3d1ad786e6b479dee4d0 (patch) | |
tree | 98edfe38e297fddcbad2624384d174436f2001b4 /gi/clda/src/tdict.h | |
parent | 70ad159e22fc6ea12a5e7b468ab38a93c3ed111f (diff) |
use centralized make
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@11 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/clda/src/tdict.h')
-rw-r--r-- | gi/clda/src/tdict.h | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/gi/clda/src/tdict.h b/gi/clda/src/tdict.h deleted file mode 100644 index 97f145a1..00000000 --- a/gi/clda/src/tdict.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _TDICT_H_ -#define _TDICT_H_ - -#include <string> -#include <vector> -#include "wordid.h" -#include "dict.h" - -class Vocab; - -struct TD { - - static Dict dict_; - static std::string empty; - static std::string space; - - static std::string GetString(const std::vector<WordID>& str) { - std::string res; - for (std::vector<WordID>::const_iterator i = str.begin(); i != str.end(); ++i) - res += (i == str.begin() ? empty : space) + TD::Convert(*i); - return res; - } - - static void ConvertSentence(const std::string& sent, std::vector<WordID>* ids) { - std::string s = sent; - int last = 0; - ids->clear(); - for (int i=0; i < s.size(); ++i) - if (s[i] == 32 || s[i] == '\t') { - s[i]=0; - if (last != i) { - ids->push_back(Convert(&s[last])); - } - last = i + 1; - } - if (last != s.size()) - ids->push_back(Convert(&s[last])); - } - - static WordID Convert(const std::string& s) { - return dict_.Convert(s); - } - - static const std::string& Convert(const WordID& w) { - return dict_.Convert(w); - } -}; - -#endif |