summaryrefslogtreecommitdiff
path: root/decoder/ff_lm_fsa.h
diff options
context:
space:
mode:
Diffstat (limited to 'decoder/ff_lm_fsa.h')
-rwxr-xr-xdecoder/ff_lm_fsa.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/decoder/ff_lm_fsa.h b/decoder/ff_lm_fsa.h
index 01b3764e..6a4e8201 100755
--- a/decoder/ff_lm_fsa.h
+++ b/decoder/ff_lm_fsa.h
@@ -6,10 +6,21 @@
#include "ff_lm.h"
#include "ff_from_fsa.h"
-class LanguageModelFsa : public FsaFeatureFunctionBase {
+struct LanguageModelFsa : public FsaFeatureFunctionBase<LanguageModelFsa> {
+ // overrides; implementations in ff_lm.cc
static std::string usage(bool,bool);
LanguageModelFsa(std::string const& param);
- // implementations in ff_lm.cc
+ int markov_order() const { return ctxlen_; }
+ void Scan(SentenceMetadata const& /* smeta */,const Hypergraph::Edge& /* edge */,WordID w,void const* old_st,void *new_st,FeatureVector *features) const;
+ void print_state(std::ostream &,void *) const;
+
+ // impl details:
+ void set_ngram_order(int i); // if you build ff_from_fsa first, then increase this, you will get memory overflows. otherwise, it's the same as a "-o i" argument to constructor
+ double floor_; // log10prob minimum used (e.g. unk words)
+private:
+ int ngram_order_;
+ int ctxlen_; // 1 less than above
+ LanguageModelImpl *pimpl_;
};
typedef FeatureFunctionFromFsa<LanguageModelFsa> LanguageModelFromFsa;