diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-07 02:24:51 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-07 02:24:51 +0000 |
commit | aaac9f8ee73ba59b72609af9a78b167312a6dac7 (patch) | |
tree | 1273c65f43c124eac220a298acbe7af951b0a83e /decoder/ff_from_fsa.h | |
parent | e2ef62dc50b9795fc801f97aba7bac8c80bb7c54 (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_from_fsa.h')
-rwxr-xr-x | decoder/ff_from_fsa.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/decoder/ff_from_fsa.h b/decoder/ff_from_fsa.h index 2c339aa8..ec1a28fa 100755 --- a/decoder/ff_from_fsa.h +++ b/decoder/ff_from_fsa.h @@ -30,14 +30,21 @@ class FeatureFunctionFromFsa : public FeatureFunction { public: FeatureFunctionFromFsa(std::string const& param) : ff(param) { debug_=true; // because factory won't set until after we construct. - Init(); } static std::string usage(bool args,bool verbose) { return Impl::usage(args,verbose); } + void init_name_debug(std::string const& n,bool debug) { + FeatureFunction::init_name_debug(n,debug); + ff.init_name_debug(n,debug); + } - Features features() const { return ff.features(); } + // this should override + Features features() const { + DBGINIT("FeatureFunctionFromFsa features() name="<<ff.name()<<" features="<<FD::Convert(ff.features())); + return ff.features(); + } // Log because it potentially stores info in edge. otherwise the same as regular TraversalFeatures. void TraversalFeaturesLog(const SentenceMetadata& smeta, @@ -227,16 +234,20 @@ public: assert(left_end(w2,w2+2)==w2+1); } -private: - Impl ff; + // override from FeatureFunction; should be called by factory after constructor. void Init() { -// FeatureFunction::name=Impl::usage(false,false); // already achieved by ff_factory.cc + ff.Init(); + ff.sync(); + DBGINIT("base (single feature) FsaFeatureFunctionBase::Init name="<<name_<<" features="<<FD::Convert(features())); +// FeatureFunction::name_=Impl::usage(false,false); // already achieved by ff_factory.cc M=ff.markov_order(); ssz=ff.state_bytes(); state_offset=sizeof(WordID)*M; SetStateSize(ssz+state_offset); assert(!ssz == !M); // no fsa state <=> markov order 0 } +private: + Impl ff; int M; // markov order (ctx len) FeatureFunctionFromFsa(); // not allowed. |