LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
SyntacticAnalyzer-nochains.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
16#ifndef SYNTACTICANALYZERNOCHAINS_H
17#define SYNTACTICANALYZERNOCHAINS_H
18
20#include "SyntacticData.h"
22
23#include <string>
24#include <stack>
25
26namespace Lima
27{
28namespace LinguisticProcessing
29{
30namespace SyntacticAnalysis
31{
32
33#define SACLOGINIT LOGINIT("LP::SyntacticAnalysis::Chains")
34#ifdef WIN32
35#undef min
36#undef max
37#endif
38
39#define SYNTACTICANALYZERCHAINS_FIRSTID 1
40#define SYNTACTICANALYZERNOCHAINS_CLASSID "SyntacticAnalyzerNoChains"
41
57{
58public:
59
64
65 // SyntacticAnalyzer(SyntacticAnalyzer&);
66
71
79 void init(
81 Manager* manager) override;
82
90 LimaStatusCode process(AnalysisContent& analysis) const override;
91
102 void identifyChains(SyntacticData* data,
103 const LinguisticGraphVertex& s,
104 const LinguisticGraphVertex& t,
105 uint64_t& startChainId) const;
106
107
112 MediaId language() const;
113
114private:
115
117 static const uint64_t m_firstChainId = SYNTACTICANALYZERCHAINS_FIRSTID;
118
121 class NoChainEndInStackException : public std::exception {};
122
130 typedef boost::tuple< LinguisticGraphVertex, bool, std::vector< LinguisticGraphVertex > > ChainStackTuple;
131
152 void reportChainInGraph(
153 SyntacticData* data,
154 const std::vector< ChainStackTuple >& pile,
156 std::set< LinguisticGraphVertex >& alreadyFinished,
157 uint64_t& chainId,
158 const LinguisticGraphVertex& stop) const;
159
173 bool parentsFinished(
174 const SyntacticData* data,
175 const LinguisticGraphVertex& v,
176 const std::set< LinguisticGraphVertex >& alreadyFinished) const;
177
202 std::string stringChain(
203 const SyntacticData* data,
204 const std::vector< ChainStackTuple >& pile,
206 std::set< LinguisticGraphVertex >& alreadyFinished,
207 uint64_t chainId,
208 const LinguisticGraphVertex& stop = std::numeric_limits<LinguisticGraphVertex>::max()) const;
209
223 LinguisticGraphVertex unstackUptoChainEnd(
224 const SyntacticData* data,
225 std::vector< ChainStackTuple >& pile,
227 ) const;
228
229protected:
230
232 MediaId m_language;
233
238 std::shared_ptr<SyntagmDefStruct> m_chainMatrix;
239
248
258
262};
263
265{
266 return m_language;
267}
268
269} // closing namespace SyntacticAnalysis
270} // closing namespace LinguisticProcessing
271} // closing namespace Lima
272
273#endif
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
#define LIMA_SYNTACTICANALYSIS_EXPORT
#define SYNTACTICANALYZERCHAINS_FIRSTID
Data used for the syntactic analyzis of texts.
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
Provide function to read write and check a property.
This class is a processing unit that can be inserted in an analysis pipeline.
std::shared_ptr< SyntagmDefStruct > m_chainMatrix
A pointer onto the chains definition matrices.
MediaId language() const
Read accessor to the language of the analyzed text.
uint64_t m_maxChainsNbByVertex
Sets the max number of chains on one vertex.
This class points to a graph, its dependency graph and the structure that holds the maping between th...
ChainsType
syntactic chains type
NAUTITIA.
LimaStatusCode
Definition LimaCommon.h:236