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:
authorMatous Machacek <machacekmatous@gmail.com>2012-02-26 21:53:08 +0400
committerMatous Machacek <machacekmatous@gmail.com>2012-02-26 21:53:08 +0400
commite8a94a7bd25fe09cd84790618a62f4cb34944065 (patch)
treecf68dd5a96e3cea121df4f573a4a89dfbdbf9bb9 /mert/InterpolatedScorer.h
parentc26e83fd098b93c33200c4794e33bf8f4c4ff1b2 (diff)
Added interpolated scorer
example: to interpolate BLEU and CDER use --sctype=BLEU,CDER to specify weights use --scconfig=weights:0.3+0.7 This scorer should replace MergeScorer (which requires mert-moses-multi.pl) soon. Interpolated scorer is more universal and is used in the same way as other scorers.
Diffstat (limited to 'mert/InterpolatedScorer.h')
-rw-r--r--mert/InterpolatedScorer.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/mert/InterpolatedScorer.h b/mert/InterpolatedScorer.h
new file mode 100644
index 000000000..5d1f962c5
--- /dev/null
+++ b/mert/InterpolatedScorer.h
@@ -0,0 +1,48 @@
+#ifndef __INTERPOLATED_SCORER_H__
+#define __INTERPOLATED_SCORER_H__
+
+#include <algorithm>
+#include <cmath>
+#include <iostream>
+#include <iterator>
+#include <limits>
+#include <set>
+#include <sstream>
+#include <stdexcept>
+#include <string>
+#include <vector>
+#include "Types.h"
+#include "ScoreData.h"
+#include "Scorer.h"
+
+/**
+ * Class that includes other scorers eg.
+ * Interpolated HAMMING and BLEU scorer **/
+class InterpolatedScorer : public Scorer
+{
+
+public:
+ // name would be: "HAMMING,BLEU" or similar
+ InterpolatedScorer(const string& name, const string& config);
+ virtual ~InterpolatedScorer() {};
+ virtual void score(const candidates_t& candidates, const diffs_t& diffs,
+ statscores_t& scores) const;
+
+ void setReferenceFiles(const vector<string>& referenceFiles);
+ void prepareStats(size_t sid, const string& text, ScoreStats& entry);
+ virtual size_t NumberOfScores() const {
+ size_t sz=0;
+ for (vector<Scorer*>::const_iterator itsc = _scorers.begin(); itsc < _scorers.end(); itsc++) {
+ sz += (*itsc)->NumberOfScores();
+ }
+ return sz;
+ };
+
+ virtual void setScoreData(ScoreData* data);
+
+protected:
+ vector<Scorer*> _scorers;
+ vector<float> _scorerWeights;
+};
+
+#endif //__INTERPOLATED_SCORER_H