LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
BoWRelation.h
Go to the documentation of this file.
1// Copyright 2002-2022 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/************************************************************************
7 * @file BoWRelation.h
8 * @author Gael de Chalendar
9 * @date Tue Oct 31 18:48:26 2006
10 * copyright Copyright (C) 2006-2012 by CEA LIST
11 *
12 * @brief A relation associated used to type the relation between a part
13 * and its enclosing complex token. This will be used primarily to
14 * represent the type of the relation in compounds but could be
15 * later be used as the basis to more structured indexing
16 *
17 ***********************************************************************/
18
19#ifndef BOWRELATION_H
20#define BOWRELATION_H
21
22#include "common/LimaCommon.h"
25#include <iostream>
26#include <string>
27#include <stdexcept>
28
29namespace Lima {
30namespace Common {
31namespace BagOfWords {
32
38class BoWRelation;
39LIMA_BOW_EXPORT std::ostream& operator << (std::ostream&, const BoWRelation&);
40LIMA_BOW_EXPORT QDebug& operator << (QDebug&, const BoWRelation&);
41
50{
51public:
52
53 BoWRelation(const Lima::LimaString& realization,
54 uint64_t type);
55 BoWRelation(const Lima::LimaString& realization,
56 uint64_t type, uint64_t syntype);
57 BoWRelation(const BoWRelation& tok);
59
60 virtual ~BoWRelation();
61
62 virtual BoWRelation* clone() const;
63
64 virtual Lima::LimaString
65 getRealization(void) const {return m_realization;};
66 uint64_t getType(void) const {return m_type;};
67 uint64_t getSynType(void) const {return s_type;};
68
69// void setRealization(const Lima::LimaString& realization)
70// {m_realization = realization;};
71 void setType(uint64_t type) {m_type = type;};
72 void setSynType(uint64_t type) {s_type = type;};
73
74 Lima::LimaString getString(void) const;
75
76 static void setUseOnlyRealization(const bool b) { m_useOnlyRealization=b; }
77 static bool getUseOnlyRealization() { return m_useOnlyRealization; }
78
79 static void setCompoundSeparator(const LimaChar c);
80
81 static LimaChar getCompoundSeparator();
82
84 virtual void read(std::istream& file);
85 virtual void write(std::ostream& file) const;
87
89// virtual std::wstring getOutputString(void) const;
90 virtual std::string getOutputUTF8String(void) const;
91
93// virtual std::wstring getIdString() const;
94 virtual std::string getIdUTF8String() const;
95
96// friend std::wostream& operator << (std::wostream&, const BoWRelation&);
97 friend LIMA_BOW_EXPORT std::ostream& operator << (std::ostream&, const BoWRelation&);
98 friend LIMA_BOW_EXPORT QDebug& operator << (QDebug&, const BoWRelation&);
99
104 virtual void parse(const Lima::LimaString& str,
105 int current);
106
114 bool operator==(const BoWRelation&) const;
115
120 bool operator!=(const BoWRelation&) const;
121
122 static Lima::LimaString
123 findNextElement(const Lima::LimaString& str,
124 int& current,
125 const LimaChar& separator);
126
127 protected:
129 uint64_t m_type;
130// added by Faiza: relation syntactic type
131 uint64_t s_type;
134
136
137
142 void convertSpaces(void);
143
144};
145
146//**************************************************************
147// inline functions
148//**************************************************************
153
158
160{
161 return new BoWRelation(*this);
162}
163
164
165} // namespace BagOfWords
166} // namespace Common
167} // namespace Lima
168
169#endif // BOWRELATION_H
QDebug & operator<<(QDebug &qd, const std::string &str)
Definition QsLog.cpp:39
#define LIMA_BOW_EXPORT
This class is used to type the relation between a part and its enclosing complex token.
Definition BoWRelation.h:50
BoWRelation(const Lima::LimaString &realization, uint64_t type, uint64_t syntype)
virtual BoWRelation * clone() const
static void setUseOnlyRealization(const bool b)
Definition BoWRelation.h:76
virtual Lima::LimaString getRealization(void) const
Definition BoWRelation.h:65
BoWRelation(const Lima::LimaString &realization, uint64_t type)
static void setCompoundSeparator(const LimaChar c)
T & operator<<(T &qd, const BoWType &bt)
NAUTITIA.
QChar LimaChar
Definition LimaString.h:30
QString LimaString
Definition LimaString.h:33