summaryrefslogtreecommitdiff
path: root/decoder/ff_spans.h
diff options
context:
space:
mode:
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