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
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
28class AnnotationDataPrivate;
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
51 AnnotationGraphVertex createAnnotationVertex();
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);
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);
70 void annotate(AnnotationGraphVertex vs, AnnotationGraphVertex vt, const LimaString& annot, const GenericAnnotation& value);
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);
80 uint64_t intAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString& annot) const;
81 const LimaString& stringAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString& annot) const;
82 const GenericAnnotation& annotation(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;
90 const GenericAnnotation& annotation(AnnotationGraphVertex v, const LimaString& annot) const;
91 GenericAnnotation& annotation(AnnotationGraphVertex v, const LimaString& annot);
97 uint64_t intAnnotation(AnnotationGraphEdge e, const LimaString& annot);
98 const LimaString& stringAnnotation(AnnotationGraphEdge e, const LimaString& annot);
99 const GenericAnnotation& annotation(AnnotationGraphEdge e, const LimaString& annot) const;
100 GenericAnnotation& annotation(AnnotationGraphEdge e, const LimaString& annot);
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);
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);
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);
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;
133 GenericAnnotation& annotation(AnnotationGraphVertex v, uint64_t annot);
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;
142 GenericAnnotation& annotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, uint64_t annot);
149 uint64_t intAnnotation(AnnotationGraphEdge e, uint64_t annot);
150 LimaString& stringAnnotation(AnnotationGraphEdge e, uint64_t annot);
151 GenericAnnotation& annotation(AnnotationGraphEdge e, uint64_t annot);
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;
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;
168 bool hasIntAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString& annot) const;
169 bool hasStringAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString& annot) const;
170 bool hasAnnotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, 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;
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;
194 AnnotationGraph& getGraph();
195 const AnnotationGraph& getGraph() const;
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);
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
268 void cloneAnnotations(AnnotationGraphVertex src, AnnotationGraphVertex tgt,
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
Holds an annotation graph and gives an API to manipulate it.
This class allows to convert any object into an annotation by inheritance.
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
NAUTITIA.
QString LimaString
Definition LimaString.h:33