summaryrefslogtreecommitdiff
path: root/decoder/ff_fsa.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_fsa.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_fsa.h')
-rwxr-xr-xdecoder/ff_fsa.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/decoder/ff_fsa.h b/decoder/ff_fsa.h
index e7877dd5..6416151c 100755
--- a/decoder/ff_fsa.h
+++ b/decoder/ff_fsa.h
@@ -68,18 +68,26 @@ usage: see ff_sample_fsa.h or ff_lm_fsa.h
template <class Impl>
struct FsaFeatureFunctionBase : public FsaFeatureFunctionData {
- // CALL 1 of these MANUALLY (because feature name(s) may depend on param, it's not done in ctor)
- void Init(std::string const& fname="") {
- fid_=FD::Convert(fname.empty()?name():fname);
+ Impl const& d() const { return static_cast<Impl const&>(*this); }
+ Impl & d() { return static_cast<Impl &>(*this); }
+
+ // this will get called by factory - override if you have multiple or dynamically named features. note: may be called repeatedly
+ void Init() {
+ Init(name());
+ DBGINIT("base (single feature) FsaFeatureFunctionBase::Init name="<<name()<<" features="<<FD::Convert(features_));
+ }
+ void Init(std::string const& fname) {
+ fid_=FD::Convert(fname);
InitHaveFid();
}
- Features features_;
void InitHaveFid() {
features_=FeatureFunction::single_feature(fid_);
}
+ Features features() const {
+ DBGINIT("FeatureFunctionBase::features() name="<<name()<<" features="<<FD::Convert(features_));
+ return features_;
+ }
- Impl const& d() const { return static_cast<Impl const&>(*this); }
- Impl & d() { return static_cast<Impl &>(*this); }
public:
int fid_; // you can have more than 1 feature of course.
@@ -252,8 +260,11 @@ public:
}
// don't set state-bytes etc. in ctor because it may depend on parsing param string
- FsaFeatureFunctionBase(int statesz=0,Sentence const& end_sentence_phrase=Sentence()) :
- FsaFeatureFunctionData(statesz,end_sentence_phrase) { }
+ FsaFeatureFunctionBase(int statesz=0,Sentence const& end_sentence_phrase=Sentence())
+ : FsaFeatureFunctionData(statesz,end_sentence_phrase)
+ {
+ name_=name(); // should allow FsaDynamic wrapper to get name copied to it with sync
+ }
};