From eac7943a058db20a9e6a50fbbd8ff87b0ce56fc4 Mon Sep 17 00:00:00 2001 From: graehl Date: Fri, 23 Jul 2010 23:10:34 +0000 Subject: strip debug param from feature spec; debug info on from_fsa Init git-svn-id: https://ws10smt.googlecode.com/svn/trunk@393 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/ff_sample_fsa.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'decoder/ff_sample_fsa.h') diff --git a/decoder/ff_sample_fsa.h b/decoder/ff_sample_fsa.h index d8aa7830..6e42b83b 100755 --- a/decoder/ff_sample_fsa.h +++ b/decoder/ff_sample_fsa.h @@ -29,7 +29,7 @@ struct WordPenaltyFsa : public FsaFeatureFunctionBase { typedef FeatureFunctionFromFsa WordPenaltyFromFsa; -// +// appears to be buggy right now: give it a bonus weight (-) and it overstates how many struct LongerThanPrev : public FsaFeatureFunctionBase { typedef FsaFeatureFunctionBase Base; static std::string usage(bool param,bool verbose) { @@ -40,11 +40,11 @@ struct LongerThanPrev : public FsaFeatureFunctionBase { param,verbose); } - static inline int &wordlen(void *state) { - return *(int*)state; + static inline int &state(void *st) { + return *(int*)st; } - static inline int wordlen(void const* state) { - return *(int const*)state; + static inline int state(void const* st) { + return *(int const*)st; } static inline int wordlen(WordID w) { return std::strlen(TD::Convert(w)); @@ -62,23 +62,23 @@ struct LongerThanPrev : public FsaFeatureFunctionBase { to_state(h_start.begin(),&ss,1); } - wordlen(start.begin())=3; - wordlen(h_start.begin())=4; // estimate: anything >4 chars is usually longer than previous + state(start.begin())=3; + state(h_start.begin())=4; // estimate: anything >4 chars is usually longer than previous } static const float val_per_target_word=-1; - void Scan(SentenceMetadata const& smeta,WordID w,void const* state,void *next_state,FeatureVector *features) const { - int prevlen=wordlen(state); + void Scan(SentenceMetadata const& smeta,WordID w,void const* from,void *next_state,FeatureVector *features) const { + int prevlen=state(from); int len=wordlen(w); - wordlen(next_state)=len; if (len>prevlen) features->add_value(fid_,val_per_target_word); + state(next_state)=len; } - }; // similar example feature; base type exposes stateful type, defines markov_order 1, state size = sizeof(State) +// also buggy right now: give it a bonus weight (-) and it overstates how many struct ShorterThanPrev : FsaTypedBase { typedef FsaTypedBase Base; static std::string usage(bool param,bool verbose) { -- cgit v1.2.3