summaryrefslogtreecommitdiff
path: root/src/ff.cc
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2009-12-08 21:38:55 -0500
committerChris Dyer <redpony@gmail.com>2009-12-08 21:38:55 -0500
commitdc6930c00b4b276883280cff1ed6dcd9ddef03c7 (patch)
treed76d25baf66459d13da4faedffd7d6faba28a513 /src/ff.cc
parent5082307f382a6563d4ffb97034137da4e362e629 (diff)
LICENSE fixes, full support of lattice decoding
Diffstat (limited to 'src/ff.cc')
-rw-r--r--src/ff.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ff.cc b/src/ff.cc
index 488e6468..2ae5b9eb 100644
--- a/src/ff.cc
+++ b/src/ff.cc
@@ -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),