summaryrefslogtreecommitdiff
path: root/decoder/cdec_ff.cc
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-07 00:07:45 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-07 00:07:45 +0000
commit9db822ad9f2e25d88520e1c61b20052e7dfca6ca (patch)
treee5375c12fc748af98f871cdb453ba48e95379a55 /decoder/cdec_ff.cc
parentf87b2add497d9033ef468233ea3ec0f33cc97944 (diff)
dynamic fsa ff, factory for fsa and ff shares code, factory moved to ff_factory.cc
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@483 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cdec_ff.cc')
-rw-r--r--decoder/cdec_ff.cc54
1 files changed, 29 insertions, 25 deletions
diff --git a/decoder/cdec_ff.cc b/decoder/cdec_ff.cc
index fc64e5c4..39f018e1 100644
--- a/decoder/cdec_ff.cc
+++ b/decoder/cdec_ff.cc
@@ -10,35 +10,39 @@
#include "ff_bleu.h"
#include "ff_lm_fsa.h"
#include "ff_sample_fsa.h"
-
-boost::shared_ptr<FFRegistry> global_ff_registry;
+#include "ff_register.h"
void register_feature_functions() {
- global_ff_registry->Register(new FFFactory<LanguageModel>);
- global_ff_registry->Register(new FFFactory<FeatureFunctionFromFsa<LanguageModelFsa> >); // same as LM but using fsa wrapper
+ RegisterFF<LanguageModel>();
+ RegisterFsaImpl<LanguageModelFsa>(true,false); // same as LM but using fsa wrapper
+
+ RegisterFF<WordPenalty>();
+ RegisterFF<SourceWordPenalty>();
+ RegisterFF<ArityPenalty>();
+ RegisterFF<BLEUModel>();
- global_ff_registry->Register(new FFFactory<WordPenaltyFromFsa>); // same as WordPenalty, but implemented using ff_fsa
- global_ff_registry->Register(new FFFactory<FeatureFunctionFromFsa<LongerThanPrev> >);
- global_ff_registry->Register(new FFFactory<FeatureFunctionFromFsa<ShorterThanPrev> >);
+ //TODO: worthless example target FSA ffs. remove later
+ ff_registry.Register(new FFFactory<WordPenaltyFromFsa>); // same as WordPenalty, but implemented using ff_fsa
+ ff_registry.Register(new FFFactory<FeatureFunctionFromFsa<SameFirstLetter> >);
+ ff_registry.Register(new FFFactory<FeatureFunctionFromFsa<LongerThanPrev> >);
+ ff_registry.Register(new FFFactory<FeatureFunctionFromFsa<ShorterThanPrev> >);
- //TODO: use for all features the new Register which requires usage(...)
+ //TODO: use for all features the new Register which requires static FF::usage(false,false) give name
#ifdef HAVE_RANDLM
- global_ff_registry->Register("RandLM", new FFFactory<LanguageModelRandLM>);
+ ff_registry.Register("RandLM", new FFFactory<LanguageModelRandLM>);
#endif
- global_ff_registry->Register(new FFFactory<WordPenalty>);
- global_ff_registry->Register(new FFFactory<SourceWordPenalty>);
- global_ff_registry->Register(new FFFactory<ArityPenalty>);
- global_ff_registry->Register(new FFFactory<BLEUModel>);
- global_ff_registry->Register("RuleShape", new FFFactory<RuleShapeFeatures>);
- global_ff_registry->Register("RelativeSentencePosition", new FFFactory<RelativeSentencePosition>);
- global_ff_registry->Register("Model2BinaryFeatures", new FFFactory<Model2BinaryFeatures>);
- global_ff_registry->Register("MarkovJump", new FFFactory<MarkovJump>);
- global_ff_registry->Register("MarkovJumpFClass", new FFFactory<MarkovJumpFClass>);
- global_ff_registry->Register("SourcePOSBigram", new FFFactory<SourcePOSBigram>);
- global_ff_registry->Register("BlunsomSynchronousParseHack", new FFFactory<BlunsomSynchronousParseHack>);
- global_ff_registry->Register("AlignerResults", new FFFactory<AlignerResults>);
- global_ff_registry->Register("CSplit_BasicFeatures", new FFFactory<BasicCSplitFeatures>);
- global_ff_registry->Register("CSplit_ReverseCharLM", new FFFactory<ReverseCharLMCSplitFeature>);
- global_ff_registry->Register("Tagger_BigramIdentity", new FFFactory<Tagger_BigramIdentity>);
- global_ff_registry->Register("LexicalPairIdentity", new FFFactory<LexicalPairIdentity>);
+ ff_registry.Register("RuleShape", new FFFactory<RuleShapeFeatures>);
+ ff_registry.Register("RelativeSentencePosition", new FFFactory<RelativeSentencePosition>);
+ ff_registry.Register("Model2BinaryFeatures", new FFFactory<Model2BinaryFeatures>);
+ ff_registry.Register("MarkovJump", new FFFactory<MarkovJump>);
+ ff_registry.Register("MarkovJumpFClass", new FFFactory<MarkovJumpFClass>);
+ ff_registry.Register("SourcePOSBigram", new FFFactory<SourcePOSBigram>);
+ ff_registry.Register("BlunsomSynchronousParseHack", new FFFactory<BlunsomSynchronousParseHack>);
+ ff_registry.Register("AlignerResults", new FFFactory<AlignerResults>);
+ ff_registry.Register("CSplit_BasicFeatures", new FFFactory<BasicCSplitFeatures>);
+ ff_registry.Register("CSplit_ReverseCharLM", new FFFactory<ReverseCharLMCSplitFeature>);
+ ff_registry.Register("Tagger_BigramIdentity", new FFFactory<Tagger_BigramIdentity>);
+ ff_registry.Register("LexicalPairIdentity", new FFFactory<LexicalPairIdentity>);
+
}
+