More work on outputting search graph as hypergraph

This commit is contained in:
Lane Schwartz 2013-02-22 15:48:40 -05:00
parent 04f107fbb0
commit 764ce06726
3 changed files with 5 additions and 5 deletions

View File

@ -462,7 +462,7 @@ void Hypothesis::CleanupArcList()
*/
const StaticData &staticData = StaticData::Instance();
size_t nBestSize = staticData.GetNBestSize();
bool distinctNBest = staticData.GetDistinctNBest() || staticData.UseMBR() || staticData.GetOutputSearchGraph() || staticData.UseLatticeMBR() ;
bool distinctNBest = staticData.GetDistinctNBest() || staticData.UseMBR() || staticData.GetOutputSearchGraph() || staticData.GetOutputSearchGraphSLF() || staticData.GetOutputSearchGraphHypergraph() || staticData.UseLatticeMBR() ;
if (!distinctNBest && m_arcList->size() > nBestSize * 5) {
// prune arc list only if there too many arcs

View File

@ -880,7 +880,7 @@ void Manager::OutputSearchGraphAsHypergraph(long translationId, std::ostream &ou
{
vector<SearchGraphNode> searchGraph;
GetSearchGraph(searchGraph);
outputSearchGraphStream << "searchGraph.size() == " << searchGraph.size() << endl;
//outputSearchGraphStream << "searchGraph.size() == " << searchGraph.size() << endl;
// long numArcs = 0;
long numNodes = 0;
@ -892,7 +892,7 @@ outputSearchGraphStream << "searchGraph.size() == " << searchGraph.size() << end
// nodes[0] = 0;
//numNodes += 1;
for (size_t arcNumber = 0, size=searchGraph.size(); arcNumber < size; ++arcNumber) {
OutputSearchNode(translationId,outputSearchGraphStream,searchGraph[arcNumber]);
//OutputSearchNode(translationId,outputSearchGraphStream,searchGraph[arcNumber]);
// Record that this arc ends at this node
// numArcs += 1;
nodeToLines.insert(pair<int,int>(numNodes,arcNumber));
@ -921,7 +921,7 @@ OutputSearchNode(translationId,outputSearchGraphStream,searchGraph[arcNumber]);
// numNodes += 1;
// Print number of nodes and arcs
outputSearchGraphStream << numNodes << " " << numArcs << "(" << searchGraph.size() << ", " << terminalNodes.size() << ")" << endl;
outputSearchGraphStream << numNodes << " " << numArcs /*<< "(" << searchGraph.size() << ", " << terminalNodes.size() << ")"*/ << endl;
// Print node and arc for beginning of sentence <s>
// outputSearchGraphStream << 1 << endl;

View File

@ -460,7 +460,7 @@ public:
return m_nBestFilePath;
}
bool IsNBestEnabled() const {
return (!m_nBestFilePath.empty()) || m_mbr || m_useLatticeMBR || m_mira || m_outputSearchGraph || m_useConsensusDecoding || !m_latticeSamplesFilePath.empty()
return (!m_nBestFilePath.empty()) || m_mbr || m_useLatticeMBR || m_mira || m_outputSearchGraph || m_outputSearchGraphSLF || m_outputSearchGraphHypergraph || m_useConsensusDecoding || !m_latticeSamplesFilePath.empty()
#ifdef HAVE_PROTOBUF
|| m_outputSearchGraphPB
#endif