diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-11-05 21:34:22 -0500 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-11-05 21:34:22 -0500 |
commit | 4b0dc9665ef59262c108957c2390290d676c2f95 (patch) | |
tree | 0e35e44fb8da5a27359badcb8e550398b4b359b9 /decoder/ff_rules.h | |
parent | 29bddedff12492812f9b8ea178957e47d1f87fb1 (diff) | |
parent | 9b8872bb7180bdc85be460c246d3ebb35fbfd30d (diff) |
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'decoder/ff_rules.h')
-rw-r--r-- | decoder/ff_rules.h | 20 |
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, |