LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
DepTripleDumper.cpp
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/***************************************************************************
7 * Copyright (C) 2004-2012 by CEA LIST *
8 * *
9 ***************************************************************************/
10#include "DepTripleDumper.h"
11// #include "linguisticProcessing/core/LinguisticProcessors/HandlerStreamBuf.h"
32
33#include <deque>
34#include <queue>
35#include <algorithm>
36#include <fstream>
37
38
39using namespace std;
40//using namespace boost;
41using namespace boost::tuples;
42
44using namespace Lima::Common::MediaticData;
45using namespace Lima::Common::BagOfWords;
46using namespace Lima::Common::AnnotationGraphs;
47
52
53namespace Lima
54{
55namespace LinguisticProcessing
56{
57namespace AnalysisDumpers
58{
59
61
64m_handler()
65{
66 m_bowGenerator = new BowGenerator();
67}
68
69
71{
72 delete m_bowGenerator;
73}
74
77 Manager* manager)
78{
79 m_language=manager->getInitializationParameters().media;
80 std::deque<std::string> relation_names;
81
82 try
83 {
84 relation_names=unitConfiguration.getListsValueAtKey("selectedDependency");
85 }
86 catch (NoSuchList& )
87 {
88 // empty display
89 }
90 for( std::deque<std::string>::iterator src = relation_names.begin() ; src != relation_names.end() ; src++ )
91 {
92 m_relation_names.insert(*src);
93 }
94 try
95 {
96 m_handler=unitConfiguration.getParamsValueAtKey("handler");
97 }
98 catch (NoSuchParam& )
99 {
101 LERROR << "DepTripleDumper::init: Missing parameter handler in DepTripleDumper configuration";
102 throw InvalidConfiguration();
103 }
104
105
106 m_macroAccessor=&(static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager().getPropertyAccessor("MACRO"));
107 m_microAccessor=&(static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager().getPropertyAccessor("MICRO"));
108
109 m_bowGenerator->init(unitConfiguration, m_language);
110}
111
113 AnalysisContent& analysis) const
114{
117 auto metadata = std::dynamic_pointer_cast<LinguisticMetaData>(analysis.getData("LinguisticMetaData"));
118 if (metadata == 0)
119 {
120 LERROR << "DepTripleDumper::process no LinguisticMetaData ! abort";
121 return MISSING_DATA;
122 }
123 LDEBUG << "handler will be: " << m_handler;
124// MediaId langid = static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(metadata->getMetaData("Lang"))).getMedia();
125
126 auto h = std::dynamic_pointer_cast<AnalysisHandlerContainer>(analysis.getData("AnalysisHandlerContainer"));
127 AbstractTextualAnalysisHandler* handler = static_cast<AbstractTextualAnalysisHandler*>(h->getHandler(m_handler));
128 if (handler==0)
129 {
130 LERROR << "DepTripleDumper::process: handler " << m_handler << " has not been given to the core client";
131 return MISSING_DATA;
132 }
133
134 auto anagraph = std::dynamic_pointer_cast<AnalysisGraph>(analysis.getData("AnalysisGraph"));
135 if (anagraph==0)
136 {
137 LERROR << "DepTripleDumper::process: hno AnalysisGraph ! abort";
138 return MISSING_DATA;
139 }
140 auto posgraph = std::dynamic_pointer_cast<AnalysisGraph>(analysis.getData("PosGraph"));
141 if (posgraph==0)
142 {
143 LERROR << "DepTripleDumper::process: hno PosGraph ! abort";
144 return MISSING_DATA;
145 }
146 auto sb = std::dynamic_pointer_cast<SegmentationData>(analysis.getData("SentenceBoundaries"));
147 if (sb==0)
148 {
149 LERROR << "DepTripleDumper::process: no SentenceBounds ! abort";
150 return MISSING_DATA;
151 }
152 auto syntacticData = std::dynamic_pointer_cast<SyntacticData>(analysis.getData("SyntacticData"));
153 if (syntacticData==0)
154 {
155 syntacticData = std::make_shared<SyntacticData>(posgraph.get(), nullptr);
156 syntacticData->setupDependencyGraph();
157 analysis.setData("SyntacticData",syntacticData);
158 }
159 auto annotationData = std::dynamic_pointer_cast< AnnotationData >(analysis.getData("AnnotationData"));
160 if (annotationData==0)
161 {
162 LERROR << "DepTripleDumper::process: no annotation graph available !";
163 return MISSING_DATA;
164 }
165
166 handler->startAnalysis();
167 HandlerStreamBuf hsb(handler);
168 std::ostream outputStream(&hsb);
169
170 VxToTermsMap compoundsHeads = getCompoundsHeads(annotationData.get(),
171 syntacticData.get(), analysis, posgraph.get(), *(anagraph->getGraph()),
172 *(posgraph->getGraph()));
173 if (sb->getGraphId() != "PosGraph")
174 {
175 LERROR << "DepTripleDumper::process: SentenceBounds have been computed on " << sb->getGraphId() << " !";
176 LERROR << "DepTripleDumper::process: DotDependencyGraphWriter needs SentenceBounds on PosGraph";
178 }
179
180 uint64_t i=0;
181 // ??OME2 for (SegmentationData::const_iterator boundItr=sb->begin();
182 // boundItr!=sb->end();
183 for (std::vector<Segment>::const_iterator boundItr=(sb->getSegments()).begin();
184 boundItr!=(sb->getSegments()).end();
185 boundItr++, i++)
186 {
187 LinguisticGraphVertex beginSentence=boundItr->getFirstVertex();
188 LinguisticGraphVertex endSentence=boundItr->getLastVertex();
189
190 dumpDependencyRelations(outputStream,
191 beginSentence,
192 endSentence,
193 *(anagraph->getGraph()),
194 *(posgraph->getGraph()), syntacticData.get(),
195 annotationData.get(), compoundsHeads);
196 outputStream << "." << std::endl;
197
198 }
199 handler->endAnalysis();
200
201 // delete syntacticData;
202
203 TimeUtils::logElapsedTime("DepTripleDumper");
204 return SUCCESS_ID;
205}
206
207
208void DepTripleDumper::dumpDependencyRelations(std::ostream& outputStream,
211 const LinguisticGraph& anagraph,
212 const LinguisticGraph& posgraph,
213 const SyntacticData* syntData,
214 const AnnotationData* annotationData,
215 const VxToTermsMap& compoundsHeads) const
216{
218 LDEBUG << "Address of syntactic data used to dump: " << syntData;
219 const DependencyGraph* depGraph = syntData-> dependencyGraph();
220 LDEBUG << "Address of dependency graph used to dump: " << depGraph;
221
222 const LinguisticGraph* graph = syntData->graph();
223 CVertexDataPropertyMap dataMap = get(vertex_data, *graph);
224// const FsaStringsPool& sp=Common::MediaticData::MediaticData::single().stringsPool(m_language);
225
226 // generate edges list between src and dest
227 std::vector<DependencyGraphEdge> edges;
228 std::list<LinguisticGraphVertex> toVisit;
229 toVisit.push_back(src);
230 std::set<LinguisticGraphVertex> visited;
231
232 while (!toVisit.empty())
233 {
234 LinguisticGraphVertex current = toVisit.front(); toVisit.pop_front();
235 visited.insert(current);
236
237 LinguisticGraphOutEdgeIt outItr,outItrEnd;
238 for (boost::tie(outItr,outItrEnd)=out_edges(current,posgraph); outItr!=outItrEnd; outItr++)
239 {
240 LinguisticGraphVertex next=target(*outItr,posgraph);
241 if (visited.find(next)==visited.end() && next != dest)
242 {
243 toVisit.push_back(next);
244 }
245 }
246 DependencyGraphVertex dcurrent = syntData->depVertexForTokenVertex(current);
247 DependencyGraphOutEdgeIt dit, dit_end;
248 boost::tie(dit,dit_end)=out_edges(dcurrent,*depGraph);
249 for (; dit != dit_end; dit++)
250 {
251 edges.push_back(*dit);
252 }
253 }
254 std::vector<DependencyGraphEdge>::const_iterator it, it_end;
255 it = edges.begin(); it_end = edges.end();
256 for (; it != it_end; it++)
257 {
258 LDEBUG << "Dumping dependency edge " << (*it).m_source << " -> " << (*it).m_target;
259 try
260 {
261 LDEBUG << "DepTripleDumper::dumpDependencyRelations";
262 CEdgeDepRelTypePropertyMap typeMap = get(edge_deprel_type, *depGraph);
263 SyntacticRelationId type = typeMap[*it];
264 LDEBUG << "DepTripleDumper::dumpDependencyRelations relation = "
265 << type;
266 std::set<std::string>::const_iterator relationPos =
267 m_relation_names.find(static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getSyntacticRelationName(type));
268 if( relationPos != m_relation_names.end() )
269 {
270 LDEBUG << "Src : Dep vertex= " << source(*it, *depGraph);
271 LinguisticGraphVertex src = syntData->tokenVertexForDepVertex(source(*it, *depGraph));
272 LDEBUG << "Src : Morph vertex= " << src;
273 LDEBUG << "Targ : Dep vertex= " << target(*it, *depGraph) ;
274 LinguisticGraphVertex dest = syntData->tokenVertexForDepVertex(target(*it, *depGraph));
275 LDEBUG << "Targ : Morph vertex= " << dest;
276
277 std::set<StringsPoolIndex> srcLemmas=dataMap[src]->allLemma();
278 std::set<StringsPoolIndex> destLemmas=dataMap[dest]->allLemma();
279
280/* for (set<StringsPoolIndex>::const_iterator srcItr=srcLemmas.begin();
281 srcItr!=srcLemmas.end();
282 srcItr++)
283 {
284 for (set<StringsPoolIndex>::const_iterator destItr=destLemmas.begin();
285 destItr!=destLemmas.end();
286 destItr++)
287 {
288 outputStream << sp[*srcItr] << "#" << *relationPos << "#" << sp[*destItr] << std::endl;
289 }
290 }*/
291 dumpDepWithCompounds(outputStream, anagraph, posgraph, syntData,
292 annotationData, src, dest,
293 *relationPos, compoundsHeads);
294 }
295 else
296 {
297 LDEBUG << "DepTripleDumper::dumpDependencyRelations: dump nothing..";
298 }
299 }
300 catch (const std::range_error& )
301 {
302 }
303 catch (...)
304 {
305 LDEBUG << "DepTripleDumper::dumpDependencyRelations: catch others.....";
306 throw;
307 }
308 }
309}
310
311
312void DepTripleDumper::dumpDepWithCompounds(
313 std::ostream& outputStream,
314 const LinguisticGraph& anagraph,
315 const LinguisticGraph& posgraph,
316 const SyntacticData* syntData,
317 const AnnotationData* annotationData,
320 const std::string& rel,
321 const VxToTermsMap& compoundsHeads) const
322{
323 LIMA_UNUSED(syntData);
324 // CVertexDataPropertyMap dataMap = get(vertex_data, posgraph);
325
326 std::set< LinguisticGraphVertex > visited;
327 std::vector<std::pair< boost::shared_ptr< BoWRelation >, boost::shared_ptr< AbstractBoWElement > > > srcTokens =
328 m_bowGenerator->createAbstractBoWElement(src, anagraph, posgraph, 0, annotationData, visited);
329 std::vector<std::pair<boost::shared_ptr< BoWRelation >, boost::shared_ptr< AbstractBoWElement > > > destTokens =
330 m_bowGenerator->createAbstractBoWElement(dest, anagraph, posgraph, 0, annotationData, visited);
331
332 std::map<std::string, std::set<LinguisticGraphVertex> > srcs, dests;
333
334 for (auto srcItr=srcTokens.begin(); srcItr!=srcTokens.end(); srcItr++)
335 {
336 std::set<LinguisticGraphVertex> theSet;
337// std::cerr << "collecting vertices for " << (*srcItr)->getOutputUTF8String() << std::endl;
338// std::cerr << " inserting " << src << std::endl;
339 theSet.insert(src);
340 srcs.insert(std::make_pair((*srcItr).second->getOutputUTF8String(),theSet));
341 }
342 if (compoundsHeads.find(src) != compoundsHeads.end())
343 {
344 auto it = (*(compoundsHeads.find(src))).second.begin(), it_end= (*(compoundsHeads.find(src))).second.end();
345 for (; it != it_end; it++)
346 {
347 std::ostringstream oss;
348 oss << (*it)->getOutputUTF8String();
349 std::set<LinguisticGraphVertex> theSet;
350// std::cerr << "collectiong vertices for " << **it << std::endl;
351 collectVertices(theSet, *it);
352 srcs.insert(std::make_pair(oss.str(), theSet));
353 }
354 }
355
356 for (auto destItr=destTokens.begin(); destItr!=destTokens.end(); destItr++)
357 {
358 std::set<LinguisticGraphVertex> theSet;
359// std::cerr << "collectiong vertices for " << (*destItr)->getOutputUTF8String() << std::endl;
360// std::cerr << " inserting " << dest << std::endl;
361 theSet.insert(dest);
362 dests.insert(std::make_pair((*destItr).second->getOutputUTF8String(),theSet));
363 }
364 if (compoundsHeads.find(dest) != compoundsHeads.end())
365 {
366 auto it = (*(compoundsHeads.find(dest))).second.begin(), it_end = (*(compoundsHeads.find(dest))).second.end();
367 for (; it != it_end; it++)
368 {
369 std::ostringstream oss;
370 oss << (*it)->getOutputUTF8String();
371 std::set<LinguisticGraphVertex> theSet;
372// std::cerr << "collectiong vertices for " << **it << std::endl;
373 collectVertices(theSet, *it);
374 dests.insert(std::make_pair(oss.str(),theSet));
375 }
376 }
377
378 for (
379 std::map<std::string, std::set<LinguisticGraphVertex> >::const_iterator sit = srcs.begin();
380 sit != srcs.end();
381 sit++
382 )
383 {
384 for (
385 std::map<std::string, std::set<LinguisticGraphVertex> >::const_iterator dit = dests.begin();
386 dit != dests.end();
387 dit++
388 )
389 {
390 std::set<LinguisticGraphVertex> intersection;
391 std::insert_iterator<std::set<LinguisticGraphVertex> > ii(intersection, intersection.begin());
392 std::set_intersection( (*sit).second.begin(), (*sit).second.end(),
393 (*dit).second.begin(), (*dit).second.end(),
394 ii);
395 if (intersection.empty())
396 {
397 outputStream << (*sit).first << "#" << rel << "#" << (*dit).first << std::endl;
398 }
399 }
400 }
401}
402
403VxToTermsMap DepTripleDumper::getCompoundsHeads(
404 const Common::AnnotationGraphs::AnnotationData* annotationData,
405 const SyntacticData* syntacticData,
406 AnalysisContent& analysis,
407 AnalysisGraph* posAgraph,
408 const LinguisticGraph& anagraph,
409 const LinguisticGraph& posgraph) const
410{
411 LIMA_UNUSED(analysis);
413 LDEBUG << "DepTripleDumper: ========================================";
414 LDEBUG << "DepTripleDumper: getting compounds heads";
415 const LinguisticGraphVertex begin = posAgraph->firstVertex();
416 const LinguisticGraphVertex end = posAgraph->lastVertex();
417
418 VxToTermsMap result;
419
420 // go through the graph, add BoWTokens that are not in complex terms
421 // Don't use visitor to avoid throwing exceptions
422
423 LinguisticGraphVertex firstVx = posAgraph->firstVertex();
424 LinguisticGraphVertex lastVx = posAgraph->lastVertex();
425
426 std::set< std::string > alreadyStored;
427 std::set<LinguisticGraphVertex> visited;
428 std::queue<LinguisticGraphVertex> toVisit;
429 toVisit.push(begin);
430
431 LinguisticGraphOutEdgeIt outItr,outItrEnd;
432 while (!toVisit.empty())
433 {
434 LinguisticGraphVertex v=toVisit.front();
435 toVisit.pop();
436 if (v == end) {
437 continue;
438 }
439
440 for (boost::tie(outItr,outItrEnd)=out_edges(v,posgraph);
441 outItr!=outItrEnd;
442 outItr++)
443 {
444 LinguisticGraphVertex next=target(*outItr,posgraph);
445 if (visited.find(next)==visited.end())
446 {
447 visited.insert(next);
448 toVisit.push(next);
449 }
450 }
451
452 if (v != firstVx && v != lastVx)
453 {
455// LDEBUG << "hasAnnotation("<<v<<", CompoundTokenAnnotation): "
456// << annotationData->hasAnnotation(v, Common::Misc::utf8stdstring2limastring("CompoundTokenAnnotation"));
457// LDEBUG << "hasAnnotation("<<v<<", SpecificEntity): "
458// << annotationData->hasAnnotation(v, Common::Misc::utf8stdstring2limastring("SpecificEntity"));
459 //std::set< uint64_t > cpdsHeads = annotationData->matches("PosGraph", v, "cpdHead");
460 std::set< AnnotationGraphVertex > cpdsHeads = annotationData->matches("PosGraph", v, "cpdHead");
461 if (!cpdsHeads.empty())
462 {
463 std::set< AnnotationGraphVertex >::const_iterator cpdsHeadsIt, cpdsHeadsIt_end;
464 cpdsHeadsIt = cpdsHeads.begin(); cpdsHeadsIt_end = cpdsHeads.end();
465 for (; cpdsHeadsIt != cpdsHeadsIt_end; cpdsHeadsIt++)
466 {
467 AnnotationGraphVertex agv = *cpdsHeadsIt;
468 std::vector<std::pair<boost::shared_ptr< BoWRelation>, boost::shared_ptr< BoWToken > > > bowTokens =
469 m_bowGenerator->buildTermFor(agv, agv, anagraph, posgraph, 0,
470 syntacticData, annotationData, visited);
471 for (auto bowItr=bowTokens.begin();
472 bowItr!=bowTokens.end();
473 bowItr++)
474 {
475 std::string elem = (*bowItr).second->getIdUTF8String();
476 if (alreadyStored.find(elem) != alreadyStored.end())
477 { // already stored
478 // LDEBUG << "BuildBoWTokenListVisitor: BoWToken already stored. Skipping it.";
479 }
480 else
481 {
482 boost::shared_ptr<BoWTerm> bt = boost::dynamic_pointer_cast<BoWTerm>((*bowItr).second);
483 if (bt != 0)
484 {
485 getCompoundsHeads(result, bt);
486 }
487 alreadyStored.insert(elem);
488 }
489 }
490 }
491 }
492 else
493 {
494 std::vector<std::pair<boost::shared_ptr< BoWRelation> , boost::shared_ptr< AbstractBoWElement > > > bowTokens=m_bowGenerator->createAbstractBoWElement(v, anagraph, posgraph, 0, annotationData, visited);
495
496 for (auto bowItr=bowTokens.begin();
497 bowItr!=bowTokens.end();
498 bowItr++)
499 {
500 std::string elem = (*bowItr).second->getIdUTF8String();
501 if (alreadyStored.find(elem) != alreadyStored.end())
502 { // already stored
503 // LDEBUG << "BuildBoWTokenListVisitor: BoWToken already stored. Skipping it.";
504 }
505 else
506 {
507 boost::shared_ptr< BoWTerm > bt = boost::dynamic_pointer_cast<BoWTerm>((*bowItr).second);
508 if (bt != 0)
509 {
510 getCompoundsHeads(result, bt);
511 }
512 alreadyStored.insert(elem);
513 }
514 }
515 }
516 }
517 }
518
519 return result;
520}
521
522void DepTripleDumper::getCompoundsHeads(
523 VxToTermsMap& result,
524 boost::shared_ptr< BoWTerm > bt) const
525{
526 if (result.find(bt->getVertex()) == result.end())
527 {
528 result.insert(std::make_pair(bt->getVertex(), std::set<boost::shared_ptr< BoWTerm > >()));
529 }
530 result[bt->getVertex()].insert(boost::dynamic_pointer_cast<BoWTerm>(bt));
531 std::deque<BoWComplexToken::Part>::const_iterator partsit, partsit_end;
532 partsit = bt->getParts().begin(); partsit_end = bt->getParts().end();
533 for (; partsit!=partsit_end; partsit++)
534 {
535 if ( boost::dynamic_pointer_cast<BoWTerm>((*partsit).get<1>()) != 0)
536 {
537 getCompoundsHeads(result, boost::dynamic_pointer_cast<BoWTerm>((*partsit).get<1>()));
538 }
539 }
540}
541
542void DepTripleDumper::collectVertices(
543 std::set<LinguisticGraphVertex>& theSet,
544 boost::shared_ptr< BoWToken > term) const
545{
546// std::cerr << " inserting " << term->getVertex() << std::endl;
547 theSet.insert(term->getVertex());
548 if ( boost::dynamic_pointer_cast<BoWTerm>(term) != 0)
549 {
550 auto partsit = boost::dynamic_pointer_cast<BoWTerm>(term)->getParts().begin(),
551 partsit_end = boost::dynamic_pointer_cast<BoWTerm>(term)->getParts().end();
552 for (; partsit!=partsit_end; partsit++)
553 {
554 collectVertices(theSet, (*partsit).get<1>());
555 }
556 }
557}
558
559
560} // closing namespace AnalysisDumpers
561} // closing namespace LinguisticProcessing
562} // closing namespace Lima
This file is the main header file for the data related to annotation graphs.
#define DEPTRIPLEDUMPER_CLASSID
DependencyGraph::out_edge_iterator DependencyGraphOutEdgeIt
DependencyGraph::vertex_descriptor DependencyGraphVertex
boost::property_map< DependencyGraph, edge_deprel_type_t >::const_type CEdgeDepRelTypePropertyMap
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, DepVertexProperties, DepEdgeProperties > DependencyGraph
The dependency graph class.
@ edge_deprel_type
#define LIMA_UNUSED(x)
Definition LimaCommon.h:224
#define LDEBUG
Definition LimaCommon.h:157
#define LERROR
Definition LimaCommon.h:161
boost::property_map< LinguisticGraph, vertex_data_t >::const_type CVertexDataPropertyMap
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
@ vertex_data
LinguisticGraph::out_edge_iterator LinguisticGraphOutEdgeIt
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, LinguisticVertexProperties > LinguisticGraph
Property to identify the chains in the graph.
#define DUMPERLOGINIT
Defines a Factory to create Object of type Base.
Data used for the syntactic analyzis of texts.
virtual void startAnalysis()=0
function called by the LIMA analyzer on start of a new document
virtual void endAnalysis()=0
function called by the LIMA analyzer on the end of a text part that is to be analyzed
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
void setData(const QString &id, std::shared_ptr< AnalysisData > data)
set an analysisData with the given id.
Holds an annotation graph and gives an API to manipulate it.
std::set< AnnotationGraphVertex > matches(const std::string &first, AnnotationGraphVertex firstVx, const std::string &second) const
Gets the set of vertices matched in the second graph by the given vertex of the first graph.
Holds linguistic data for one language.
const MediaData & mediaData(MediaId media) const
std::deque< std::string > & getListsValueAtKey(const std::string &key)
return a message when a 'param' was not found
Manage initialization of InitializableObjects using configuration module and parameters.
const InitializationParameters & getInitializationParameters() const
get Initialization Parameters
Use this exception to signal an error in one of the configuration files.
Definition LimaCommon.h:345
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
LimaStatusCode process(AnalysisContent &analysis) const override
Process on data in analysisContent.
Parameters retrived in the configuration file:
std::vector< std::pair< boost::shared_ptr< Common::BagOfWords::BoWRelation >, boost::shared_ptr< Common::BagOfWords::BoWToken > > > buildTermFor(const AnnotationGraphVertex &vx, const AnnotationGraphVertex &tgt, const LinguisticGraph &anagraph, const LinguisticGraph &posgraph, const uint64_t offset, const SyntacticAnalysis::SyntacticData *syntacticData, const Common::AnnotationGraphs::AnnotationData *annotationData, std::set< LinguisticGraphVertex > &visited) const
Creates the terms reachable from the given annotation vertex.
std::vector< std::pair< boost::shared_ptr< Common::BagOfWords::BoWRelation >, boost::shared_ptr< Common::BagOfWords::AbstractBoWElement > > > createAbstractBoWElement(const LinguisticGraphVertex v, const LinguisticGraph &anagraph, const LinguisticGraph &posgraph, const uint64_t offsetBegin, const Common::AnnotationGraphs::AnnotationData *annotationData, std::set< LinguisticGraphVertex > &visited, bool keepAnyway=false) const
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, MediaId language)
An AnalysisData containing a LinguisticGraph with a language and an id.
const LinguisticGraphVertex & lastVertex(void) const
Returns the last vertex of the graph.
const LinguisticGraphVertex & firstVertex(void) const
Returns the first vertex of the graph.
This class points to a graph, its dependency graph and the structure that holds the maping between th...
LinguisticGraphVertex tokenVertexForDepVertex(const DependencyGraphVertex &v) const
DependencyGraphVertex depVertexForTokenVertex(const LinguisticGraphVertex &v) const
static const MediaticData & single()
const singleton accessor
Definition Singleton.h:51
static void logElapsedTime(const std::string &mess, const std::string &taskCategory=std::string(""))
log the number of microseconds since last UpdateCurrentTime
static void updateCurrentTime(const std::string &taskCategory=std::string(""))
store current time for new elapsed time computation
AnnotationGraph::vertex_descriptor AnnotationGraphVertex
SimpleFactory< MediaProcessUnit, DepTripleDumper > DepTripleDumperFactory(DEPTRIPLEDUMPER_CLASSID)
std::map< LinguisticGraphVertex, std::set< boost::shared_ptr< Common::BagOfWords::BoWTerm > > > VxToTermsMap
std::map< LinguisticGraphVertex, std::set< const Common::BagOfWords::BoWTerm * > > VxToTermsMap
NAUTITIA.
LimaStatusCode
Definition LimaCommon.h:236
@ SUCCESS_ID
Definition LimaCommon.h:237
@ INVALID_CONFIGURATION
Definition LimaCommon.h:242
@ MISSING_DATA
Definition LimaCommon.h:243
STL namespace.
launch exception related to the configuration file parsing