Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230>2009-08-05 19:38:35 +0400
committernicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230>2009-08-05 19:38:35 +0400
commit0393183eb489aa4a7334cbf0af37cfa60b4957db (patch)
tree8e05ca63754b96158d7f035251dd3bd5fbb86954 /mert/BleuScorer.h
parentc50596d1e18894ee0f81dcdd8cf1569a2238d75b (diff)
mert software now works with different reference length policies: shortest, average, closest (default) and with case information (default is preserving case). Pay attention that both defaults are different from the previous version (which were shortest reflen and case-insensitive).
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@2459 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'mert/BleuScorer.h')
-rw-r--r--mert/BleuScorer.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/mert/BleuScorer.h b/mert/BleuScorer.h
index fc5d5f332..cd2471b55 100644
--- a/mert/BleuScorer.h
+++ b/mert/BleuScorer.h
@@ -25,7 +25,26 @@ enum BleuReferenceLengthStrategy { BLEU_AVERAGE, BLEU_SHORTEST, BLEU_CLOSEST };
**/
class BleuScorer: public StatisticsBasedScorer {
public:
- BleuScorer(const string& config = "") : StatisticsBasedScorer("BLEU",config),_refLengthStrategy(BLEU_SHORTEST) {}
+ BleuScorer(const string& config = "") : StatisticsBasedScorer("BLEU",config),_refLengthStrategy(BLEU_CLOSEST) {
+ //configure regularisation
+ static string KEY_REFLEN = "reflen";
+ static string REFLEN_AVERAGE = "average";
+ static string REFLEN_SHORTEST = "shortest";
+ static string REFLEN_CLOSEST = "closest";
+
+
+ string reflen = getConfig(KEY_REFLEN,REFLEN_CLOSEST);
+ if (reflen == REFLEN_AVERAGE) {
+ _refLengthStrategy = BLEU_AVERAGE;
+ } else if (reflen == REFLEN_SHORTEST) {
+ _refLengthStrategy = BLEU_SHORTEST;
+ } else if (reflen == REFLEN_CLOSEST) {
+ _refLengthStrategy = BLEU_CLOSEST;
+ } else {
+ throw runtime_error("Unknown reference length strategy: " + reflen);
+ }
+ cerr << "Using reference length strategy: " << reflen << endl;
+}
virtual void setReferenceFiles(const vector<string>& referenceFiles);
virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry);
static const int LENGTH;