LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
HomoSyntagmaticConstraints.h
Go to the documentation of this file.
1// Copyright 2002-2019 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
14#ifndef LIMA_SYNTACTICANALYSIS_HOMOSYNTAGMATICCONSTRAINTS_H
15#define LIMA_SYNTACTICANALYSIS_HOMOSYNTAGMATICCONSTRAINTS_H
16
18#include "SyntacticData.h"
22#include <iostream>
23
24namespace Lima {
25namespace LinguisticProcessing {
26namespace SyntacticAnalysis {
27
28//**********************************************************************
29// ids of constraints defined in this file
30#define SecondUngovernedById "SecondUngovernedBy"
31#define GovernorOfId "GovernorOf"
32#define GovernedById "GovernedBy"
33#define RemoveOutRelationFromId "RemoveOutRelationFrom"
34#define SameNominalChainId "SameNominalChain"
35#define SameVerbalChainId "SameVerbalChain"
36#define CreateRelationBetweenId "CreateRelationBetween"
37#define CreateRelationWithRelatedId "CreateRelationWithRelated"
38#define CreateRelationReverseWithRelatedId "CreateRelationReverseWithRelated"
39#define CopyRelationsOutOfToId "CopyRelationsOutOfTo"
40#define CopyIncomingRelationsToId "CopyIncomingRelationsTo"
41#define CreateCompoundTenseId "CreateCompoundTense"
42#define CreateEasyCompoundTenseId "CreateEasyCompoundTense"
43#define FindRelationFromId "FindRelationFrom"
44#define EnforcePropertiesConstraintsId "EnforcePropertiesConstraints"
45#define AddRelationInGraphId "AddRelationInGraph"
46#define ModifyRelationInGraphId "ModifyRelationInGraph"
47#define ClearStoredRelationsId "ClearStoredRelations"
48
51
66
67
76{
77public:
78 explicit SecondUngovernedBy(MediaId language,
79 const LimaString& complement=LimaString());
81 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
82 const LinguisticGraphVertex& v1,
83 const LinguisticGraphVertex& v2,
84 AnalysisContent& analysis) const override;
85
86private:
87};
88
89
98{
99public:
100 explicit GovernorOf(MediaId language,
101 const LimaString& complement=LimaString());
103 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
104 const LinguisticGraphVertex& v1,
105 AnalysisContent& analysis) const override;
106
107private:
108};
109
118{
119public:
120 explicit GovernedBy(MediaId language,
121 const LimaString& complement=LimaString());
123 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
124 const LinguisticGraphVertex& v1,
125 AnalysisContent& analysis) const override;
126
127private:
128};
129
135{
136public:
137 explicit SameNominalChain(MediaId language,
138 const LimaString& complement=LimaString());
140 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
141 const LinguisticGraphVertex& v1,
142 const LinguisticGraphVertex& v2,
143 AnalysisContent& analysis) const override;
144
145private:
146};
147
148
154{
155public:
156 explicit SameVerbalChain(MediaId language,
157 const LimaString& complement=LimaString());
159 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
160 const LinguisticGraphVertex& v1,
161 const LinguisticGraphVertex& v2,
162 AnalysisContent& analysis) const override;
163
164private:
165};
166
167
176{
177public:
178 explicit CreateRelationBetween(MediaId language,
179 const LimaString& complement=LimaString());
181 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
182 const LinguisticGraphVertex& v1,
183 const LinguisticGraphVertex& v2,
184 AnalysisContent& analysis) const override;
185
186private:
187};
188
189//**********************************************************************
203{
204public:
205 explicit CreateRelationWithRelated(MediaId language,
206 const LimaString& complement=LimaString());
208 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
209 const LinguisticGraphVertex& v1,
210 const LinguisticGraphVertex& v2,
211 AnalysisContent& analysis) const override;
212
213protected:
214 std::set<Common::MediaticData::SyntacticRelationId> m_relationsToFollow;
216
217 std::vector<LinguisticGraphVertex>
218 findRelatedVertices(const LinguisticGraphVertex& v,
219 SyntacticData* syntacticData) const;
220
221};
222
240{
241public:
242 explicit CreateRelationReverseWithRelated(MediaId language,
243 const LimaString& complement=LimaString());
245 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
246 const LinguisticGraphVertex& v1,
247 const LinguisticGraphVertex& v2,
248 AnalysisContent& analysis) const override;
249
250private:
251};
252
261{
262public:
263 explicit RemoveOutRelationFrom(MediaId language,
264 const LimaString& complement=LimaString());
266 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
267 const LinguisticGraphVertex& v1,
268 AnalysisContent& analysis) const override;
269
270private:
271};
272
277{
278public:
279 explicit CopyRelationsOutOfTo(MediaId language,
280 const LimaString& complement=LimaString());
282 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
283 const LinguisticGraphVertex& v1,
284 const LinguisticGraphVertex& v2,
285 AnalysisContent& analysis) const override;
286
287private:
288 QStringList m_relations;
289};
290
301{
302public:
303 explicit CopyIncomingRelationsTo(MediaId language,
304 const LimaString& complement=LimaString());
306 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
307 const LinguisticGraphVertex& v1,
308 const LinguisticGraphVertex& v2,
309 AnalysisContent& analysis) const override;
310
311private:
312 QStringList m_relations;
313};
314
324{
325public:
326 explicit CreateCompoundTense(MediaId language,
327 const LimaString& complement=LimaString());
329 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
330 const LinguisticGraphVertex& v1,
331 const LinguisticGraphVertex& v2,
332 AnalysisContent& analysis) const override;
333
334private:
335 LinguisticCode m_macro; //< Macro category of the auxiliary
336 LinguisticCode m_micro; //< Micro category of the auxiliary
337 LinguisticCode m_tense; //< Tense of the auxiliary
339 const Common::PropertyCode::PropertyAccessor* m_macroAccessor;
340 const Common::PropertyCode::PropertyAccessor* m_microAccessor;
341 const Common::PropertyCode::PropertyAccessor* m_timeAccessor;
342 const Common::PropertyCode::PropertyAccessor* m_genderAccessor;
343 const Common::PropertyCode::PropertyAccessor* m_syntaxAccessor;
344 const Common::PropertyCode::PropertyAccessor* m_personAccessor;
345 const Common::PropertyCode::PropertyAccessor* m_numberAccessor;
346};
347
348
354{
355 public:
356 CreateEasyCompoundTense(MediaId language,
357 const LimaString& complement=LimaString());
359 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
360 const LinguisticGraphVertex& v1,
361 const LinguisticGraphVertex& v2,
362 AnalysisContent& analysis) const override;
363
364 private:
365 LinguisticCode m_macro;
366 LinguisticCode m_micro;
368 const Common::PropertyCode::PropertyAccessor* m_macroAccessor;
369 const Common::PropertyCode::PropertyAccessor* m_microAccessor;
370 const Common::PropertyCode::PropertyAccessor* m_timeAccessor;
371 const Common::PropertyCode::PropertyAccessor* m_genderAccessor;
372 const Common::PropertyCode::PropertyAccessor* m_syntaxAccessor;
373 const Common::PropertyCode::PropertyAccessor* m_personAccessor;
374 const Common::PropertyCode::PropertyAccessor* m_numberAccessor;
375};
376
377
378
389{
390public:
391 explicit FindRelationFrom(MediaId language,
392 const LimaString& complement=LimaString());
394 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
395 const LinguisticGraphVertex& v1,
396 AnalysisContent& analysis) const override;
397private:
398};
399
409{
410public:
411 explicit EnforcePropertiesConstraints(MediaId language,
412 const LimaString& complement=LimaString());
414 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
415 const LinguisticGraphVertex& v1,
416 const LinguisticGraphVertex& v2,
417 AnalysisContent& analysis) const override;
418
419private:
421 std::vector<Common::PropertyCode::PropertyAccessor> m_categories;
422 MediaId m_language;
423};
424
429{
430public:
431 explicit AddRelationInGraph(MediaId language,
432 const LimaString& complement=LimaString());
434 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
435 const LinguisticGraphVertex& v1,
436 const LinguisticGraphVertex& v2,
437 AnalysisContent& analysis) const override;
438 // if no arguments, add relations stored in syntactic data
439 bool operator()(AnalysisContent& analysis) const override;
440
441private:
442};
443
451{
452public:
453 explicit ModifyRelationInGraph(MediaId language,
454 const LimaString& complement=LimaString());
456 bool operator()(const LinguisticAnalysisStructure::AnalysisGraph& graph,
457 const LinguisticGraphVertex& v1,
458 const LinguisticGraphVertex& v2,
459 AnalysisContent& analysis) const override;
460 // if no arguments, add relations stored in syntactic data
461 bool operator()(AnalysisContent& analysis) const override;
462
463private:
464};
465
470{
471public:
472 explicit ClearStoredRelations(MediaId language,
473 const LimaString& complement=LimaString());
475 bool operator()(AnalysisContent& analysis) const override;
476
477private:
478};
479
481
482} // end namespace SyntacticAnalysis
483} // end namespace LinguisticProcessing
484} // end namespace Lima
485
486#endif // LIMA_SYNTACTICANALYSIS_HOMOSYNTAGMATICCONSTRAINTS_H
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
#define LIMA_SYNTACTICANALYSIS_EXPORT
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.
An AnalysisData containing a LinguisticGraph with a language and an id.
This action constraint does the real job of adding in the graph relations stored by CreateRelationBet...
This action constraint is used if a rule finally fail to remove stored relations that were scheduled ...
Abstract constraint function that takes a complement string that represents a relation name (entity t...
Copy all relations incoming to v1 to relations incoming to of v2.
This constraint creates a aux relation between its two parameters.
This constraint was developed specifically for Easy campaign, creating a classic compound tense (aux ...
This constraint add the specified relation in the relations buffer.
This constraint add in the relations buffer the relations of the given type from the targets of relat...
This constraint add in the relations buffer the relations of the given type from v1 to the targets of...
std::set< Common::MediaticData::SyntacticRelationId > m_relationsToFollow
This constraint modifies the both arguments DicoWords to keep only properties with compatible values ...
This constraint follows all relations from its argument until it finds the relation given as its comp...
This constraint tests if its argument is governed by a relation of the given type.
This constraint tests if its argument is the governor of a relation of the given type.
This action constraint modifies the type of relations previously found by FindRelationFrom.
This constraint removes any relation of the type given by the complement outgoing from the given vert...
This constraint tests if its two argument vertices have at least one common nominal chain.
This constraint tests if its two argument vertices have at least one common verbal chain.
This constraint tests if the second argument is not governed by the first one with a relation of the ...
This class points to a graph, its dependency graph and the structure that holds the maping between th...
NAUTITIA.
QString LimaString
Definition LimaString.h:33