2014-05-20 22:51:46 +04:00
|
|
|
#pragma once
|
|
|
|
|
2015-10-17 23:43:03 +03:00
|
|
|
#include <boost/unordered_set.hpp>
|
2014-05-20 22:51:46 +04:00
|
|
|
#include <string>
|
|
|
|
#include "StatelessFeatureFunction.h"
|
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
2015-10-25 16:37:59 +03:00
|
|
|
class Range;
|
2014-05-20 22:51:46 +04:00
|
|
|
class Word;
|
|
|
|
|
|
|
|
// 1 of the non-term covers the same word as 1 of the terminals
|
2014-05-20 23:02:49 +04:00
|
|
|
class NieceTerminal : public StatelessFeatureFunction
|
2014-05-20 22:51:46 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-05-29 01:51:26 +04:00
|
|
|
NieceTerminal(const std::string &line);
|
2014-05-20 22:51:46 +04:00
|
|
|
|
|
|
|
bool IsUseable(const FactorMask &mask) const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-07-10 01:35:59 +04:00
|
|
|
void EvaluateInIsolation(const Phrase &source
|
2015-01-14 14:07:42 +03:00
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
2015-11-04 18:10:45 +03:00
|
|
|
, ScoreComponentCollection &estimatedScores) const;
|
2014-07-10 02:06:54 +04:00
|
|
|
void EvaluateWithSourceContext(const InputType &input
|
2015-01-14 14:07:42 +03:00
|
|
|
, const InputPath &inputPath
|
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, const StackVec *stackVec
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
2015-11-04 18:10:45 +03:00
|
|
|
, ScoreComponentCollection *estimatedScores = NULL) const;
|
2015-01-14 14:07:42 +03:00
|
|
|
|
2015-01-06 15:56:13 +03:00
|
|
|
void EvaluateTranslationOptionListWithSourceContext(const InputType &input
|
2015-01-14 14:07:42 +03:00
|
|
|
, const TranslationOptionList &translationOptionList) const {
|
|
|
|
}
|
|
|
|
|
2014-07-10 02:41:08 +04:00
|
|
|
void EvaluateWhenApplied(const Hypothesis& hypo,
|
2015-01-14 14:07:42 +03:00
|
|
|
ScoreComponentCollection* accumulator) const;
|
2014-07-10 02:54:16 +04:00
|
|
|
void EvaluateWhenApplied(const ChartHypothesis &hypo,
|
2015-01-14 14:07:42 +03:00
|
|
|
ScoreComponentCollection* accumulator) const;
|
2014-05-20 22:51:46 +04:00
|
|
|
|
2014-05-29 01:51:26 +04:00
|
|
|
void SetParameter(const std::string& key, const std::string& value);
|
2014-06-01 23:29:55 +04:00
|
|
|
std::vector<float> DefaultWeights() const;
|
2014-05-29 01:51:26 +04:00
|
|
|
|
2014-05-20 22:51:46 +04:00
|
|
|
protected:
|
2014-05-29 01:51:26 +04:00
|
|
|
bool m_hardConstraint;
|
2014-05-21 16:43:32 +04:00
|
|
|
bool ContainTerm(const InputType &input,
|
2015-10-25 16:37:59 +03:00
|
|
|
const Range &ntRange,
|
2015-10-17 23:43:03 +03:00
|
|
|
const boost::unordered_set<Word> &terms) const;
|
2014-05-20 22:51:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-29 01:51:26 +04:00
|
|
|
|