diff options
author | Matous Machacek <machacekmatous@gmail.com> | 2012-02-28 05:27:23 +0400 |
---|---|---|
committer | Matous Machacek <machacekmatous@gmail.com> | 2012-02-28 05:27:23 +0400 |
commit | ba987c94ba9be5e7c8eb9c3e7c83d8f971fbd3aa (patch) | |
tree | 4140bd7b8fcef62012d2fe59956dcc81bb25c2bd /mert/BleuScorer.cpp | |
parent | e38cd12ef3385304a4b363ca9b9ab16ed886a2ff (diff) |
Support for using factors in mert and evaluator
example:
Use --factor "0|2" to use only first and third factor from nbest list and from reference.
If you use interpolated scorer, separate records with comma (e.g. --factor "0|2,1").
Diffstat (limited to 'mert/BleuScorer.cpp')
-rw-r--r-- | mert/BleuScorer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mert/BleuScorer.cpp b/mert/BleuScorer.cpp index cf2b84242..baf8a0f8b 100644 --- a/mert/BleuScorer.cpp +++ b/mert/BleuScorer.cpp @@ -139,6 +139,7 @@ void BleuScorer::setReferenceFiles(const vector<string>& referenceFiles) string line; size_t sid = 0; //sentence counter while (getline(refin,line)) { + line = this->applyFactors(line); if (i == 0) { NgramCounts *counts = new NgramCounts; //these get leaked m_ref_counts.push_back(counts); @@ -183,8 +184,9 @@ void BleuScorer::prepareStats(size_t sid, const string& text, ScoreStats& entry) } NgramCounts testcounts; // stats for this line - vector<ScoreStatsType> stats(kLENGTH * 2);; - const size_t length = countNgrams(text, testcounts, kLENGTH); + vector<ScoreStatsType> stats(kLENGTH * 2); + string sentence = this->applyFactors(text); + const size_t length = countNgrams(sentence, testcounts, kLENGTH); // Calculate effective reference length. switch (m_ref_length_type) { |