summaryrefslogtreecommitdiff
path: root/decoder/ff_wordalign.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2010-12-15 00:26:55 -0500
committerChris Dyer <cdyer@cs.cmu.edu>2010-12-15 00:26:55 -0500
commit491848839c0340f6c629ebae7ed6b6dc1a3842ad (patch)
treec48590f5553e517d583232e6ffb73d33d8709d88 /decoder/ff_wordalign.h
parentcd1f6d47e48fa79c706cdaa4d69bbf6f1142c55a (diff)
feature to detect self-transition before/after identity translations
Diffstat (limited to 'decoder/ff_wordalign.h')
-rw-r--r--decoder/ff_wordalign.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/decoder/ff_wordalign.h b/decoder/ff_wordalign.h
index a1ffd9ca..8035000e 100644
--- a/decoder/ff_wordalign.h
+++ b/decoder/ff_wordalign.h
@@ -237,6 +237,23 @@ class WordPairFeatures : public FeatureFunction {
std::vector<std::map<WordID, SparseVector<float> > > values_; // fkeys_index -> e -> value
};
+// fires when a len(word) >= length_min_ is translated as itself and then a self-transition is made
+class IdentityCycleDetector : public FeatureFunction {
+ public:
+ IdentityCycleDetector(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:
+ int length_min_;
+ int fid_;
+ mutable std::map<WordID, bool> big_enough_;
+};
+
class InputIdentity : public FeatureFunction {
public:
InputIdentity(const std::string& param);