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 | 367d09306da18663870f7200e81fce14b86bec12 (patch) | |
tree | 2289f336378174f7d1bc6226b5749bef3f1f73c8 /decoder | |
parent | c915f1dfaee23dfe229da0b47163d86e9f9cac60 (diff) |
use centralized make
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@11 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/sampler.h | 2 | ||||
-rw-r--r-- | decoder/tdict.cc | 4 | ||||
-rw-r--r-- | decoder/tdict.h | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/decoder/sampler.h b/decoder/sampler.h index e5840f41..4d0b2e64 100644 --- a/decoder/sampler.h +++ b/decoder/sampler.h @@ -88,10 +88,12 @@ typedef RandomNumberGenerator<boost::mt19937> MT19937; class SampleSet { public: const prob_t& operator[](int i) const { return m_scores[i]; } + prob_t& operator[](int i) { return m_scores[i]; } bool empty() const { return m_scores.empty(); } void add(const prob_t& s) { m_scores.push_back(s); } void clear() { m_scores.clear(); } size_t size() const { return m_scores.size(); } + void resize(int size) { m_scores.resize(size); } std::vector<prob_t> m_scores; }; diff --git a/decoder/tdict.cc b/decoder/tdict.cc index c00d20b8..ac590bd8 100644 --- a/decoder/tdict.cc +++ b/decoder/tdict.cc @@ -10,6 +10,10 @@ Vocab* TD::dict_ = new Vocab; static const string empty; static const string space = " "; +unsigned int TD::NumWords() { + return dict_->numWords(); +} + WordID TD::Convert(const std::string& s) { return dict_->addWord((VocabString)s.c_str()); } diff --git a/decoder/tdict.h b/decoder/tdict.h index 31f66367..fd77543d 100644 --- a/decoder/tdict.h +++ b/decoder/tdict.h @@ -23,6 +23,7 @@ struct TD { } return (dest - buffer); } + static unsigned int NumWords(); static WordID Convert(const std::string& s); static const char* Convert(const WordID& w); }; |