diff options
author | Nicola Bertoldi <bertoldi@fbk.eu> | 2014-12-13 14:52:47 +0300 |
---|---|---|
committer | Nicola Bertoldi <bertoldi@fbk.eu> | 2014-12-13 14:52:47 +0300 |
commit | e4eb201c52be74fee74399a6f35fcbe8eb85d834 (patch) | |
tree | 7792ef96d63262f6e28f1857741e1162c7dccbc4 /moses/ChartHypothesisCollection.cpp | |
parent | cea2d9d8bb34a81660974cae20d66aefec4e0468 (diff) | |
parent | a0b6b6a341e74b47bbef4652ad7fd928cf91e17c (diff) |
merged master into dynamic-models and solved conflicts
Diffstat (limited to 'moses/ChartHypothesisCollection.cpp')
-rw-r--r-- | moses/ChartHypothesisCollection.cpp | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/moses/ChartHypothesisCollection.cpp b/moses/ChartHypothesisCollection.cpp index ee155b103..d53211f34 100644 --- a/moses/ChartHypothesisCollection.cpp +++ b/moses/ChartHypothesisCollection.cpp @@ -24,6 +24,7 @@ #include "ChartHypothesisCollection.h" #include "ChartHypothesis.h" #include "ChartManager.h" +#include "HypergraphOutput.h" #include "util/exception.hh" using namespace std; @@ -55,7 +56,7 @@ ChartHypothesisCollection::~ChartHypothesisCollection() /** public function to add hypothesis to this collection. * Returns false if equiv hypo exists in collection, otherwise returns true. * Takes care of update arc list for n-best list creation. - * Will delete hypo is it exist - once this function is call don't delete hypothesis. + * Will delete hypo if it exists - once this function is call don't delete hypothesis. * \param hypo hypothesis to add * \param manager pointer back to manager */ @@ -293,27 +294,9 @@ void ChartHypothesisCollection::CleanupArcList() * \param outputSearchGraphStream stream to output the info to * \param reachable @todo don't know */ -void ChartHypothesisCollection::GetSearchGraph(long translationId, std::ostream &outputSearchGraphStream, const std::map<unsigned, bool> &reachable) const +void ChartHypothesisCollection::WriteSearchGraph(const ChartSearchGraphWriter& writer, const std::map<unsigned, bool> &reachable) const { - HCType::const_iterator iter; - for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter) { - ChartHypothesis &mainHypo = **iter; - if (StaticData::Instance().GetUnprunedSearchGraph() || - reachable.find(mainHypo.GetId()) != reachable.end()) { - outputSearchGraphStream << translationId << " " << mainHypo << endl; - } - - const ChartArcList *arcList = mainHypo.GetArcList(); - if (arcList) { - ChartArcList::const_iterator iterArc; - for (iterArc = arcList->begin(); iterArc != arcList->end(); ++iterArc) { - const ChartHypothesis &arc = **iterArc; - if (reachable.find(arc.GetId()) != reachable.end()) { - outputSearchGraphStream << translationId << " " << arc << endl; - } - } - } - } + writer.WriteHypos(*this,reachable); } std::ostream& operator<<(std::ostream &out, const ChartHypothesisCollection &coll) |