LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
EventTemplate.h
Go to the documentation of this file.
1// Copyright (C) 2011 by CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6#ifndef EVENTTEMPLATE_H
7#define EVENTTEMPLATE_H
8
11#include <map>
12#include <string>
13
14namespace Lima {
15namespace LinguisticProcessing {
16namespace EventAnalysis {
17
18typedef std::string EventRole;
19typedef std::multimap<std::string,EventTemplateElement> TemplateElements;
20
22{
23 public:
25 EventTemplate(const std::string&);
27
28 void setTemplateElements(const TemplateElements& elts);
29 void addElement(const std::string& role, const EventTemplateElement& elt, unsigned int cardinality);
30 void setWeight(double w) { m_weight=w; }
31 void setType(const std::string type) { m_type=type; }
32 void setMain(bool isMainEvent) { m_mainEvent=isMainEvent; }
33 void clear();
34
35 const EventTemplateElement& getElement(const std::string& role) const;
36 const TemplateElements& getTemplateElements() const { return m_template; }
37 TemplateElements& getTemplateElements() { return m_template; }
38 double getWeight() const { return m_weight; }
39 const std::string getType() const { return m_type; }
40 bool isMainEvent() const { return m_mainEvent; }
41 uint64_t getPosBegin() const { return m_posBegin; }
42 uint64_t getPosEnd() const { return m_posEnd; }
43
44 LIMA_EVENTANALISYS_EXPORT friend std::ostream& operator<<(std::ostream& os, const EventTemplate& e);
45 LIMA_EVENTANALISYS_EXPORT friend QDebug& operator<<(QDebug& os, const EventTemplate& e);
46
47 private:
48 TemplateElements m_template;
49 double m_weight;
50 bool m_mainEvent;
51 std::string m_type;
52 // store positions of text span
53 uint64_t m_posBegin;
54 uint64_t m_posEnd;
55};
56
57} // end namespace
58} // end namespace
59} // end namespace
60
61#endif
#define LIMA_EVENTANALISYS_EXPORT
QDebug & operator<<(QDebug &qd, const std::string &str)
Definition QsLog.cpp:39
std::multimap< std::string, EventTemplateElement > TemplateElements
NAUTITIA.