diff options
author | Barry Haddow <barry.haddow@gmail.com> | 2012-07-17 16:36:50 +0400 |
---|---|---|
committer | Barry Haddow <barry.haddow@gmail.com> | 2012-07-17 16:36:50 +0400 |
commit | 2b4e61d8261510732ac53eaf48a73e6198b77c2b (patch) | |
tree | feeba83dd2c24530d5e069f0089803d77ebfc9cb /mert/Data.cpp | |
parent | f592c222fec19e41fcfb9c059c81de2077b971fe (diff) | |
parent | 6a94f740197ac3eff812dcf5d4bbf658eea02d5d (diff) |
Merge branch 'trunk' into miramerge
Compiles, not tested.
Conflicts:
Jamroot
OnDiskPt/PhraseNode.h
OnDiskPt/TargetPhrase.cpp
OnDiskPt/TargetPhrase.h
OnDiskPt/TargetPhraseCollection.cpp
mert/BleuScorer.cpp
mert/Data.cpp
mert/FeatureData.cpp
moses-chart-cmd/src/Main.cpp
moses/src/AlignmentInfo.h
moses/src/ChartManager.cpp
moses/src/LM/Ken.cpp
moses/src/LM/Ken.h
moses/src/LMList.h
moses/src/LexicalReordering.h
moses/src/PhraseDictionaryTree.h
moses/src/ScoreIndexManager.h
moses/src/StaticData.h
moses/src/TargetPhrase.h
moses/src/Word.cpp
scripts/ems/experiment.meta
scripts/ems/experiment.perl
scripts/training/train-model.perl
Diffstat (limited to 'mert/Data.cpp')
-rw-r--r-- | mert/Data.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/mert/Data.cpp b/mert/Data.cpp index 2a6bd5e92..7b703b77b 100644 --- a/mert/Data.cpp +++ b/mert/Data.cpp @@ -19,6 +19,8 @@ using namespace std; +namespace MosesTuning +{ Data::Data(Scorer* scorer, const string& sparse_weights_file) : m_scorer(scorer), @@ -135,7 +137,7 @@ void Data::loadNBest(const string &file) throw runtime_error("Unable to open: " + file); ScoreStats scoreentry; - string line, sentence_index, sentence, feature_str; + string line, sentence_index, sentence, feature_str, alignment; while (getline(inp, line, '\n')) { if (line.empty()) continue; @@ -146,7 +148,21 @@ void Data::loadNBest(const string &file) getNextPound(line, sentence, "|||"); // second field getNextPound(line, feature_str, "|||"); // third field + if (line.length() > 0) { + string temp; + getNextPound(line, temp, "|||"); //fourth field sentence score + if (line.length() > 0) { + getNextPound(line, alignment, "|||"); //fourth field only there if alignment scorer + } + } + //TODO check alignment exists if scorers need it + + if (m_scorer->useAlignment()) { + sentence += "|||"; + sentence += alignment; + } m_scorer->prepareStats(sentence_index, sentence, scoreentry); + m_score_data->add(scoreentry, sentence_index); // examine first line for name of features @@ -260,3 +276,6 @@ void Data::createShards(size_t shard_count, float shard_size, const string& scor //cerr << endl; } } + +} + |