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"
|
|
|
|
|
|
|
|
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):
|
|
|
|
StatelessFeatureFunction("swd"),
|
|
|
|
m_factorType(factorType),
|
|
|
|
m_unrestricted(true)
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool Load(const std::string &filePath);
|
|
|
|
void Evaluate(const TargetPhrase& cur_phrase,
|
|
|
|
ScoreComponentCollection* accumulator) const;
|
|
|
|
|
|
|
|
// basic properties
|
|
|
|
size_t GetNumScoreComponents() const { return ScoreProducer::unlimited; }
|
2011-09-20 14:23:38 +04:00
|
|
|
std::string GetScoreProducerWeightShortName(unsigned) const { return "swd"; }
|
2011-08-13 05:39:35 +04:00
|
|
|
size_t GetNumInputScores() const { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // moses_SourceWordDeletionFeature_h
|