summaryrefslogtreecommitdiff
path: root/vest/scorer.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-20 00:11:45 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-20 00:11:45 +0000
commiteb0a8931eb835d8a23c939ef61867a08c19ebf6b (patch)
tree7112b6af490a04c8bfdc40eb88718702060823c7 /vest/scorer.h
parentbcad98e114d468edf16369b3a30d98556a3d0e61 (diff)
Score::TimesEquals for vlad-mira, intrusive refcount for Score, shared_ptr compile fixes for decoder progs
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@331 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'vest/scorer.h')
-rw-r--r--vest/scorer.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/vest/scorer.h b/vest/scorer.h
index 29ba5377..0d90f378 100644
--- a/vest/scorer.h
+++ b/vest/scorer.h
@@ -5,21 +5,23 @@
#include <boost/shared_ptr.hpp>
//TODO: use intrusive shared_ptr in Score (because there are many of them on ErrorSurfaces)
#include "wordid.h"
+#include "intrusive_refcount.hpp"
class Score;
class SentenceScorer;
-typedef boost::shared_ptr<Score> ScoreP;
+typedef boost::intrusive_ptr<Score> ScoreP;
typedef boost::shared_ptr<SentenceScorer> ScorerP;
class ViterbiEnvelope;
class ErrorSurface;
class Hypergraph; // needed for alignment
+//TODO: BLEU N (N separate arg, not part of enum)?
enum ScoreType { IBM_BLEU, NIST_BLEU, Koehn_BLEU, TER, BLEU_minus_TER_over_2, SER, AER, IBM_BLEU_3 };
ScoreType ScoreTypeFromString(const std::string& st);
std::string StringFromScoreType(ScoreType st);
-class Score {
+class Score : public boost::intrusive_refcount<Score> {
public:
virtual ~Score();
virtual float ComputeScore() const = 0;
@@ -30,6 +32,8 @@ class Score {
ScoreDetails(&d);
return d;
}
+ virtual void TimesEquals(float scale); // only for bleu; for mira oracle
+ /// same as rhs.TimesEquals(scale);PlusEquals(rhs) except doesn't modify rhs.
virtual void PlusEquals(const Score& rhs, const float scale) = 0;
virtual void PlusEquals(const Score& rhs) = 0;
virtual void PlusPartialEquals(const Score& rhs, int oracle_e_cover, int oracle_f_cover, int src_len) = 0;