LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
AnnotationData.h
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
14
15#ifndef LIMA_ANNOTATIONGRAPHS_ANNOTATIONDATA_H
16#define LIMA_ANNOTATIONGRAPHS_ANNOTATIONDATA_H
17
20
21#include "AnnotationGraph.h"
23
24namespace Lima {
25namespace Common {
26namespace AnnotationGraphs {
27
29
35{
36public:
37
38 class Dumper {
39 public:
40 virtual ~Dumper() {}
41 virtual int dump(std::ostream&, GenericAnnotation&) const = 0;
42 };
43
46
48 virtual ~AnnotationData();
49
52
55
60 void annotate(AnnotationGraphVertex v, const LimaString& annot, uint64_t value);
61 void annotate(AnnotationGraphVertex v, const LimaString& annot, const LimaString& value);
62 void annotate(AnnotationGraphVertex v, const LimaString& annot, const GenericAnnotation& value);
64
68 void annotate(AnnotationGraphVertex vs, AnnotationGraphVertex vt, const LimaString& annot, uint64_t value);
69 void annotate(AnnotationGraphVertex vs, AnnotationGraphVertex vt, const LimaString& annot, const LimaString& value);
72
75 void annotate(AnnotationGraphEdge e, const LimaString& annot, uint64_t value);
76 void annotate(AnnotationGraphEdge e, const LimaString& annot, const LimaString& value);
77 void annotate(AnnotationGraphEdge e, const LimaString& annot, const GenericAnnotation& value);
79
80 uint64_t intAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString& annot) const;
84
88 uint64_t intAnnotation(AnnotationGraphVertex v, const LimaString& annot) const;
89 const LimaString& stringAnnotation(AnnotationGraphVertex v, const LimaString& annot) const;
93
97 uint64_t intAnnotation(AnnotationGraphEdge e, const LimaString& annot);
99 const GenericAnnotation& annotation(AnnotationGraphEdge e, const LimaString& annot) const;
102
107 void annotate(AnnotationGraphVertex v, uint64_t annot, uint64_t value);
108 void annotate(AnnotationGraphVertex v, uint64_t annot, const LimaString& value);
109 void annotate(AnnotationGraphVertex v, uint64_t annot, const GenericAnnotation& value);
111
115 void annotate(AnnotationGraphVertex vs, AnnotationGraphVertex vt, uint64_t annot, uint64_t value);
116 void annotate(AnnotationGraphVertex vs, AnnotationGraphVertex vt, uint64_t annot, const LimaString& value);
117 void annotate(AnnotationGraphVertex vs, AnnotationGraphVertex vt, uint64_t annot, const GenericAnnotation& value);
119
122 void annotate(AnnotationGraphEdge e, uint64_t annot, uint64_t value);
123 void annotate(AnnotationGraphEdge e, uint64_t annot, const LimaString& value);
124 void annotate(AnnotationGraphEdge e, uint64_t annot, const GenericAnnotation& value);
126
130 uint64_t intAnnotation(AnnotationGraphVertex v, uint64_t annot) const;
131 const LimaString& stringAnnotation(AnnotationGraphVertex v, uint64_t annot) const;
132 const GenericAnnotation& annotation(AnnotationGraphVertex v, uint64_t annot) const;
135
139 uint64_t intAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, uint64_t annot) const;
140 const LimaString& stringAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, uint64_t annot) const;
141 const GenericAnnotation& annotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, uint64_t annot) const;
144
145
149 uint64_t intAnnotation(AnnotationGraphEdge e, uint64_t annot);
153
157 uint64_t intAnnotation(AnnotationGraphEdge e, uint64_t annot) const;
158 const LimaString& stringAnnotation(AnnotationGraphEdge e, uint64_t annot) const;
159 const GenericAnnotation& annotation(AnnotationGraphEdge e, uint64_t annot) const;
161
165 bool hasIntAnnotation(AnnotationGraphVertex v, const LimaString& annot) const;
166 bool hasStringAnnotation(AnnotationGraphVertex v, const LimaString& annot) const;
167 bool hasAnnotation(AnnotationGraphVertex v, const LimaString& annot) const;
171 bool hasIntAnnotation(AnnotationGraphEdge e, const LimaString& annot) const;
172 bool hasStringAnnotation(AnnotationGraphEdge e, const LimaString& annot) const;
173 bool hasAnnotation(AnnotationGraphEdge e, const LimaString& annot) const;
175
176
180 bool hasIntAnnotation(AnnotationGraphVertex v, uint64_t annot) const;
181 bool hasStringAnnotation(AnnotationGraphVertex v, uint64_t annot) const;
182 bool hasAnnotation(AnnotationGraphVertex v, uint64_t annot) const;
183 bool hasIntAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, uint64_t annot) const;
184 bool hasStringAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, uint64_t annot) const;
185 bool hasAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, uint64_t annot) const;
186 bool hasIntAnnotation(AnnotationGraphEdge e, uint64_t annot) const;
187 bool hasStringAnnotation(AnnotationGraphEdge e, uint64_t annot) const;
188 bool hasAnnotation(AnnotationGraphEdge e, uint64_t annot) const;
190
191
195 const AnnotationGraph& getGraph() const;
197
199 const LimaString& annotationName(uint64_t annotationId) const;
200
202 uint64_t annotationId(const LimaString& s);
203
209 void dumpFunction(const std::string& annot, const Dumper* f);
210 const Dumper* dumpFunction(const std::string& annot);
211 const Dumper* dumpFunction(uint64_t annot);
213
217 void addMatching(const std::string& first, AnnotationGraphVertex firstVx,
218 const std::string& second, AnnotationGraphVertex secondVx);
219
223 std::set< AnnotationGraphVertex > matches(const std::string& first, AnnotationGraphVertex firstVx,
224 const std::string& second) const;
225
228 bool isMatching(const std::string& first, AnnotationGraphVertex firstVx,
229 const std::string& second, AnnotationGraphVertex secondVx) const;
230
234 void addMatching(const StringsPoolIndex& first, AnnotationGraphVertex firstVx,
235 const StringsPoolIndex& second, AnnotationGraphVertex secondVx);
236
240 std::set< AnnotationGraphVertex > matches(const StringsPoolIndex& first, AnnotationGraphVertex firstVx,
241 const StringsPoolIndex& second) const;
242
245 bool isMatching(const StringsPoolIndex& first, AnnotationGraphVertex firstVx,
246 const StringsPoolIndex& second, AnnotationGraphVertex secondVx) const;
247
251 void addMatching(const StringsPoolIndex& direction, AnnotationGraphVertex firstVx,
252 AnnotationGraphVertex secondVx);
253
257 std::set< AnnotationGraphVertex > matches(const StringsPoolIndex& direction,
258 AnnotationGraphVertex firstVx) const;
259
262 bool isMatching(const StringsPoolIndex& direction, AnnotationGraphVertex firstVx,
263 AnnotationGraphVertex secondVx) const;
264
269 std::set< std::string >& excepted);
270
272 const std::map<StringsPoolIndex, std::multimap<AnnotationGraphVertex, AnnotationGraphVertex> >& matchings() const;
273
274private:
276 AnnotationData& operator=(const AnnotationData&);
277
278
280};
281
282} // closing namespace AnnotationGraphs
283} // closing namespace Common
284} // closing namespace Lima
285
286
287#endif // LIMA_ANNOTATIONGRAPH_ANNOTATIONDATA_H
A graph that stores any data (annotations) referencing primarily nodes of a text anlaysis.
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AGVertexProperties, AGEdgeProperties > AnnotationGraph
The graph class.
#define LIMA_ANNOTATIONGRAPH_EXPORT
just for semantics: base class for analysisData
virtual int dump(std::ostream &, GenericAnnotation &) const =0
void addMatching(const std::string &first, AnnotationGraphVertex firstVx, const std::string &second, AnnotationGraphVertex secondVx)
Adds a symetric matching between two vertices of two graphs identified by the two string parameters.
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 std::map< StringsPoolIndex, std::multimap< AnnotationGraphVertex, AnnotationGraphVertex > > & matchings() const
Access to the underlying raw matching structure.
const GenericAnnotation & annotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString &annot) const
const LimaString & stringAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString &annot) const
AnnotationGraphVertex createAnnotationVertex()
Creates a new annotation vertex in the graph.
void cloneAnnotations(AnnotationGraphVertex src, AnnotationGraphVertex tgt, std::set< std::string > &excepted)
@briefs copies all the annotations of the source annotation vertex onto the target annotation vertex,...
uint64_t annotationId(const LimaString &s)
Gives the id of an annotation name.
bool isMatching(const std::string &first, AnnotationGraphVertex firstVx, const std::string &second, AnnotationGraphVertex secondVx) const
Tests if the two given vertices are matching in the two given graphs.
AnnotationGraphEdge createAnnotationEdge(AnnotationGraphVertex s, AnnotationGraphVertex t)
Creates a new annotation edge in the graph.
const LimaString & annotationName(uint64_t annotationId) const
Gives the name of an annotation id.
This class allows to convert any object into an annotation by inheritance.
void dumpFunction(const std::string &annot, const Dumper *f)
AnnotationGraph::edge_descriptor AnnotationGraphEdge
AnnotationGraph::vertex_descriptor AnnotationGraphVertex
uint64_t intAnnotation(AnnotationGraphEdge e, uint64_t annot) const
const LimaString & stringAnnotation(AnnotationGraphEdge e, uint64_t annot) const
bool hasStringAnnotation(AnnotationGraphVertex v, const LimaString &annot) const
bool hasIntAnnotation(AnnotationGraphVertex v, const LimaString &annot) const
bool hasAnnotation(AnnotationGraphVertex v, const LimaString &annot) const
void annotate(AnnotationGraphVertex v, const LimaString &annot, uint64_t value)
NAUTITIA.
QString LimaString
Definition LimaString.h:33