27namespace LinguisticProcessing {
42m_entityName(complement),
53 if (m_annotationData==0)
56 LERROR <<
"no annotation graph available !";
64 uint64_t nbEntities(0);
65 if (m_annotationData!=0) {
67 bool isPosGraph=(anagraph->
getGraphId()==
"PosGraph");
74 std::queue<LinguisticGraphVertex> toVisit;
75 std::set<LinguisticGraphVertex> visited;
83 while (!toVisit.empty()) {
86 if (last || v == lastVertex) {
93 for (boost::tie(outItr,outItrEnd)=out_edges(v,*graph); outItr!=outItrEnd; outItr++)
96 if (visited.find(next)==visited.end())
109 if (isVertexInPosGraphAnEntityOfType(v, m_annotationData, m_entityType)) {
113 if (isAnEntityOfType(v, m_annotationData, m_entityType,
"AnalysisGraph")) {
122 oss << m_entityName <<
"_" << nbEntities;
126bool SegmentFeatureEntity::
130 const std::string& graphId)
const
132 std::set< AnnotationGraphVertex > matches = annotationData->
matches(graphId,v,
"annot");
133 for (std::set< AnnotationGraphVertex >::const_iterator it = matches.begin();
134 it != matches.end(); it++)
141 pointerValue<SpecificEntities::SpecificEntityAnnotation>();
151bool SegmentFeatureEntity::
158 std::set< AnnotationGraphVertex > anaVertices = annotationData->
matches(
"PosGraph",v,
"AnalysisGraph");
160 for (std::set< AnnotationGraphVertex >::const_iterator anaVerticesIt = anaVertices.begin();
161 anaVerticesIt != anaVertices.end(); anaVerticesIt++)
163 if (isAnEntityOfType(*anaVerticesIt,annotationData,type,
"AnalysisGraph")) {
169 if (isAnEntityOfType(v,annotationData,type,
"PosGraph")) {
185 string::size_type i=complement.find(
",");
186 if (i==string::npos) {
188 LERROR <<
"No data name provided for entityInData";
189 m_entityName=complement;
192 m_entityName=string(complement,0,i);
193 m_dataName=string(complement,i+1);
204 if (resultData == 0) {
206 LERROR <<
"no data " << m_data <<
"in AnalysisContent";
211 LERROR <<
"data " << m_data <<
"in AnalysisContent is not a RecognizerResultData";
223 uint64_t nbEntities(0);
224 for (ApplyRecognizer::RecognizerResultData::const_iterator it=m_data->begin(),it_end=m_data->end();
226 for (std::vector< Automaton::RecognizerMatch >::const_iterator m=(*it).begin(),
227 m_end=(*it).end(); m!=m_end; m++) {
228 if ((*m).getType()==m_entityType &&
236 oss << m_entityName <<
"_" << nbEntities;
266 for (vector<Segment>::const_iterator it=m_segmData->
getSegments().begin(),
267 it_end=m_segmData->
getSegments().end();it!=it_end;it++) {
275 oss <<
"rank_" << rank;
287 string::size_type i=complement.find(
"=");
288 if (i==string::npos) {
293 m_propertyName=string(complement,0,i);
294 m_propertyValue=string(complement,i+1);
313 if (m_propertyAccessor==0) {
323 std::queue<LinguisticGraphVertex> toVisit;
324 std::set<LinguisticGraphVertex> visited;
332 while (!toVisit.empty()) {
335 if (last || v == lastVertex) {
342 for (boost::tie(outItr,outItrEnd)=out_edges(v,*graph); outItr!=outItrEnd; outItr++)
345 if (visited.find(next)==visited.end())
347 visited.insert(next);
357 if (isProperty(v, graph, m_value)) {
364 oss << m_propertyValue <<
"_" << nbProp;
368bool SegmentFeatureCheckProperty::
374 for (MorphoSyntacticData::const_iterator m=data->begin(),m_end=data->end();m!=m_end;m++)
377 if (code==propertyValue) {
390 m_segmentData=complement;
414 std::string segmentType;
417 for (std::vector<Segment>::const_iterator s=(m_data->
getSegments()).begin(),s_end=(m_data->
getSegments()).end();s!=s_end;s++)
420 segmentType=(*s).getType();
424 if (segmentType.empty()) {
428 oss << segmentType <<
"_1";
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 SegmentFeatureRank_ID
#define SegmentFeatureEntity_ID
#define SegmentFeatureCheckProperty_ID
#define SegmentFeatureInSegment_ID
#define SegmentFeatureEntityInData_ID
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
std::shared_ptr< AnalysisData > getData(const QString &id)
return AnalysisData by id
just for semantics: base class for analysisData
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
LinguisticCode readValue(const LinguisticCode &code) const
read a property in a coded int.
Provide tools to parse a property file, and deal with the property coding system.
const PropertyManager & getPropertyManager(const std::string &propertyName) const
Get the PropertyManager associated to a property.
const PropertyAccessor & getPropertyAccessor(const std::string &propertyName) const
Get the PropertyAccessor associated to a property.
Provide tools to manage a specific property.
LinguisticCode getPropertyValue(const std::string &symbolicValue) const
Get the coded property value from the symbolic value.
An AnalysisData containing a LinguisticGraph with a language and an id.
const std::string & getGraphId(void) const
const LinguisticGraphVertex & lastVertex(void) const
Returns the last vertex of the graph.
const LinguisticGraph * getGraph(void) const
Returns the underlying graph structure.
Holds morphosyntactic informations.
void update(const AnalysisContent &analysis)
std::string getValue(const LinguisticAnalysisStructure::AnalysisGraph *graph, const Segment &seg) const
SegmentFeatureCheckProperty(MediaId language, const std::string &complement="")
void update(const AnalysisContent &analysis)
SegmentFeatureEntityInData(MediaId language, const std::string &complement="")
std::string getValue(const LinguisticAnalysisStructure::AnalysisGraph *graph, const Segment &seg) const
std::string getValue(const LinguisticAnalysisStructure::AnalysisGraph *graph, const Segment &seg) const
void update(const AnalysisContent &analysis)
SegmentFeatureEntity(MediaId language, const std::string &complement="")
std::string getValue(const LinguisticAnalysisStructure::AnalysisGraph *graph, const Segment &seg) const
SegmentFeatureInSegment(MediaId language, const std::string &complement="")
void update(const AnalysisContent &analysis)
std::string getValue(const LinguisticAnalysisStructure::AnalysisGraph *graph, const Segment &seg) const
void update(const AnalysisContent &analysis)
SegmentFeatureRank(MediaId language, const std::string &complement="")
LinguisticGraphVertex getFirstVertex() const
uint64_t getPosBegin() const
uint64_t getPosEnd() const
LinguisticGraphVertex getLastVertex() const
uint64_t getLength() const
const std::vector< Segment > & getSegments() const
A representation of a specific entity to store in the annotation graph.
Common::MediaticData::EntityType getType() const
static const MediaticData & single()
const singleton accessor
AnnotationGraph::vertex_descriptor AnnotationGraphVertex
bool hasAnnotation(AnnotationGraphVertex v, const LimaString &annot) const
LimaString utf8stdstring2limastring(const std::string &src)
SegmentFeatureExtractorFactory< SegmentFeatureEntity > SegmentFeatureEntityFactory(SegmentFeatureEntity_ID)
SegmentFeatureExtractorFactory< SegmentFeatureRank > SegmentFeatureRankFactory(SegmentFeatureRank_ID)
SegmentFeatureExtractorFactory< SegmentFeatureCheckProperty > SegmentFeatureCheckPropertyFactory(SegmentFeatureCheckProperty_ID)
SegmentFeatureExtractorFactory< SegmentFeatureInSegment > SegmentFeatureInSegmentFactory(SegmentFeatureInSegment_ID)
SegmentFeatureExtractorFactory< SegmentFeatureEntityInData > SegmentFeatureEntityInDataFactory(SegmentFeatureEntityInData_ID)