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:
authorTetsuo Kiso <tetsuo-s@is.naist.jp>2011-11-12 05:21:08 +0400
committerTetsuo Kiso <tetsuo-s@is.naist.jp>2011-11-12 05:21:08 +0400
commitd776281b8b988e5f29663adfeb8ade538ebb446f (patch)
tree17be3e34e06730f308f695a64eadfeef2a81e42f /mert/BleuScorer.h
parent43beb88df52977ed84ced6cb431d21d616fb757a (diff)
Simple refactoring of BLEU scorer.
Diffstat (limited to 'mert/BleuScorer.h')
-rw-r--r--mert/BleuScorer.h23
1 files changed, 6 insertions, 17 deletions
diff --git a/mert/BleuScorer.h b/mert/BleuScorer.h
index f3dd978aa..6f6d40d53 100644
--- a/mert/BleuScorer.h
+++ b/mert/BleuScorer.h
@@ -34,22 +34,15 @@ public:
virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry);
size_t NumberOfScores() {
- // cerr << "BleuScorer: " << (2 * LENGTH + 1) << endl;
return (2 * kLENGTH + 1);
}
-
-//protected:
float calculateScore(const vector<int>& comps);
private:
- // no copying allowed
- BleuScorer(const BleuScorer&);
- BleuScorer& operator=(const BleuScorer&);
-
//Used to construct the ngram map
struct CompareNgrams {
- int operator() (const vector<int>& a, const vector<int>& b) {
+ int operator()(const vector<int>& a, const vector<int>& b) {
size_t i;
size_t as = a.size();
size_t bs = b.size();
@@ -70,7 +63,6 @@ private:
typedef map<vector<int>,int,CompareNgrams> counts_t;
typedef map<vector<int>,int,CompareNgrams>::iterator counts_it;
-
typedef ScopedVector<counts_t> refcounts_t;
/**
@@ -78,14 +70,7 @@ private:
*/
size_t countNgrams(const string& line, counts_t& counts, unsigned int n);
- void dump_counts(counts_t& counts) {
- for (counts_it i = counts.begin(); i != counts.end(); ++i) {
- cerr << "(";
- copy(i->first.begin(), i->first.end(), ostream_iterator<int>(cerr," "));
- cerr << ") " << i->second << ", ";
- }
- cerr << endl;
- }
+ void dump_counts(counts_t& counts);
const int kLENGTH;
BleuReferenceLengthStrategy _refLengthStrategy;
@@ -93,6 +78,10 @@ private:
// data extracted from reference files
refcounts_t _refcounts;
vector<vector<size_t> > _reflengths;
+
+ // no copying allowed
+ BleuScorer(const BleuScorer&);
+ BleuScorer& operator=(const BleuScorer&);
};
#endif // __BLEUSCORER_H__