diff options
Diffstat (limited to 'vest/scorer.cc')
-rw-r--r-- | vest/scorer.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/vest/scorer.cc b/vest/scorer.cc index 86894c32..05269a3b 100644 --- a/vest/scorer.cc +++ b/vest/scorer.cc @@ -28,6 +28,10 @@ using namespace std; const bool minimize_segments = true; // if adjacent segments have equal scores, merge them +void Score::TimesEquals(float scale) { + cerr<<"UNIMPLEMENTED except for BLEU (for MIRA): Score::TimesEquals"<<endl;abort(); +} + ScoreType ScoreTypeFromString(const string& st) { const string sl = LowercaseString(st); if (sl == "ser") @@ -159,6 +163,7 @@ class BLEUScore : public Score { float ComputeScore() const; float ComputePartialScore() const; void ScoreDetails(string* details) const; + void TimesEquals(float scale); void PlusEquals(const Score& delta); void PlusEquals(const Score& delta, const float scale); void PlusPartialEquals(const Score& delta, int oracle_e_cover, int oracle_f_cover, int src_len); @@ -566,6 +571,13 @@ void BLEUScore::PlusEquals(const Score& delta) { hyp_len += d.hyp_len; } +void BLEUScore::TimesEquals(float scale) { + correct_ngram_hit_counts *= scale; + hyp_ngram_counts *= scale; + ref_len *= scale; + hyp_len *= scale; +} + void BLEUScore::PlusEquals(const Score& delta, const float scale) { const BLEUScore& d = static_cast<const BLEUScore&>(delta); correct_ngram_hit_counts = correct_ngram_hit_counts + (d.correct_ngram_hit_counts * scale); |