123 auto anagraph = std::dynamic_pointer_cast<AnalysisGraph>(analysis.
getData(
"AnalysisGraph"));
124 auto posgraph = std::dynamic_pointer_cast<AnalysisGraph>(analysis.
getData(
"PosGraph"));
125 auto annotationData = std::dynamic_pointer_cast<AnnotationData>(analysis.
getData(
"AnnotationData"));
126 auto syntacticData = std::dynamic_pointer_cast<SyntacticData>(analysis.
getData(
"SyntacticData"));
127 auto metadata = std::dynamic_pointer_cast<LinguisticMetaData>(analysis.
getData(
"LinguisticMetaData"));
130 LERROR <<
"no LinguisticMetaData ! abort";
135 string outputFileName=metadata->getMetaData(
"FileName") +
m_outputSuffix;
137 std::ofstream ofs(outputFileName.c_str(), std::ofstream::binary);
145 PosTaggingVertexWriter<LinguisticGraph, LinguisticGraphVertex>
146 phoenixGraphVertexWriter(posgraph->getGraph(),
150 DependencyGraphVertexWriter<DependencyGraph,DependencyGraphVertex>
151 vertexWriter(syntacticData->dependencyGraph(),
152 phoenixGraphVertexWriter);
154 DependencyGraphEdgeWriter<DependencyGraph,DependencyGraphEdge>
155 edgeWriter(syntacticData->dependencyGraph(),
162 boost::write_graphviz(ofs,
163 *(syntacticData->dependencyGraph()),
173 PosTaggingVertexWriter<LinguisticGraph, LinguisticGraphVertex>
174 vertexWriter(posgraph->getGraph(),
178 PosTaggingDepGraphEdgeWriter<LinguisticGraph,LinguisticGraphEdge>
180 syntacticData->dependencyGraph(),
181 syntacticData.get());
188 boost::write_graphviz(ofs,
189 *(syntacticData->dependencyGraph()),
197 auto sb = std::dynamic_pointer_cast<SegmentationData>(analysis.
getData(
"SentenceBoundaries"));
200 LERROR <<
"no sentence bounds ! abort";
203 if (sb->getGraphId() !=
"PosGraph") {
204 LERROR <<
"SentenceBounds have been computed on " << sb->getGraphId() <<
" !";
205 LERROR <<
"DotDependencyGraphWriter needs SentenceBounds on PosGraph";
212 for (std::vector<Segment>::const_iterator boundItr=(sb->getSegments()).begin();
213 boundItr!=(sb->getSegments()).end();
222 std::ostringstream outputFileName;
223 outputFileName << metadata->getMetaData(
"FileName") <<
".sent"<< i <<
m_outputSuffix;
225 std::ofstream ofs(outputFileName.str().c_str(), std::ofstream::binary);
228 ofs <<
"digraph sentence" << i <<
" {" << std::endl;
230 for (std::map<std::string,std::string>::const_iterator graphDotOptionsIt = m_graphDotOptions.begin() ; graphDotOptionsIt != m_graphDotOptions.end(); graphDotOptionsIt++)
232 ofs << graphDotOptionsIt->first <<
"=" << graphDotOptionsIt->second <<
",";
234 ofs <<
"]"<<std::endl;
236 for (std::map<std::string,std::string>::const_iterator nodeDotOptionsIt = m_nodeDotOptions.begin() ; nodeDotOptionsIt != m_nodeDotOptions.end(); nodeDotOptionsIt++)
238 ofs << nodeDotOptionsIt->first <<
"=" << nodeDotOptionsIt->second <<
",";
240 ofs <<
"]"<<std::endl;
242 for (std::map<std::string,std::string>::const_iterator edgeDotOptionsIt = m_edgeDotOptions.begin() ; edgeDotOptionsIt != m_edgeDotOptions.end(); edgeDotOptionsIt++)
244 ofs << edgeDotOptionsIt->first <<
"=" << edgeDotOptionsIt->second <<
",";
246 ofs <<
"]"<<std::endl;
264 annotationData.get());
266 ofs <<
"}"<<std::endl;
271 LERROR <<
"Unknown output mode";
312 depGraph,PosTagger::PosTaggingVertexWriter<LinguisticGraph,LinguisticGraphVertex> (&lposgraph,
m_language,m_vertexDisplay))(os,v);
336 PosTaggingDepGraphEdgeWriter<LinguisticGraph,LinguisticGraphEdge>(&lposgraph,
m_language,depGraph,syntacticData)(os,*outItr);
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
std::shared_ptr< AnalysisData > getData(const QString &id)
return AnalysisData by id