mosesdecoder/moses/PP/SpanLengthPhraseProperty.h
Hieu Hoang cef8fd3b72 merge
2014-06-13 17:42:13 +01:00

36 lines
754 B
C++

#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