From 4f9933d668d247ea5831c3f2af0b996a94da28f7 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 10 Mar 2011 01:58:30 -0500 Subject: remove dependency on SRILM --- decoder/ff_lm_fsa.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'decoder/ff_lm_fsa.h') diff --git a/decoder/ff_lm_fsa.h b/decoder/ff_lm_fsa.h index d2df943e..85b7ef44 100755 --- a/decoder/ff_lm_fsa.h +++ b/decoder/ff_lm_fsa.h @@ -21,8 +21,13 @@ #include "ff_fsa.h" #include "ff_lm.h" +#ifndef TD__none +// replacing dependency on SRILM +#define TD__none -1 +#endif + namespace { -WordID empty_context=TD::none; +WordID empty_context=TD__none; } struct LanguageModelFsa : public FsaFeatureFunctionBase { @@ -40,7 +45,7 @@ struct LanguageModelFsa : public FsaFeatureFunctionBase { } static inline WordID const* left_end(WordID const* left, WordID const* e) { for (;e>left;--e) - if (e[-1]!=TD::none) break; + if (e[-1]!=TD__none) break; //post: [left,e] are the seen left words return e; } @@ -55,7 +60,7 @@ struct LanguageModelFsa : public FsaFeatureFunctionBase { } else { WordID ctx[ngram_order_]; //alloca if you don't have C99 state_copy(ctx,old_st); - ctx[ctxlen_]=TD::none; + ctx[ctxlen_]=TD__none; Featval p=floored(pimpl_->WordProb(w,ctx)); FSALMDBG(de,"p("< { WP st_end=st+ctxlen_; // may include some null already (or none if full) int nboth=nw+ctxlen_; WordID ctx[nboth+1]; - ctx[nboth]=TD::none; + ctx[nboth]=TD__none; // reverse order - state at very end of context, then [i,end) in rev order ending at ctx[0] W ctx_score_end=wordcpy_reverse(ctx,begin,end); wordcpy(ctx_score_end,st,st_end); // st already reversed. -- cgit v1.2.3