LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
EventTemplateMerging.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 *
8 * @file EventTemplateMerging.h
9 * @author besancon (besanconr@zoe.cea.fr)
10 * @date Mon Sep 26 2011
11 * copyright Copyright (C) 2011 by CEA - LIST
12 * Project LIMA
13 *
14 * @brief
15 *
16 *
17 ***********************************************************************/
18#ifndef LIMA_LINGUISTICPROCESSING_EVENTTEMPLATEMERGING_H
19#define LIMA_LINGUISTICPROCESSING_EVENTTEMPLATEMERGING_H
20
21#include "EventAnalysisExport.h"
23#include "EventTemplateData.h"
24#include "EventTemplate.h"
27
28namespace Lima {
29namespace LinguisticProcessing {
30namespace EventAnalysis {
31
32//**********************************************************************
33// process unit
34#define EVENTTEMPLATEMERGING_CLASSID "EventTemplateMerging"
35
37{
38public:
40
41 virtual ~EventTemplateMerging();
42
44 Manager* manager) override;
45
46 LimaStatusCode process(AnalysisContent& analysis) const override;
47
48private:
49 std::shared_ptr<EventTemplateDefinitionResource> m_templateDefinition;
50 std::deque<std::string> m_mandatoryElements;
51 uint64_t m_maxCharCompatibleEvents;
52 bool m_useSentenceBounds;
53 std::string m_sentenceBoundsData; // name of data containing the boundaries if m_useSentenceBounds
54
55 // private member function
56 LimaStatusCode mergeEventTemplatesOnEachSentence(AnalysisContent& analysis, EventTemplateData* eventData) const;
57 LimaStatusCode mergeEventTemplates(EventTemplateData* eventData, uint64_t posBegin, uint64_t posEnd) const;
58 bool compatibleTemplates(const EventTemplate& e1, const EventTemplate& e2,
59 unsigned int numTemplate, unsigned int numOtherTemplate,
60 TemplateElements& mergedElements) const;
61
62 bool compatibleValues(const std::vector<const EventTemplateElement*> values1,
63 const std::vector<const EventTemplateElement*> values2,
64 unsigned int cardinality,
65 std::vector<EventTemplateElement>& merged) const;
66
67 // return the template to be removed (either numTemplate or numOtherTemplate)
68 bool mergeTemplates(EventTemplate& e1, EventTemplate& e2,
69 unsigned int numTemplate, unsigned int numOtherTemplate,
70 unsigned int& templateToRemove) const;
71
72 bool ignoreTemplate(const EventTemplate& event, uint64_t numTemplate,
73 uint64_t posBegin, uint64_t posEnd,
74 const std::set<uint64_t>& toRemove) const;
75
76 void cleanEventTemplates(EventTemplateData* eventData) const;
77
78
79};
80
81} // end namespace
82} // end namespace
83} // end namespace
84
85#endif
#define LIMA_EVENTANALISYS_EXPORT
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
Manage initialization of InitializableObjects using configuration module and parameters.
std::multimap< std::string, EventTemplateElement > TemplateElements
NAUTITIA.
LimaStatusCode
Definition LimaCommon.h:236