2011-08-15 07:40:28 +04:00
|
|
|
#ifndef moses_PhraseLengthFeature_h
|
|
|
|
#define moses_PhraseLengthFeature_h
|
|
|
|
|
2012-09-21 14:56:01 +04:00
|
|
|
#include <stdexcept>
|
2011-08-15 07:40:28 +04:00
|
|
|
#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"
|
2011-08-15 07:40:28 +04:00
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2011-08-15 07:40:28 +04:00
|
|
|
public:
|
2013-01-02 20:54:38 +04:00
|
|
|
PhraseLengthFeature(const std::string &line);
|
2013-05-15 15:20:44 +04:00
|
|
|
|
2013-05-30 15:51:40 +04:00
|
|
|
bool IsUseable(const FactorMask &mask) const {
|
|
|
|
return true;
|
|
|
|
}
|
2013-05-30 15:41:08 +04:00
|
|
|
|
2014-07-10 02:41:08 +04:00
|
|
|
void EvaluateWhenApplied(const Hypothesis& hypo,
|
2013-09-27 12:35:24 +04:00
|
|
|
ScoreComponentCollection* accumulator) const
|
2013-08-30 18:49:00 +04:00
|
|
|
{}
|
|
|
|
|
2014-07-10 02:54:16 +04:00
|
|
|
void EvaluateWhenApplied(const ChartHypothesis& hypo,
|
2012-09-14 01:08:01 +04:00
|
|
|
ScoreComponentCollection*) const {
|
2012-09-21 14:56:01 +04:00
|
|
|
throw std::logic_error("PhraseLengthFeature not valid in chart decoder");
|
2013-05-24 16:04:39 +04:00
|
|
|
}
|
2012-04-09 23:47:51 +04:00
|
|
|
|
2014-07-10 02:06:54 +04:00
|
|
|
void EvaluateWithSourceContext(const InputType &input
|
2013-09-27 12:35:24 +04:00
|
|
|
, const InputPath &inputPath
|
|
|
|
, const TargetPhrase &targetPhrase
|
2014-05-08 20:51:45 +04:00
|
|
|
, const StackVec *stackVec
|
2013-12-03 19:50:41 +04:00
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection *estimatedFutureScore = NULL) const
|
2013-08-30 18:49:00 +04:00
|
|
|
{}
|
|
|
|
|
2014-07-10 01:35:59 +04:00
|
|
|
virtual void EvaluateInIsolation(const Phrase &source
|
2013-05-29 21:16:15 +04:00
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection &estimatedFutureScore) const;
|
2013-05-02 15:15:26 +04:00
|
|
|
|
2011-08-15 07:40:28 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // moses_PhraseLengthFeature_h
|