42 for (std::deque<BoWComplexToken::Part>::const_iterator i=bctp.
m_parts.begin(); i!=bctp.
m_parts.end(); i++) {
44 addPart((*i).getBoWRelation(),(*i).getBoWToken());
53 const uint64_t position,
54 const uint64_t length):
63 const uint64_t position,
64 const uint64_t length,
65 std::deque< boost::shared_ptr< BoWToken > >& parts,
67BoWTokenPrivate(lemma, category, position, length),
71 for (
auto i = parts.begin(); i != parts.end(); i++) {
72 addPart(boost::shared_ptr< BoWRelation >(),*i);
102 const uint64_t position,
103 const uint64_t length):
114 const uint64_t position,
115 const uint64_t length,
116 std::deque< boost::shared_ptr< BoWToken > >& parts,
117 const uint64_t head):
118 BoWToken(*new BoWComplexTokenPrivate())
125 for (
auto i = parts.begin(); i != parts.end(); i++)
127 addPart(boost::shared_ptr< BoWRelation >(), *i);
177 for (std::deque<BoWComplexToken::Part>::const_iterator i(t.
getParts().begin());
179 boost::shared_ptr< BoWRelation > rel = (*i).get<0>();
192const std::deque<BoWComplexToken::Part>&
198std::deque<BoWComplexToken::Part>::iterator
204const std::deque<BoWComplexToken::Part>::const_iterator
220 boost::shared_ptr< BoWToken > tok,
242 else if (tok->getPosition() > (previousPosition +
m_length))
244 m_length = tok->getPosition() - previousPosition + tok->getLength();
253 return addPart(boost::shared_ptr< BoWRelation >(), tok, isHead);
258 boost::shared_ptr< BoWToken > tok,
307 for (uint64_t i=0; i < static_cast<BoWComplexTokenPrivate *>(
m_d)->m_parts.size(); i++)
325 for (uint64_t i=0; i < static_cast<BoWComplexTokenPrivate *>(
m_d)->m_parts.size(); i++)
342 for (std::deque<BoWComplexToken::Part>::const_iterator
344 nbParts+=(*part).getBoWToken()->size();
357 poslenlist.insert(poslenlist.end(),partposlen.begin(),partposlen.end());
371 (*part).getBoWToken()->addToPosition(offset);
382 std::ostringstream oss;
384 for (uint64_t i(0); i<static_cast<BoWComplexTokenPrivate *>(
m_d)->m_parts.size(); i++) {
390 oss << static_cast<BoWComplexTokenPrivate *>(
m_d)->m_parts[i].getBoWRelation()->getOutputUTF8String();
392 oss << static_cast<BoWComplexTokenPrivate *>(
m_d)->m_parts[i].getBoWToken()->getOutputUTF8String(macroManager);
404 std::ostringstream oss;
406 for (uint64_t i(0); i<static_cast<BoWComplexTokenPrivate *>(
m_d)->m_parts.size(); i++) {
412 oss << *(static_cast<BoWComplexTokenPrivate *>(
m_d)->m_parts[i].getBoWRelation());
414 oss << *(static_cast<BoWComplexTokenPrivate *>(
m_d)->m_parts[i].getBoWToken());
422 std::set< uint64_t > result;
423 for (uint64_t i(0); i<static_cast<BoWComplexTokenPrivate *>(
m_d)->m_parts.size(); i++)
425 if (boost::dynamic_pointer_cast< BoWComplexToken >(
static_cast<BoWComplexTokenPrivate *
>(
m_d)->m_parts[i].get<1>()) != 0)
427 std::set< uint64_t > partResult = boost::dynamic_pointer_cast< BoWComplexToken >(
static_cast<BoWComplexTokenPrivate *
>(
m_d)->m_parts[i].get<1>())->getVertices();
428 result.insert(partResult.begin(), partResult.end());
void copy(const BoWComplexToken &a)
boost::shared_ptr< BoWToken > addPart(boost::shared_ptr< BoWRelation > rel, boost::shared_ptr< BoWToken > tok, const bool isHead=false)
std::deque< BoWComplexToken::Part > m_parts
the list of the parts of the complex token
virtual ~BoWComplexTokenPrivate()
uint64_t m_head
the index of the head of the complex token in its part list
This class represents a part of a ComplexToken : it is composed of a pointer on the actual part (a Bo...
This is a complex token for an index.
std::string getstdstringParts() const
virtual void clear() override
virtual Lima::LimaString getLemma(void) const override
virtual Lima::LimaString getInflectedForm(void) const override
virtual ~BoWComplexToken()
bool operator==(const BoWComplexToken &)
virtual Common::Misc::PositionLengthList getPositionLengthList() const override
get the list of (position,length) couples of the elements of the token (if several)
uint64_t getHead() const
add a part in the list of parts of the complex token.
uint64_t size(void) const override
size is the number of parts in the token
void addToPosition(const uint64_t offset) override
add the offset to the positions of the token and of each of its parts (recusrively)
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.
void setHead(const uint64_t)
BoWComplexToken & operator=(const BoWComplexToken &)
std::deque< Part >::iterator getPartsIterator(void)
std::string getUTF8StringParts(const Common::PropertyCode::PropertyManager *macroManager=0) const
friend class BoWComplexTokenPrivate
std::deque< Part > & getParts(void)
virtual std::set< uint64_t > getVertices() const override
returns the vertices of all its parts
static LimaChar m_separator
static LimaChar m_compoundSeparator
static bool m_useOnlyLemma
LinguisticCode m_category
Lima::LimaString m_inflectedForm
This class contains the representation of an element of the bag of words.
static LimaChar getCompoundSeparator()
bool operator==(const BoWToken &) const
redefine equality
BoWToken & operator=(const BoWToken &tok)
uint64_t getVertex() const
Provide tools to manage a specific property.
std::vector< std::pair< Position, Length > > PositionLengthList