LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
CoreXmlReaderClient.h
Go to the documentation of this file.
1// Copyright 2009-2021 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6#ifndef COREXMLREADERCLIENT_H
7#define COREXMLREADERCLIENT_H
8
13
14namespace Lima {
16}
17
18namespace Lima {
19namespace DocumentsReader {
20 class DocumentReader;
23}
24namespace XmlReader {
25
38{
39public:
43
46
47 //-------------------------------------------------------------
48 // En tant que client d'analyse (AbstractXmlReaderClient)
49 //-------------------------------------------------------------
55 std::shared_ptr<AnalysisContent> analyze(
56 const std::string& content,
57 const std::map<std::string,std::string>& metaData,
58 const std::string& pipeline,
59 const std::map<std::string, Lima::AbstractAnalysisHandler*>& handlers = std::map<std::string, Lima::AbstractAnalysisHandler*>(),
60 const std::set<std::string>& inactiveUnits = std::set<std::string>()) const override;
61
63 void setAnalysisHandler(const std::string& handlerId, Lima::AbstractAnalysisHandler* handler) override;
64
66 void releaseAnalysisHandler(const std::string &handlerId) override;
67
68
69 //---------------------------------------------------------------
70 // En tant que handler de XML (StructuredXmlDocumentHandler)
71 //---------------------------------------------------------------
72
73 void startHierarchy ( const DocumentsReader::ContentStructuredDocument& contentDocument ) override;
74
75 void endHierarchy ( const DocumentsReader::ContentStructuredDocument& contentDocument ) override;
76
77 void startIndexing ( const DocumentsReader::ContentStructuredDocument& contentDocument ) override ;
78 void endIndexing ( const DocumentsReader::ContentStructuredDocument& contentDocument ) override;
79
86 void handle (const DocumentsReader::ContentStructuredDocument& contentDocument,
87 const Lima::LimaString& text,
88 unsigned long int offset,
89 const std::string tagName) override;
90
92 const std::string& data ) override ;
93
94private:
95 void startNode ( const DocumentsReader::ContentStructuredDocument& contentDocument, bool isIndexing );
96
99
101 DocumentsReader::DocumentReader* m_documentReader;
102
103 // arguments pour l'analyseur, initialise avec l'argument metadata d'analyze()
104 // contient eventuellement des valeurs pour "FileName" et "Lang" et "Type" ??
105 std::map<std::string,std::string> m_docMetaData;
106
108 Lima::LimaString m_emptyTextChars;
109
111 std::map<std::string, Lima::AbstractAnalysisHandler*> m_mapHandlers;
112
113 // @brief resultat de l'analyse du fichier XML
114// std::map<std::string, std::map<int , std::map<int, std::vector< std::pair<int, std::string> > > > > m_mapToIndex;
115// LinguisticProcessing::AbstractLinguisticProcessingClient* m_delegate;
116};
117
119class COREXMLREADERCLIENT_EXPORT CoreXmlReaderClientFactory : public AbstractXmlReaderClientFactory
120{
121public:
122
123 void configure(
125 const std::string& defaultMedia,
126 const std::deque<std::string>& medias,
127 const std::deque<std::string>& pipelines) override;
128
129 std::shared_ptr< AbstractXmlReaderClient > createClient(Lima::Common::XMLConfigurationFiles::XMLConfigurationFileParser *configuration) const override;
130
131 virtual ~CoreXmlReaderClientFactory();
132
133private:
134 CoreXmlReaderClientFactory();
135 static std::unique_ptr< CoreXmlReaderClientFactory > s_instance;
136
137 std::string m_defaultMedia;
138};
139
146
147} // XmlReader
148} // Lima
149
150
151
152#endif
#define COREXMLREADERCLIENT_EXPORT
Symbol exporting for Windows DLL CoreXmlReaderClient.dll.
The AbstractAnalysisHandler class defines the callback interface: the functions that are to be define...
abstract handler for XML processing : just inherits from different handlers
Parser class for the lima's xml configuration files.
Partie d'un document structure decodee avant analyse.
Handler pour les elements de parsing de document structure.
interface publique au client d'analyse de fichier XML
void configure(const Lima::Common::XMLConfigurationFiles::XMLConfigurationFileParser &configuration, const std::string &defaultMedia, const std::deque< std::string > &medias, const std::deque< std::string > &pipelines) override
std::shared_ptr< AbstractXmlReaderClient > createClient(Lima::Common::XMLConfigurationFiles::XMLConfigurationFileParser *configuration) const override
This function create a XmlReader client
void endHierarchy(const DocumentsReader::ContentStructuredDocument &contentDocument) override
void setAnalysisHandler(const std::string &handlerId, Lima::AbstractAnalysisHandler *handler) override
associe un handler recupérant l'analyse XML
void handleProperty(const DocumentsReader::DocumentPropertyType &property, const std::string &data) override
void startHierarchy(const DocumentsReader::ContentStructuredDocument &contentDocument) override
void releaseAnalysisHandler(const std::string &handlerId) override
deletes the analysis handler with the given id and removes it
CoreXmlReaderClient(Lima::Common::XMLConfigurationFiles::XMLConfigurationFileParser &configuration)
constructeur
void startIndexing(const DocumentsReader::ContentStructuredDocument &contentDocument) override
void endIndexing(const DocumentsReader::ContentStructuredDocument &contentDocument) override
std::shared_ptr< AnalysisContent > analyze(const std::string &content, const std::map< std::string, std::string > &metaData, const std::string &pipeline, const std::map< std::string, Lima::AbstractAnalysisHandler * > &handlers=std::map< std::string, Lima::AbstractAnalysisHandler * >(), const std::set< std::string > &inactiveUnits=std::set< std::string >()) const override
analyse effective d'un fichier XML.
void handle(const DocumentsReader::ContentStructuredDocument &contentDocument, const Lima::LimaString &text, unsigned long int offset, const std::string tagName) override
callback to the handler.
NAUTITIA.
QString LimaString
Definition LimaString.h:33