summaryrefslogtreecommitdiff
path: root/decoder/ff_rules.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-11-06 00:02:58 -0500
committerChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-11-06 00:02:58 -0500
commitd8d8dad6e63306b3c8e326b22fcfdf90856bb85e (patch)
treeb4dc354bdb2080e110a8f9067d108cbacab5b3b8 /decoder/ff_rules.h
parent552793bbd50f634ea755b84d47ddcc6cd4f158f2 (diff)
parent9e5107a05bfabb76ce547d2849173c5a11aeba60 (diff)
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'decoder/ff_rules.h')
-rw-r--r--decoder/ff_rules.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/decoder/ff_rules.h b/decoder/ff_rules.h
index 7f5e1dfa..b100ec34 100644
--- a/decoder/ff_rules.h
+++ b/decoder/ff_rules.h
@@ -5,6 +5,7 @@
#include <map>
#include "trule.h"
#include "ff.h"
+#include "hg.h"
#include "array2d.h"
#include "wordid.h"
@@ -23,9 +24,24 @@ class RuleIdentityFeatures : public FeatureFunction {
mutable std::map<const TRule*, int> rule2_fid_;
};
-class RuleNgramFeatures : public FeatureFunction {
+class RuleSourceBigramFeatures : public FeatureFunction {
public:
- RuleNgramFeatures(const std::string& param);
+ RuleSourceBigramFeatures(const std::string& param);
+ protected:
+ virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta,
+ const Hypergraph::Edge& edge,
+ const std::vector<const void*>& ant_contexts,
+ SparseVector<double>* features,
+ SparseVector<double>* estimated_features,
+ void* context) const;
+ virtual void PrepareForInput(const SentenceMetadata& smeta);
+ private:
+ mutable std::map<const TRule*, SparseVector<double> > rule2_feats_;
+};
+
+class RuleTargetBigramFeatures : public FeatureFunction {
+ public:
+ RuleTargetBigramFeatures(const std::string& param);
protected:
virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta,
const HG::Edge& edge,