LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
BowDumper.cpp
Go to the documentation of this file.
1// Copyright 2002-2015 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6#include "BowDumper.h"
7
38
39#include <boost/graph/properties.hpp>
40
41#include <fstream>
42#include <deque>
43#include <queue>
44#include <iostream>
45
47using namespace Lima::Common::MediaticData;
48using namespace Lima::Common::BagOfWords;
49using namespace Lima::Common::AnnotationGraphs;
56using namespace std;
57namespace Lima
58{
59
60namespace LinguisticProcessing
61{
62
63namespace AnalysisDumpers
64{
65
67
68typedef boost::color_traits<boost::default_color_type> Color;
69
72 m_bowGenerator(new Compounds::BowGenerator()),
73 m_graph(),
74 m_allEntities(false),
75 m_xml(false)
76{
77}
78
83
86 Manager* manager)
87{
88 AbstractTextualAnalysisDumper::init(unitConfiguration,manager);
89
90 m_language = manager->getInitializationParameters().media;
91 try
92 {
93 m_graph=unitConfiguration.getParamsValueAtKey("graph");
94 }
95 catch (NoSuchParam& )
96 {
97 m_graph=std::string("PosGraph");
98 }
99 try
100 {
101 m_handlerName=unitConfiguration.getParamsValueAtKey("handler");
102 }
103 catch (NoSuchParam& )
104 {
106 LERROR << "Missing parameter handler in BowDumper configuration";
107 throw InvalidConfiguration();
108 }
109
110 try
111 {
112 std::string allEntities=unitConfiguration.getParamsValueAtKey("allEntities");
113 if (allEntities=="yes" || allEntities=="1" || allEntities=="true") {
114 m_allEntities=true;
115 }
116 }
117 catch (NoSuchParam& ) { } // ignored: optional parameter
118
119 try
120 {
121 std::string allEntities=unitConfiguration.getParamsValueAtKey("xml");
122 if (allEntities=="yes" || allEntities=="1" || allEntities=="true") {
123 m_xml=true;
124 }
125 }
126 catch (NoSuchParam& ) { } // ignored: optional parameter
127 m_bowGenerator->init(unitConfiguration, m_language);
128
129
130 m_bowGenerator->init(unitConfiguration, m_language);
131}
132
134 AnalysisContent& analysis) const
135{
136 TimeUtilsController timer("BowDumper");
138
139 auto metadata = std::dynamic_pointer_cast<LinguisticMetaData>(analysis.getData("LinguisticMetaData"));
140 if (metadata == 0)
141 {
142 LERROR << "no LinguisticMetaData ! abort";
143 return MISSING_DATA;
144 }
145
146
147 auto h = std::dynamic_pointer_cast<AnalysisHandlerContainer>(analysis.getData("AnalysisHandlerContainer"));
148
149 AbstractTextualAnalysisHandler* handler = static_cast<AbstractTextualAnalysisHandler*>(h->getHandler(m_handlerName));
150
151#ifdef DEBUG_LP
152 LDEBUG << "BowDumper handler will be: " << m_handlerName << (void*)handler;
153#endif
154 if (handler==0)
155 {
156 LERROR << "BowDumper::process: handler " << m_handlerName << " has not been given to the core client";
157 return MISSING_DATA;
158 }
159
160 auto anagraph = std::dynamic_pointer_cast<AnalysisGraph>(analysis.getData("AnalysisGraph"));
161 if (anagraph==0)
162 {
163 LERROR << "BowDumper::process: no graph 'AnaGraph' available !";
164 return MISSING_DATA;
165 }
166 auto posgraph = std::dynamic_pointer_cast<AnalysisGraph>(analysis.getData("PosGraph"));
167 if (posgraph==0)
168 {
169 LERROR << "BowDumper::process: no graph 'PosGraph' available !";
170 return MISSING_DATA;
171 }
172 auto annotationData = std::dynamic_pointer_cast< AnnotationData >(analysis.getData("AnnotationData"));
173 if (annotationData==0)
174 {
175 LERROR << "BowDumper::process: no annotation graph available !";
176 return MISSING_DATA;
177 }
178 auto syntacticData = std::dynamic_pointer_cast<SyntacticData>(analysis.getData("SyntacticData"));
179/* if (syntacticData==0)
180 {
181 LERROR << "BowDumper::process: no SyntacticData ! abort";
182 return MISSING_DATA;
183 }*/
184 if (syntacticData==0)
185 {
186 syntacticData = std::make_shared<SyntacticAnalysis::SyntacticData>(
187 std::dynamic_pointer_cast<AnalysisGraph>(analysis.getData(m_graph)).get(), nullptr);
188 syntacticData->setupDependencyGraph();
189 analysis.setData("SyntacticData",syntacticData);
190 }
191
192
193 // build BoWText from the result of the analysis
194 BoWText bowText;
195 bowText.lang=metadata->getMetaData("Lang");
196 uint64_t offset = metadata->getStartOffset();
197 std::set<LinguisticGraphVertex> addedEntities;
198 buildBoWText(annotationData.get(),syntacticData.get(),bowText,analysis,anagraph.get(),posgraph.get(),addedEntities,offset);
199 if (m_allEntities) {
200 addAllEntities(annotationData.get(),addedEntities,bowText,anagraph.get(),posgraph.get(),offset);
201 }
202
203 auto dstream = initialize(analysis);
204
205#ifdef DEBUG_LP
206 LDEBUG << "BowDumper::process writing BoW text on" << &(dstream->out());
207#endif
208 if (m_xml) {
209 // positions of tokens in the analysis start at 1, positions in the bow binary format
210 // start at 0 : must adjust positions in BowXMLWriter
211 int32_t offset=-1;
212 BoWXMLWriter writer(dstream->out(),offset);
213 writer.writeBoWText(&bowText,false,false);
214 }
215 else {
216 BoWBinaryWriter writer(handler->shiftFrom());
217 writer.writeBoWText(dstream->out(),bowText);
218 }
219
220 return SUCCESS_ID;
221}
222
223void BowDumper::buildBoWText(
224 const Common::AnnotationGraphs::AnnotationData* annotationData,
225 const SyntacticData* syntacticData,
226 BoWText& bowText,
227 AnalysisContent& analysis,
228 AnalysisGraph* anagraph,
229 AnalysisGraph* posgraph,
230 std::set<LinguisticGraphVertex>& addedEntities,
231 const uint64_t offset) const
232{
233#ifdef DEBUG_LP
235#endif
236
237 auto sb = std::dynamic_pointer_cast<SegmentationData>(analysis.getData("SentenceBoundaries"));
238 if (sb==0)
239 {
241 LWARN << "no SentenceBounds";
242 }
243
244 if (sb==0)
245 {
246 // no sentence bounds : there can be specific entities,
247 // but no compounds (syntactic analysis depend on sentence bounds)
248 // dump whole text at once
249 addVerticesToBoWText(
250 annotationData,
251 anagraph,
252 posgraph,
253 syntacticData,
254 anagraph->firstVertex(),
255 anagraph->lastVertex(),
256 offset,
257 bowText,
258 addedEntities);
259
260 }
261 else
262 {
263 for (auto boundItr=sb->getSegments().begin(); boundItr!=sb->getSegments().end(); boundItr++)
264 {
265 LinguisticGraphVertex sentenceBegin=boundItr->getFirstVertex();
266 LinguisticGraphVertex sentenceEnd=boundItr->getLastVertex();
267
268#ifdef DEBUG_LP
269 LDEBUG << "BowDumper::buildBoWText dump sentence between " << sentenceBegin << " and " << sentenceEnd;
270
271 LDEBUG << "BowDumper::buildBoWText dump simple terms for this sentence";
272#endif
273 addVerticesToBoWText(annotationData,
274 anagraph,
275 posgraph,
276 syntacticData,
277 sentenceBegin,
278 sentenceEnd,
279 offset,
280 bowText,
281 addedEntities);
282
283 }
284 }
285
286 // look at all edges for relations
287 AnnotationGraphEdgeIt it,it_end;
288 const AnnotationGraph& annotGraph=annotationData->getGraph();
289 boost::tie(it, it_end) = boost::edges(annotGraph);
290 for (; it != it_end; it++)
291 {
292#ifdef DEBUG_LP
293 LDEBUG << "BowDumper::buildBoWText on annotation edge "
294 << source(*it,annotGraph) << "->" << target(*it,annotGraph);
295#endif
296 if (annotationData->hasAnnotation(*it,
297 QString::fromUtf8("SemanticRelation")))
298 {
299#ifdef DEBUG_LP
300 LDEBUG << "found semantic relation";
301#endif
302 try
303 {
304 auto agvs = source(*it,annotGraph);
305 auto agvt = target(*it,annotGraph);
306 auto anaGraphVertices = annotationData->matches("annot", agvs,
307 "AnalysisGraph");
308 if (anaGraphVertices.empty())
309 {
311 LERROR << "Found no analysis graph vertex associated to the annotation graph vertex"
312 << agvs << ". It will crash";
313 }
314 auto lgvs = *anaGraphVertices.begin();
315 std::set< LinguisticGraphVertex > visited;
316 bool keepAnyway = true;
317
318 const auto& annot = annotationData->annotation(
319 *it, QString::fromUtf8("SemanticRelation"))
322 lgvs, agvs, agvt, annot,
323 annotationData,
324 *anagraph->getGraph(),
325 *posgraph->getGraph(),
326 offset, visited,
327 keepAnyway);
328 for (const auto& predicate: predicates)
329 {
330 bowText.push_back(predicate);
331 }
332 }
333 catch (const boost::bad_any_cast& e)
334 {
336 LERROR << "This annotation is not a SemanticAnnotation";
337 continue;
338 }
339 }
340 }
341
342
343}
344
345void BowDumper::addVerticesToBoWText(
346 const Common::AnnotationGraphs::AnnotationData* annotationData,
347 AnalysisGraph* anagraph,
348 AnalysisGraph* posgraph,
349 const SyntacticData* syntacticData,
350 const LinguisticGraphVertex begin,
351 const LinguisticGraphVertex end,
352 const uint64_t offset,
353 BoWText& bowText,
354 std::set<LinguisticGraphVertex>& addedEntities) const
355{
356
357#ifdef DEBUG_LP
359 LDEBUG << "BowDumper::addVerticesToBoWText from" << begin << "to" << end << "; offset:" << offset;
360#endif
361
362 const LinguisticGraph& beforePoSGraph=*(anagraph->getGraph());
363 const LinguisticGraph& graph=*(posgraph->getGraph());
364
365 // go through the graph, add BoWTokens that are not in complex terms
366 // Don't use visitor to avoid throwing exceptions
367
368 LinguisticGraphVertex firstVx = anagraph->firstVertex();
369 LinguisticGraphVertex lastVx = anagraph->lastVertex();
370
371 std::set< std::string > alreadyStored;
372 std::set<LinguisticGraphVertex> visited;
373 //std::set<uint32_t> alreadyStoredVertices; compatibilite 32 64 bits
374 std::set<LinguisticGraphVertex> alreadyStoredVertices;
375
376 std::queue<LinguisticGraphVertex> toVisit;
377 toVisit.push(begin);
378
379 while (!toVisit.empty())
380 {
381 LinguisticGraphVertex v=toVisit.front();
382// #ifdef DEBUG_LP
383// LDEBUG << "BowDumper::addVerticesToBoWText visiting" << v;
384// #endif
385
386 toVisit.pop();
387 if (v == end) {
388// #ifdef DEBUG_LP
389// LDEBUG << "BowDumper::addVerticesToBoWText on end";
390// #endif
391 continue;
392 }
393
394 LinguisticGraphOutEdgeIt outItr,outItrEnd;
395 for (boost::tie(outItr,outItrEnd)=out_edges(v,graph);
396 outItr!=outItrEnd;
397 outItr++)
398 {
399 LinguisticGraphVertex next=target(*outItr,graph);
400 if (visited.find(next)==visited.end())
401 {
402 visited.insert(next);
403 toVisit.push(next);
404 }
405 }
406
407 if (v != firstVx && v != lastVx)
408 {
410// LDEBUG << "BowDumper::addVerticesToBoWText: hasAnnotation("<<v<<", CompoundTokenAnnotation): "
411// << annotationData->hasAnnotation(v, Common::Misc::utf8stdstring2limastring("CompoundTokenAnnotation"));
412// LDEBUG << "BowDumper::addVerticesToBoWText: hasAnnotation("<<v<<", SpecificEntity): "
413// << annotationData->hasAnnotation(v, Common::Misc::utf8stdstring2limastring("SpecificEntity"));
414 std::set< AnnotationGraphVertex > cpdsHeads = annotationData->matches("PosGraph", v, "cpdHead");
415 std::set< AnnotationGraphVertex > cpdsExts = annotationData->matches("PosGraph", v, "cpdExt");
416 if (!cpdsHeads.empty())
417 {
418// #ifdef DEBUG_LP
419// LDEBUG << "BowDumper::addVerticesToBoWText" << v << "is a compound head";
420// #endif
421 auto cpdsHeadsIt = cpdsHeads.begin(), cpdsHeadsIt_end = cpdsHeads.end();
422 for (; cpdsHeadsIt != cpdsHeadsIt_end; cpdsHeadsIt++)
423 {
424 AnnotationGraphVertex agv = *cpdsHeadsIt;
425// #ifdef DEBUG_LP
426// LDEBUG << "BowDumper::addVerticesToBoWText" << v << "calling buildTermFor on" << agv;
427// #endif
428 std::vector<std::pair< boost::shared_ptr< BoWRelation >, boost::shared_ptr< BoWToken > > > bowTokens = m_bowGenerator->buildTermFor(agv, agv, beforePoSGraph, graph, offset, syntacticData, annotationData, visited);
429// #ifdef DEBUG_LP
430// LDEBUG << "BowDumper::addVerticesToBoWText" << v << "buildTermFor on" << agv << "got nb tokens:" << bowTokens.size();
431// #endif
432 for (auto bowItr=bowTokens.begin(); bowItr!=bowTokens.end(); bowItr++)
433 {
434 std::string elem = (*bowItr).second->getIdUTF8String();
435 if (alreadyStored.find(elem) != alreadyStored.end())
436 { // already stored
437// #ifdef DEBUG_LP
438// LDEBUG << "BowDumper::addVerticesToBoWText" << elem << "already stored. Skipping it.";
439// #endif
440 }
441 else
442 {
443 bowText.push_back((*bowItr).second); // copy pointer
444 std::set<uint64_t> bowTokenVertices = (*bowItr).second->getVertices();
445 //std::set<LinguisticGraphVertex> bowTokenVertices = (*bowItr)->getVertices();
446 alreadyStoredVertices.insert(bowTokenVertices.begin(), bowTokenVertices.end());
447 alreadyStored.insert(elem);
448
449// #ifdef DEBUG_LP
450// std::ostringstream oss;
451// //std::set<uint32_t>::const_iterator asvit, asvit_end;
452// std::set<LinguisticGraphVertex>::const_iterator asvit, asvit_end;
453// asvit = alreadyStoredVertices.begin(); asvit_end = alreadyStoredVertices.end();
454// for (; asvit != asvit_end; asvit++)
455// {
456// oss << *asvit << ", ";
457// }
458// LDEBUG << "BowDumper::addVerticesToBoWText" << v << "added" << elem << "to bowText; alreadyStoredVertices are: " << oss.str();
459// #endif
460 }
461 }
462 }
463 }
464 else if (!cpdsExts.empty())
465 {
466 // Do nothing for compound extensions. Will be handled by the head
467// #ifdef DEBUG_LP
468// LDEBUG << "BowDumper::addVerticesToBoWText Do nothing for compound extensions. Will be handled by the head";
469// #endif
470 }
471 else if (alreadyStoredVertices.find(v) == alreadyStoredVertices.end())
472 {
473 {
474// #ifdef DEBUG_LP
475// LDEBUG << "BowDumper::addVerticesToBoWText" << v << "isn't a compound head";
476// #endif
477 std::vector<std::pair<boost::shared_ptr< BoWRelation>, boost::shared_ptr< AbstractBoWElement>> > bowTokens=
478 m_bowGenerator->createAbstractBoWElement(v, beforePoSGraph, graph, offset, annotationData, visited);
479// #ifdef DEBUG_LP
480// LDEBUG << "BowDumper::addVerticesToBoWText"<<v<<" createAbstractBoWElement returned a vector of size" << bowTokens.size();
481// #endif
482
483 for (auto bowItr=bowTokens.begin();
484 bowItr!=bowTokens.end();
485 bowItr++)
486 {
487 std::string elem = (*bowItr).second->getIdUTF8String();
488// #ifdef DEBUG_LP
489// LDEBUG << "BowDumper::addVerticesToBoWText"<<v<<"created BoWToken" << elem;
490// #endif
491 if (alreadyStored.find(elem) != alreadyStored.end())
492 { // already stored
493// #ifdef DEBUG_LP
494// LDEBUG << "BowDumper::addVerticesToBoWText BoWToken already stored. Skipping it.";
495// #endif
496 }
497 else
498 {
499// #ifdef DEBUG_LP
500// LDEBUG << "BowDumper::addVerticesToBoWText pushing" << elem << "to bowText";
501// #endif
502 bowText.push_back((*bowItr).second); // copy pointer
503 std::set<uint64_t> bowTokenVertices = (*bowItr).second->getVertices();
504 alreadyStoredVertices.insert(bowTokenVertices.begin(), bowTokenVertices.end());
505 alreadyStored.insert(elem);
506
507// #ifdef DEBUG_LP
508// std::ostringstream oss;
509// //std::set<uint32_t>::const_iterator asvit, asvit_end;
510// std::set<LinguisticGraphVertex>::const_iterator asvit, asvit_end;
511// asvit = alreadyStoredVertices.begin(); asvit_end = alreadyStoredVertices.end();
512// for (; asvit != asvit_end; asvit++)
513// {
514// oss << *asvit << ", ";
515// }
516// std::string elem = (*bowItr).second->getIdUTF8String();
517// LDEBUG << "BowDumper::addVerticesToBoWText for" << v << elem << "; alreadyStoredVertices are:" << oss.str();
518// #endif
519 }
520 }
521 }
522 }
523// #ifdef DEBUG_LP
524// else
525// {
526// LDEBUG << "BowDumper::addVerticesToBoWText" << v << "is already stored.";
527// }
528// #endif
529 }
530 addedEntities.insert(visited.begin(),visited.end());
531 }
532}
533
534
535void BowDumper::addAllEntities(
536 const Common::AnnotationGraphs::AnnotationData* annotationData,
537 const std::set<LinguisticGraphVertex>& addedEntities,
538 BoWText& bowText,
539 AnalysisGraph* anagraph,
540 AnalysisGraph* posgraph,
541 const uint64_t offset) const
542{
543 //cerr << "addAllEntities" << endl;
544 // output does not depend on m_graph: BoWDumper always relies on PosGraph
545 //cerr << "seen vertices (PosGraph)=";
546 //std::copy(addedEntities.begin(), addedEntities.end(),std::ostream_iterator<int>(std::cerr, " "));
547 //cerr << endl;
548
549 // take all annotations
550 AnnotationGraphVertexIt itv, itv_end;
551 boost::tie(itv, itv_end) = vertices(annotationData->getGraph());
552 for (; itv != itv_end; itv++)
553 {
554 //cerr << "look at annotation vertex " << *itv << endl;
555 if (annotationData->hasAnnotation(*itv,Common::Misc::utf8stdstring2limastring("SpecificEntity")))
556 {
557 //cerr << "-> is a specific entity" << endl;
558 // get the id of corresponding vertex: test both posgraph and analysis graph
560 string graph="PosGraph";
561 bool frompos=true;
562 if (!annotationData->hasIntAnnotation(*itv,Common::Misc::utf8stdstring2limastring(graph)))
563 {
564 graph="AnalysisGraph";
565 if (!annotationData->hasIntAnnotation(*itv,Common::Misc::utf8stdstring2limastring(graph)))
566 {
567 continue;
568 }
569 frompos=false;
570 }
571 //cerr << "-> comes from graph " << graph << endl;
572
573 v = annotationData->intAnnotation(*itv,Common::Misc::utf8stdstring2limastring(graph));
574 // vertex can have already been visited during the standard bow dumper
575 //cerr << "look at vertex " << v << endl;
576 if (graph=="PosGraph") { // v is on PosGraph
577 if (addedEntities.find(v)!=addedEntities.end()) {
578 //cerr << "-> vertex " << v << " already processed" << endl;
579 continue;
580 }
581 }
582 else { // v is on AnalysisGraph
583 // find matches between graphs to check if corresponding vertex has been treated in PosGraph
584 std::set< AnnotationGraphVertex > posVertices = annotationData->matches(graph,v,"PosGraph");
585 if (posVertices.size()==1) { // note: size should be 0 or 1
586 AnnotationGraphVertex posVertex= *(posVertices.begin());
587 // do not get fooled by the AnnotationGraphVertex type: posVertex is
588 // the LinguisticGraphVertex matching v in the PosGraph
589 if (addedEntities.find(posVertex)!=addedEntities.end()) {
590 //cerr << "-> vertex " << v << " has corresponding vertex "<< posVertex <<" which was already processed" << endl;
591 continue;
592 }
593 }
594 }
595 // create the bowNamedEntity
596 boost::shared_ptr< Common::BagOfWords::BoWNamedEntity >
597 ne=m_bowGenerator->createSpecificEntity(v,*itv,annotationData,*(anagraph->getGraph()),*(posgraph->getGraph()),offset,frompos);
598 if (ne) {
599 //cerr << "add new entity" << endl;
600 bowText.push_back(ne);
601 }
602 }
603 }
604}
605
606
607} // AnalysisDumper
608
609} // LinguisticProcessing
610
611} // Lima
This file is the main header file for the data related to annotation graphs.
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AGVertexProperties, AGEdgeProperties > AnnotationGraph
The graph class.
#define BOWDUMPER_CLASSID
Definition BowDumper.h:50
#define LWARN
Definition LimaCommon.h:160
#define LDEBUG
Definition LimaCommon.h:157
#define LERROR
Definition LimaCommon.h:161
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
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.
std::shared_ptr< const ShiftFrom > shiftFrom() const
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.
uint64_t intAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString &annot) const
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.
const GenericAnnotation & annotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString &annot) const
void writeBoWText(std::ostream &file, const BoWText &bowText) const
This class represents a list of elements, that are pointers on polymmorphic tokens that can be simple...
Definition bowText.h:48
void writeBoWText(const BoWText *document, const bool useIterator, const bool useIndexIterator)
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
std::shared_ptr< DumperStream > initialize(AnalysisContent &analysis) const
virtual void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
virtual LimaStatusCode process(AnalysisContent &analysis) const override
Process on data in analysisContent.
virtual void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
Definition BowDumper.cpp:84
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.
boost::shared_ptr< Common::BagOfWords::BoWNamedEntity > createSpecificEntity(const LinguisticGraphVertex &vertex, const AnnotationGraphVertex &v, const Common::AnnotationGraphs::AnnotationData *annotationData, const LinguisticGraph &anagraph, const LinguisticGraph &posgraph, const uint64_t offset, bool frompos) const
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)
QList< boost::shared_ptr< Common::BagOfWords::BoWPredicate > > createSemanticRelationPredicate(const LinguisticGraphVertex &lgvs, const AnnotationGraphVertex &agvs, const AnnotationGraphVertex &agvt, const SemanticAnalysis::SemanticRelationAnnotation &annot, const Common::AnnotationGraphs::AnnotationData *annotationData, const LinguisticGraph &anagraph, const LinguisticGraph &posgraph, uint64_t offset, std::set< LinguisticGraphVertex > &visited, bool keepAnyway) const
Builds a BoWPredicate corresponding to a semantic relation (an edge in the annotation graph holding a...
An AnalysisData containing a LinguisticGraph with a language and an id.
const LinguisticGraphVertex & lastVertex(void) const
Returns the last vertex of the graph.
const LinguisticGraph * getGraph(void) const
Returns the underlying graph structure.
const LinguisticGraphVertex & firstVertex(void) const
Returns the first vertex of the graph.
An annotation between two annotation graph vertices denoting the semantic relation(s) holding between...
This class points to a graph, its dependency graph and the structure that holds the maping between th...
This file contains a class to control log of informations about time, such as logging cumulated time ...
AnnotationGraph::vertex_iterator AnnotationGraphVertexIt
AnnotationGraph::edge_iterator AnnotationGraphEdgeIt
AnnotationGraph::vertex_descriptor AnnotationGraphVertex
bool hasIntAnnotation(AnnotationGraphVertex v, const LimaString &annot) const
bool hasAnnotation(AnnotationGraphVertex v, const LimaString &annot) const
LimaString utf8stdstring2limastring(const std::string &src)
boost::color_traits< boost::default_color_type > Color
Definition BowDumper.cpp:68
SimpleFactory< MediaProcessUnit, BowDumper > bowDumperFactory(BOWDUMPER_CLASSID)
NAUTITIA.
LimaStatusCode
Definition LimaCommon.h:236
@ SUCCESS_ID
Definition LimaCommon.h:237
@ MISSING_DATA
Definition LimaCommon.h:243
STL namespace.
launch exception related to the configuration file parsing