From c70e58a62d9f2fed4df0665202c2eb44334dfd8c Mon Sep 17 00:00:00 2001 From: graehl Date: Fri, 23 Jul 2010 02:27:28 +0000 Subject: bottom-up FF from fsa FF - WordPenaltyFsa - needs debugging git-svn-id: https://ws10smt.googlecode.com/svn/trunk@373 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/ff.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'decoder/ff.cc') diff --git a/decoder/ff.cc b/decoder/ff.cc index a20b743f..b6a541e3 100644 --- a/decoder/ff.cc +++ b/decoder/ff.cc @@ -30,12 +30,12 @@ string FeatureFunction::usage_helper(std::string const& name,std::string const& return r; } -FeatureFunction::Features FeatureFunction::single_feature(WordID feat) { +Features FeatureFunction::single_feature(WordID feat) { return Features(1,feat); } -FeatureFunction::Features ModelSet::all_features(std::ostream *warn,bool warn0) { - typedef FeatureFunction::Features FFS; +Features ModelSet::all_features(std::ostream *warn,bool warn0) { + typedef Features FFS; FFS ffs; #define WARNFF(x) do { if (warn) { *warn << "WARNING: "<< x ; *warn< FFM; @@ -74,7 +74,7 @@ FeatureFunction::Features ModelSet::all_features(std::ostream *warn,bool warn0) void ModelSet::show_features(std::ostream &out,std::ostream &warn,bool warn_zero_wt) { - typedef FeatureFunction::Features FFS; + typedef Features FFS; FFS ffs=all_features(&warn,warn_zero_wt); out << "Weight Feature\n"; for (unsigned i=0;iedge_prob_.logeq(edge->feature_values_.dot(weights_)); } -void ModelSet::AddFinalFeatures(const std::string& state, Hypergraph::Edge* edge) const { +void ModelSet::AddFinalFeatures(const std::string& state, Hypergraph::Edge* edge,SentenceMetadata const& smeta) const { assert(1 == edge->rule_->Arity()); for (int i = 0; i < models_.size(); ++i) { @@ -223,7 +223,7 @@ void ModelSet::AddFinalFeatures(const std::string& state, Hypergraph::Edge* edge int spos = model_state_pos_[i]; ant_state = &state[spos]; } - ff.FinalTraversalFeatures(ant_state, &edge->feature_values_); + ff.FinalTraversalFeatures(smeta, ant_state, &edge->feature_values_); } edge->edge_prob_.logeq(edge->feature_values_.dot(weights_)); } -- cgit v1.2.3