summaryrefslogtreecommitdiff
path: root/decoder/ff_factory.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-07 02:24:51 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-07 02:24:51 +0000
commitaaac9f8ee73ba59b72609af9a78b167312a6dac7 (patch)
tree1273c65f43c124eac220a298acbe7af951b0a83e /decoder/ff_factory.h
parente2ef62dc50b9795fc801f97aba7bac8c80bb7c54 (diff)
propagation of feature name+debug from factory, return correct features array for fsa ffs
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@486 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/ff_factory.h')
-rw-r--r--decoder/ff_factory.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/decoder/ff_factory.h b/decoder/ff_factory.h
index 102e709c..5eb68c8b 100644
--- a/decoder/ff_factory.h
+++ b/decoder/ff_factory.h
@@ -42,7 +42,9 @@ struct FactoryBase : public UntypedFactory {
template<class FF>
struct FFFactory : public FactoryBase<FeatureFunction> {
FP Create(std::string param) const {
- return FP(new FF(param));
+ FF *ret=new FF(param);
+ ret->Init();
+ return FP(ret);
}
virtual std::string usage(bool params,bool verbose) const {
return FF::usage(params,verbose);
@@ -54,7 +56,9 @@ struct FFFactory : public FactoryBase<FeatureFunction> {
template<class FF>
struct FsaFactory : public FactoryBase<FsaFeatureFunction> {
FP Create(std::string param) const {
- return FP(new FF(param));
+ FF *ret=new FF(param);
+ ret->Init();
+ return FP(ret);
}
virtual std::string usage(bool params,bool verbose) const {
return FF::usage(params,verbose);
@@ -94,8 +98,8 @@ struct FactoryRegistry : public UntypedFactoryRegistry {
if (debug)
cerr<<"debug enabled for "<<ffname<< " - remaining options: '"<<param<<"'\n";
FP res = dynamic_cast<FB const&>(*it->second).Create(param);
- res->name_ = ffname;
- res->debug_ = debug;
+ res->init_name_debug(ffname,debug);
+ // could add a res->Init() here instead of in Create if we wanted feature id to potentially differ based on the registered name rather than static usage() - of course, specific feature ids can be computed on the basis of feature param as well; this only affects the default single feature id=name
return res;
}
};