#include <InterpolatedScorer.h>
Public Member Functions | |
InterpolatedScorer (const std::string &name, const std::string &config) | |
virtual | ~InterpolatedScorer () |
virtual void | score (const candidates_t &candidates, const diffs_t &diffs, statscores_t &scores) const |
virtual void | setReferenceFiles (const std::vector< std::string > &referenceFiles) |
virtual void | prepareStats (std::size_t sid, const std::string &text, ScoreStats &entry) |
virtual std::size_t | NumberOfScores () const |
virtual void | setScoreData (ScoreData *data) |
virtual float | calculateScore (const std::vector< ScoreStatsType > &totals) const |
virtual float | getReferenceLength (const std::vector< ScoreStatsType > &totals) const |
virtual void | setFactors (const std::string &factors) |
virtual void | setFilter (const std::string &filterCommand) |
bool | useAlignment () const |
Protected Attributes | |
ScopedVector< Scorer > | m_scorers |
ScopedVector< ScoreData > | m_scorers_score_data |
std::vector< float > | m_scorer_weights |
Definition at line 18 of file InterpolatedScorer.h.
MosesTuning::InterpolatedScorer::InterpolatedScorer | ( | const std::string & | name, | |
const std::string & | config | |||
) |
virtual MosesTuning::InterpolatedScorer::~InterpolatedScorer | ( | ) | [inline, virtual] |
Definition at line 23 of file InterpolatedScorer.h.
float MosesTuning::InterpolatedScorer::calculateScore | ( | const std::vector< ScoreStatsType > & | totals | ) | const [virtual] |
Interpolated scorer gets a vector of sufficient statistics, calls all scorers with corresponding statistics, and combines them with weights
Implements MosesTuning::Scorer.
Definition at line 158 of file InterpolatedScorer.cpp.
References MosesTuning::ScopedVector< T >::begin(), MosesTuning::ScopedVector< T >::end(), m_scorer_weights, m_scorers, and score().
float MosesTuning::InterpolatedScorer::getReferenceLength | ( | const std::vector< ScoreStatsType > & | totals | ) | const [virtual] |
Based on vector of sufficient statistics, return length of reference.
Implements MosesTuning::Scorer.
Definition at line 175 of file InterpolatedScorer.cpp.
References MosesTuning::ScopedVector< T >::begin(), MosesTuning::ScopedVector< T >::end(), m_scorer_weights, and m_scorers.
virtual std::size_t MosesTuning::InterpolatedScorer::NumberOfScores | ( | ) | const [inline, virtual] |
Return the number of statistics needed for the computation of the score.
Implements MosesTuning::Scorer.
Definition at line 31 of file InterpolatedScorer.h.
References MosesTuning::ScopedVector< T >::begin(), MosesTuning::ScopedVector< T >::end(), and m_scorers.
virtual void MosesTuning::InterpolatedScorer::prepareStats | ( | std::size_t | sindex, | |
const std::string & | text, | |||
ScoreStats & | entry | |||
) | [virtual] |
Process the given guessed text, corresponding to the given reference sindex and add the appropriate statistics to the entry.
Reimplemented from MosesTuning::Scorer.
void MosesTuning::InterpolatedScorer::score | ( | const candidates_t & | candidates, | |
const diffs_t & | diffs, | |||
statscores_t & | scores | |||
) | const [virtual] |
The interpolated scorer calls a vector of scorers and combines them with weights
Implements MosesTuning::Scorer.
Definition at line 122 of file InterpolatedScorer.cpp.
References MosesTuning::ScopedVector< T >::begin(), MosesTuning::ScopedVector< T >::end(), m_scorer_weights, and m_scorers.
Referenced by calculateScore(), and setScoreData().
virtual void MosesTuning::InterpolatedScorer::setFactors | ( | const std::string & | factors | ) | [virtual] |
Set the factors, which should be used for this metric
Reimplemented from MosesTuning::Scorer.
virtual void MosesTuning::InterpolatedScorer::setFilter | ( | const std::string & | filterCommand | ) | [virtual] |
Set unix filter, which will be used to preprocess the sentences
Reimplemented from MosesTuning::Scorer.
virtual void MosesTuning::InterpolatedScorer::setReferenceFiles | ( | const std::vector< std::string > & | referenceFiles | ) | [virtual] |
Set the reference files. This must be called before prepareStats().
Reimplemented from MosesTuning::Scorer.
void MosesTuning::InterpolatedScorer::setScoreData | ( | ScoreData * | data | ) | [virtual] |
Set the score data, prior to scoring.
Reimplemented from MosesTuning::Scorer.
Definition at line 81 of file InterpolatedScorer.cpp.
References MosesTuning::ScoreData::add(), MosesTuning::ScoreArray::add(), MosesTuning::ScoreStats::add(), MosesTuning::ScopedVector< T >::begin(), MosesTuning::ScopedVector< T >::end(), MosesTuning::ScoreStats::get(), MosesTuning::ScoreData::get(), k, MosesTuning::Scorer::m_score_data, m_scorers, m_scorers_score_data, MosesTuning::ScoreData::NumberOfScores(), MosesTuning::ScopedVector< T >::push_back(), score(), MosesTuning::ScoreArray::setIndex(), MosesTuning::ScoreArray::size(), and MosesTuning::ScoreData::size().
bool MosesTuning::InterpolatedScorer::useAlignment | ( | ) | const [virtual] |
The scorer returns if it uses the reference alignment data for permutation distance scores
Reimplemented from MosesTuning::Scorer.
Definition at line 69 of file InterpolatedScorer.cpp.
References MosesTuning::ScopedVector< T >::begin(), MosesTuning::ScopedVector< T >::end(), and m_scorers.
std::vector<float> MosesTuning::InterpolatedScorer::m_scorer_weights [protected] |
Definition at line 62 of file InterpolatedScorer.h.
Referenced by calculateScore(), getReferenceLength(), and score().
ScopedVector<Scorer> MosesTuning::InterpolatedScorer::m_scorers [protected] |
Definition at line 56 of file InterpolatedScorer.h.
Referenced by calculateScore(), getReferenceLength(), NumberOfScores(), score(), setScoreData(), and useAlignment().