diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-03-10 12:12:34 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-03-10 12:12:34 +0400 |
commit | e7a2483b2296be98441a8df286612fe3f37ef613 (patch) | |
tree | 60dd9e1fc444391437237df6a68b2806d1156446 /mert/Data.cpp | |
parent | ed6e6f00b1b73a99d9177b984835af063ccf690f (diff) |
mert: Prefix private members with "m_" except TER.
Squashed commit of the following:
- Clean up PRO.
- Clean up ScoreStats.
- Clean up ScoreData.
- Clean up ScoreArray.
- Remove unnecessary headers.
- Clean up ScopedVector.
- Clean up Point.
- Clean up PerScorer.
- Clean up Optimizer.
- Clean up MergeScorer.
- Clean up InterpolatedScorer.
- Clean up FileStream.
- Clean up FeatureStats.
- Remove inefficient string concatenation.
- Clean up FeatureData.
- Clean up FeatureArray.
- Clean up Data.
Diffstat (limited to 'mert/Data.cpp')
-rw-r--r-- | mert/Data.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/mert/Data.cpp b/mert/Data.cpp index c4a35b9b2..3a50a4550 100644 --- a/mert/Data.cpp +++ b/mert/Data.cpp @@ -18,34 +18,34 @@ #include "Util.h" Data::Data() - : theScorer(NULL), - number_of_scores(0), - _sparse_flag(false), - scoredata(), - featdata() {} + : m_scorer(NULL), + m_num_scores(0), + m_sparse_flag(false), + m_score_data(), + m_feature_data() {} Data::Data(Scorer& ptr) - : theScorer(&ptr), - score_type(theScorer->getName()), - number_of_scores(0), - _sparse_flag(false), - scoredata(new ScoreData(*theScorer)), - featdata(new FeatureData) + : m_scorer(&ptr), + m_score_type(m_scorer->getName()), + m_num_scores(0), + m_sparse_flag(false), + m_score_data(new ScoreData(*m_scorer)), + m_feature_data(new FeatureData) { - TRACE_ERR("Data::score_type " << score_type << endl); - TRACE_ERR("Data::Scorer type from Scorer: " << theScorer->getName() << endl); + TRACE_ERR("Data::m_score_type " << m_score_type << endl); + TRACE_ERR("Data::Scorer type from Scorer: " << m_scorer->getName() << endl); } //ADDED BY TS void Data::remove_duplicates() { - size_t nSentences = featdata->size(); - assert(scoredata->size() == nSentences); + size_t nSentences = m_feature_data->size(); + assert(m_score_data->size() == nSentences); for (size_t s=0; s < nSentences; s++) { - FeatureArray& feat_array = featdata->get(s); - ScoreArray& score_array = scoredata->get(s); + FeatureArray& feat_array = m_feature_data->get(s); + ScoreArray& score_array = m_score_data->get(s); assert(feat_array.size() == score_array.size()); @@ -147,8 +147,8 @@ void Data::loadnbest(const string &file) getNextPound(line, sentence, "|||"); // second field getNextPound(line, feature_str, "|||"); // third field - theScorer->prepareStats(sentence_index, sentence, scoreentry); - scoredata->add(scoreentry, sentence_index); + m_scorer->prepareStats(sentence_index, sentence, scoreentry); + m_score_data->add(scoreentry, sentence_index); // examine first line for name of features if (!existsFeatureNames()) { @@ -185,7 +185,7 @@ void Data::InitFeatureMap(const string& str) { tmp_name = substr.substr(0, substr.size() - 1); } } - featdata->setFeatureMap(features); + m_feature_data->setFeatureMap(features); } void Data::AddFeatures(const string& str, @@ -207,10 +207,10 @@ void Data::AddFeatures(const string& str, string name = substr; getNextPound(buf, substr); feature_entry.addSparse(name, atof(substr.c_str())); - _sparse_flag = true; + m_sparse_flag = true; } } - featdata->add(feature_entry, sentence_index); + m_feature_data->add(feature_entry, sentence_index); } // TODO @@ -226,8 +226,8 @@ void Data::createShards(size_t shard_count, float shard_size, const string& scor CHECK(shard_size >= 0); CHECK(shard_size <= 1); - size_t data_size = scoredata->size(); - CHECK(data_size == featdata->size()); + size_t data_size = m_score_data->size(); + CHECK(data_size == m_feature_data->size()); shard_size *= data_size; const float coeff = static_cast<float>(data_size) / shard_count; @@ -248,15 +248,15 @@ void Data::createShards(size_t shard_count, float shard_size, const string& scor } } - Scorer* scorer = ScorerFactory::getScorer(score_type, scorerconfig); + Scorer* scorer = ScorerFactory::getScorer(m_score_type, scorerconfig); shards.push_back(Data(*scorer)); - shards.back().score_type = score_type; - shards.back().number_of_scores = number_of_scores; - shards.back()._sparse_flag = _sparse_flag; + shards.back().m_score_type = m_score_type; + shards.back().m_num_scores = m_num_scores; + shards.back().m_sparse_flag = m_sparse_flag; for (size_t i = 0; i < shard_contents.size(); ++i) { - shards.back().featdata->add(featdata->get(shard_contents[i])); - shards.back().scoredata->add(scoredata->get(shard_contents[i])); + shards.back().m_feature_data->add(m_feature_data->get(shard_contents[i])); + shards.back().m_score_data->add(m_score_data->get(shard_contents[i])); } //cerr << endl; } |