26namespace LinguisticProcessing {
38 m_numberOfConstraints(0),
41 m_hasLeftRightConstraint(false),
43 m_actionsWithOneArgument(),
50 m_trigger(r.m_trigger->clone()),
54 m_lingProp(r.m_lingProp),
55 m_normalizedForm(r.m_normalizedForm),
56 m_numberOfConstraints(r.m_numberOfConstraints),
57 m_contextual(r.m_contextual),
58 m_negative(r.m_negative),
59 m_hasLeftRightConstraint(r.m_hasLeftRightConstraint),
60 m_actions(r.m_actions),
61 m_actionsWithOneArgument(r.m_actionsWithOneArgument),
204 analysis,leftMatches,
205 constraintCheckList,forward,backward,
215 Automaton::AutomatonMatchSet::const_iterator
216 currentLeftMatch=leftMatches.begin(),
217 endLeftMatch=leftMatches.end();
221 std::set<ConstraintCheckList> leftCheckLists;
223 for (; currentLeftMatch!=endLeftMatch; currentLeftMatch++) {
229 if (leftCheckLists.find((*currentLeftMatch).second)!=
230 leftCheckLists.end()) {
235 constraintCheckList=(*currentLeftMatch).second;
237 analysis,rightmatch,constraintCheckList,
239 leftmatch=(*currentLeftMatch).first;
241 std::reverse(leftmatch.begin(),leftmatch.end());
245 leftCheckLists.insert((*currentLeftMatch).second);
262 LDEBUG <<
"Rule::executeActions: start";
264 LDEBUG <<
"result = " << *result;
266 LDEBUG <<
"result = NULL";
279 LDEBUG <<
"Rule::executeActions: success = " << success
280 <<
", check if execution is required for function " << actionItr->second.functionName();
284 const LimaString& ruelElemtId = actionItr->first;
286 LDEBUG <<
"Rule::executeActions: check " << ruelElemtId <<
"for function " << actionItr->second.functionName();
290 for( std::vector<MatchElement>::iterator matchElmt = result->begin() ;
291 matchElmt != result->end() ; matchElmt++ ) {
293 LDEBUG <<
"Rule::executeActions: check vertex "
294 << matchElmt->m_elem.first <<
" with " << matchElmt->getRuleElemtId();
296 if( (matchElmt->getRuleElemtId()).startsWith(ruelElemtId) ) {
298 LDEBUG <<
"Rule::executeActions: found " << matchElmt->m_elem.first;
300 bool ok=(*functionAddr)(graph,matchElmt->m_elem.first,analysis);
303 LERROR <<
"Rule::executeActions: execution of function" << actionItr->second.functionName() <<
"failed";
310 LDEBUG <<
"Rule::executeActions: execution of function" << actionItr->second.functionName() <<
"not required";
316 for (std::vector<Constraint>::const_iterator action=
m_actions.begin();
319 if (! (*action).apply(graph,analysis,
339 for (std::vector<Constraint>::const_iterator action=r.
m_actions.begin();
341 os << *action << endl;
345 os <<
"(" << (*action).first.toUtf8().data() <<
","<< (*action).second<<
")" << endl;
355 for (std::vector<Constraint>::const_iterator action=r.
m_actions.begin();
361 os <<
"(" << action->first <<
","<< action->second<<
")" <<
QTENDL;
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
std::string toString() const
␈rief a class for control parameters for the search using the automata
␈rief A class for the description of automata
bool getBestMatch(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &begin, const LinguisticGraphVertex &limit, AnalysisContent &analysis, RecognizerMatch &longestMatch, ConstraintCheckList &checkList, const SearchGraphSense sense, const AutomatonControlParams &controlParams) const
test if a text corresponds to the automaton : the text is represented as a LinguisticAnalysisStructur...
bool getAllMatches(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &begin, const LinguisticGraphVertex &limit, AnalysisContent &analysis, AutomatonMatchSet &allMatches, ConstraintCheckList &checkList, ForwardSearch &forward, BackwardSearch &backward, const SearchGraphSense sense, const AutomatonControlParams &controlParams) const
get all matches found between automaton and graph between two points (WARNING: in case of backward se...
void reinit()
reinitializes the automaton (no states, no transitions)
std::set< AutomatonMatch, CompareAutomatonMatch > AutomatonMatchSet
Automaton const & leftAutomaton() const
bool m_hasLeftRightConstraint
uint64_t m_numberOfConstraints
uint64_t numberOfConstraints() const
Automaton const & rightAutomaton() const
const std::string & getRuleId() const
std::vector< Constraint > m_actions
bool operator<(const Rule &r)
LinguisticCode getLinguisticProperties() const
LimaString m_normalizedForm
Rule & operator=(const Rule &)
TransitionUnit * m_trigger
const LimaString & getNormalizedForm() const
Common::MediaticData::EntityType m_type
LinguisticCode m_lingProp
const std::vector< Constraint > & getActions() const
TransitionUnit * getTrigger() const
bool test(const LinguisticProcessing::LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &leftContext, const LinguisticGraphVertex &rightContext, const LinguisticGraphVertex &leftLimit, const LinguisticGraphVertex &rightLimit, AnalysisContent &analysis, RecognizerMatch &leftmatch, RecognizerMatch &rightmatch, ConstraintCheckList &, ForwardSearch &forward, BackwardSearch &backward, const AutomatonControlParams &controlParams) const
test the rule on a morphological graph : the trigger has already been tested: test only left and righ...
std::vector< std::pair< LimaString, Constraint > > m_actionsWithOneArgument
Common::MediaticData::EntityType getType() const
bool executeActions(const LinguisticAnalysisStructure::AnalysisGraph &graph, AnalysisContent &analysis, ConstraintCheckList &constraintCheckList, const bool success, RecognizerMatch *result) const
const std::vector< std::pair< LimaString, Constraint > > & getActionsWithOneArgument() const
virtual TransitionUnit * clone() const =0
An AnalysisData containing a LinguisticGraph with a language and an id.
@ EXECUTE_IF_FAILURE_REVERSE
@ EXECUTE_IF_SUCCESS_REVERSE
std::ostream & operator<<(std::ostream &os, const DFFSPos &x)
@ FORWARDSEARCH
forward search in the graph
@ BACKWARDSEARCH
backward search in the graph
std::vector< ConstraintCheckListElement > ConstraintCheckList