2011-08-13 05:39:35 +04:00
|
|
|
#ifndef moses_SourceWordDeletionFeature_h
|
|
|
|
#define moses_SourceWordDeletionFeature_h
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "FeatureFunction.h"
|
|
|
|
#include "FactorCollection.h"
|
2012-04-19 22:08:06 +04:00
|
|
|
#include "AlignmentInfo.h"
|
2011-08-13 05:39:35 +04:00
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
|
|
|
/** Sets the features for source word deletion
|
|
|
|
*/
|
|
|
|
class SourceWordDeletionFeature : public StatelessFeatureFunction {
|
|
|
|
private:
|
|
|
|
std::set<std::string> m_vocab;
|
|
|
|
FactorType m_factorType;
|
|
|
|
bool m_unrestricted;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SourceWordDeletionFeature(FactorType factorType = 0):
|
2011-11-09 01:22:34 +04:00
|
|
|
StatelessFeatureFunction("swd", ScoreProducer::unlimited),
|
2011-08-13 05:39:35 +04:00
|
|
|
m_factorType(factorType),
|
|
|
|
m_unrestricted(true)
|
2012-04-09 23:47:51 +04:00
|
|
|
{
|
|
|
|
std::cerr << "Initializing source word deletion feature.." << std::endl;
|
|
|
|
}
|
2011-08-13 05:39:35 +04:00
|
|
|
|
|
|
|
bool Load(const std::string &filePath);
|
2012-09-19 21:00:53 +04:00
|
|
|
void Evaluate(const PhraseBasedFeatureContext& context,
|
2012-09-07 19:57:53 +04:00
|
|
|
ScoreComponentCollection* accumulator) const;
|
2011-08-13 05:39:35 +04:00
|
|
|
|
2012-09-21 14:56:01 +04:00
|
|
|
void EvaluateChart(const ChartBasedFeatureContext& context,
|
2012-04-09 23:47:51 +04:00
|
|
|
ScoreComponentCollection* accumulator) const;
|
|
|
|
|
2012-04-19 22:08:06 +04:00
|
|
|
void ComputeFeatures(const TargetPhrase& targetPhrase,
|
|
|
|
ScoreComponentCollection* accumulator,
|
2012-10-19 19:00:42 +04:00
|
|
|
const AlignmentInfo &alignmentInfo) const;
|
2012-04-09 23:47:51 +04:00
|
|
|
|
2011-08-13 05:39:35 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // moses_SourceWordDeletionFeature_h
|