summaryrefslogtreecommitdiff
path: root/decoder/ff_rules.h
diff options
context:
space:
mode:
authorAvneesh Saluja <asaluja@gmail.com>2013-03-28 18:28:16 -0700
committerAvneesh Saluja <asaluja@gmail.com>2013-03-28 18:28:16 -0700
commit3d8d656fa7911524e0e6885647173474524e0784 (patch)
tree81b1ee2fcb67980376d03f0aa48e42e53abff222 /decoder/ff_rules.h
parentbe7f57fdd484e063775d7abf083b9fa4c403b610 (diff)
parent96fedabebafe7a38a6d5928be8fff767e411d705 (diff)
fixed conflicts
Diffstat (limited to 'decoder/ff_rules.h')
-rw-r--r--decoder/ff_rules.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/decoder/ff_rules.h b/decoder/ff_rules.h
index 48d8bd05..f210dc65 100644
--- a/decoder/ff_rules.h
+++ b/decoder/ff_rules.h
@@ -3,7 +3,9 @@
#include <vector>
#include <map>
+#include "trule.h"
#include "ff.h"
+#include "hg.h"
#include "array2d.h"
#include "wordid.h"
@@ -12,7 +14,7 @@ class RuleIdentityFeatures : public FeatureFunction {
RuleIdentityFeatures(const std::string& param);
protected:
virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta,
- const Hypergraph::Edge& edge,
+ const HG::Edge& edge,
const std::vector<const void*>& ant_contexts,
SparseVector<double>* features,
SparseVector<double>* estimated_features,
@@ -22,9 +24,9 @@ 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,
@@ -37,4 +39,20 @@ class RuleNgramFeatures : public FeatureFunction {
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,
+ const std::vector<const void*>& ant_contexts,
+ SparseVector<double>* features,
+ SparseVector<double>* estimated_features,
+ void* context) const;
+ virtual void PrepareForInput(const SentenceMetadata& smeta);
+ private:
+ std::vector<std::string> inds;
+ mutable std::map<const TRule*, SparseVector<double> > rule2_feats_;
+};
+
#endif