2015-01-26 23:45:08 +03:00
|
|
|
#pragma once
|
2011-08-13 05:39:35 +04:00
|
|
|
|
|
|
|
#include <string>
|
2013-05-27 03:33:01 +04:00
|
|
|
#include <boost/unordered_set.hpp>
|
2011-08-13 05:39:35 +04:00
|
|
|
|
2013-05-24 22:11:15 +04:00
|
|
|
#include "StatelessFeatureFunction.h"
|
2013-05-24 21:02:49 +04:00
|
|
|
#include "moses/FactorCollection.h"
|
|
|
|
#include "moses/AlignmentInfo.h"
|
2011-08-13 05:39:35 +04:00
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
|
|
|
/** Sets the features for length of source phrase, target phrase, both.
|
|
|
|
*/
|
2013-05-29 21:16:15 +04:00
|
|
|
class TargetWordInsertionFeature : public StatelessFeatureFunction
|
|
|
|
{
|
2011-08-13 05:39:35 +04:00
|
|
|
private:
|
2013-05-27 03:33:01 +04:00
|
|
|
boost::unordered_set<std::string> m_vocab;
|
2011-08-13 05:39:35 +04:00
|
|
|
FactorType m_factorType;
|
|
|
|
bool m_unrestricted;
|
2013-06-09 23:09:21 +04:00
|
|
|
std::string m_filename;
|
2011-08-13 05:39:35 +04:00
|
|
|
|
|
|
|
public:
|
2013-01-02 18:48:19 +04:00
|
|
|
TargetWordInsertionFeature(const std::string &line);
|
2013-05-29 21:16:15 +04:00
|
|
|
|
2013-05-30 15:41:08 +04:00
|
|
|
bool IsUseable(const FactorMask &mask) const;
|
|
|
|
|
2015-12-10 06:17:36 +03:00
|
|
|
void Load(AllOptions::ptr const& opts);
|
2012-04-09 23:47:51 +04:00
|
|
|
|
2014-07-10 01:35:59 +04:00
|
|
|
virtual 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
|
|
|
}
|
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 {
|
|
|
|
}
|
|
|
|
|
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 {
|
|
|
|
}
|
2013-05-02 15:15:26 +04:00
|
|
|
|
2013-05-28 13:51:28 +04:00
|
|
|
void ComputeFeatures(const Phrase &source,
|
2013-05-29 21:16:15 +04:00
|
|
|
const TargetPhrase& targetPhrase,
|
|
|
|
ScoreComponentCollection* accumulator,
|
|
|
|
const AlignmentInfo &alignmentInfo) const;
|
2013-06-20 16:25:02 +04:00
|
|
|
void SetParameter(const std::string& key, const std::string& value);
|
2012-04-09 23:47:51 +04:00
|
|
|
|
2011-08-13 05:39:35 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|