diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2011-02-26 17:21:21 -0500 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2011-02-26 17:21:21 -0500 |
commit | 6ce05aeddfc4e57e943a016e10a3c158a5c449bb (patch) | |
tree | 15a5c41306b5ac596c74eb80c9c69c2bf8c5ccda /decoder/ff_spans.h | |
parent | bebc061c3ac9799a0c91abc1a1fff1f57f5a3522 (diff) |
chiang, marton, resnik fine reordering features
Diffstat (limited to 'decoder/ff_spans.h')
-rw-r--r-- | decoder/ff_spans.h | 25 |
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 |