mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-17 14:17:13 +03:00
Added wipo-specific n-best list format
This commit is contained in:
parent
0368228f84
commit
2fd74a83e7
@ -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];
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user