mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
Add 'explicit' for constructors with one argument.
This commit is contained in:
parent
ce9a628ed0
commit
dfb714296f
@ -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) {
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ private:
|
||||
bool _sparse_flag;
|
||||
|
||||
public:
|
||||
Data(Scorer& sc);
|
||||
explicit Data(Scorer& sc);
|
||||
~Data();
|
||||
|
||||
inline void clear() {
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
11
mert/Point.h
11
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
|
||||
|
@ -32,13 +32,14 @@ private:
|
||||
|
||||
public:
|
||||
ScoreStats();
|
||||
ScoreStats(const size_t size);
|
||||
ScoreStats(const ScoreStats &stats);
|
||||
ScoreStats(std::string &theString);
|
||||
ScoreStats& operator=(const ScoreStats &stats);
|
||||
|
||||
explicit ScoreStats(const size_t size);
|
||||
explicit ScoreStats(std::string &theString);
|
||||
~ScoreStats();
|
||||
|
||||
// We intentionally allow copying.
|
||||
ScoreStats(const ScoreStats &stats);
|
||||
ScoreStats& operator=(const ScoreStats &stats);
|
||||
|
||||
bool isfull() {
|
||||
return (entries_ < available_)?0:1;
|
||||
}
|
||||
|
@ -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() {}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user