blob: 03b231487f7a25d05d934c4afff23aa9c529875e (
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
46
47
48
49
50
51
52
|
// -*- c++ -*-
#pragma once
#include "ug_typedefs.h"
#include "ug_lexical_reordering.h"
#include <boost/thread.hpp>
namespace Moses
{
namespace bitext
{
using namespace ugdiss;
// "joint" (i.e., phrase pair) statistics
class
jstats
{
boost::mutex lock;
uint32_t my_rcnt; // unweighted joint count
uint32_t my_cnt2; // raw counts L2
float my_wcnt; // weighted joint count
// to do: use a static alignment pattern store that stores each pattern only
// once, so that we don't have to store so many alignment vectors
vector<pair<size_t, vector<uchar> > > my_aln; // internal word alignment
uint32_t ofwd[Moses::LRModel::NONE+1]; // forward distortion type counts
uint32_t obwd[Moses::LRModel::NONE+1]; // backward distortion type counts
public:
std::map<uint32_t,uint32_t> indoc;
// vector<uint32_t> indoc; // counts origin of samples (for biased sampling)
jstats();
jstats(jstats const& other);
uint32_t rcnt() const; // raw joint counts
uint32_t cnt2() const; // raw target phrase occurrence count
float wcnt() const; // weighted joint counts
vector<pair<size_t, vector<uchar> > > const & aln() const;
void add(float w, vector<uchar> const& a, uint32_t const cnt2,
uint32_t fwd_orient, uint32_t bwd_orient,
int const docid);
void invalidate();
void validate();
bool valid();
uint32_t dcnt_fwd(PhraseOrientation const idx) const;
uint32_t dcnt_bwd(PhraseOrientation const idx) const;
void fill_lr_vec(Moses::LRModel::Direction const& dir,
Moses::LRModel::ModelType const& mdl,
vector<float>& v);
};
}
}
|