49 else return std::numeric_limits<uint8_t>::max();
53#define DEFAULT_SEPARATOR QChar{'#'}
54#define DEFAULT_COMPOUND_SEPARATOR QChar{'_'}
76 const uint64_t position,
77 const uint64_t length):
91 m_lemma(tok.m_d->m_lemma),
92 m_inflectedForm(tok.m_d->m_inflectedForm),
93 m_category(tok.m_d->m_category),
94 m_position(tok.m_d->m_position),
95 m_length(tok.m_d->m_length),
96 m_vertex(tok.m_d->m_vertex)
103 const uint64_t position,
104 const uint64_t length):
106 m_position(position),
129 m_lemma(tok.m_lemma),
130 m_inflectedForm(tok.m_inflectedForm),
131 m_category(tok.m_category),
132 m_position(tok.m_position),
133 m_length(tok.m_length),
134 m_vertex(tok.m_vertex)
178 LDEBUG <<
"BoWToken::BoWToken(BoWTokenPrivate): " << (*this) <<
" - " <<
this;
187 LDEBUG <<
"BoWToken::BoWToken()" <<
this;
193 const uint64_t position,
194 const uint64_t length):
200 LDEBUG <<
"Creating BoWToken : " << (*this) <<
" - " <<
this;
209 LDEBUG <<
"BoWToken::BoWToken(BoWToken) : " << tok <<
" - " << &tok <<
" ; new one is: " <<
this;
217 LDEBUG <<
"BoWToken::operator=(BoWToken) : " << tok <<
" - " << &tok <<
" ; new one is: " <<
this;
225 return( *
m_d == *tok.
m_d);
229 const uint64_t position,
230 const uint64_t length):
235 LDEBUG <<
"BoWToken::BoWToken" <<
this << str << position << length;
259 LDEBUG <<
"BoWToken::clone " <<
this;
432 std::ostringstream oss;
448 std::ostringstream oss;
456 std::set< uint64_t > result;
#define DEFAULT_SEPARATOR
#define DEFAULT_COMPOUND_SEPARATOR
This is a complex token used to represent a named entity token.
Common::MediaticData::EntityType getNamedEntityType(void) const
static LimaChar m_separator
static LimaChar m_compoundSeparator
static bool m_useOnlyLemma
LinguisticCode m_category
virtual ~BoWTokenPrivate()
BoWTokenPrivate & operator=(const BoWTokenPrivate &tok)
Lima::LimaString m_inflectedForm
bool operator==(const BoWTokenPrivate &tok)
void convertSpaces(void)
convert the spaces in the lemma string into a non-space character (defined by the m_compoundSeparator...
This class contains the representation of an element of the bag of words.
virtual uint64_t size(void) const override
size of the BoWToken is the number of parts in the token
void setVertex(uint64_t vertex)
static LimaChar getInternalSeparator()
void setCategory(LinguisticCode c)
virtual std::string getIdUTF8String() const override
function used to identify a bowtoken in a text (used in BowDumper)
static LimaChar getCompoundSeparator()
LinguisticCode getCategory(void) const
void setPosition(const uint64_t pos) override
static void setInternalSeparator(const LimaChar c)
virtual std::set< uint64_t > getVertices() const override
returns a singleton made of the value of the getVertex function.
void setLength(const uint64_t len) override
void setLemma(const Lima::LimaString &lemma)
bool operator==(const BoWToken &) const
redefine equality
BoWToken & operator=(const BoWToken &tok)
static void setUseOnlyLemma(const bool b)
uint64_t getVertex() const
uint64_t getPosition(void) const override
bool operator!=(const BoWToken &) const
redefine inequality as negation of equality.
static bool getUseOnlyLemma()
uint64_t getLength(void) const override
friend class BoWTokenPrivate
virtual std::string getOutputUTF8String(const Common::PropertyCode::PropertyManager *macroManager=0) const override
get a string of the BoWToken for output function
virtual Lima::LimaString getInflectedForm(void) const
virtual void addToPosition(const uint64_t offset)
add the offset to the position of the token
virtual BoWToken * clone() const override
virtual Common::Misc::PositionLengthList getPositionLengthList() const
get the list of (position,length) couples of the elements of the token (if several)
virtual Lima::LimaString getString(void) const override
static void setCompoundSeparator(const LimaChar c)
virtual Lima::LimaString getLemma(void) const
void setInflectedForm(const Lima::LimaString &inflectedForm)
virtual BoWType getType() const override
Provide tools to manage a specific property.
const std::string & getPropertySymbolicValue(const LinguisticCode &value) const
The coded property value can hold several property data.
std::string toString() const
static LinguisticCode fromString(const std::string &str)
LIMA_BOW_EXPORT uint8_t toInt(const BoWType &bt)
BoWType
enum to characterize the type of the AbstractBoWElement
@ BOW_NOTYPE
the AbstractBoWElement is an abstract one that should not be instanciated
@ BOW_TERM
the AbstractBoWElement is a multi-term
@ BOW_NAMEDENTITY
the AbstractBoWElement is a named entity
@ BOW_TOKEN
the AbstractBoWElement is a simple token
@ BOW_PREDICATE
the AbstractBoWElement is a predicate (n-ary relation, template or semantic frame
T & operator<<(T &qd, const BoWType &bt)
std::vector< std::pair< Position, Length > > PositionLengthList
std::string limastring2utf8stdstring(const Lima::LimaString &phrase, uint32_t size0)
Convert a wide string to a string , in dest up to size bytes.
LimaString utf8stdstring2limastring(const std::string &src)