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
path: root/mert
diff options
context:
space:
mode:
authorTetsuo Kiso <tetsuo-s@is.naist.jp>2011-11-12 04:51:27 +0400
committerTetsuo Kiso <tetsuo-s@is.naist.jp>2011-11-12 04:51:27 +0400
commitdfb714296fcb6ee2bdde028a5c5bef430b9558aa (patch)
tree0ba8be0d16405633dd9208d8e232b6dc6d945e02 /mert
parentce9a628ed0337d051ce7058dcace2fa53df6d884 (diff)
Add 'explicit' for constructors with one argument.
Diffstat (limited to 'mert')
-rw-r--r--mert/BleuScorer.h5
-rw-r--r--mert/CderScorer.h2
-rw-r--r--mert/Data.h2
-rw-r--r--mert/FeatureStats.h6
-rw-r--r--mert/MergeScorer.h2
-rw-r--r--mert/PerScorer.h2
-rw-r--r--mert/Point.h11
-rw-r--r--mert/ScoreStats.h9
-rw-r--r--mert/TerScorer.h3
-rw-r--r--mert/Util.h8
-rw-r--r--mert/gzfilebuf.h2
11 files changed, 29 insertions, 23 deletions
diff --git a/mert/BleuScorer.h b/mert/BleuScorer.h
index 373325744..500910bb0 100644
--- a/mert/BleuScorer.h
+++ b/mert/BleuScorer.h
@@ -27,7 +27,7 @@ enum BleuReferenceLengthStrategy { BLEU_AVERAGE, BLEU_SHORTEST, BLEU_CLOSEST };
class BleuScorer: public StatisticsBasedScorer
{
public:
- BleuScorer(const string& config = "") : StatisticsBasedScorer("BLEU",config),_refLengthStrategy(BLEU_CLOSEST) {
+ explicit BleuScorer(const string& config = "") : StatisticsBasedScorer("BLEU",config),_refLengthStrategy(BLEU_CLOSEST) {
//configure regularisation
static string KEY_REFLEN = "reflen";
static string REFLEN_AVERAGE = "average";
@@ -61,10 +61,11 @@ public:
float calculateScore(const vector<int>& comps);
private:
- //no copy
+ // no copying allowed
BleuScorer(const BleuScorer&);
~BleuScorer() {}
BleuScorer& operator=(const BleuScorer&);
+
//Used to construct the ngram map
struct CompareNgrams {
int operator() (const vector<int>& a, const vector<int>& b) {
diff --git a/mert/CderScorer.h b/mert/CderScorer.h
index 1f9d01b3f..9a1ad8348 100644
--- a/mert/CderScorer.h
+++ b/mert/CderScorer.h
@@ -14,7 +14,7 @@ using namespace std;
class CderScorer: public StatisticsBasedScorer
{
public:
- CderScorer(const string& config);
+ explicit CderScorer(const string& config);
virtual void setReferenceFiles(const vector<string>& referenceFiles);
virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry)
{
diff --git a/mert/Data.h b/mert/Data.h
index 7d2fa1504..ef40a6d71 100644
--- a/mert/Data.h
+++ b/mert/Data.h
@@ -34,7 +34,7 @@ private:
bool _sparse_flag;
public:
- Data(Scorer& sc);
+ explicit Data(Scorer& sc);
~Data();
inline void clear() {
diff --git a/mert/FeatureStats.h b/mert/FeatureStats.h
index f23aa5052..cbf4cd56b 100644
--- a/mert/FeatureStats.h
+++ b/mert/FeatureStats.h
@@ -57,9 +57,11 @@ private:
public:
FeatureStats();
- FeatureStats(const size_t size);
+ explicit FeatureStats(const size_t size);
+ explicit FeatureStats(std::string &theString);
+
+ // We intentionally allow copying.
FeatureStats(const FeatureStats &stats);
- FeatureStats(std::string &theString);
FeatureStats& operator=(const FeatureStats &stats);
~FeatureStats();
diff --git a/mert/MergeScorer.h b/mert/MergeScorer.h
index 501c08a1b..10b47033f 100644
--- a/mert/MergeScorer.h
+++ b/mert/MergeScorer.h
@@ -32,7 +32,7 @@ using namespace TERCpp;
*/
class MergeScorer: public StatisticsBasedScorer {
public:
- MergeScorer(const string& config = "") : StatisticsBasedScorer("MERGE",config){}
+ explicit MergeScorer(const string& config = "") : StatisticsBasedScorer("MERGE",config){}
virtual void setReferenceFiles(const vector<string>& referenceFiles);
virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry);
static const int LENGTH;
diff --git a/mert/PerScorer.h b/mert/PerScorer.h
index ae01b1079..180028ba2 100644
--- a/mert/PerScorer.h
+++ b/mert/PerScorer.h
@@ -26,7 +26,7 @@ using namespace std;
class PerScorer: public StatisticsBasedScorer
{
public:
- PerScorer(const string& config = "") : StatisticsBasedScorer("PER",config) {}
+ explicit PerScorer(const string& config = "") : StatisticsBasedScorer("PER",config) {}
virtual void setReferenceFiles(const vector<string>& referenceFiles);
virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry);
diff --git a/mert/Point.h b/mert/Point.h
index bf1643b36..4e06bfd26 100644
--- a/mert/Point.h
+++ b/mert/Point.h
@@ -13,7 +13,7 @@ class Optimizer;
* A class that handles the subset of the Feature weight on which
* we run the optimization.
*/
-class Point:public vector<parameter_t>
+class Point : public vector<parameter_t>
{
friend class Optimizer;
private:
@@ -61,12 +61,13 @@ public:
static bool OptimizeAll() {
return fixedweights.empty();
}
+
statscore_t score;
- Point():vector<parameter_t>(dim) {}
+
+ Point() : vector<parameter_t>(dim) {}
Point(const vector<parameter_t>& init,
- const vector<parameter_t>& min,
- const vector<parameter_t>& max
- );
+ const vector<parameter_t>& min,
+ const vector<parameter_t>& max);
void Randomize();
// Compute the feature function
diff --git a/mert/ScoreStats.h b/mert/ScoreStats.h
index 5c1e91270..2fad3971f 100644
--- a/mert/ScoreStats.h
+++ b/mert/ScoreStats.h
@@ -32,13 +32,14 @@ private:
public:
ScoreStats();
- ScoreStats(const size_t size);
+ explicit ScoreStats(const size_t size);
+ explicit ScoreStats(std::string &theString);
+ ~ScoreStats();
+
+ // We intentionally allow copying.
ScoreStats(const ScoreStats &stats);
- ScoreStats(std::string &theString);
ScoreStats& operator=(const ScoreStats &stats);
- ~ScoreStats();
-
bool isfull() {
return (entries_ < available_)?0:1;
}
diff --git a/mert/TerScorer.h b/mert/TerScorer.h
index 9b76d135f..fada3ba5a 100644
--- a/mert/TerScorer.h
+++ b/mert/TerScorer.h
@@ -29,7 +29,7 @@ using namespace TERCpp;
class TerScorer: public StatisticsBasedScorer
{
public:
- TerScorer(const string& config = "") : StatisticsBasedScorer("TER",config) {}
+ explicit TerScorer(const string& config = "") : StatisticsBasedScorer("TER",config) {}
virtual void setReferenceFiles(const vector<string>& referenceFiles);
virtual void prepareStats(size_t sid, const string& text, ScoreStats& entry);
static const int LENGTH;
@@ -49,6 +49,7 @@ public:
private:
string javaEnv;
string tercomEnv;
+
// no copying allowed
TerScorer(const TerScorer&);
~TerScorer() {}
diff --git a/mert/Util.h b/mert/Util.h
index 765cd2cb4..1145694da 100644
--- a/mert/Util.h
+++ b/mert/Util.h
@@ -65,9 +65,9 @@ class inputfilestream : public std::istream
protected:
std::streambuf *m_streambuf;
bool _good;
-public:
- inputfilestream(const std::string &filePath);
+public:
+ explicit inputfilestream(const std::string &filePath);
~inputfilestream();
bool good() {
return _good;
@@ -80,9 +80,9 @@ class outputfilestream : public std::ostream
protected:
std::streambuf *m_streambuf;
bool _good;
-public:
- outputfilestream(const std::string &filePath);
+public:
+ explicit outputfilestream(const std::string &filePath);
~outputfilestream();
bool good() {
return _good;
diff --git a/mert/gzfilebuf.h b/mert/gzfilebuf.h
index b794e83e3..bad248730 100644
--- a/mert/gzfilebuf.h
+++ b/mert/gzfilebuf.h
@@ -7,7 +7,7 @@
class gzfilebuf : public std::streambuf
{
public:
- gzfilebuf(const char *filename) {
+ explicit gzfilebuf(const char *filename) {
_gzf = gzopen(filename, "rb");
setg (_buff+sizeof(int), // beginning of putback area
_buff+sizeof(int), // read position