31namespace LinguisticProcessing
34namespace EventAnalysis
69 std::set< AnnotationGraphVertex > matches = annotationData->
matches(graphId,v,
"annot");
70 for (std::set< AnnotationGraphVertex >::const_iterator it = matches.begin();
71 it != matches.end(); it++)
96 if (m_otherentities.find(t)!=m_otherentities.end())
101 if (m_evententities.first==t && m_evententities.second.size()> 0)
return true;
108 std::pair<Common::MediaticData::EntityType,std::deque<LinguisticGraphVertex> > event_pair= p->
getEventEntities();
111 LDEBUG <<
"EventParagraph::addEventEntities EventEntitie type " << event_pair.first;
112 std::vector<Entity *> v_entity;
113 for(std::deque<LinguisticGraphVertex>::const_iterator iT= event_pair.second.begin(); iT != event_pair.second.end();iT++)
122 v_entity.push_back(e);
124 m_evententities=make_pair(event_pair.first,v_entity);
129 std::map<Common::MediaticData::EntityType,std::deque<LinguisticGraphVertex> > map_entities= p->
getOtherEntities();
130 for(std::map<
Common::MediaticData::EntityType,std::deque<LinguisticGraphVertex> >::const_iterator iT1 = map_entities.begin(); iT1!=map_entities.end(); iT1++)
132 std::vector<Entity *> v_entity;
133 for(std::deque<LinguisticGraphVertex>::const_iterator iT= iT1->second.begin(); iT != iT1->second.end();iT++)
142 v_entity.push_back(e);
144 m_otherentities[iT1->first]=v_entity;
151 m_evententities.first=type;
152 m_evententities.second.push_back(entity);
157 m_otherentities[type].push_back(entity);
167 m_evententities.first=t;
169 for (
int i=0; i< size; i++)
173 m_evententities.second.push_back(e);
176 for (
int i=0; i< other_size; i++)
182 std::vector<Entity*> v;
183 for (
int j=0; j< to_size; j++)
189 m_otherentities[to]=v;
196 LDEBUG <<
"EventParagraph::write()..";
199 LDEBUG <<
"EventParagraph::write: write typeId of m_evententities..."
200 << m_evententities.first.getTypeId();
202 LDEBUG <<
"EventParagraph::write: write groupId of m_evententities..."
203 << m_evententities.first.getGroupId();
206 for(std::vector<Entity*>::const_iterator iT=m_evententities.second.begin();iT!=m_evententities.second.end();iT++)
208 LDEBUG <<
"EventParagraph::write m_evententities";
211 LDEBUG <<
"EventParagraph::write size of m_otherentities (" << m_otherentities.size() <<
")....";
213 for(std::map<
EntityType,std::vector<Entity *> >::const_iterator iT=m_otherentities.begin();
214 iT!=m_otherentities.end();iT++)
216 LDEBUG <<
"EventParagraph::write m_otherentity....";
220 for(std::vector<Entity *>::const_iterator iT2 =(*iT).second.begin();iT2!=(*iT).second.end();iT2++)
234 for(std::vector<Entity *>::const_iterator iT=m_evententities.second.begin();iT!=m_evententities.second.end();iT++)
236 if ((*iT)!=0)
delete (*iT);
238 m_evententities.second.clear();
242 for(std::vector<Entity *>::const_iterator iT=(*iTm).second.begin();iT!=(*iTm).second.end();iT++)
244 if ((*iT)!=0)
delete (*iT);
247 m_otherentities.clear();
255 std::ostringstream oss;
256 oss <<
"<rdf:rdf xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\""
257 <<
" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"" << std::endl;
258 oss <<
"<dc:creator>CEA LIST Specific entities extraction service</dc:creator>";
263 for(std::vector<Entity *>::const_iterator iT=m_evententities.second.begin();iT!=m_evententities.second.end();iT++)
271 for(std::vector<Entity *>::const_iterator iT=(*iTm).second.begin();iT!=(*iTm).second.end();iT++)
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, LinguisticVertexProperties > LinguisticGraph
Property to identify the chains in the graph.
#define EVENTANALYZERLOGINIT
#define EVENTANALYSISLOGINIT
Holds an annotation graph and gives an API to manipulate it.
std::set< AnnotationGraphVertex > matches(const std::string &first, AnnotationGraphVertex firstVx, const std::string &second) const
Gets the set of vertices matched in the second graph by the given vertex of the first graph.
const GenericAnnotation & annotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString &annot) const
a list of generic features: each feature is unique (only one feature for a name)
void setFeatures(Lima::LinguisticProcessing::Automaton::EntityFeatures features)
void setLength(uint64_t length)
virtual void read(std::istream &file)
void setPosition(uint64_t position)
virtual void write(std::ostream &file) const
bool has_entity(Common::MediaticData::EntityType t) const
std::string toString(std::string parentURI, uint64_t index, bool main) const
void addEventEntity(const Common::MediaticData::EntityType &type, Entity *entity)
virtual void read(std::istream &file)
virtual ~EventParagraph()
void addEntities(Paragraph *p, Common::AnnotationGraphs::AnnotationData *, std::string graphId, LinguisticGraph *graph)
void addEntity(const Common::MediaticData::EntityType &type, Entity *entity)
void addEventEntities(Paragraph *p, Common::AnnotationGraphs::AnnotationData *, std::string graphId, LinguisticGraph *graph)
This class represents a list of elements, that are pointers on polymmorphic annotations that can be d...
std::map< Common::MediaticData::EntityType, std::deque< LinguisticGraphVertex > > getOtherEntities() const
std::pair< Common::MediaticData::EntityType, std::deque< LinguisticGraphVertex > > getEventEntities() const
holds surface data of a token
uint64_t position() const
AnnotationGraph::vertex_descriptor AnnotationGraphVertex
bool hasAnnotation(AnnotationGraphVertex v, const LimaString &annot) const
int main(int argc, char *argv[])
uint64_t readCodedInt(std::istream &file)
read a integer coded in variable-byte format in a file
void writeCodedInt(std::ostream &file, const uint64_t number)
write a integer coded in variable-byte format in a file
LimaString utf8stdstring2limastring(const std::string &src)