LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
Lima::Common::BagOfWords::BoWComplexToken Class Referenceabstract

This is a complex token for an index. More...

#include <linguisticProcessing/common/BagOfWords/bowComplexToken.h>

Inheritance diagram for Lima::Common::BagOfWords::BoWComplexToken:
Lima::Common::BagOfWords::BoWToken Lima::Common::BagOfWords::AbstractBoWElement Lima::Common::BagOfWords::BoWNamedEntity Lima::Common::BagOfWords::BoWTerm

Classes

class  Part
 This class represents a part of a ComplexToken : it is composed of a pointer on the actual part (a BoWToken), and a boolean that says if the BoWToken is also in the global list (the BoWText) or not. More...
 

Public Member Functions

 BoWComplexToken ()
 
 BoWComplexToken (const Lima::LimaString &lemma, const LinguisticCode category, const uint64_t position, const uint64_t length)
 
 BoWComplexToken (const Lima::LimaString &lemma, const LinguisticCode category, const uint64_t position, const uint64_t length, std::deque< boost::shared_ptr< Lima::Common::BagOfWords::BoWToken > > &parts, const uint64_t head)
 a constructor to build a simple, independent complex token (parts are simple tokens, not listed elsewhere in a BoWText)
 
virtual ~BoWComplexToken ()
 
virtual void clear () override
 
virtual Lima::LimaString getLemma (void) const override
 
virtual Lima::LimaString getInflectedForm (void) const override
 
BoWComplexToken & operator= (const BoWComplexToken &)
 
bool operator== (const BoWComplexToken &)
 
uint64_t size (void) const override
 size is the number of parts in the token
 
std::deque< Part > & getParts (void)
 
const std::deque< Part > & getParts (void) const
 
std::deque< Part >::iterator getPartsIterator (void)
 
const std::deque< Part >::const_iterator getPartsIterator (void) const
 
boost::shared_ptr< BoWToken > addPart (boost::shared_ptr< BoWToken > tok, const bool isHead=false)
 add a part in the list of parts of the complex token.
 
boost::shared_ptr< BoWToken > addPart (boost::shared_ptr< BoWRelation > rel, boost::shared_ptr< BoWToken > tok, const bool isHead=false)
 add a part in the list of parts of the complex token.
 
uint64_t getHead () const
 add a part in the list of parts of the complex token.
 
void setHead (const uint64_t)
 
virtual BoWType getType () const override=0
 
std::string getUTF8StringParts (const Common::PropertyCode::PropertyManager *macroManager=0) const
 
std::string getstdstringParts () const
 
virtual Common::Misc::PositionLengthList getPositionLengthList () const override
 get the list of (position,length) couples of the elements of the token (if several)
 
void addToPosition (const uint64_t offset) override
 add the offset to the positions of the token and of each of its parts (recusrively)
 
virtual std::set< uint64_t > getVertices () const override
 returns the vertices of all its parts
 
- Public Member Functions inherited from Lima::Common::BagOfWords::BoWToken
 BoWToken (const Lima::LimaString &lemma, const LinguisticCode category, const uint64_t position, const uint64_t length)
 
 BoWToken (const Lima::LimaString &str, const uint64_t position=0, const uint64_t length=0)
 
 BoWToken (const BoWToken &tok)
 
 BoWToken ()
 
virtual ~BoWToken ()
 
virtual BoWToken * clone () const override
 
LinguisticCode getCategory (void) const
 
uint64_t getPosition (void) const override
 
uint64_t getLength (void) const override
 
void setLemma (const Lima::LimaString &lemma)
 
void setInflectedForm (const Lima::LimaString &inflectedForm)
 
void setCategory (LinguisticCode c)
 
void setPosition (const uint64_t pos) override
 
void setLength (const uint64_t len) override
 
virtual Lima::LimaString getString (void) const override
 
uint64_t getVertex () const
 
void setVertex (uint64_t vertex)
 
virtual std::string getOutputUTF8String (const Common::PropertyCode::PropertyManager *macroManager=0) const override
 get a string of the BoWToken for output function
 
virtual std::string getIdUTF8String () const override
 function used to identify a bowtoken in a text (used in BowDumper)
 
bool operator== (const BoWToken &) const
 redefine equality
 
bool operator!= (const BoWToken &) const
 redefine inequality as negation of equality.
 
- Public Member Functions inherited from Lima::Common::BagOfWords::AbstractBoWElement
 AbstractBoWElement ()
 
virtual ~AbstractBoWElement ()
 

Protected Member Functions

 BoWComplexToken (BoWComplexTokenPrivate &d)
 
- Protected Member Functions inherited from Lima::Common::BagOfWords::BoWToken
 BoWToken (BoWTokenPrivate &d)
 
BoWToken & operator= (const BoWToken &tok)
 
bool operator== (const BoWToken &tok)
 

Friends

class BoWComplexTokenPrivate
 

Additional Inherited Members

- Static Public Member Functions inherited from Lima::Common::BagOfWords::BoWToken
static void setInternalSeparator (const LimaChar c)
 
static void setCompoundSeparator (const LimaChar c)
 
static LimaChar getInternalSeparator ()
 
static LimaChar getCompoundSeparator ()
 
static void setUseOnlyLemma (const bool b)
 
static bool getUseOnlyLemma ()
 
- Protected Attributes inherited from Lima::Common::BagOfWords::BoWToken
BoWTokenPrivate * m_d
 

Detailed Description

This is a complex token for an index.

It is made of a collection of BoWTokens's, one of which is the head of the token.

Author
Romaric Besancon

Definition at line 42 of file bowComplexToken.h.

Constructor & Destructor Documentation

◆ BoWComplexToken() [1/4]

Lima::Common::BagOfWords::BoWComplexToken::BoWComplexToken ( )

Definition at line 95 of file bowComplexToken.cpp.

◆ BoWComplexToken() [2/4]

Lima::Common::BagOfWords::BoWComplexToken::BoWComplexToken ( const Lima::LimaString &  lemma,
const LinguisticCode  category,
const uint64_t  position,
const uint64_t  length 
)

◆ BoWComplexToken() [3/4]

Lima::Common::BagOfWords::BoWComplexToken::BoWComplexToken ( const Lima::LimaString &  lemma,
const LinguisticCode  category,
const uint64_t  position,
const uint64_t  length,
std::deque< boost::shared_ptr< Lima::Common::BagOfWords::BoWToken > > &  parts,
const uint64_t  head 
)

a constructor to build a simple, independent complex token (parts are simple tokens, not listed elsewhere in a BoWText)

Parameters
lemmathe lemma of the complex token
categorythe category of the complex token
positionthe position of the complex token
lengththe length of the complex token
partsa deque containing the simple tokens forming the parts of the complex token
inthead the index of the head token in the preceding list
Returns

◆ ~BoWComplexToken()

Lima::Common::BagOfWords::BoWComplexToken::~BoWComplexToken ( )
virtual

Definition at line 140 of file bowComplexToken.cpp.

◆ BoWComplexToken() [4/4]

Lima::Common::BagOfWords::BoWComplexToken::BoWComplexToken ( BoWComplexTokenPrivate &  d)
protected

Definition at line 136 of file bowComplexToken.cpp.

Member Function Documentation

◆ addPart() [1/2]

boost::shared_ptr< BoWToken > Lima::Common::BagOfWords::BoWComplexToken::addPart ( boost::shared_ptr< BoWRelation >  rel,
boost::shared_ptr< BoWToken >  tok,
const bool  isHead = false 
)

add a part in the list of parts of the complex token.

Have to specify if the token forming the part exists as a proper token or only as a part: in the first case, the pointer is added in the part list, in the second case, a pointer on a copy of the token is added in the list.

Parameters
rela pointer on the BoWRelation linking the part to add to the head or the other parts
toka pointer on the BoWToken forming the part to add
isInLista boolean indicating, if true, that the BoWToken pointed has an existence outside of the part list
isHeada boolean indicating that the BoWToken a

Definition at line 257 of file bowComplexToken.cpp.

◆ addPart() [2/2]

boost::shared_ptr< BoWToken > Lima::Common::BagOfWords::BoWComplexToken::addPart ( boost::shared_ptr< BoWToken >  tok,
const bool  isHead = false 
)

add a part in the list of parts of the complex token.

Have to specify if the token forming the part exists as a proper token or only as a part: in the first case, the pointer is added in the part list, in the second case, a pointer on a copy of the token is added in the list.

Parameters
toka pointer on the BoWToken forming the part to add
isInLista boolean indicating, if true, that the BoWToken pointed has an existence outside of the part list
isHeada boolean indicating that the BoWToken a

Definition at line 250 of file bowComplexToken.cpp.

◆ addToPosition()

void Lima::Common::BagOfWords::BoWComplexToken::addToPosition ( const uint64_t  offset)
overridevirtual

add the offset to the positions of the token and of each of its parts (recusrively)

Parameters
offsetthe offset to add to all positions

Reimplemented from Lima::Common::BagOfWords::BoWToken.

Definition at line 367 of file bowComplexToken.cpp.

◆ clear()

void Lima::Common::BagOfWords::BoWComplexToken::clear ( )
overridevirtual

Reimplemented from Lima::Common::BagOfWords::BoWToken.

Definition at line 280 of file bowComplexToken.cpp.

◆ getHead()

uint64_t Lima::Common::BagOfWords::BoWComplexToken::getHead ( ) const

add a part in the list of parts of the complex token.

A pointer on a copy of tok is added in the list.

Parameters
toka pointer on the BoWToken forming the part to be copied and added
isHeada boolean indicating that the BoWToken is the head of the complex token it is part of add a part in the list of parts of the complex token. A pointer on a copy of tok is added in the list.
rela pointer on the BoWRelation linking the part to copy and add to the head or the other parts
toka pointer on the BoWToken forming the part to be copied and added
isHeada boolean indicating that the BoWToken is the head of the complex token it is part of

Definition at line 210 of file bowComplexToken.cpp.

◆ getInflectedForm()

LimaString Lima::Common::BagOfWords::BoWComplexToken::getInflectedForm ( void  ) const
overridevirtual

Reimplemented from Lima::Common::BagOfWords::BoWToken.

Definition at line 317 of file bowComplexToken.cpp.

◆ getLemma()

LimaString Lima::Common::BagOfWords::BoWComplexToken::getLemma ( void  ) const
overridevirtual

Reimplemented from Lima::Common::BagOfWords::BoWToken.

Definition at line 299 of file bowComplexToken.cpp.

◆ getParts() [1/2]

std::deque< BoWComplexToken::Part > & Lima::Common::BagOfWords::BoWComplexToken::getParts ( void  )

Definition at line 187 of file bowComplexToken.cpp.

◆ getParts() [2/2]

const std::deque< BoWComplexToken::Part > & Lima::Common::BagOfWords::BoWComplexToken::getParts ( void  ) const

Definition at line 193 of file bowComplexToken.cpp.

◆ getPartsIterator() [1/2]

std::deque< BoWComplexToken::Part >::iterator Lima::Common::BagOfWords::BoWComplexToken::getPartsIterator ( void  )

Definition at line 199 of file bowComplexToken.cpp.

◆ getPartsIterator() [2/2]

const std::deque< BoWComplexToken::Part >::const_iterator Lima::Common::BagOfWords::BoWComplexToken::getPartsIterator ( void  ) const

Definition at line 205 of file bowComplexToken.cpp.

◆ getPositionLengthList()

Common::Misc::PositionLengthList Lima::Common::BagOfWords::BoWComplexToken::getPositionLengthList ( ) const
overridevirtual

get the list of (position,length) couples of the elements of the token (if several)

Returns

Reimplemented from Lima::Common::BagOfWords::BoWToken.

Definition at line 352 of file bowComplexToken.cpp.

◆ getstdstringParts()

std::string Lima::Common::BagOfWords::BoWComplexToken::getstdstringParts ( ) const

Definition at line 402 of file bowComplexToken.cpp.

◆ getType()

virtual BoWType Lima::Common::BagOfWords::BoWComplexToken::getType ( ) const
overridepure virtual

◆ getUTF8StringParts()

std::string Lima::Common::BagOfWords::BoWComplexToken::getUTF8StringParts ( const Common::PropertyCode::PropertyManager *  macroManager = 0) const

Definition at line 379 of file bowComplexToken.cpp.

◆ getVertices()

std::set< uint64_t > Lima::Common::BagOfWords::BoWComplexToken::getVertices ( ) const
overridevirtual

returns the vertices of all its parts

Returns
the vertices of all its parts

Reimplemented from Lima::Common::BagOfWords::BoWToken.

Reimplemented in Lima::Common::BagOfWords::BoWNamedEntity.

Definition at line 420 of file bowComplexToken.cpp.

◆ operator=()

BoWComplexToken & Lima::Common::BagOfWords::BoWComplexToken::operator= ( const BoWComplexToken &  t)

Definition at line 146 of file bowComplexToken.cpp.

◆ operator==()

bool Lima::Common::BagOfWords::BoWComplexToken::operator== ( const BoWComplexToken &  t)

Definition at line 155 of file bowComplexToken.cpp.

◆ setHead()

void Lima::Common::BagOfWords::BoWComplexToken::setHead ( const uint64_t  i)

Definition at line 215 of file bowComplexToken.cpp.

◆ size()

uint64_t Lima::Common::BagOfWords::BoWComplexToken::size ( void  ) const
overridevirtual

size is the number of parts in the token

Reimplemented from Lima::Common::BagOfWords::BoWToken.

Definition at line 337 of file bowComplexToken.cpp.

Friends And Related Symbol Documentation

◆ BoWComplexTokenPrivate

friend class BoWComplexTokenPrivate
friend

Definition at line 44 of file bowComplexToken.h.


The documentation for this class was generated from the following files: