From a2d9d0f96502c7d3c04303f3db36a8602d992287 Mon Sep 17 00:00:00 2001 From: graehl Date: Fri, 23 Jul 2010 19:17:22 +0000 Subject: sparse_vector use google::dense_hash_map, fsa scan logging git-svn-id: https://ws10smt.googlecode.com/svn/trunk@383 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/ff_sample_fsa.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'decoder/ff_sample_fsa.h') diff --git a/decoder/ff_sample_fsa.h b/decoder/ff_sample_fsa.h index 13a25387..947ad21c 100755 --- a/decoder/ff_sample_fsa.h +++ b/decoder/ff_sample_fsa.h @@ -57,7 +57,7 @@ struct LongerThanPrev : public FsaFeatureFunctionBase { // int ss=-1; // wordcpy((WordID*)start.begin(),&ss,&ss+1); //to_state(start.begin(),&ss,1); - wordlen(start.begin())=-1; // same as above. + wordlen(start.begin())=-1; wordlen(h_start.begin())=4; // estimate: anything >4 chars is usually longer than previous } @@ -73,8 +73,7 @@ struct LongerThanPrev : public FsaFeatureFunctionBase { }; // similar example feature; base type exposes stateful type, defines markov_order 1, state size = sizeof(State) -struct ShorterThanPrev : public FsaTypedBase,FsaTypedScan { - typedef int State; // defines # of bytes in state and return type of state(void *) +struct ShorterThanPrev : FsaTypedScan { static std::string usage(bool param,bool verbose) { return FeatureFunction::usage_helper( "ShorterThanPrev", @@ -88,22 +87,22 @@ struct ShorterThanPrev : public FsaTypedBase,FsaTypedScan } ShorterThanPrev(std::string const& param) { init_fid(usage(false,false)); - end_phrase_.push_back(TD::Convert("")); // this triggers end of sentence firing +// end_phrase_.push_back(TD::Convert("")); // this triggers end of sentence firing set_starts(-1,4); // estimate: anything <4 chars is usually shorter than previous } static const float val_per_target_word=-1; // evil anti-google int & len out-param: - void Scan(SentenceMetadata const& smeta,WordID w,int prevlen,int &len,FeatureVector *features) const { + void ScanTyped(SentenceMetadata const& smeta,WordID w,int prevlen,int &len,FeatureVector *features) const { len=wordlen(w); if (lenadd_value(fid_,val_per_target_word); } // already provided by FsaTypedScan - void Scan(SentenceMetadata const& smeta,WordID w,void const* st,void *next_state,FeatureVector *features) const { - Scan(smeta,w,state(st),state(next_state),features); - } +/* void Scan(SentenceMetadata const& smeta,WordID w,void const* st,void *next_state,FeatureVector *features) const { + ScanTyped(smeta,w,state(st),state(next_state),features); + } */ }; -- cgit v1.2.3