summaryrefslogtreecommitdiff
path: root/gi/pf/backward.h
blob: e67eff0c3596fbd4c657616cf946d1e2d8babce2 (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
#ifndef _BACKWARD_H_
#define _BACKWARD_H_

#include <vector>
#include <string>
#include "wordid.h"

struct Reachability;
struct Model1;

struct BackwardEstimator {
  BackwardEstimator(const std::string& s2t,
                    const std::string& t2s);
  ~BackwardEstimator();

  void InitializeGrid(const std::vector<WordID>& src,
                      const std::vector<WordID>& trg,
                      const Reachability& r,
                      double src2trg_ratio,
                      float* grid) const;

 private:
  float ComputeBackwardProb(const std::vector<WordID>& src,
                            const std::vector<WordID>& trg,
                            unsigned src_covered,
                            unsigned trg_covered,
                            double src2trg_ratio) const;

  Model1* m1;
  Model1* m1inv;
};

#endif