2012-03-10 12:12:34 +04:00
|
|
|
#ifndef MERT_INTERPOLATED_SCORER_H_
|
|
|
|
#define MERT_INTERPOLATED_SCORER_H_
|
|
|
|
|
2012-02-26 21:53:08 +04:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include "Types.h"
|
|
|
|
#include "ScoreData.h"
|
|
|
|
#include "Scorer.h"
|
2012-02-27 09:30:37 +04:00
|
|
|
#include "ScopedVector.h"
|
2012-02-26 21:53:08 +04:00
|
|
|
|
2012-06-30 23:23:45 +04:00
|
|
|
namespace MosesTuning
|
|
|
|
{
|
2013-05-29 21:16:15 +04:00
|
|
|
|
2012-06-30 23:23:45 +04:00
|
|
|
|
2012-02-26 21:53:08 +04:00
|
|
|
/**
|
|
|
|
* Class that includes other scorers eg.
|
|
|
|
* Interpolated HAMMING and BLEU scorer **/
|
|
|
|
class InterpolatedScorer : public Scorer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// name would be: "HAMMING,BLEU" or similar
|
2012-05-10 02:51:05 +04:00
|
|
|
InterpolatedScorer(const std::string& name, const std::string& config);
|
2012-02-27 09:30:37 +04:00
|
|
|
virtual ~InterpolatedScorer() {}
|
|
|
|
|
2012-02-26 21:53:08 +04:00
|
|
|
virtual void score(const candidates_t& candidates, const diffs_t& diffs,
|
2012-02-27 09:30:37 +04:00
|
|
|
statscores_t& scores) const;
|
|
|
|
|
2012-05-10 02:51:05 +04:00
|
|
|
virtual void setReferenceFiles(const std::vector<std::string>& referenceFiles);
|
|
|
|
virtual void prepareStats(std::size_t sid, const std::string& text, ScoreStats& entry);
|
2012-02-26 21:53:08 +04:00
|
|
|
|
2012-05-10 02:51:05 +04:00
|
|
|
virtual std::size_t NumberOfScores() const {
|
|
|
|
std::size_t sz = 0;
|
2012-03-10 12:12:34 +04:00
|
|
|
for (ScopedVector<Scorer>::const_iterator itsc = m_scorers.begin();
|
|
|
|
itsc != m_scorers.end(); ++itsc) {
|
2012-02-26 21:53:08 +04:00
|
|
|
sz += (*itsc)->NumberOfScores();
|
|
|
|
}
|
|
|
|
return sz;
|
2012-03-10 12:12:34 +04:00
|
|
|
}
|
2012-02-26 21:53:08 +04:00
|
|
|
|
|
|
|
virtual void setScoreData(ScoreData* data);
|
|
|
|
|
2012-02-28 05:27:23 +04:00
|
|
|
/**
|
|
|
|
* Set the factors, which should be used for this metric
|
|
|
|
*/
|
2012-05-10 02:51:05 +04:00
|
|
|
virtual void setFactors(const std::string& factors);
|
2012-02-28 05:27:23 +04:00
|
|
|
|
2012-05-10 02:51:05 +04:00
|
|
|
virtual void setFilter(const std::string& filterCommand);
|
2012-05-09 21:21:41 +04:00
|
|
|
|
2012-07-10 12:25:00 +04:00
|
|
|
bool useAlignment() const;
|
|
|
|
|
2012-02-26 21:53:08 +04:00
|
|
|
protected:
|
2012-03-10 12:12:34 +04:00
|
|
|
ScopedVector<Scorer> m_scorers;
|
2012-02-27 09:30:37 +04:00
|
|
|
|
|
|
|
// Take the ownership of the heap-allocated the objects
|
|
|
|
// by Scorer objects.
|
|
|
|
ScopedVector<ScoreData> m_scorers_score_data;
|
|
|
|
|
2012-05-10 02:51:05 +04:00
|
|
|
std::vector<float> m_scorer_weights;
|
2012-02-26 21:53:08 +04:00
|
|
|
};
|
|
|
|
|
2012-06-30 23:23:45 +04:00
|
|
|
}
|
|
|
|
|
2012-03-10 12:12:34 +04:00
|
|
|
#endif // MERT_INTERPOLATED_SCORER_H_
|