45ConstraintFunctionFactory<isAlphaPossessive>
87 const TStatus& status = tokenMap[v]->status();
98 if (! complement.isEmpty()) {
99 m_type=Common::MediaticData::MediaticData::single().getEntityType(complement);
107 auto recoData = std::dynamic_pointer_cast<RecognizerData>(analysis.
getData(
"RecognizerData"));
108 auto annotationData = std::dynamic_pointer_cast< AnnotationData >(analysis.
getData(
"AnnotationData"));
109 if (annotationData == 0)
113 bool annotFound =
false;
116 std::set< AnnotationGraphVertex > matches = annotationData->matches(recoData->getGraphId(),v,
"annot");
117 for (std::set< AnnotationGraphVertex >::const_iterator it = matches.begin();
118 it != matches.end(); it++)
139 for (std::set< AnnotationGraphVertex >::const_iterator it = matches.begin();
140 it != matches.end(); it++)
142 if (annotationData->annotation(*it,
166 if (!str.isEmpty()) {
168 int j=str.indexOf(sep);
170 typeName=str.left(j);
178 LDEBUG <<
"CreateSpecificEntity: getting entity type "
191getPropertyManager(
"MICRO");
197 while (currentPos != str.size()+1)
199 int sepPos = str.indexOf(sep, currentPos);
207 m_microsToKeep.insert(micro);
209 currentPos = sepPos+1;
220 LDEBUG <<
"CreateSpecificEntity: create entity of type " << match.
getType() <<
" on vertices " << match;
222 if (match.empty())
return false;
229 auto syntacticData = std::dynamic_pointer_cast<SyntacticData>(analysis.
getData(
"SyntacticData"));
231 auto annotationData = std::dynamic_pointer_cast< AnnotationData >(analysis.
getData(
"AnnotationData"));
232 if (annotationData==0)
237 if (match.size() == 1)
242 std::set< AnnotationGraphVertex > matches = annotationData->matches(graph.
getGraphId(),v1,
"annot");
243 for (std::set< AnnotationGraphVertex >::const_iterator it = matches.begin();
244 it != matches.end(); it++) {
246 && annotationData->annotation(*it,
261 if (annotationData->dumpFunction(
"SpecificEntity") == 0)
266 auto rdata = analysis.
getData(
"RecognizerData");
269 LERROR <<
"CreateSpecificEntity: missing data RecognizerData: entity will not be created";
272 auto recoData = std::dynamic_pointer_cast<RecognizerData>(rdata);
275 LERROR <<
"CreateSpecificEntity: missing data RecognizerData: entity will not be created";
278 std::string graphId=recoData->getGraphId();
284 std::ostringstream oss;
287 LDEBUG <<
"CreateSpecificEntity: annot = " << oss.str();
308 StringsPoolIndex seFlex = annot.
getString();
324 elem.
lemma = seLemma;
328 if (! m_microsToKeep.empty()) {
330 LDEBUG <<
"CreateSpecificEntity, use micros from the rule ";
333 addMicrosToMorphoSyntacticData(newMorphData,dataHead,m_microsToKeep,elem);
337 LDEBUG <<
"CreateSpecificEntity, use micros from config file ";
343 if (seType.
getGroupId() ==
static_cast<EntityGroupId
>(0))
346 LERROR <<
"CreateSpecificEntity::operator() null group id:" << seType;
354 LDEBUG <<
"Entities resource name is : " << resourceName;
357 auto entityMicros = std::dynamic_pointer_cast<SpecificEntitiesMicros>(res);
358 auto micros = entityMicros->getMicros(seType);
360 if (logger.isDebugEnabled())
362 std::ostringstream oss;
363 for (std::set<LinguisticCode>::const_iterator it=micros->begin(),it_end=micros->end();it!=it_end;it++) {
366 LDEBUG <<
"CreateSpecificEntity, micros are " << oss.str();
369 addMicrosToMorphoSyntacticData(newMorphData,dataHead,*micros,elem);
374 LERROR <<
"CreateSpecificEntity: missing resource " << resourceName ;
388 TStatus tStatus = tokenMap[head]->status();
389 const TStatus& headTStatus = tokenMap[v2]->status();
395 if (newMorphData->empty())
398 LERROR <<
"CreateSpecificEntity::operator() Found no morphosyntactic data for new vertex. Abort.";
408 if (syntacticData != 0)
410 boost::tie (newVertex, newDepVertex) = syntacticData->addVertex();
414 newVertex = add_vertex(*lingGraph);
417 annotationData->addMatching(graphId, newVertex,
"annot", agv);
419 tokenMap[newVertex] = newToken;
420 dataMap[newVertex] = newMorphData;
422 LDEBUG <<
" - new vertex " << newVertex <<
"("<<graphId<<
"), " << newDepVertex
423 <<
"(dep), " << agv <<
"(annot) added";
432 Automaton::RecognizerMatch::const_iterator matchIt, matchIt_end;
433 matchIt = match.begin(); matchIt_end = match.end();
434 for (; matchIt != matchIt_end; matchIt++)
436 std::set< AnnotationGraphVertex > matches = annotationData->matches(graphId,(*matchIt).m_elem.first,
"annot");
440 LERROR <<
"CreateSpecificEntity::operator() No annotation 'annot' for" << (*matchIt).m_elem.first;
444 if( recoData->hasVertexAsEmbededEntity((*matchIt).m_elem.first) )
447 LDEBUG <<
"CreateSpecificEntity::operator(): vertex " << *(matches.begin()) <<
" is embeded";
457 std::vector< LinguisticGraphVertex > previous;
459 boost::tie(firstInEdgesIt, firstInEdgesIt_end) = in_edges(v1, *lingGraph);
460 std::set< std::pair<LinguisticGraphVertex,LinguisticGraphVertex > > newEdgesToRemove;
461 for (; firstInEdgesIt != firstInEdgesIt_end; firstInEdgesIt++)
464 previous.push_back(firstInVertex);
465 if (shouldRemoveInitial(source(*firstInEdgesIt, *lingGraph),target(*firstInEdgesIt, *lingGraph), match))
468 LDEBUG <<
" - storing edge " << source(*firstInEdgesIt, *lingGraph) <<
" -> "<<target(*firstInEdgesIt, *lingGraph) <<
" to be removed";
471 newEdgesToRemove.insert(std::make_pair(source(*firstInEdgesIt, *lingGraph),target(*firstInEdgesIt, *lingGraph)));
476 LDEBUG <<
" - do not store initial edge " << source(*firstInEdgesIt, *lingGraph) <<
" -> "<<target(*firstInEdgesIt, *lingGraph) <<
" to be removed";
480 std::vector< LinguisticGraphVertex >::iterator pit, pit_end;
481 pit = previous.begin(); pit_end = previous.end();
482 for (; pit != pit_end; pit++)
486 if (!recoData->isEdgeToBeRemoved(*pit, v1))
490 boost::tie(e, success) = add_edge(*pit, newVertex, *lingGraph);
494 LDEBUG <<
" - in edge " << e.m_source <<
" -> " << e.m_target <<
" added";
500 LERROR <<
" - in edge " << *pit <<
" ->" << newVertex <<
" NOT added";
506 LDEBUG <<
" - edge " << *pit <<
" - " << newVertex <<
" not added because " << *pit <<
" - " << v1 <<
" has to be removed";
510 std::set< std::pair<LinguisticGraphVertex,LinguisticGraphVertex > >::iterator newEdgesToRemoveIt = newEdgesToRemove.begin();
511 for (; newEdgesToRemoveIt != newEdgesToRemove.end(); newEdgesToRemoveIt++)
513 recoData->setEdgeToBeRemoved(analysis, edge( newEdgesToRemoveIt->first, newEdgesToRemoveIt->second, *lingGraph).first);
516 LDEBUG <<
" - in edges added";
522 LDEBUG <<
" there is " << out_degree(v2, *lingGraph) <<
" edges out of " << v2;
525 boost::tie(secondOutEdgesIt, secondOutEdgesIt_end) = out_edges(v2, *lingGraph);
526 std::vector< LinguisticGraphVertex > nexts;
527 for (; secondOutEdgesIt != secondOutEdgesIt_end; secondOutEdgesIt++)
530 LDEBUG <<
" looking at edge " << source(*secondOutEdgesIt, *lingGraph) <<
" -> " << target(*secondOutEdgesIt, *lingGraph);
533 if (secondOutVertex == v2)
continue;
534 nexts.push_back(secondOutVertex);
535 if (shouldRemoveFinal(source(*secondOutEdgesIt, *lingGraph),target(*secondOutEdgesIt, *lingGraph), match))
538 LDEBUG <<
" - storing edge " << source(*secondOutEdgesIt, *lingGraph) <<
" -> " << target(*secondOutEdgesIt, *lingGraph) <<
" to be removed";
540 recoData->setEdgeToBeRemoved(analysis, *secondOutEdgesIt);
545 LDEBUG <<
" - do not store final edge " << source(*secondOutEdgesIt, *lingGraph) <<
" -> " << target(*secondOutEdgesIt, *lingGraph) <<
" to be removed";
549 std::vector< LinguisticGraphVertex >::iterator nit, nit_end;
550 nit = nexts.begin(); nit_end = nexts.end();
551 for (; nit != nit_end; nit++)
555 boost::tie(e, success) = add_edge(newVertex, *nit, *lingGraph);
559 LDEBUG <<
" - out edge " << e.m_source <<
" -> " << e.m_target <<
" added";
565 LERROR <<
" - out edge " << newVertex <<
" ->" << *nit <<
" NOT added";
569 LDEBUG <<
" - out edges added";
573 recoData->removeEdges( analysis );
587 boost::tie(outItr,outItrEnd) = out_edges(newVertex,*lingGraph);
588 for (;outItr!=outItrEnd;outItr++)
590 recoData->setNextVertex(target(*outItr, *lingGraph));
593 RecognizerMatch::const_iterator matchItr=match.begin();
594 for (; matchItr!=match.end(); matchItr++)
596 recoData->clearUnreachableVertices( analysis, (*matchItr).getVertex());
604 const std::set<LinguisticCode>& micros,
612 .getPropertyCodeManager().getPropertyAccessor(
"MICRO");
614 for (MorphoSyntacticData::const_iterator it=oldMorphData->begin(),
615 it_end=oldMorphData->end(); it!=it_end; it++) {
617 if (micros.find(microAccessor.readValue((*it).properties)) !=
620 newMorphData->push_back(elem);
624 if (newMorphData->empty()) {
625 for (std::set<LinguisticCode>::const_iterator it=micros.begin(),
626 it_end=micros.end(); it!=it_end; it++) {
628 newMorphData->push_back(elem);
633bool CreateSpecificEntity::shouldRemoveInitial(
636 const RecognizerMatch& match)
const
641 if (match.size() == 1)
645 const LinguisticAnalysisStructure::AnalysisGraph& graph = *(match.
getGraph());
647 std::set< LinguisticGraphVertex > matchVertices;
648 Automaton::RecognizerMatch::const_iterator matchIt, matchIt_end;
650 matchIt = match.begin();
651 matchIt_end = match.end();
652 for (; matchIt != matchIt_end; matchIt++)
654 matchVertices.insert((*matchIt).m_elem.first);
657 matchIt = match.begin();
658 matchIt_end = match.end()-1;
659 if (boost::out_degree((*matchIt).m_elem.first,*graph.
getGraph()) > 1)
662 LDEBUG <<
"removing edge (" << (*matchIt).m_elem.first <<
"," << (*(matchIt+1)).m_elem.first <<
") because there is more than one path from the first vertex of the match.";
664 boost::remove_edge((*matchIt).m_elem.first,(*(matchIt+1)).m_elem.first, *
const_cast<LinguisticGraph*
>(graph.
getGraph()));
668 for (; matchIt != matchIt_end; matchIt++)
670 if (boost::out_degree((*matchIt).m_elem.first,*graph.
getGraph()) > 1)
673 boost::tie (outIt, outIt_end) = boost::out_edges((*matchIt).m_elem.first, *graph.
getGraph());
674 for (; outIt != outIt_end; outIt++)
676 if (matchVertices.find(source(*outIt, *graph.
getGraph())) != matchVertices.end())
690bool CreateSpecificEntity::shouldRemoveFinal(
693 const RecognizerMatch& match)
const
698 if (match.size() == 1)
702 const LinguisticAnalysisStructure::AnalysisGraph& graph = *(match.
getGraph());
704 std::set< LinguisticGraphVertex > matchVertices;
705 Automaton::RecognizerMatch::const_iterator matchIt, matchIt_end;
707 matchIt = match.begin();
708 matchIt_end = match.end();
709 for (; matchIt != matchIt_end; matchIt++)
711 matchVertices.insert((*matchIt).m_elem.first);
714 matchIt = match.begin()+1;
715 matchIt_end = match.end();
716 for (; matchIt != matchIt_end; matchIt++)
718 if (boost::in_degree((*matchIt).m_elem.first,*graph.
getGraph()) > 1)
721 boost::tie (inIt, inIt_end) = boost::in_edges((*matchIt).m_elem.first, *graph.
getGraph());
722 for (; inIt != inIt_end; inIt++)
724 if (matchVertices.find(source(*inIt, *graph.
getGraph())) != matchVertices.end())
727 LDEBUG <<
"removing final edge " << source(*inIt, *graph.
getGraph()) <<
" -> " << target(*inIt, *graph.
getGraph());
754m_featureType(QVariant::String)
756 if (complement.size()) {
757 QStringList complementElements = complement.split(
":");
758 m_featureName=complementElements.front().toUtf8().constData();
759 complementElements.pop_front();
760 if (!complementElements.empty()) {
761 const QString& complementType = complementElements.front();
762 m_featureType = QVariant::nameToType(complementType.toUtf8().constData());
763 if (m_featureType != QVariant::Invalid) {
764 if (complementType ==
"int") {
765 m_featureType = QVariant::Int;
767 else if (complementType ==
"double") {
768 m_featureType = QVariant::Double;
771 m_featureType = QVariant::String;
778bool SetEntityFeature::
785 LDEBUG <<
"SetEntityFeature:: (one argument) start... ";
786 LDEBUG <<
"SetEntityFeature::(feature:" << m_featureName <<
", vertex:" << vertex <<
")";
789 auto recoData = std::dynamic_pointer_cast<RecognizerData>(analysis.
getData(
"RecognizerData"));
792 LERROR <<
"SetEntityFeature:: Error: missing RecognizerData";
803 if (token ==
nullptr)
809 switch (m_featureType) {
810 case QVariant::String:
812 LDEBUG <<
"SetEntityFeature:: recoData->setEntityFeature(feature:" << m_featureName <<
", featureValue:" << featureValue<<
")";
814 recoData->setEntityFeature(m_featureName,featureValue);
818 LDEBUG <<
"SetEntityFeature:: recoData->setEntityFeature(feature:" << m_featureName <<
", featureValue:" << featureValue.toInt() <<
")";
820 recoData->setEntityFeature(m_featureName,featureValue.toInt());
822 case QVariant::Double:
824 LDEBUG <<
"SetEntityFeature:: recoData->setEntityFeature(feature:" << m_featureName <<
", featureValue:" << featureValue.toDouble() <<
")";
826 recoData->setEntityFeature(m_featureName,featureValue.toDouble());
829 recoData->setEntityFeature(m_featureName,featureValue);
831 uint64_t pos = (int64_t)(token->
position());
832 uint64_t len = (int64_t)(token->
length());
835 std::vector<EntityFeature>::iterator featureIt =
836 features.
find(m_featureName);
837 if( featureIt != recoData->getEntityFeatures().end() )
839 featureIt->setPosition(pos);
840 featureIt->setLength(len);
846bool SetEntityFeature::
854 LDEBUG <<
"SetEntityFeature:: (two arguments) start... ";
855 LDEBUG <<
"SetEntityFeature::(feature:" << m_featureName <<
", v1:" << v1 <<
", v2:" << v2 <<
")";
859 auto recoData = std::dynamic_pointer_cast<RecognizerData>(analysis.
getData(
"RecognizerData"));
862 LERROR <<
"SetEntityFeature:: Error: missing RecognizerData";
873 std::queue<LinguisticGraphVertex> toVisit;
874 std::set<LinguisticGraphVertex> visited;
880 unsigned int nbEdges(0);
881 while (!toVisit.empty()) {
885 for (boost::tie(outItr,outItrEnd)=out_edges(v,lGraph); outItr!=outItrEnd; outItr++)
888 if (visited.find(next)==visited.end())
890 visited.insert(next);
898 LWARN <<
"SetEntityFeature:: Warning: ambiguities in graph";
907 len = (int64_t)(token->
position()) - pos + 1 + (int64_t)(token->
length());
914 switch (m_featureType) {
915 case QVariant::String:
916 recoData->setEntityFeature(m_featureName,featureValue);
919 recoData->setEntityFeature(m_featureName,featureValue.toInt());
921 case QVariant::Double:
922 recoData->setEntityFeature(m_featureName,featureValue.toDouble());
925 recoData->setEntityFeature(m_featureName,featureValue);
928 std::vector<EntityFeature>::iterator featureIt =
929 features.
find(m_featureName);
930 if( featureIt != recoData->getEntityFeatures().end() )
932 featureIt->setPosition(pos);
933 featureIt->setLength(len);
950 if (complement.size()) {
951 QStringList complementElements = complement.split(
":");
952 m_featureName=complementElements.front().toUtf8().constData();
953 complementElements.pop_front();
954 if (!complementElements.empty()) {
957 LERROR <<
"AddEntityFeatureAsEntity::AddEntityFeatureAsEntity(): no type specification authorized for the feature ("
958 << complementElements <<
") the feature type is the type of the entity";
964bool AddEntityFeatureAsEntity::
971 LDEBUG <<
"AddEntityFeatureAsEntity:: (one argument) start... ";
972 LDEBUG <<
"AddEntityFeatureAsEntity::(feature:" << m_featureName <<
", vertex:" << vertex <<
")";
975 auto recoData = std::dynamic_pointer_cast<RecognizerData>(analysis.
getData(
"RecognizerData"));
978 LERROR <<
"AddEntityFeatureAsEntity:: Error: missing RecognizerData";
982 recoData->addVertexAsEmbededEntity(vertex);
999m_featureType(QVariant::String)
1001 if (complement.size()) {
1002 QStringList complementElements = complement.split(
":");
1003 m_featureName=complementElements.front().toUtf8().constData();
1004 complementElements.pop_front();
1005 if (!complementElements.empty()) {
1006 const QString& complementType = complementElements.front();
1007 m_featureType = QVariant::nameToType(complementType.toUtf8().constData());
1008 if (m_featureType != QVariant::Invalid) {
1009 if (complementType ==
"int") {
1010 m_featureType = QVariant::Int;
1012 else if (complementType ==
"double") {
1013 m_featureType = QVariant::Double;
1016 m_featureType = QVariant::String;
1023bool AddEntityFeature::
1030 LDEBUG <<
"AddEntityFeature:: (one argument) start... ";
1031 LDEBUG <<
"AddEntityFeature::(feature:" << m_featureName <<
", vertex:" << vertex <<
")";
1034 auto recoData = std::dynamic_pointer_cast<RecognizerData>(analysis.
getData(
"RecognizerData"));
1037 LERROR <<
"AddEntityFeature:: Error: missing RecognizerData";
1048 if (token ==
nullptr)
1054 switch (m_featureType) {
1055 case QVariant::String:
1057 LDEBUG <<
"AddEntityFeature:: recoData->addEntityFeature(feature:" << m_featureName <<
", featureValue:" << featureValue<<
")";
1059 recoData->addEntityFeature(m_featureName,featureValue);
1063 LDEBUG <<
"AddEntityFeature:: recoData->addEntityFeature(feature:" << m_featureName <<
", featureValue:" << featureValue.toInt()<<
")";
1065 recoData->addEntityFeature(m_featureName,featureValue.toInt());
1067 case QVariant::Double:
1069 LDEBUG <<
"AddEntityFeature:: recoData->addEntityFeature(feature:" << m_featureName <<
", featureValue:" << featureValue.toDouble()<<
")";
1071 recoData->addEntityFeature(m_featureName,featureValue.toDouble());
1074 recoData->addEntityFeature(m_featureName,featureValue);
1076 uint64_t pos = (int64_t)(token->
position());
1077 uint64_t len = (int64_t)(token->
length());
1080 std::vector<EntityFeature>::iterator featureIt =
1082 if( featureIt != recoData->getEntityFeatures().end() )
1084 featureIt->setPosition(pos);
1085 featureIt->setLength(len);
1091bool AddEntityFeature::
1099 LDEBUG <<
"AddEntityFeature:: (two arguments) start... ";
1100 LDEBUG <<
"AddEntityFeature::(feature:" << m_featureName <<
", v1:" << v1 <<
", v2:" << v2 <<
")";
1104 auto recoData = std::dynamic_pointer_cast<RecognizerData>(analysis.
getData(
"RecognizerData"));
1107 LERROR <<
"AddEntityFeature:: Error: missing RecognizerData";
1118 std::queue<LinguisticGraphVertex> toVisit;
1119 std::set<LinguisticGraphVertex> visited;
1125 unsigned int nbEdges(0);
1126 while (!toVisit.empty()) {
1130 for (boost::tie(outItr,outItrEnd)=out_edges(v,lGraph); outItr!=outItrEnd; outItr++)
1133 if (visited.find(next)==visited.end())
1135 visited.insert(next);
1143 LWARN <<
"AddEntityFeature:: Warning: ambiguities in graph";
1148 pos = (int64_t)(token->
position());
1152 len = (int64_t)(token->
position()) - pos + 1 + (int64_t)(token->
length());
1159 switch (m_featureType) {
1160 case QVariant::String:
1161 recoData->setEntityFeature(m_featureName,featureValue);
1164 recoData->setEntityFeature(m_featureName,featureValue.toInt());
1166 case QVariant::Double:
1167 recoData->setEntityFeature(m_featureName,featureValue.toDouble());
1170 recoData->setEntityFeature(m_featureName,featureValue);
1173 std::vector<EntityFeature>::iterator featureIt =
1175 if( featureIt != recoData->getEntityFeatures().end() )
1177 featureIt->setPosition(pos);
1178 featureIt->setLength(len);
1193m_featureType(QVariant::String)
1195 if (complement.size()) {
1196 QStringList complementElements = complement.split(
":");
1197 m_featureName=complementElements.front().toUtf8().constData();
1198 complementElements.pop_front();
1199 if (!complementElements.empty()) {
1200 const QString& complementType = complementElements.front();
1201 m_featureType = QVariant::nameToType(complementType.toUtf8().constData());
1202 if (m_featureType != QVariant::Invalid) {
1203 if (complementType ==
"int") {
1204 m_featureType = QVariant::Int;
1206 else if (complementType ==
"double") {
1207 m_featureType = QVariant::Double;
1210 m_featureType = QVariant::String;
1244 LDEBUG <<
"AppendEntityFeature::() (one argument) start... ";
1245 LDEBUG <<
"AppendEntityFeature::() feature:" << m_featureName <<
", vertex:" << vertex <<
")";
1248 auto recoData = std::dynamic_pointer_cast<RecognizerData>(analysis.
getData(
"RecognizerData"));
1251 LERROR <<
"AppendEntityFeature::() Error: missing RecognizerData";
1262 std::vector<EntityFeature>::iterator featureIt = features.
find(m_featureName);
1266 if( featureIt != recoData->getEntityFeatures().end() )
1268 pos =
minPos( featureIt->getPosition(), (int64_t)(token->
position()) );
1270 LDEBUG <<
"AppendEntityFeature::() minPos=" << pos;
1274 maxPos1 = featureIt->getPosition() + featureIt->getLength();
1277 LDEBUG <<
"AppendEntityFeature::() maxPos1=" << maxPos1;
1279 uint64_t maxPos2 = (int64_t)(token->
position()) + (int64_t)(token->
length());
1281 LDEBUG <<
"AppendEntityFeature::() maxPos2=" << maxPos2;
1283 uint64_t maxPos3 =
maxPos( maxPos1, maxPos2 );
1285 LDEBUG <<
"AppendEntityFeature::() maxPos3=" << maxPos3;
1287 len = maxPos3 - pos;
1289 LDEBUG <<
"AppendEntityFeature::() len=" << len;
1293 pos = (int64_t)(token->
position());
1294 len = (int64_t)(token->
length());
1305 switch (m_featureType) {
1306 case QVariant::String:
1307 recoData->appendEntityFeature(m_featureName,featureValue);
1310 recoData->appendEntityFeature(m_featureName,featureValue.toInt());
1312 case QVariant::Double:
1313 recoData->appendEntityFeature(m_featureName,featureValue.toDouble());
1316 recoData->appendEntityFeature(m_featureName,featureValue);
1318 featureIt = features.
find(m_featureName);
1320 LDEBUG <<
"AppendEntityFeature::() pos before = ("
1321 << featureIt->getPosition() <<
","
1322 << featureIt->getLength() <<
")";
1324 featureIt->setPosition(pos);
1325 featureIt->setLength(len);
1327 LDEBUG <<
"AppendEntityFeature::() pos after = (" << pos <<
"," << len <<
")";
1343 auto recoData = std::dynamic_pointer_cast<RecognizerData>(analysis.
getData(
"RecognizerData"));
1345 recoData->clearEntityFeatures();
1362 auto recoData = std::dynamic_pointer_cast<RecognizerData>(analysis.
getData(
"RecognizerData"));
1363 if (recoData ==
nullptr) {
1365 LERROR <<
"NormalizeEntity:: Error: missing RecognizerData";
1370 const auto& features = recoData->getEntityFeatures();
1371 for (
auto it = features.cbegin(); it != features.cend(); ++it) {
1375 (*featureIt).setPosition(it->getPosition());
1376 (*featureIt).setLength(it->getLength());
1380 recoData->clearEntityFeatures();
This file is the main header file for the data related to annotation graphs.
DependencyGraph::vertex_descriptor DependencyGraphVertex
#define LIMA_EXCEPTION(X)
This macro writes the message X to a previously configured error stream before throwing a LimaExcepti...
LinguisticGraph::in_edge_iterator LinguisticGraphInEdgeIt
boost::property_map< LinguisticGraph, vertex_data_t >::type VertexDataPropertyMap
boost::graph_traits< LinguisticGraph >::edge_descriptor LinguisticGraphEdge
typedefs to simplify the access to various graphs elements
boost::property_map< LinguisticGraph, vertex_token_t >::type VertexTokenPropertyMap
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 SetEntityFeatureId
#define CreateSpecificEntityId
#define isAlphaPossessiveId
#define NormalizeEntityId
#define ClearEntityFeaturesId
#define AddEntityFeatureId
#define isASpecificEntityId
#define AppendEntityFeatureId
#define AddEntityFeatureAsEntityId
Data used for the syntactic analyzis of texts.
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
This class allows to convert any object into an annotation by inheritance.
Provide tools to manage a specific property.
LinguisticCode getPropertyValue(const std::string &symbolicValue) const
Get the coded property value from the symbolic value.
The main LIMA exception class.
virtual const char * what() const override
ConstraintFunction(MediaId language, const LimaString &complement=LimaString())
a list of generic features: each feature is unique (only one feature for a name)
EntityFeatures::const_iterator findLast(const std::string &featureName) const
void addFeature(const std::string &name, const ValueType &value)
EntityFeatures::const_iterator find(const std::string &featureName) const
const EntityFeatures & features() const
const Common::MediaticData::EntityType & getType() const
const LinguisticAnalysisStructure::AnalysisGraph * getGraph() const
uint64_t positionBegin() const
An AnalysisData containing a LinguisticGraph with a language and an id.
const std::string & getGraphId(void) const
const LinguisticGraph * getGraph(void) const
Returns the underlying graph structure.
Holds morphosyntactic informations.
bool isAlphaPossessive() const
void setAlphaPossessive(bool isAlphaPossessive)
holds surface data of a token
uint64_t position() const
const LimaString & stringForm() const
void setStatus(const TStatus &status)
Set the TStatus of a token.
AddEntityFeatureAsEntity(MediaId language, const LimaString &complement=LimaString())
AddEntityFeature(MediaId language, const LimaString &complement=LimaString())
uint64_t maxPos(const uint64_t pos1, const uint64_t pos2) const
bool operator()(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &vertex, AnalysisContent &analysis) const override
unary constraint function : the constraint only applies on one vertices in the graph (the graph is al...
uint64_t minPos(const uint64_t pos1, const uint64_t pos2) const
AppendEntityFeature(MediaId language, const LimaString &complement=LimaString())
ClearEntityFeatures(MediaId language, const LimaString &complement=LimaString())
bool operator()(AnalysisContent &analysis) const override
zero-ary constraint function : applies the function without a vertex indication (used for actions,...
CreateSpecificEntity(MediaId language, const LimaString &complement=LimaString())
bool operator()(Automaton::RecognizerMatch &match, AnalysisContent &analysis) const override
Definition of a function suitable to be used as a dumper for specific entities annotations of an anno...
NormalizeEntity(MediaId language, const LimaString &complement=LimaString())
bool operator()(Automaton::RecognizerMatch &match, AnalysisContent &analysis) const override
zero-ary constraint function : applies the function without a vertex indication (used for actions,...
SetEntityFeature(MediaId language, const LimaString &complement=LimaString())
A representation of a specific entity to store in the annotation graph.
StringsPoolIndex getString() const
Common::MediaticData::EntityType getType() const
LinguisticGraphVertex getHead() const
void dump(std::ostream &os) const
The functions that dumps a SpecificEntityAnnotation on an output stream.
StringsPoolIndex getNormalizedForm() const
bool operator()(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &v, AnalysisContent &analysis) const override
unary constraint function : the constraint only applies on one vertices in the graph (the graph is al...
isASpecificEntity(MediaId language, const LimaString &complement=LimaString())
isAlphaPossessive(MediaId language, const LimaString &complement=LimaString())
bool operator()(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &v, AnalysisContent &analysis) const override
unary constraint function : the constraint only applies on one vertices in the graph (the graph is al...
static const MediaticData & single()
static MediaticData & changeable()
AnnotationGraph::vertex_descriptor AnnotationGraphVertex
std::string limastring2utf8stdstring(const Lima::LimaString &phrase, uint32_t size0)
Convert a wide string to a string , in dest up to size bytes.
LimaString utf8stdstring2limastring(const std::string &src)
ConstraintFunctionFactory< AddEntityFeatureAsEntity > AddEntityFeatureAsEntityFactory(AddEntityFeatureAsEntityId)
ConstraintFunctionFactory< AppendEntityFeature > AppendEntityFeatureFactory(AppendEntityFeatureId)
ConstraintFunctionFactory< ClearEntityFeatures > ClearEntityFeaturesFactory(ClearEntityFeaturesId)
ConstraintFunctionFactory< isAlphaPossessive > isAlphaPossessiveFactory(isAlphaPossessiveId)
ConstraintFunctionFactory< NormalizeEntity > NormalizeEntityFactory(NormalizeEntityId)
ConstraintFunctionFactory< CreateSpecificEntity > CreateSpecificEntityFactory(CreateSpecificEntityId)
ConstraintFunctionFactory< isASpecificEntity > isASpecificEntityFactory(isASpecificEntityId)
ConstraintFunctionFactory< SetEntityFeature > SetEntityFeatureFactory(SetEntityFeatureId)
ConstraintFunctionFactory< AddEntityFeature > AddEntityFeatureFactory(AddEntityFeatureId)
StringsPoolIndex inflectedForm
StringsPoolIndex normalizedForm
LinguisticCode properties