option to get unpruned search graph for chart decoder

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4228 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
phkoehn 2011-09-16 11:58:53 +00:00
parent 0ab0df5aac
commit 7927439ce5
7 changed files with 10 additions and 4 deletions

View File

@ -190,7 +190,6 @@ void ChartCell::GetSearchGraph(long translationId, std::ostream &outputSearchGra
const ChartHypothesisCollection &coll = iterOutside->second;
coll.GetSearchGraph(translationId, outputSearchGraphStream, reachable);
}
}
std::ostream& operator<<(std::ostream &out, const ChartCell &cell)

View File

@ -259,7 +259,8 @@ void ChartHypothesisCollection::GetSearchGraph(long translationId, std::ostream
HCType::const_iterator iter;
for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter) {
ChartHypothesis &mainHypo = **iter;
if (reachable.find(mainHypo.GetId()) != reachable.end()) {
if (StaticData::Instance().GetUnprunedSearchGraph() ||
reachable.find(mainHypo.GetId()) != reachable.end()) {
outputSearchGraphStream << translationId << " " << mainHypo << endl;
}

View File

@ -254,7 +254,7 @@ void ChartRuleLookupManagerOnDisk::GetChartRuleCollection(
delete tpcollBerkeleyDb;
m_cache[tpCollFilePos] = targetPhraseCollection;
} else {
// jsut get out of cache
// just get out of cache
targetPhraseCollection = iterCache->second;
}

View File

@ -125,7 +125,7 @@ size_t GenerationDictionary::GetNumScoreComponents() const
std::string GenerationDictionary::GetScoreProducerDescription(unsigned) const
{
return "Generation score, file=" + m_filePath;
return "Generation score,file=" + m_filePath;
}
std::string GenerationDictionary::GetScoreProducerWeightShortName(unsigned) const

View File

@ -120,6 +120,7 @@ Parameter::Parameter()
AddParam("time-out", "seconds after which is interrupted (-1=no time-out, default is -1)");
AddParam("output-search-graph", "osg", "Output connected hypotheses of search into specified filename");
AddParam("output-search-graph-extended", "osgx", "Output connected hypotheses of search into specified filename, in extended format");
AddParam("unpruned-search-graph", "usg", "When outputting chart search graph, do not exclude dead ends. Note: stack pruning may have eliminated some hypotheses");
#ifdef HAVE_PROTOBUF
AddParam("output-search-graph-pb", "pb", "Write phrase lattice to protocol buffer objects in the specified path.");
#endif

View File

@ -210,6 +210,7 @@ bool StaticData::LoadData(Parameter *parameter)
} else
m_outputSearchGraphPB = false;
#endif
SetBooleanParameter( &m_unprunedSearchGraph, "unpruned-search-graph", true );
// include feature names in the n-best list
SetBooleanParameter( &m_labeledNBestList, "labeled-n-best-list", true );

View File

@ -193,6 +193,7 @@ protected:
#ifdef HAVE_PROTOBUF
bool m_outputSearchGraphPB; //! whether to output search graph as a protobuf
#endif
bool m_unprunedSearchGraph; //! do not exclude dead ends (chart decoder only)
size_t m_cubePruningPopLimit;
size_t m_cubePruningDiversity;
@ -539,6 +540,9 @@ public:
return m_outputSearchGraphPB;
}
#endif
bool GetUnprunedSearchGraph() const {
return m_unprunedSearchGraph;
}
XmlInputType GetXmlInputType() const {
return m_xmlInputType;