diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-08 19:12:59 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-08 19:12:59 +0000 |
commit | 71b39bcf60182d1686966db34225a670d13e3594 (patch) | |
tree | be260c40aaaeca1a70df4187c5abf7c167d74b1c | |
parent | 337b647baac15609a0a493902d58c473d25d2ed8 (diff) |
misc
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@185 ec762483-ff6d-05da-a07a-a48fb63a330f
-rw-r--r-- | decoder/cdec.cc | 2 | ||||
-rw-r--r-- | decoder/sparse_vector.h | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/decoder/cdec.cc b/decoder/cdec.cc index 85412d6a..140fe8e4 100644 --- a/decoder/cdec.cc +++ b/decoder/cdec.cc @@ -350,7 +350,9 @@ int main(int argc, char** argv) { prelm_w.InitFromFile(plmw); prelm_feature_weights.resize(FD::NumFeats()); prelm_w.InitVector(&prelm_feature_weights); + cerr << "prelm_weights: " << FeatureVector(prelm_feature_weights)<<endl; } + cerr << "+LM weights: " << FeatureVector(feature_weights)<<endl; if (!conf.count("no_freeze_feature_set")) { cerr << "Freezing feature set (use --no_freeze_feature_set to change)." << endl; FD::Freeze(); diff --git a/decoder/sparse_vector.h b/decoder/sparse_vector.h index 26f5d791..7794fd5e 100644 --- a/decoder/sparse_vector.h +++ b/decoder/sparse_vector.h @@ -18,6 +18,11 @@ public: typedef std::map<int, T> MapType; typedef typename std::map<int, T>::const_iterator const_iterator; SparseVector() {} + explicit SparseVector(std::vector<T> const& v) { + MapType::iterator p=values_.end(); + for (unsigned i=0;i<v.size();++i) + p=values_.insert(p,MapType::value_type(i,v[i])); //faster + } const T operator[](int index) const { typename MapType::const_iterator found = values_.find(index); |