summaryrefslogtreecommitdiff
path: root/decoder/ff_const_reorder.h
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2014-12-17 22:04:58 -0500
committerChris Dyer <redpony@gmail.com>2014-12-17 22:04:58 -0500
commita059245e63178682624e10cde69f171820bd9209 (patch)
treea6f17da7c69048c8900260b5490bb9d8611be3bb /decoder/ff_const_reorder.h
parent1a79175f9a101d46cf27ca921213d5dd9300518f (diff)
parent7468e8d85e99b4619442c7afaf4a0d92870111bb (diff)
Merge pull request #63 from kho/const_reorder_2
Soft linguistic reordering constraints from http://www.aclweb.org/anthology/P14-1106
Diffstat (limited to 'decoder/ff_const_reorder.h')
-rw-r--r--decoder/ff_const_reorder.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/decoder/ff_const_reorder.h b/decoder/ff_const_reorder.h
new file mode 100644
index 00000000..a5be02d0
--- /dev/null
+++ b/decoder/ff_const_reorder.h
@@ -0,0 +1,43 @@
+/*
+ * ff_const_reorder.h
+ *
+ * Created on: Jul 11, 2013
+ * Author: junhuili
+ */
+
+#ifndef FF_CONST_REORDER_H_
+#define FF_CONST_REORDER_H_
+
+#include "ff_factory.h"
+#include "ff.h"
+
+struct ConstReorderFeatureImpl;
+
+// Soft reordering constraint features from
+// http://www.aclweb.org/anthology/P14-1106. To train the classifers,
+// use utils/const_reorder_model_trainer for constituency reordering
+// constraints and utils/argument_reorder_model_trainer for SRL
+// reordering constraints.
+//
+// Input segments should provide path to parse tree (resp. SRL parse)
+// as "parse" (resp. "srl") properties.
+class ConstReorderFeature : public FeatureFunction {
+ public:
+ ConstReorderFeature(const std::string& param);
+ ~ConstReorderFeature();
+ static std::string usage(bool param, bool verbose);
+
+ protected:
+ virtual void PrepareForInput(const SentenceMetadata& smeta);
+
+ 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* out_context) const;
+
+ private:
+ ConstReorderFeatureImpl* pimpl_;
+};
+
+#endif /* FF_CONST_REORDER_H_ */