summaryrefslogtreecommitdiff
path: root/decoder/ff_spans.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2011-02-26 17:21:21 -0500
committerChris Dyer <cdyer@cs.cmu.edu>2011-02-26 17:21:21 -0500
commit6ce05aeddfc4e57e943a016e10a3c158a5c449bb (patch)
tree15a5c41306b5ac596c74eb80c9c69c2bf8c5ccda /decoder/ff_spans.h
parentbebc061c3ac9799a0c91abc1a1fff1f57f5a3522 (diff)
chiang, marton, resnik fine reordering features
Diffstat (limited to 'decoder/ff_spans.h')
-rw-r--r--decoder/ff_spans.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/decoder/ff_spans.h b/decoder/ff_spans.h
index b93faec5..9928d70f 100644
--- a/decoder/ff_spans.h
+++ b/decoder/ff_spans.h
@@ -41,4 +41,29 @@ class SpanFeatures : public FeatureFunction {
WordID oov_;
};
+class CMR2008ReorderingFeatures : public FeatureFunction {
+ public:
+ CMR2008ReorderingFeatures(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;
+ private:
+ static int SpanSizeTransform(unsigned span_size);
+
+ const int kS;
+ std::pair<int, int> unconditioned_fids_; // first = monotone
+ // second = inverse
+ std::vector<std::pair<int, int> > fids_; // index=(j-i)
+
+ // collapsed feature values
+ bool use_collapsed_features_;
+ int fid_reorder_;
+ std::pair<double, double> uncoditioned_vals_;
+ std::vector<std::pair<double, double> > fvals_;
+};
+
#endif