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:58:14 +0400
committerTetsuo Kiso <tetsuo-s@is.naist.jp>2011-11-12 05:58:14 +0400
commit54b3b846c7591c8e4b8443740e5f611297959ed7 (patch)
tree5a5ef4e3a7c8750ab474fafa60453904d576db47 /mert/Scorer.h
parent00b8c6d76895fb90ef4c8679f9337dafe9633019 (diff)
Add const member functions in Scorer classes.
Diffstat (limited to 'mert/Scorer.h')
-rw-r--r--mert/Scorer.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/mert/Scorer.h b/mert/Scorer.h
index 903ec06ae..801f40d98 100644
--- a/mert/Scorer.h
+++ b/mert/Scorer.h
@@ -38,7 +38,7 @@ public:
/**
* Return the number of statistics needed for the computation of the score.
*/
- virtual size_t NumberOfScores() {
+ virtual size_t NumberOfScores() const {
cerr << "Scorer: 0" << endl;
return 0;
}
@@ -69,7 +69,7 @@ public:
* applying each in turn, and calculating a new score each time.
*/
virtual void score(const candidates_t& candidates, const diffs_t& diffs,
- statscores_t& scores) {
+ statscores_t& scores) const {
//dummy impl
if (!_scoreData) {
throw runtime_error("score data not loaded");
@@ -84,7 +84,7 @@ public:
* Calculate the score of the sentences corresponding to the list of candidate
* indices. Each index indicates the 1-best choice from the n-best list.
*/
- float score(const candidates_t& candidates) {
+ float score(const candidates_t& candidates) const {
diffs_t diffs;
statscores_t scores;
score(candidates, diffs, scores);
@@ -95,7 +95,7 @@ public:
return _name;
}
- size_t getReferenceSize() {
+ size_t getReferenceSize() const {
if (_scoreData) {
return _scoreData->size();
}
@@ -121,9 +121,9 @@ protected:
/**
* Get value of config variable. If not provided, return default.
*/
- string getConfig(const string& key, const string& def="") {
- map<string,string>::iterator i = _config.find(key);
- if (i == _config.end()) {
+ string getConfig(const string& key, const string& def="") const {
+ map<string,string>::const_iterator i = _config.find(key);
+ if (i == _config.end()) {
return def;
} else {
return i->second;
@@ -175,7 +175,7 @@ public:
StatisticsBasedScorer(const string& name, const string& config);
virtual ~StatisticsBasedScorer() {}
virtual void score(const candidates_t& candidates, const diffs_t& diffs,
- statscores_t& scores);
+ statscores_t& scores) const;
protected:
/**