blob: 8f5c55e049eb37fe7399aaff742bd1bc6f1eab33 (
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
53
54
55
56
|
// -*- c++ -*-
#pragma once
#include <string>
#include <stdint.h>
#include "ug_typedefs.h"
#include "ug_lexical_reordering.h"
#include <boost/thread.hpp>
namespace Moses
{
namespace bitext
{
// using namespace ugdiss;
// "joint" (i.e., phrase std::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 std::vectors
std::vector<std::pair<size_t, std::vector<unsigned char> > > 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;
// std::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
std::vector<std::pair<size_t, std::vector<unsigned char> > > const & aln() const;
void add(float w, std::vector<unsigned char> 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,
std::vector<float>& v);
};
}
}
|