LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
indexElement.h
Go to the documentation of this file.
1// Copyright 2002-2020 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/************************************************************************
7 *
8 * @file indexElement.h
9 * @author Besancon Romaric (romaric.besancon@cea.fr)
10 * @date Tue Feb 7 2006
11 * copyright Copyright (C) 2006-2020 by CEA LIST
12 * Project BagOfWords
13 *
14 * @brief a class to represent the element to index in the bag of
15 * words structure
16 *
17 *
18 ***********************************************************************/
19
20#ifndef INDEXELEMENT_H
21#define INDEXELEMENT_H
22
28#include <vector>
29#include <iostream>
30
31namespace Lima {
32namespace Common {
33namespace BagOfWords {
34
35class IndexElementPrivate;
36
46{
47public:
49 IndexElement(const uint64_t id,
50 const BagOfWords::BoWType type,
51 const LimaString& word,
52 const LinguisticCode cat = LinguisticCode::ZERO,
53 const uint64_t position=0,
54 const uint64_t length=0,
56 IndexElement(const uint64_t id,
58 const std::vector<uint64_t>& structure,
59 const std::vector<uint64_t>& relations,
61 IndexElement(const IndexElement& ie);
62 IndexElement& operator=(const IndexElement&);
64
66 bool operator==(const IndexElement& other) const;
68 bool hasSamePosition(const IndexElement& other) const;
70 bool hasNearlySamePosition(const IndexElement& other) const;
71
72 bool empty() const;
73 uint64_t getId() const;
75 bool isSimpleTerm() const;
76 bool isComposedTerm() const;
77 bool isPredicate() const;
78
79 const LimaString& getSimpleTerm() const;
80 LinguisticCode getCategory() const;
81 uint64_t getPosition() const;
82 uint64_t getLength() const;
83 bool isNamedEntity() const;
84 const Common::MediaticData::EntityType& getNamedEntityType() const;
85 Lima::Common::Misc::PositionLengthList& getPositionLengthList();
86 const Misc::PositionLengthList& getPositionLengthList() const;
87 const std::vector<uint64_t>& getStructure() const;
88 std::vector<uint64_t>& getStructure();
89
90 const std::vector<uint64_t>& getRelations() const;
91 std::vector<uint64_t>& getRelations();
92
93 void setId(const uint64_t id);
94 void setSimpleTerm(const LimaString& t);
95 void setCategory(LinguisticCode category);
96 void setStructure(const std::vector<uint64_t>& s,
97 const std::vector<uint64_t>& r);
98 void addInStructure(uint64_t id, uint64_t rel);
99
100 friend LIMA_BOW_EXPORT std::ostream& operator<<(std::ostream& os, const IndexElement& elt);
101 friend LIMA_BOW_EXPORT QDebug& operator<<(QDebug& os, const IndexElement& elt);
102 friend LIMA_BOW_EXPORT QTextStream& operator<<(QTextStream& os, const IndexElement& elt);
103
104private:
106};
107
108} // end namespace
109} // end namespace
110} // end namespace
111
112#endif
QDebug & operator<<(QDebug &qd, const std::string &str)
Definition QsLog.cpp:39
#define LIMA_BOW_EXPORT
Represent an element of an index If it is a predicate, its simple term is "PredicateElement" and its ...
BoWType
enum to characterize the type of the AbstractBoWElement
std::vector< std::pair< Position, Length > > PositionLengthList
NAUTITIA.
QString LimaString
Definition LimaString.h:33