blob: 6a4e820157da77a60de475b571d8b982f580e19e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#ifndef FF_LM_FSA_H
#define FF_LM_FSA_H
//TODO: use SRI LM::contextBOW, LM::contextID to shorten state
#include "ff_lm.h"
#include "ff_from_fsa.h"
struct LanguageModelFsa : public FsaFeatureFunctionBase<LanguageModelFsa> {
// overrides; implementations in ff_lm.cc
static std::string usage(bool,bool);
LanguageModelFsa(std::string const& param);
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;
#endif
|