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