diff options
author | Patrick Simianer <p@simianer.de> | 2011-07-27 00:03:35 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2011-09-23 19:13:57 +0200 |
commit | 05c41075d0018ca6142f7ba593742fbadfecdf65 (patch) | |
tree | dbcc5d241eb92691b26ea12d5a07646a6a0201c6 /utils/weights.cc | |
parent | 1ee85918c6aaaf0ca9d72f7b876ba18e0c531b3e (diff) |
hacking in weights setting, getting
Diffstat (limited to 'utils/weights.cc')
-rw-r--r-- | utils/weights.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/utils/weights.cc b/utils/weights.cc index b994a2fe..6b7e58ed 100644 --- a/utils/weights.cc +++ b/utils/weights.cc @@ -88,3 +88,21 @@ void Weights::InitFromVector(const SparseVector<double>& w) { for (int i = 1; i < FD::NumFeats(); ++i) wv_[i] = w.value(i); } + +void Weights::SetWeight(SparseVector<double>* v, const string fname, const double w) { + WordID fid = FD::Convert(fname); + cout << "fid " << fid << endl; + SetWeight(v, fid, w); +} + +void Weights::SetWeight(SparseVector<double>* v, const WordID fid, const double w) { + wv_.resize(FD::NumFeats(), 0.0); + wv_[fid] = w; + //v->set_value(fid, w); +} + +void Weights::sz() +{ + cout << "wv_.size() " << wv_.size() << endl; +} + |