mosesdecoder/moses/FF/PhrasePairFeature.h

57 lines
1.3 KiB
C
Raw Normal View History

#ifndef moses_PhrasePairFeature_h
#define moses_PhrasePairFeature_h
2012-09-21 14:56:01 +04:00
#include <stdexcept>
#include <boost/unordered_set.hpp>
2012-09-21 14:56:01 +04:00
2013-05-24 22:11:15 +04:00
#include "StatelessFeatureFunction.h"
2013-05-24 21:02:49 +04:00
#include "moses/Factor.h"
#include "moses/Sentence.h"
2013-05-29 21:16:15 +04:00
namespace Moses
{
/**
2012-03-07 15:48:58 +04:00
* Phrase pair feature: complete source/target phrase pair
**/
2013-05-29 21:16:15 +04:00
class PhrasePairFeature: public StatelessFeatureFunction
{
typedef std::map< char, short > CharHash;
typedef std::vector< std::set<std::string> > DocumentVector;
boost::unordered_set<std::string> m_vocabSource;
DocumentVector m_vocabDomain;
FactorType m_sourceFactorId;
FactorType m_targetFactorId;
bool m_unrestricted;
bool m_simple;
bool m_sourceContext;
bool m_domainTrigger;
bool m_ignorePunctuation;
CharHash m_punctuationHash;
std::string m_filePathSource;
2013-05-29 21:16:15 +04:00
public:
PhrasePairFeature(const std::string &line);
bool IsUseable(const FactorMask &mask) const;
2013-05-29 21:16:15 +04:00
void Evaluate(const PhraseBasedFeatureContext& context,
ScoreComponentCollection* accumulator) const;
void EvaluateChart(const ChartBasedFeatureContext& context,
ScoreComponentCollection*) const {
throw std::logic_error("PhrasePairFeature not valid in chart decoder");
}
void Load();
void SetParameter(const std::string& key, const std::string& value);
};
}
#endif