diff options
author | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-11-16 13:43:57 +0300 |
---|---|---|
committer | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-11-16 13:43:57 +0300 |
commit | 5272e4d241234bae7f59d278d60de441ce2e925b (patch) | |
tree | 7e819e2cb5d35f915031bb08f963db763e77749a /moses-cmd | |
parent | 8e06834ec1b4a4757ca5896c3214f072ddf73c85 (diff) |
Modified output of feature scores.
Scores from Confusion Network input are output BEFORE any lexicon scores.
In nbest file, they are NOW labelled with "I:". Before they were "hidden" among other translation scores.
This change affect MERT, which will be changed ASAP.
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@980 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses-cmd')
-rwxr-xr-x | moses-cmd/src/IOCommandLine.cpp | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/moses-cmd/src/IOCommandLine.cpp b/moses-cmd/src/IOCommandLine.cpp index e31af9f70..3858a87cb 100755 --- a/moses-cmd/src/IOCommandLine.cpp +++ b/moses-cmd/src/IOCommandLine.cpp @@ -193,18 +193,57 @@ void IOCommandLine::SetNBest(const LatticePathList &nBestList, long translationI } // translation components - vector<PhraseDictionary*> pds = StaticData::Instance()->GetPhraseDictionaries(); - if (pds.size() > 0) { - if (labeledOutput) - m_nBestFile << "tm: "; - vector<PhraseDictionary*>::iterator iter; - for (iter = pds.begin(); iter != pds.end(); ++iter) { - vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter); - for (size_t j = 0; j<scores.size(); ++j) - m_nBestFile << scores[j] << " "; - - } - } + if (StaticData::Instance()->GetInputType()==0){ + // translation components for text input + vector<PhraseDictionary*> pds = StaticData::Instance()->GetPhraseDictionaries(); + if (pds.size() > 0) { + if (labeledOutput) + m_nBestFile << "tm: "; + vector<PhraseDictionary*>::iterator iter; + for (iter = pds.begin(); iter != pds.end(); ++iter) { + vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter); + for (size_t j = 0; j<scores.size(); ++j) + m_nBestFile << scores[j] << " "; + } + } + } + else{ + // translation components for Confusion Network input + // first translation component has GetNumInputScores() scores from the input Confusion Network + // at the beginning of the vector + vector<PhraseDictionary*> pds = StaticData::Instance()->GetPhraseDictionaries(); + if (pds.size() > 0) { + vector<PhraseDictionary*>::iterator iter; + + iter = pds.begin(); + vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter); + + size_t pd_numinputscore = (*iter)->GetNumInputScores(); + + if (pd_numinputscore){ + + if (labeledOutput) + m_nBestFile << "I: "; + + for (size_t j = 0; j < pd_numinputscore; ++j) + m_nBestFile << scores[j] << " "; + } + + + for (iter = pds.begin() ; iter != pds.end(); ++iter) { + vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter); + + size_t pd_numinputscore = (*iter)->GetNumInputScores(); + + if (iter == pds.begin() && labeledOutput) + m_nBestFile << "tm: "; + for (size_t j = pd_numinputscore; j < scores.size() ; ++j) + m_nBestFile << scores[j] << " "; + } + } + } + + // word penalty if (labeledOutput) |