blob: 490b7db72044a0375f2d63d2ce76003867892f0f (
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
|
#pragma once
#include <string>
#include <set>
#include <map>
#include <vector>
#include "moses/PP/PhraseProperty.h"
namespace Moses
{
class SpanLengthPhraseProperty : public PhraseProperty
{
public:
SpanLengthPhraseProperty();
void ProcessValue(const std::string &value);
float GetProb(size_t ntInd, size_t sourceWidth, float smoothing) const;
protected:
// fractional counts
typedef std::map<size_t, float> Map;
typedef std::vector<std::pair<Map, float> > Vec;
Vec m_source, m_target;
void Populate(const std::set< std::vector<std::string> > &indices, float count);
void Populate(const std::vector<size_t> &toks, float count);
void Populate(Map &map, size_t span, float count);
void CalcTotals(Vec &vec);
};
} // namespace Moses
|