mosesdecoder/moses/FF/PhraseLengthFeature.h

54 lines
1.5 KiB
C
Raw Normal View History

#ifndef moses_PhraseLengthFeature_h
#define moses_PhraseLengthFeature_h
2012-09-21 14:56:01 +04:00
#include <stdexcept>
#include <string>
#include <map>
2013-05-24 22:11:15 +04:00
#include "StatelessFeatureFunction.h"
2013-05-24 21:02:49 +04:00
#include "moses/FF/FFState.h"
#include "moses/Word.h"
#include "moses/FactorCollection.h"
namespace Moses
{
/** Sets the features for length of source phrase, target phrase, both.
*/
2013-05-29 21:16:15 +04:00
class PhraseLengthFeature : public StatelessFeatureFunction
{
public:
PhraseLengthFeature(const std::string &line);
2013-05-30 15:51:40 +04:00
bool IsUseable(const FactorMask &mask) const {
return true;
}
void EvaluateWhenApplied(const Hypothesis& hypo,
2013-09-27 12:35:24 +04:00
ScoreComponentCollection* accumulator) const
{}
void EvaluateWhenApplied(const ChartHypothesis& hypo,
ScoreComponentCollection*) const {
2012-09-21 14:56:01 +04:00
throw std::logic_error("PhraseLengthFeature not valid in chart decoder");
}
void EvaluateWithSourceContext(const InputType &input
2013-09-27 12:35:24 +04:00
, const InputPath &inputPath
, const TargetPhrase &targetPhrase
, const StackVec *stackVec
, ScoreComponentCollection &scoreBreakdown
, ScoreComponentCollection *estimatedFutureScore = NULL) const
{}
virtual void EvaluateInIsolation(const Phrase &source
2013-05-29 21:16:15 +04:00
, const TargetPhrase &targetPhrase
, ScoreComponentCollection &scoreBreakdown
, ScoreComponentCollection &estimatedFutureScore) const;
};
}
#endif // moses_PhraseLengthFeature_h