From 6b6a2d966a0d341fe5abee8b332a9d89f6c95bc4 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Mon, 13 Jan 2014 17:15:24 +0100
Subject: Felix' https://github.com/felleh lexical word alignment features
---
decoder/cdec_ff.cc | 2 ++
1 file changed, 2 insertions(+)
(limited to 'decoder/cdec_ff.cc')
diff --git a/decoder/cdec_ff.cc b/decoder/cdec_ff.cc
index b2541722..80b42d22 100644
--- a/decoder/cdec_ff.cc
+++ b/decoder/cdec_ff.cc
@@ -24,6 +24,7 @@
#include "ff_charset.h"
#include "ff_wordset.h"
#include "ff_external.h"
+#include "ff_lexical.h"
void register_feature_functions() {
@@ -39,6 +40,7 @@ void register_feature_functions() {
RegisterFF();
RegisterFF();
RegisterFF();
+ RegisterFF();
//TODO: use for all features the new Register which requires static FF::usage(false,false) give name
ff_registry.Register("SpanFeatures", new FFFactory());
--
cgit v1.2.3
From a1f3f7fb262b6efefb106a7bddaf81d2a3a6df93 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Mon, 13 Jan 2014 18:30:58 +0100
Subject: remove duplicate word alignment features
---
decoder/cdec_ff.cc | 1 -
decoder/ff_rules.cc | 22 ----------------------
decoder/ff_rules.h | 13 -------------
training/dtrain/examples/standard/cdec.ini | 1 -
4 files changed, 37 deletions(-)
(limited to 'decoder/cdec_ff.cc')
diff --git a/decoder/cdec_ff.cc b/decoder/cdec_ff.cc
index 80b42d22..8689a615 100644
--- a/decoder/cdec_ff.cc
+++ b/decoder/cdec_ff.cc
@@ -47,7 +47,6 @@ void register_feature_functions() {
ff_registry.Register("NgramFeatures", new FFFactory());
ff_registry.Register("RuleContextFeatures", new FFFactory());
ff_registry.Register("RuleIdentityFeatures", new FFFactory());
- ff_registry.Register("RuleWordAlignmentFeatures", new FFFactory());
ff_registry.Register("ParseMatchFeatures", new FFFactory);
ff_registry.Register("SoftSyntaxFeatures", new FFFactory);
ff_registry.Register("SoftSyntaxFeaturesMindist", new FFFactory);
diff --git a/decoder/ff_rules.cc b/decoder/ff_rules.cc
index 7bccf084..9533caed 100644
--- a/decoder/ff_rules.cc
+++ b/decoder/ff_rules.cc
@@ -69,28 +69,6 @@ void RuleIdentityFeatures::TraversalFeaturesImpl(const SentenceMetadata& smeta,
features->add_value(it->second, 1);
}
-RuleWordAlignmentFeatures::RuleWordAlignmentFeatures(const std::string& param) {
-}
-
-void RuleWordAlignmentFeatures::PrepareForInput(const SentenceMetadata& smeta) {
-}
-
-void RuleWordAlignmentFeatures::TraversalFeaturesImpl(const SentenceMetadata& smeta,
- const Hypergraph::Edge& edge,
- const vector& ant_contexts,
- SparseVector* features,
- SparseVector* estimated_features,
- void* context) const {
- const TRule& rule = *edge.rule_;
- ostringstream os;
- vector als = rule.als();
- std::vector::const_iterator xx = als.begin();
- for (; xx != als.end(); ++xx) {
- os << "WA:" << TD::Convert(rule.f_[xx->s_]) << ":" << TD::Convert(rule.e_[xx->t_]);
- }
- features->add_value(FD::Convert(Escape(os.str())), 1);
-}
-
RuleSourceBigramFeatures::RuleSourceBigramFeatures(const std::string& param) {
}
diff --git a/decoder/ff_rules.h b/decoder/ff_rules.h
index 324d7a39..f210dc65 100644
--- a/decoder/ff_rules.h
+++ b/decoder/ff_rules.h
@@ -24,19 +24,6 @@ class RuleIdentityFeatures : public FeatureFunction {
mutable std::map rule2_fid_;
};
-class RuleWordAlignmentFeatures : public FeatureFunction {
- public:
- RuleWordAlignmentFeatures(const std::string& param);
- protected:
- virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta,
- const HG::Edge& edge,
- const std::vector& ant_contexts,
- SparseVector* features,
- SparseVector* estimated_features,
- void* context) const;
- virtual void PrepareForInput(const SentenceMetadata& smeta);
-};
-
class RuleSourceBigramFeatures : public FeatureFunction {
public:
RuleSourceBigramFeatures(const std::string& param);
diff --git a/training/dtrain/examples/standard/cdec.ini b/training/dtrain/examples/standard/cdec.ini
index 044ae2f5..3330dd71 100644
--- a/training/dtrain/examples/standard/cdec.ini
+++ b/training/dtrain/examples/standard/cdec.ini
@@ -21,7 +21,6 @@ feature_function=RuleIdentityFeatures
feature_function=RuleSourceBigramFeatures
feature_function=RuleTargetBigramFeatures
feature_function=RuleShape
-#feature_function=RuleWordAlignmentFeatures
feature_function=LexicalFeatures 1 1 1
#feature_function=SourceSpanSizeFeatures
#feature_function=SourceWordPenalty
--
cgit v1.2.3