Welcome to mirror list, hosted at ThFree Co, Russian Federation.

phraselm.h « memscore « contrib - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 62e8f08d40cddf461b1fdff2c8b15eb58e332325 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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