00001 #pragma once 00002 00003 #include "moses/Syntax/PHyperedge.h" 00004 #include "moses/Syntax/PVertex.h" 00005 #include "moses/Syntax/SHyperedgeBundle.h" 00006 00007 #include "PVertexToStackMap.h" 00008 00009 namespace Moses 00010 { 00011 namespace Syntax 00012 { 00013 namespace F2S 00014 { 00015 00016 // Given a PHyperedge object and SStackSet produces a SHyperedgeBundle object. 00017 inline void PHyperedgeToSHyperedgeBundle(const PHyperedge &hyperedge, 00018 const PVertexToStackMap &stackMap, 00019 SHyperedgeBundle &bundle) 00020 { 00021 bundle.inputWeight = hyperedge.label.inputWeight; 00022 bundle.translations = hyperedge.label.translations; 00023 bundle.stacks.clear(); 00024 for (std::vector<PVertex*>::const_iterator p = hyperedge.tail.begin(); 00025 p != hyperedge.tail.end(); ++p) { 00026 PVertexToStackMap::const_iterator q = stackMap.find(*p); 00027 const SVertexStack &stack = q->second; 00028 bundle.stacks.push_back(&stack); 00029 } 00030 } 00031 00032 } // F2S 00033 } // Syntax 00034 } // Moses