LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
AnnotationGraphXmlDumper.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
21#ifndef LIMA_LINGUISTICPROCESSINGS_ANALYSISDUMPERS_ANNOTATIONGRAPHXMLDUMPER_H
22#define LIMA_LINGUISTICPROCESSINGS_ANALYSISDUMPERS_ANNOTATIONGRAPHXMLDUMPER_H
23
25
28
29#include <boost/tuple/tuple.hpp>
30#include <boost/graph/properties.hpp>
32#include <boost/graph/breadth_first_search.hpp>
33
34#include <map>
35#include <iostream>
36#include <set>
37// #include <ext/hash_set>
38
39namespace Lima {
40namespace LinguisticProcessing {
41namespace AnalysisDumpers {
42 class FullXmlDumper;
43}
44}
45}
46
47namespace Lima {
48namespace LinguisticProcessing {
49namespace AnalysisDumpers {
50
51#define ANNOTATIONGRAPHXMLDUMPER_CLASSID "AnnotationGraphXmlDumper"
52
54{
56
57public:
58
60
62
63 void init(
65 Manager* manager) override;
66
67 LimaStatusCode process(
68 AnalysisContent& analysis) const override;
69
70 LimaStatusCode dump(
71 AnalysisContent& analysis, const std::string& prologue = "" ) const;
72
73private:
74 // constructor to be used by FullXmlDumper
75 AnnotationGraphXmlDumper( const MediaId& language, const std::string& handler );
76protected:
82 class DumpGraphVisitor : public boost::default_dfs_visitor
83 {
84 const AnnotationGraphXmlDumper& m_dumper;
86 std::ostream& m_os;
87 MediaId m_language;
88
89 public:
92 std::ostream& outputStream,
93 MediaId language):
94 m_dumper(dumper),
95 m_data(annotData),
96 m_os(outputStream),
97 m_language(language)
98 {
99 }
100
101 void discover_vertex(AnnotationGraphVertex v, const AnnotationGraph& g);
102 void examine_edge(AnnotationGraphEdge e, const AnnotationGraph& g);
103 void examine_vertex(AnnotationGraphVertex v, const AnnotationGraph& g);
104 class EndOfSearch : public std::runtime_error
105 {
106 public:
107 EndOfSearch():std::runtime_error("") {}
108 };
109 };
110
111 void dumpLimaData(std::ostream& os,
112 const Common::AnnotationGraphs::AnnotationData& annotData) const;
113
114 void outputVertex(const AnnotationGraphVertex v,
115 const AnnotationGraph& graph,
117 std::ostream& xmlStream) const;
118
119 void outputEdge(const AnnotationGraphEdge e,
120 const AnnotationGraph& graph,
122 std::ostream& xmlStream) const;
123
124 void outputVertexIAnnotations(const AnnotationGraphVertex v,
125 const AnnotationGraph& graph,
127 std::ostream& xmlStream) const;
128
129 void outputVertexSAnnotations(const AnnotationGraphVertex v,
130 const AnnotationGraph& graph,
132 std::ostream& xmlStream) const;
133
134 void outputVertexGAnnotations(const AnnotationGraphVertex v,
135 const AnnotationGraph& graph,
137 std::ostream& xmlStream) const;
138
139 void outputEdgeIAnnotations(const AnnotationGraphEdge e,
140 const AnnotationGraph& graph,
142 std::ostream& xmlStream) const;
143
144 void outputEdgeSAnnotations(const AnnotationGraphEdge e,
145 const AnnotationGraph& graph,
147 std::ostream& xmlStream) const;
148
149 void outputEdgeGAnnotations(const AnnotationGraphEdge e,
150 const AnnotationGraph& graph,
152 std::ostream& xmlStream) const;
153
154 MediaId m_language;
155 std::string m_handler;
156};
157
158} // end namespace AnalysisDumpers
159} // end namespace LinguisticProcessings
160} // end namespace Lima
161
162#endif // LIMA_LINGUISTICPROCESSINGS_ANALYSISDUMPERS_ANNOTATIONGRAPHXMLDUMPER_H
#define LIMA_ANALYSISDUMPERS_EXPORT
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.
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
Holds an annotation graph and gives an API to manipulate it.
Manage initialization of InitializableObjects using configuration module and parameters.
a visitor for going through the graph between two points and storing a BoWToken for every vertex that...
DumpGraphVisitor(const AnnotationGraphXmlDumper &dumper, const Common::AnnotationGraphs::AnnotationData &annotData, std::ostream &outputStream, MediaId language)
Dumps all the content of the analysis on an XML stream.
AnnotationGraph::edge_descriptor AnnotationGraphEdge
AnnotationGraph::vertex_descriptor AnnotationGraphVertex
NAUTITIA.
LimaStatusCode
Definition LimaCommon.h:236
STL namespace.