diff options
Diffstat (limited to 'contrib/memscore/phraselm.h')
-rw-r--r-- | contrib/memscore/phraselm.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/memscore/phraselm.h b/contrib/memscore/phraselm.h new file mode 100644 index 000000000..62e8f08d4 --- /dev/null +++ b/contrib/memscore/phraselm.h @@ -0,0 +1,45 @@ +// memscore - in-memory phrase scoring for Statistical Machine Translation +// Christian Hardmeier, FBK-irst, Trento, 2010 +// $Id$ + +#ifndef PHRASELM_H +#define PHRASELM_H + +#include <cassert> + +#include "memscore.h" +#include "phrasetable.h" +#include "statistic.h" + +class lmtable; + +class PhraseLanguageModel : public PhraseStatistic +{ +protected: + String lmfile_; + Count score_idx_; + + PhraseInfoList *phrase_info_list_; + + void compute_lmscores(PhraseInfoList &phrase_info_list, bool closed_world); + +public: + PhraseLanguageModel(String lmfile) : lmfile_(lmfile) {} + + virtual void attach(PhraseInfoList &pilist); + virtual void compute_statistic(); + + virtual Score get_score(PhraseInfo &pi) { + assert(computation_done_); + return pi.data(score_idx_); + } +}; + +class ClosedPhraseLanguageModel : public PhraseLanguageModel +{ +public: + ClosedPhraseLanguageModel(String lmfile) : PhraseLanguageModel(lmfile) {} + virtual void compute_statistic(); +}; + +#endif |