FreeLing
3.1
|
The class rule_expression is an abstract class (interface) for building dynamic restriction on a ruleLabeler which are used by class depLabeler. More...
#include <dep_rules.h>
Public Member Functions | |
rule_expression () | |
Constructor. | |
rule_expression (const std::wstring &, const std::wstring &) | |
virtual | ~rule_expression () |
bool | find (const std::wstring &) const |
Search for a value in the list of an expression. | |
bool | find_match (const std::wstring &) const |
Search for a value in the list of an expression, taking into account wildcards. | |
bool | match (const std::wstring &) const |
Match the value against a RegExp. | |
bool | find_any (const std::list< std::wstring > &) const |
Search for any value of a list in the list of an expression. | |
bool | find_any_match (const std::list< std::wstring > &) const |
Search for any value of a list in the list of an expression, taking into account wildcards. | |
virtual bool | check (dep_tree::iterator, dep_tree::iterator) const |
Check wheter a rule_expression can be applied to the given pair of nodes. | |
Protected Member Functions | |
bool | nodes_to_check (dep_tree::iterator, dep_tree::iterator, std::list< dep_tree::iterator > &) const |
Givent parent and daughter iterators, resolve which of them is to be checked in this condition. | |
virtual bool | eval (dep_tree::iterator) const |
eval whether a single node matches a condition only called from check if needed. | |
Protected Attributes | |
std::wstring | node |
std::set< std::wstring > | valueList |
Private Member Functions | |
void | parse_node_ref (std::wstring, dep_tree::iterator, std::list< dep_tree::iterator > &) const |
Recursive disassembly of node reference string (e.g. |
The class rule_expression is an abstract class (interface) for building dynamic restriction on a ruleLabeler which are used by class depLabeler.
Constructor.
freeling::rule_expression::rule_expression | ( | const std::wstring & | , |
const std::wstring & | |||
) |
virtual freeling::rule_expression::~rule_expression | ( | ) | [inline, virtual] |
bool freeling::rule_expression::check | ( | dep_tree::iterator | ancestor, |
dep_tree::iterator | descendant | ||
) | const [virtual] |
Check wheter a rule_expression can be applied to the given pair of nodes.
Reimplemented in freeling::check_side, freeling::check_not, and freeling::check_and.
References eval(), nodes_to_check(), and TRACE.
Referenced by freeling::check_not::check(), and freeling::ruleLabeler::check().
bool freeling::rule_expression::eval | ( | dep_tree::iterator | n | ) | const [protected, virtual] |
eval whether a single node matches a condition only called from check if needed.
The abstract class version should never be reached.
Reimplemented in freeling::check_asynon, freeling::check_synon, freeling::check_semfile, freeling::check_tonto, freeling::check_wordclass, freeling::check_category, freeling::check_pos, and freeling::check_lemma.
Referenced by check().
bool freeling::rule_expression::find | ( | const std::wstring & | ) | const |
Search for a value in the list of an expression.
References valueList.
Referenced by freeling::depLabeler::build_expression(), freeling::check_lemma::eval(), freeling::check_semfile::eval(), and find_any().
bool freeling::rule_expression::find_any | ( | const std::list< std::wstring > & | ) | const |
Search for any value of a list in the list of an expression.
References find().
Referenced by freeling::check_tonto::eval(), freeling::check_synon::eval(), and freeling::check_asynon::eval().
bool freeling::rule_expression::find_any_match | ( | const std::list< std::wstring > & | ) | const |
Search for any value of a list in the list of an expression, taking into account wildcards.
References find_match().
bool freeling::rule_expression::find_match | ( | const std::wstring & | ) | const |
Search for a value in the list of an expression, taking into account wildcards.
References TRACE, and valueList.
Referenced by freeling::check_category::eval(), and find_any_match().
bool freeling::rule_expression::match | ( | const std::wstring & | ) | const |
Match the value against a RegExp.
References freeling::regexp::search(), set2wstring, and valueList.
Referenced by freeling::check_pos::eval().
bool freeling::rule_expression::nodes_to_check | ( | dep_tree::iterator | , |
dep_tree::iterator | , | ||
std::list< dep_tree::iterator > & | |||
) | const [protected] |
Givent parent and daughter iterators, resolve which of them is to be checked in this condition.
References node, and parse_node_ref().
Referenced by check().
void freeling::rule_expression::parse_node_ref | ( | std::wstring | , |
dep_tree::iterator | , | ||
std::list< dep_tree::iterator > & | |||
) | const [private] |
Recursive disassembly of node reference string (e.g.
p:sn:sajd) to get the right iterator. When (if) found, add it to given list.
References TRACE.
Referenced by nodes_to_check().
std::wstring freeling::rule_expression::node [protected] |
Referenced by nodes_to_check().
std::set<std::wstring> freeling::rule_expression::valueList [protected] |