summaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-08 19:12:59 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-08 19:12:59 +0000
commite202d85c10942fd586088207a55226cc1eb1a01e (patch)
tree0b0ce54e83178a4251988c749b5ec2744bed6b8d /decoder
parentd5ff16caf653f6fab31a3f0620214c331d6eebc4 (diff)
misc
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@185 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder')
-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);