#ifndef FF_FROM_FSA_H #define FF_FROM_FSA_H #include "ff_fsa.h" #ifndef TD__none // replacing dependency on SRILM #define TD__none -1 #endif #ifndef FSA_FF_DEBUG # define FSA_FF_DEBUG 0 #endif #if FSA_FF_DEBUG # define FSAFFDBG(e,x) FSADBGif(debug(),e,x) # define FSAFFDBGnl(e) FSADBGif_nl(debug(),e) #else # define FSAFFDBG(e,x) # define FSAFFDBGnl(e) #endif /* regular bottom up scorer from Fsa feature uses guarantee about markov order=N to score ASAP encoding of state: if less than N-1 (ctxlen) words usage: typedef FeatureFunctionFromFsa LanguageModelFromFsa; */ template class FeatureFunctionFromFsa : public FeatureFunction { typedef void const* SP; typedef WordID *W; typedef WordID const* WP; public: template FeatureFunctionFromFsa(I const& param) : ff(param) { debug_=true; // because factory won't set until after we construct. } template FeatureFunctionFromFsa(I & param) : ff(param) { debug_=true; // because factory won't set until after we construct. } 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); } // this should override Features features() const { DBGINIT("FeatureFunctionFromFsa features() name="<=1) for (int j=0,ee=e.size();;++j) { // items in target side of rule for(;;++j) { if (j>=ee) goto rhs_done; // j may go 1 past ee due to k possibly getting to end if (RHS_WORD(j)) break; } // word @j int k=j; while(k{"<") FSAFFDBG(edge," end="<{"<