void TrellisPath::CreateDeviantPaths(TrellisPathCollection &pathColl) const
{
  const size_t sizePath = m_path.size();

  if (m_prevEdgeChanged == NOT_FOUND) {
    // initial enumration from a pure hypo
    //VERBOSE(2,"Parcours de Path  hypo par hypo"<<endl);
    for (size_t currEdge = 0 ; currEdge < sizePath ; currEdge++) {
      const Hypothesis	*hypo	= static_cast<const Hypothesis*>(m_path[currEdge]);
      const ArcList *pAL = hypo->GetArcList();
      if (!pAL) continue;
      const ArcList &arcList = *pAL;
	// VERBOSE(2, "  Create from hypo recombined with :  "<< hypo->GetId()<<" ARC size "<<arcList.size()<<endl);	
      // every possible Arc to replace this edge
      ArcList::const_iterator iterArc;
      for (iterArc = arcList.begin() ; iterArc != arcList.end() ; ++iterArc) {
        const Hypothesis *arc = *iterArc;
		
        TrellisPath *deviantPath = new TrellisPath(*this, currEdge, arc);

 	 //  VERBOSE(2," Add deviantPath to contenders : "<<*deviantPath<<" Score : "<<(*deviantPath).GetTotalScore()<<endl);

        pathColl.Add(deviantPath);
      }
    }
  } else {
    // wiggle 1 of the edges only
    for (size_t currEdge = m_prevEdgeChanged + 1 ; currEdge < sizePath ; currEdge++) {
      const ArcList *pAL = m_path[currEdge]->GetArcList();
      if (!pAL) continue;
      const ArcList &arcList = *pAL;
      ArcList::const_iterator iterArc;
      // VERBOSE(2, " wiggle Create from hypo recombined with :  "<< m_path[currEdge]->GetId() <<endl);		
      for (iterArc = arcList.begin() ; iterArc != arcList.end() ; ++iterArc) {
        // copy this Path & change 1 edge
        const Hypothesis *arcReplace = *iterArc;

        TrellisPath *deviantPath = new TrellisPath(*this, currEdge, arcReplace);
	
	// VERBOSE(2," Add deviantPath 1 : "<<*deviantPath<<" Score : "<<(*deviantPath).GetTotalScore()<<endl);

        pathColl.Add(deviantPath);
      } // for (iterArc...
    } // for (currEdge = 0 ...
  }

	//std::cerr<<" New Contains of Path : "<<endl;
	//std::cerr<<pathColl<<endl;
	//std::cerr<<" END  "<<endl;

}
Exemplo n.º 2
0
void TrellisPath::CreateDeviantPaths(TrellisPathCollection &pathColl) const
{
	const size_t sizePath = m_path.size();

	if (m_prevEdgeChanged == NOT_FOUND)
	{ // initial enumration from a pure hypo
		for (size_t currEdge = 0 ; currEdge < sizePath ; currEdge++)
		{
			const Hypothesis	*hypo		= static_cast<const Hypothesis*>(m_path[currEdge]);
			const ArcList *pAL = hypo->GetArcList();
      if (!pAL) continue;
			const ArcList &arcList = *pAL;

			// every possible Arc to replace this edge
			ArcList::const_iterator iterArc;
			for (iterArc = arcList.begin() ; iterArc != arcList.end() ; ++iterArc)
			{
				const Hypothesis *arc = *iterArc;
				TrellisPath *deviantPath = new TrellisPath(*this, currEdge, arc);
				pathColl.Add(deviantPath);
			}
		}
	}
	else
	{	// wiggle 1 of the edges only
		for (size_t currEdge = m_prevEdgeChanged + 1 ; currEdge < sizePath ; currEdge++)
		{
			const ArcList *pAL = m_path[currEdge]->GetArcList();
    	if (!pAL) continue;
			const ArcList &arcList = *pAL;
			ArcList::const_iterator iterArc;

			for (iterArc = arcList.begin() ; iterArc != arcList.end() ; ++iterArc)
			{	// copy this Path & change 1 edge
				const Hypothesis *arcReplace = *iterArc;

				TrellisPath *deviantPath = new TrellisPath(*this, currEdge, arcReplace);
				pathColl.Add(deviantPath);						
			} // for (iterArc...
		} // for (currEdge = 0 ...
	}
}