54#define DEFAULT_OVERLAP_STRATEGY IGNORE_FIRST
68#define RECOGNIZER_CLASSID "AutomatonRecognizer"
160 std::vector<RecognizerMatch>& result,
161 bool testAllVertices=
false,
162 bool stopAtFirstSuccess=
true,
163 bool onlyOneSuccessPerType=
false,
164 bool returnAtFirstSuccess=
false,
165 bool applySameRuleWhileSuccess=
false)
const;
200 std::vector<RecognizerMatch>& result,
201 bool testAllVertices,
202 bool stopAtFirstSuccess,
203 bool onlyOneSuccessPerType,
204 bool returnAtFirstSuccess,
205 bool applySameRuleWhileSuccess)
const;
225 std::vector<RecognizerMatch>& result,
226 bool stopAtFirstSuccess=
true,
227 bool onlyOneSuccessPerType=
false,
228 bool applySameRuleWhileSuccess=
false)
const;
295 std::vector<RecognizerMatch>& match,
296 std::set<Common::MediaticData::EntityType>* forbiddenTypes=0,
297 bool stopAtFirstSuccess=
true,
298 bool onlyOneSuccessPerType=
false,
299 bool applySameRuleWhileSuccess=
false)
const ;
316 class TriggerRule :
public std::pair<TransitionUnit*, SetOfRules> {
328 class CompareTriggerRule;
354 std::vector<TriggerRule*>& matchingSetOfRules)
const;
#define LIMA_AUTOMATON_EXPORT
QDebug & operator<<(QDebug &qd, const std::string &str)
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
InitializableObjectManager< AbstractResource, ResourceInitializationParameters > Manager
AbstractResource(QObject *parent=0)
␈rief a class for control parameters for the search using the automata
TriggerRule(TransitionUnit *t, const SetOfRules &s)
void setTransitionUnit(TransitionUnit *t)
SetOfRules & setOfRules()
TransitionUnit * transitionUnit() const
const SetOfRules & setOfRules() const
friend class AutomatonReader
void findNextSetOfRules(const LinguisticAnalysisStructure::AnalysisGraph &graph, LinguisticGraphVertex &vertex, AnalysisContent &analysis, const LinguisticAnalysisStructure::Token *token, const LinguisticAnalysisStructure::MorphoSyntacticData *data, std::vector< TriggerRule * > &matchingSetOfRules) const
void listTriggers() const
uint64_t testOnVertex(const LinguisticAnalysisStructure::AnalysisGraph &graph, LinguisticGraphVertex ¤t, const LinguisticGraphVertex &begin, const LinguisticGraphVertex &end, AnalysisContent &analysis, std::vector< RecognizerMatch > &result, bool stopAtFirstSuccess=true, bool onlyOneSuccessPerType=false, bool applySameRuleWhileSuccess=false) const
test the recognizer on a given vertex : check if this vertex is a trigger and if a rule applies,...
void initializeSearchStructure()
TransitionSearchStructure< TriggerRule > m_searchStructure
std::vector< TriggerRule > m_rules
uint64_t numberOfRules() const
uint64_t testSetOfRules(const TransitionUnit &trigger, const SetOfRules &rules, const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &position, const LinguisticGraphVertex &begin, const LinguisticGraphVertex &end, AnalysisContent &analysis, std::vector< RecognizerMatch > &match, std::set< Common::MediaticData::EntityType > *forbiddenTypes=0, bool stopAtFirstSuccess=true, bool onlyOneSuccessPerType=false, bool applySameRuleWhileSuccess=false) const
TODO: toBeDeleted Parse tokens paths from the trigger point.
friend class AutomatonWriter
AutomatonControlParams m_automatonControlParams
parameters to control the search of the automaton
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
uint64_t addRuleInStorage(Rule *rule)
add a rule in the storage zone
uint64_t apply(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &begin, const LinguisticGraphVertex &end, AnalysisContent &analysis, std::vector< RecognizerMatch > &result, bool testAllVertices=false, bool stopAtFirstSuccess=true, bool onlyOneSuccessPerType=false, bool returnAtFirstSuccess=false, bool applySameRuleWhileSuccess=false) const
apply the recognizer on a graph
void copy(const Recognizer &a)
void clearSearchStructure()
void setNormalizedForm(const LimaString &norm, RecognizerMatch &match) const
uint64_t resolveOverlappingEntities(std::vector< RecognizerMatch > &listEntities, const OverlapResolutionStrategy &strategy=DEFAULT_OVERLAP_STRATEGY) const
resolve the problem of overlapping entities in the list of entities : when two entities are overlapin...
uint64_t findRuleIndex(Rule *) const
uint64_t addRule(TransitionUnit *trigger, Rule *rule)
add a rule in the recognizer : add the rule in the storage zone, and associate the trigger to the rul...
An AnalysisData containing a LinguisticGraph with a language and an id.
Holds morphosyntactic informations.
holds surface data of a token
OverlapResolutionStrategy
an enumerated type to indicate which kind of strategy adopt to deal with two overlapping entities
@ IGNORE_SECOND
the second entity is ignored => assumes the leftmost trigger is more important
@ IGNORE_SMALLEST
the smallest entity is ignored (the one that covers the smallest number of words is assumed to be les...
@ KEEP_ALL_OVERLAPS
do not try to avoid overlaps, find the largest number of entities possible
@ IGNORE_FIRST
the first entity is ignored => assumes the rightmost trigger is more important
std::vector< Rule * > SetOfRules
the SetOfRules type is defined as a vector of pointers on Rule
#define DEFAULT_OVERLAP_STRATEGY