LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
SpecificEntitiesConstraints.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
6/***************************************************************************
7 * Copyright (C) 2004-2012 by CEA LIST *
8 * *
9 ***************************************************************************/
10#ifndef LIMA_LINGUISTICPROCESSING_SPECIFICENTITIESSPECIFICENTITIESCONSTRAINTS_H
11#define LIMA_LINGUISTICPROCESSING_SPECIFICENTITIESSPECIFICENTITIESCONSTRAINTS_H
12
17
18#include <QVariant>
19
20namespace Lima {
21namespace LinguisticProcessing {
22namespace SpecificEntities {
23
24// ids for constraints in this file
25#define isAlphaPossessiveId "isAlphaPossessive"
26#define isASpecificEntityId "isASpecificEntity"
27#define CreateSpecificEntityId "CreateSpecificEntity"
28#define SetEntityFeatureId "SetEntityFeature"
29#define AddEntityFeatureAsEntityId "AddEntityFeatureAsEntity"
30#define AddEntityFeatureId "AddEntityFeature"
31#define AppendEntityFeatureId "AppendEntityFeature"
32#define ClearEntityFeaturesId "ClearEntityFeatures"
33#define NormalizeEntityId "NormalizeEntity"
34
39{
40public:
41 isAlphaPossessive(MediaId language,
42 const LimaString& complement=LimaString());
44 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
45 const LinguisticGraphVertex& v,
46 AnalysisContent& analysis) const override;
47};
48
50{
51public:
52 isASpecificEntity(MediaId language,
53 const LimaString& complement=LimaString());
55 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
56 const LinguisticGraphVertex& v,
57 AnalysisContent& analysis) const override;
58
59private:
61};
62
75{
76public:
77 CreateSpecificEntity(MediaId language,
78 const LimaString& complement=LimaString());
80 bool operator()(Automaton::RecognizerMatch& match,
81 AnalysisContent& analysis) const override;
82
83 bool actionNeedsRecognizedExpression() override { return true; }
84
85private:
86 bool shouldRemoveInitial(
89 const Automaton::RecognizerMatch& match) const;
90
91 bool shouldRemoveFinal(
94 const Automaton::RecognizerMatch& match) const;
95
96 void addMicrosToMorphoSyntacticData(
99 const std::set<LinguisticCode>& micros,
101
102
103 MediaId m_language;
105 const Common::PropertyCode::PropertyAccessor* m_microAccessor;
106 std::set< LinguisticCode > m_microsToKeep;
107
108};
109
119{
120public:
121 SetEntityFeature(MediaId language,
122 const LimaString& complement=LimaString());
124 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
125 const LinguisticGraphVertex& vertex,
126 AnalysisContent& analysis) const override;
127 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
128 const LinguisticGraphVertex& v1,
129 const LinguisticGraphVertex& v2,
130 AnalysisContent& analysis) const override;
131
132private:
133 std::string m_featureName;
135 QVariant::Type m_featureType;
136};
137
144{
145public:
146 AddEntityFeatureAsEntity(MediaId language,
147 const LimaString& complement=LimaString());
149 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
150 const LinguisticGraphVertex& vertex,
151 AnalysisContent& analysis) const override;
152
153private:
154 std::string m_featureName;
156};
157
167{
168public:
169 AddEntityFeature(MediaId language,
170 const LimaString& complement=LimaString());
172 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
173 const LinguisticGraphVertex& vertex,
174 AnalysisContent& analysis) const override;
175 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
176 const LinguisticGraphVertex& v1,
177 const LinguisticGraphVertex& v2,
178 AnalysisContent& analysis) const override;
179
180private:
181 std::string m_featureName;
183 QVariant::Type m_featureType;
184};
185
197{
198public:
199 AppendEntityFeature(MediaId language,
200 const LimaString& complement=LimaString());
202 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
203 const LinguisticGraphVertex& vertex,
204 AnalysisContent& analysis) const override;
205 uint64_t minPos( const uint64_t pos1, const uint64_t pos2 )const;
206 uint64_t maxPos( const uint64_t pos1, const uint64_t pos2 )const;
207
208private:
209 std::string m_featureName;
211 QVariant::Type m_featureType;
212};
213
221{
222public:
223 ClearEntityFeatures(MediaId language,
224 const LimaString& complement=LimaString());
226 bool operator()(AnalysisContent& analysis) const override;
227
228private:
229
230};
231
239{
240public:
241 NormalizeEntity(MediaId language,
242 const LimaString& complement=LimaString());
244 bool operator()(Automaton::RecognizerMatch& match,
245 AnalysisContent& analysis) const override;
246
247 bool actionNeedsRecognizedExpression() override { return true; }
248
249private:
250
251};
252
253
254}
255}
256}
257
258#endif
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
#define LIMA_SPECIFICENTITIES_EXPORT
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
Provide function to read write and check a property.
An AnalysisData containing a LinguisticGraph with a language and an id.
This action add a vertex as an embedded entity of the entity (i.e.
This action set the value of a feature for an entity during the recognition of the entity (i....
This action appends a value to the previously set value of a feature for an entity during the recogni...
This action creates a new vertex for given match containing a specific entity's data.
This action performs the normalization of an entity according to stored features.
This action set the value of a feature for an entity during the recognition of the entity (i....
NAUTITIA.
QString LimaString
Definition LimaString.h:33