summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decoder/cdec.cc2
-rw-r--r--decoder/sparse_vector.h5
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);