diff options
author | Chris Dyer <redpony@gmail.com> | 2009-12-08 21:38:55 -0500 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2009-12-08 21:38:55 -0500 |
commit | dc6930c00b4b276883280cff1ed6dcd9ddef03c7 (patch) | |
tree | d76d25baf66459d13da4faedffd7d6faba28a513 /src/ff.cc | |
parent | 5082307f382a6563d4ffb97034137da4e362e629 (diff) |
LICENSE fixes, full support of lattice decoding
Diffstat (limited to 'src/ff.cc')
-rw-r--r-- | src/ff.cc | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -36,6 +36,27 @@ void WordPenalty::TraversalFeaturesImpl(const SentenceMetadata& smeta, features->set_value(fid_, edge.rule_->EWords() * value_); } +SourceWordPenalty::SourceWordPenalty(const string& param) : + fid_(FD::Convert("SourceWordPenalty")), + value_(-1.0 / log(10)) { + if (!param.empty()) { + cerr << "Warning SourceWordPenalty ignoring parameter: " << param << endl; + } +} + +void SourceWordPenalty::TraversalFeaturesImpl(const SentenceMetadata& smeta, + const Hypergraph::Edge& edge, + const std::vector<const void*>& ant_states, + SparseVector<double>* features, + SparseVector<double>* estimated_features, + void* state) const { + (void) smeta; + (void) ant_states; + (void) state; + (void) estimated_features; + features->set_value(fid_, edge.rule_->FWords() * value_); +} + ModelSet::ModelSet(const vector<double>& w, const vector<const FeatureFunction*>& models) : models_(models), weights_(w), |