25namespace LinguisticProcessing {
50 LDEBUG <<
"Segment::Segment :"<< begin << end;
60 boost::tie(it, it_end) = boost::out_edges(begin, *graph);
61 for (; it != it_end; it++)
67 LDEBUG <<
"Warning: empty segment";
75 if (foundPos && position!=t->
position())
78 LWARN <<
"Warning: conflicting position for alternative vertices";
89 LDEBUG <<
"Warning: no token for vertex v after begin:" << v;
100 LERROR <<
"Error: cannot find position of begin vertex "
101 << begin <<
" for segmentation data";
108 uint64_t positionEnd(0);
109 bool foundPosEnd(
false);
113 boost::tie(pit, pit_end) = boost::in_edges(end, *graph);
114 for (; pit != pit_end; pit++)
130 LWARN <<
"Warning: conflicting position for alternative vertices";
141 LWARN <<
"Warning: no token for vertex before end" << v;
154 LWARN <<
"Warning: conflicting position for alternative vertices";
165 LWARN <<
"Warning: no token for vertex end" << end;
171 LDEBUG <<
"Segment::Segment m_length = "<< positionEnd <<
"-" << m_posBegin <<
"+1";
173 m_length=positionEnd-m_posBegin+1;
178 LERROR <<
"Error: cannot determine length of segment for segmentation data ("
179 << begin <<
"," << end <<
")";
182 LDEBUG <<
"Segment::Segment :"<< m_begin << m_end << m_posBegin << m_length;
206 uint64_t posEnd=posBegin+length;
208 std::queue<std::pair<LinguisticGraphVertex,LinguisticGraphVertex> > toVisit;
209 std::set<LinguisticGraphVertex> visited;
216 toVisit.push(make_pair(anagraph->
firstVertex(),0));
219 while (!toVisit.empty())
221 auto v = toVisit.front();
228 bool endIsNextVertex(
false);
244 endIsNextVertex =
true;
250 for (boost::tie(outItr,outItrEnd)=out_edges(v.first,*graph);
251 outItr != outItrEnd; outItr++)
259 if (visited.find(next)==visited.end())
261 visited.insert(next);
262 toVisit.push(make_pair(next,v.first));
290 os <<
"Segment(posBegin="<<seg.m_posBegin
291 <<
", length="<<seg.m_length
292 <<
", type="<<seg.m_type
293 <<
", begin="<<seg.m_begin
294 <<
", end="<<seg.m_end
301 os <<
"Segment(posBegin="<<seg.m_posBegin
302 <<
", length="<<seg.m_length
303 <<
", type="<<seg.m_type
304 <<
", begin="<<seg.m_begin
305 <<
", end="<<seg.m_end
333 LDEBUG <<
"SegmentationData::add trying to add empty segment: ignored";
339 auto it = lower_bound( m_segments.begin(),m_segments.end(),s);
341 m_segments.insert(it,s);
LinguisticGraph::in_edge_iterator LinguisticGraphInEdgeIt
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
LinguisticGraph::out_edge_iterator LinguisticGraphOutEdgeIt
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, LinguisticVertexProperties > LinguisticGraph
Property to identify the chains in the graph.
#define SEGMENTATIONLOGINIT
An AnalysisData containing a LinguisticGraph with a language and an id.
const LinguisticGraphVertex & lastVertex(void) const
Returns the last vertex of the graph.
const LinguisticGraph * getGraph(void) const
Returns the underlying graph structure.
const LinguisticGraphVertex & firstVertex(void) const
Returns the first vertex of the graph.
holds surface data of a token
uint64_t position() const
void setVerticesFromPositions(uint64_t posBegin, uint64_t length, LinguisticAnalysisStructure::AnalysisGraph *anagraph)
LinguisticGraphVertex getFirstVertex() const
uint64_t getPosBegin() const
bool operator<(const Segment &s) const
void addSegment(const Segment &s)
const std::string & getType() const
uint64_t getPosEnd() const
Segment(const std::string &type)
LinguisticGraphVertex getLastVertex() const
uint64_t getLength() const
void add(const Segment &s)
SegmentationData(const std::string &sourceGraph="")
std::ostream & operator<<(std::ostream &os, const ChainIdStruct &ids)