Added wipo-specific n-best list format

This commit is contained in:
smtadmin 2014-12-10 11:39:04 +01:00
parent 0368228f84
commit 2fd74a83e7
4 changed files with 21 additions and 1 deletions

View File

@ -463,13 +463,20 @@ void OutputNBest(std::ostream& out
bool reportAllFactors = staticData.GetReportAllFactorsNBest();
bool includeSegmentation = staticData.NBestIncludesSegmentation();
bool includeWordAlignment = staticData.PrintAlignmentInfoInNbest();
bool wipoNBest = staticData.WipoNBest();
if(wipoNBest)
out << "OUT: " << std::distance(nBestList.begin(), nBestList.end()) << std::endl;
TrellisPathList::const_iterator iter;
for (iter = nBestList.begin() ; iter != nBestList.end() ; ++iter) {
const TrellisPath &path = **iter;
const std::vector<const Hypothesis *> &edges = path.GetEdges();
// print the surface factor of the translation
if(wipoNBest)
out << "OUT: ";
out << translationId << " ||| ";
for (int currEdge = (int)edges.size() - 1 ; currEdge >= 0 ; currEdge--) {
const Hypothesis &edge = *edges[currEdge];

View File

@ -141,6 +141,7 @@ Parameter::Parameter()
AddParam("print-alignment-info", "Output word-to-word alignment to standard out, separated from translation by |||. Word-to-word alignments are takne from the phrase table if any. Default is false");
AddParam("include-segmentation-in-n-best", "include phrasal segmentation in the n-best list. default is false");
AddParam("print-alignment-info-in-n-best", "Include word-to-word alignment in the n-best list. Word-to-word alignments are takne from the phrase table if any. Default is false");
AddParam("wipo-n-best", "Use WIPO-specific n-best list format. Default is false");
AddParam("alignment-output-file", "print output word alignments into given file");
AddParam("sort-word-alignment", "Sort word alignments for more consistent display. 0=no sort (default), 1=target order");
AddParam("report-segmentation", "t", "report phrase segmentation in the output");

View File

@ -164,6 +164,11 @@ bool StaticData::LoadData(Parameter *parameter)
m_needAlignmentInfo = true;
}
SetBooleanParameter( &m_WipoNBest, "wipo-n-best", false );
if (m_WipoNBest) {
m_WipoNBest = true;
}
if (m_parameter->GetParam("alignment-output-file").size() > 0) {
m_alignmentOutputFile = Scan<std::string>(m_parameter->GetParam("alignment-output-file")[0]);
m_needAlignmentInfo = true;

View File

@ -129,6 +129,7 @@ protected:
bool m_PrintAlignmentInfo;
bool m_needAlignmentInfo;
bool m_PrintAlignmentInfoNbest;
bool m_WipoNBest;
std::string m_alignmentOutputFile;
@ -623,9 +624,15 @@ public:
bool PrintAlignmentInfo() const {
return m_PrintAlignmentInfo;
}
bool PrintAlignmentInfoInNbest() const {
return m_PrintAlignmentInfoNbest;
}
bool WipoNBest() const {
return m_WipoNBest;
}
WordAlignmentSort GetWordAlignmentSort() const {
return m_wordAlignmentSort;
}