summaryrefslogtreecommitdiff
path: root/vest/scorer.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-15 03:50:05 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-15 03:50:05 +0000
commit27ed3c0fecde089a761ccf718748413bb572a3a4 (patch)
tree69e84990a9c4842ccbb7783f76e73b2dc1e3a7fa /vest/scorer.h
parent12b09cc1069ee4401074e0e0f6d8f9c120318aa0 (diff)
oracle bleu refactor
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@259 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'vest/scorer.h')
-rw-r--r--vest/scorer.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/vest/scorer.h b/vest/scorer.h
index 7ce688c4..5bfeee0f 100644
--- a/vest/scorer.h
+++ b/vest/scorer.h
@@ -12,6 +12,7 @@ class Hypergraph; // needed for alignment
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 {
public:
@@ -33,20 +34,24 @@ class Score {
class SentenceScorer {
public:
+ typedef std::vector<WordID> Sentence;
+ virtual float ComputeRefLength(const Sentence& hyp) const; // default: avg of refs.length
virtual ~SentenceScorer();
void ComputeErrorSurface(const ViterbiEnvelope& ve, ErrorSurface* es, const ScoreType type, const Hypergraph& hg) const;
- virtual Score* ScoreCandidate(const std::vector<WordID>& hyp) const = 0;
- virtual Score* ScoreCCandidate(const std::vector<WordID>& hyp) const =0;
+ virtual Score* ScoreCandidate(const Sentence& hyp) const = 0;
+ virtual Score* ScoreCCandidate(const Sentence& hyp) const =0;
virtual const std::string* GetSource() const;
static Score* CreateScoreFromString(const ScoreType type, const std::string& in);
static SentenceScorer* CreateSentenceScorer(const ScoreType type,
- const std::vector<std::vector<WordID> >& refs,
+ const std::vector<Sentence >& refs,
const std::string& src = "");
};
+//TODO: should be able to GetOne GetZero without supplying sentence (just type)
class DocScorer {
public:
~DocScorer();
+ DocScorer() { }
DocScorer(
const ScoreType type,
const std::vector<std::string>& ref_files,