mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 23:10:31 +03:00
Include chrf as a metric
This commit is contained in:
parent
8b59644945
commit
fb478bf1db
@ -47,11 +47,16 @@ public:
|
|||||||
virtual float calculateScore(const std::vector<ScoreStatsType>& totals) const = 0;
|
virtual float calculateScore(const std::vector<ScoreStatsType>& totals) const = 0;
|
||||||
|
|
||||||
float calculateSentenceLevelBackgroundScore(const std::vector<ScoreStatsType>& totals, const std::vector<ScoreStatsType>& bg) {
|
float calculateSentenceLevelBackgroundScore(const std::vector<ScoreStatsType>& totals, const std::vector<ScoreStatsType>& bg) {
|
||||||
std::vector<ScoreStatsType> stats(totals.size());
|
if (m_name.compare("CHRF")!=0){
|
||||||
for(size_t i=0; i<stats.size(); i++)
|
std::vector<ScoreStatsType> stats(totals.size());
|
||||||
stats[i] = totals[i]+bg[i];
|
for(size_t i=0; i<stats.size(); i++)
|
||||||
// Get score and scale by reference length (as per Chiang et al 08)
|
stats[i] = totals[i]+bg[i];
|
||||||
return calculateScore(stats) * getReferenceLength(stats);
|
// Get score and scale by reference length (as per Chiang et al 08)
|
||||||
|
return calculateScore(stats) * getReferenceLength(stats);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return calculateScore(totals);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "BleuDocScorer.h"
|
#include "BleuDocScorer.h"
|
||||||
#include "PerScorer.h"
|
#include "PerScorer.h"
|
||||||
#include "TerScorer.h"
|
#include "TerScorer.h"
|
||||||
|
#include "CHRFScorer.h"
|
||||||
#include "CderScorer.h"
|
#include "CderScorer.h"
|
||||||
#include "InterpolatedScorer.h"
|
#include "InterpolatedScorer.h"
|
||||||
#include "SemposScorer.h"
|
#include "SemposScorer.h"
|
||||||
@ -29,6 +30,7 @@ vector<string> ScorerFactory::getTypes()
|
|||||||
types.push_back(string("PER"));
|
types.push_back(string("PER"));
|
||||||
types.push_back(string("TER"));
|
types.push_back(string("TER"));
|
||||||
types.push_back(string("CDER"));
|
types.push_back(string("CDER"));
|
||||||
|
types.push_back(string("CHRF"));
|
||||||
types.push_back(string("WER"));
|
types.push_back(string("WER"));
|
||||||
types.push_back(string("MERGE"));
|
types.push_back(string("MERGE"));
|
||||||
types.push_back(string("SEMPOS"));
|
types.push_back(string("SEMPOS"));
|
||||||
@ -62,6 +64,8 @@ Scorer* ScorerFactory::getScorer(const string& type, const string& config)
|
|||||||
return (PermutationScorer*) new PermutationScorer(type, config);
|
return (PermutationScorer*) new PermutationScorer(type, config);
|
||||||
} else if (type == "METEOR") {
|
} else if (type == "METEOR") {
|
||||||
return new MeteorScorer(config);
|
return new MeteorScorer(config);
|
||||||
|
} else if (type == "CHRF") {
|
||||||
|
return new CHRFScorer(config);
|
||||||
} else if (type == "HWCM") {
|
} else if (type == "HWCM") {
|
||||||
return new HwcmScorer(config);
|
return new HwcmScorer(config);
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,6 +43,7 @@ de recherches du Canada
|
|||||||
#include "util/random.hh"
|
#include "util/random.hh"
|
||||||
|
|
||||||
#include "BleuScorer.h"
|
#include "BleuScorer.h"
|
||||||
|
#include "CHRFScorer.h"
|
||||||
#include "HopeFearDecoder.h"
|
#include "HopeFearDecoder.h"
|
||||||
#include "MiraFeatureVector.h"
|
#include "MiraFeatureVector.h"
|
||||||
#include "MiraWeightVector.h"
|
#include "MiraWeightVector.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user