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:
-rw-r--r--mert/Data.cpp8
-rw-r--r--mert/Data.h2
-rw-r--r--mert/DataTest.cpp2
-rw-r--r--mert/InterpolatedScorer.cpp2
-rw-r--r--mert/ScoreData.cpp4
-rw-r--r--mert/ScoreData.h2
-rw-r--r--mert/evaluator.cpp4
-rw-r--r--mert/extractor.cpp2
-rwxr-xr-xmert/mert.cpp2
9 files changed, 14 insertions, 14 deletions
diff --git a/mert/Data.cpp b/mert/Data.cpp
index 3a50a4550..33c259658 100644
--- a/mert/Data.cpp
+++ b/mert/Data.cpp
@@ -24,12 +24,12 @@ Data::Data()
m_score_data(),
m_feature_data() {}
-Data::Data(Scorer& ptr)
- : m_scorer(&ptr),
+Data::Data(Scorer* scorer)
+ : m_scorer(scorer),
m_score_type(m_scorer->getName()),
m_num_scores(0),
m_sparse_flag(false),
- m_score_data(new ScoreData(*m_scorer)),
+ m_score_data(new ScoreData(m_scorer)),
m_feature_data(new FeatureData)
{
TRACE_ERR("Data::m_score_type " << m_score_type << endl);
@@ -250,7 +250,7 @@ void Data::createShards(size_t shard_count, float shard_size, const string& scor
Scorer* scorer = ScorerFactory::getScorer(m_score_type, scorerconfig);
- shards.push_back(Data(*scorer));
+ shards.push_back(Data(scorer));
shards.back().m_score_type = m_score_type;
shards.back().m_num_scores = m_num_scores;
shards.back().m_sparse_flag = m_sparse_flag;
diff --git a/mert/Data.h b/mert/Data.h
index 222a58665..c18d0d9bd 100644
--- a/mert/Data.h
+++ b/mert/Data.h
@@ -42,7 +42,7 @@ private:
const std::string& sentence_index);
public:
- explicit Data(Scorer& sc);
+ explicit Data(Scorer* scorer);
Data();
//Note that there is no copy constructor implemented, so only the
diff --git a/mert/DataTest.cpp b/mert/DataTest.cpp
index 6d48a46eb..bf644fe1a 100644
--- a/mert/DataTest.cpp
+++ b/mert/DataTest.cpp
@@ -10,7 +10,7 @@
//very basic test of sharding
BOOST_AUTO_TEST_CASE(shard_basic) {
boost::scoped_ptr<Scorer> scorer(ScorerFactory::getScorer("BLEU", ""));
- Data data(*scorer);
+ Data data(scorer.get());
FeatureArray fa1, fa2, fa3, fa4;
ScoreArray sa1, sa2, sa3, sa4;
fa1.setIndex("1");
diff --git a/mert/InterpolatedScorer.cpp b/mert/InterpolatedScorer.cpp
index fced4b4fe..25d29b42a 100644
--- a/mert/InterpolatedScorer.cpp
+++ b/mert/InterpolatedScorer.cpp
@@ -69,7 +69,7 @@ void InterpolatedScorer::setScoreData(ScoreData* data)
for (ScopedVector<Scorer>::iterator itsc = m_scorers.begin();
itsc != m_scorers.end(); ++itsc) {
int numScoresScorer = (*itsc)->NumberOfScores();
- ScoreData* newData =new ScoreData(**itsc);
+ ScoreData* newData =new ScoreData(*itsc);
for (size_t i = 0; i < data->size(); i++) {
ScoreArray scoreArray = data->get(i);
ScoreArray newScoreArray;
diff --git a/mert/ScoreData.cpp b/mert/ScoreData.cpp
index ac117289e..5a561816a 100644
--- a/mert/ScoreData.cpp
+++ b/mert/ScoreData.cpp
@@ -11,8 +11,8 @@
#include "Util.h"
#include "FileStream.h"
-ScoreData::ScoreData(Scorer& ptr):
- m_scorer(&ptr)
+ScoreData::ScoreData(Scorer* scorer) :
+ m_scorer(scorer)
{
m_score_type = m_scorer->getName();
// This is not dangerous: we don't use the this pointer in SetScoreData.
diff --git a/mert/ScoreData.h b/mert/ScoreData.h
index 37413445e..475ecb1ca 100644
--- a/mert/ScoreData.h
+++ b/mert/ScoreData.h
@@ -35,7 +35,7 @@ private:
size_t m_num_scores;
public:
- ScoreData(Scorer& sc);
+ ScoreData(Scorer* scorer);
~ScoreData() {}
inline void clear() {
diff --git a/mert/evaluator.cpp b/mert/evaluator.cpp
index 3b2e0d61f..eb8a9be95 100644
--- a/mert/evaluator.cpp
+++ b/mert/evaluator.cpp
@@ -55,7 +55,7 @@ void EvaluatorUtil::evaluate(const string& candFile, int bootstrap)
for (int i = 0; i < bootstrap; ++i)
{
// TODO: Use smart pointer for exceptional-safety.
- ScoreData* scoredata = new ScoreData(*g_scorer);
+ ScoreData* scoredata = new ScoreData(g_scorer);
for (int j = 0; j < n; ++j)
{
int randomIndex = random() % n;
@@ -89,7 +89,7 @@ void EvaluatorUtil::evaluate(const string& candFile, int bootstrap)
else
{
// TODO: Use smart pointer for exceptional-safety.
- ScoreData* scoredata = new ScoreData(*g_scorer);
+ ScoreData* scoredata = new ScoreData(g_scorer);
for (int sid = 0; sid < n; ++sid)
{
string str_sid = int2string(sid);
diff --git a/mert/extractor.cpp b/mert/extractor.cpp
index 99567281a..1e1cebeaa 100644
--- a/mert/extractor.cpp
+++ b/mert/extractor.cpp
@@ -197,7 +197,7 @@ int main(int argc, char** argv)
PrintUserTime("References loaded");
- Data data(*scorer);
+ Data data(scorer.get());
// load old data
for (size_t i = 0; i < prevScoreDataFiles.size(); i++) {
diff --git a/mert/mert.cpp b/mert/mert.cpp
index cd9efa45a..bc0252277 100755
--- a/mert/mert.cpp
+++ b/mert/mert.cpp
@@ -338,7 +338,7 @@ int main(int argc, char **argv)
ScorerFactory::getScorer(option.scorer_type, option.scorer_config));
//load data
- Data data(*scorer);
+ Data data(scorer.get());
for (size_t i = 0; i < ScoreDataFiles.size(); i++) {
cerr<<"Loading Data from: "<< ScoreDataFiles.at(i) << " and " << FeatureDataFiles.at(i) << endl;