FreeLing
4.0
|
dep_txala is a class for obtaining a dependency tree from chunks. More...
#include <dep_txala.h>
Public Member Functions | |
dep_txala (const std::wstring &, const std::wstring &) | |
constructor | |
~dep_txala () | |
destructor | |
void | complete_parse_tree (sentence &) const |
apply completion rules to get a full parse tree | |
void | complete_parse_tree (std::list< sentence > &) const |
apply completion rules to get a full parse tree | |
void | complete_parse_tree (document &) const |
apply completion rules to get a full parse tree | |
void | analyze (sentence &) const |
analyze given sentences, obtain dependency tree | |
Static Public Member Functions | |
static dep_tree * | parse2dep (parse_tree &) |
convert parse_tree to dependency tree | |
Private Member Functions | |
void | load_classes (const std::wstring &, const std::wstring &, const std::wstring &, std::set< std::wstring > &) |
grammar file parsing methods ------------------- | |
void | extract_conds (std::wstring &, matching_condition &) const |
Separate extra lemma/form/class conditions from the chunk label. | |
void | create_subexpression (const std::wstring &node, const std::wstring &func, const std::wstring &value, bool negated, rule_expression &re) const |
void | add_subexpression (const std::wstring &condition, rule_expression &re) const |
void | load_rule (const std::wstring &line, completer_rule &r) |
parse a line containing a completer rule, and fill completer_rule instance | |
void | load_rule (const std::wstring &line, labeler_rule &r) |
completer_rule | find_grammar_rule (const std::vector< parse_tree * > &, const size_t, dep_txala_status *) const |
tree-completing methods --------------------- | |
parse_tree * | applyRule (const completer_rule &, int, parse_tree *, parse_tree *, dep_txala_status *) const |
apply a completion rule | |
void | extract_attrib (const std::wstring &attr, const std::list< parse_tree::const_iterator > &nds, std::list< std::wstring > &val) const |
Extract values for requested atribute frm given node. | |
void | locate_node (const std::vector< parse_tree * > &trees, const size_t chk, const std::wstring &node, std::list< parse_tree::const_iterator > &res) const |
Locate actual node for given path. | |
bool | match_condition (parse_tree::const_iterator, const matching_condition &) const |
check if the extra lemma/form/class conditions are satisfied | |
bool | matching_context (const std::vector< parse_tree * > &, const size_t, const completer_rule &) const |
check if the current context matches the given rule | |
bool | matching_operation (const std::vector< parse_tree * > &, const size_t, const completer_rule &, dep_txala_status *) const |
check if the operation is executable (for last_left/last_right cases) | |
bool | matching_pair (const std::vector< parse_tree * > &trees, const size_t chk, const completer_rule &r) const |
Check if the chunk pair matches pair condition specified in the given rule. | |
bool | match_side (const int, const std::vector< parse_tree * > &, const size_t, const std::vector< matching_condition > &) const |
check left or right context | |
bool | enabled_rule (const completer_rule &, dep_txala_status *) const |
Find out if currently active flags enable the given rule. | |
parse_tree | complete (parse_tree &, const std::wstring &, dep_txala_status *) const |
find best completions for given parse tree | |
void | label (dep_tree *, dep_tree::iterator) const |
function labelling methods --------------- | |
void | label (dep_tree *) const |
Label nodes in a dependency tree. (Initial call) | |
Static Private Member Functions | |
static dep_tree * | dependencies (parse_tree::iterator, parse_tree::iterator) |
recursively convert parse_tree to dependency tree | |
Private Attributes | |
std::wstring | start |
std::map< std::pair < std::wstring, std::wstring > , std::list< completer_rule > > | chgram |
set of completer rules, indexed by labels of nodes | |
std::map< std::wstring, std::list< labeler_rule > > | rules |
std::set< std::wstring > | unique |
semanticDB * | semdb |
std::set< std::wstring > | wordclasses |
std::set< std::wstring > | pairclasses |
dep_txala is a class for obtaining a dependency tree from chunks.
this implementation uses two subclasses: txala_completer: to complete the chunk analysis in a full parse tree txala_labeler: to set the labels once the class has build a dependency tree
freeling::dep_txala::dep_txala | ( | const std::wstring & | , |
const std::wstring & | |||
) |
constructor
destructor
void freeling::dep_txala::add_subexpression | ( | const std::wstring & | condition, |
rule_expression & | re | ||
) | const [private] |
void freeling::dep_txala::analyze | ( | sentence & | ) | const [virtual] |
analyze given sentences, obtain dependency tree
Implements freeling::dependency_parser.
parse_tree* freeling::dep_txala::applyRule | ( | const completer_rule & | , |
int | , | ||
parse_tree * | , | ||
parse_tree * | , | ||
dep_txala_status * | |||
) | const [private] |
apply a completion rule
parse_tree freeling::dep_txala::complete | ( | parse_tree & | , |
const std::wstring & | , | ||
dep_txala_status * | |||
) | const [private] |
find best completions for given parse tree
void freeling::dep_txala::complete_parse_tree | ( | sentence & | ) | const |
apply completion rules to get a full parse tree
void freeling::dep_txala::complete_parse_tree | ( | std::list< sentence > & | ) | const |
apply completion rules to get a full parse tree
void freeling::dep_txala::complete_parse_tree | ( | document & | ) | const |
apply completion rules to get a full parse tree
void freeling::dep_txala::create_subexpression | ( | const std::wstring & | node, |
const std::wstring & | func, | ||
const std::wstring & | value, | ||
bool | negated, | ||
rule_expression & | re | ||
) | const [private] |
static dep_tree* freeling::dep_txala::dependencies | ( | parse_tree::iterator | , |
parse_tree::iterator | |||
) | [static, private] |
recursively convert parse_tree to dependency tree
bool freeling::dep_txala::enabled_rule | ( | const completer_rule & | , |
dep_txala_status * | |||
) | const [private] |
Find out if currently active flags enable the given rule.
void freeling::dep_txala::extract_attrib | ( | const std::wstring & | attr, |
const std::list< parse_tree::const_iterator > & | nds, | ||
std::list< std::wstring > & | val | ||
) | const [private] |
Extract values for requested atribute frm given node.
void freeling::dep_txala::extract_conds | ( | std::wstring & | , |
matching_condition & | |||
) | const [private] |
Separate extra lemma/form/class conditions from the chunk label.
completer_rule freeling::dep_txala::find_grammar_rule | ( | const std::vector< parse_tree * > & | , |
const size_t | , | ||
dep_txala_status * | |||
) | const [private] |
tree-completing methods ---------------------
retrieve rule from grammar
void freeling::dep_txala::label | ( | dep_tree * | , |
dep_tree::iterator | |||
) | const [private] |
function labelling methods ---------------
Label nodes in a dependency tree. (recursive)
void freeling::dep_txala::label | ( | dep_tree * | ) | const [private] |
Label nodes in a dependency tree. (Initial call)
void freeling::dep_txala::load_classes | ( | const std::wstring & | , |
const std::wstring & | , | ||
const std::wstring & | , | ||
std::set< std::wstring > & | |||
) | [private] |
grammar file parsing methods -------------------
auxiliary to load CLASS section of config file
void freeling::dep_txala::load_rule | ( | const std::wstring & | line, |
completer_rule & | r | ||
) | [private] |
parse a line containing a completer rule, and fill completer_rule instance
void freeling::dep_txala::load_rule | ( | const std::wstring & | line, |
labeler_rule & | r | ||
) | [private] |
void freeling::dep_txala::locate_node | ( | const std::vector< parse_tree * > & | trees, |
const size_t | chk, | ||
const std::wstring & | node, | ||
std::list< parse_tree::const_iterator > & | res | ||
) | const [private] |
Locate actual node for given path.
bool freeling::dep_txala::match_condition | ( | parse_tree::const_iterator | , |
const matching_condition & | |||
) | const [private] |
check if the extra lemma/form/class conditions are satisfied
bool freeling::dep_txala::match_side | ( | const int | , |
const std::vector< parse_tree * > & | , | ||
const size_t | , | ||
const std::vector< matching_condition > & | |||
) | const [private] |
check left or right context
bool freeling::dep_txala::matching_context | ( | const std::vector< parse_tree * > & | , |
const size_t | , | ||
const completer_rule & | |||
) | const [private] |
check if the current context matches the given rule
bool freeling::dep_txala::matching_operation | ( | const std::vector< parse_tree * > & | , |
const size_t | , | ||
const completer_rule & | , | ||
dep_txala_status * | |||
) | const [private] |
check if the operation is executable (for last_left/last_right cases)
bool freeling::dep_txala::matching_pair | ( | const std::vector< parse_tree * > & | trees, |
const size_t | chk, | ||
const completer_rule & | r | ||
) | const [private] |
Check if the chunk pair matches pair condition specified in the given rule.
static dep_tree* freeling::dep_txala::parse2dep | ( | parse_tree & | ) | [static] |
convert parse_tree to dependency tree
std::map<std::pair<std::wstring,std::wstring>,std::list<completer_rule> > freeling::dep_txala::chgram [private] |
set of completer rules, indexed by labels of nodes
std::set<std::wstring> freeling::dep_txala::pairclasses [private] |
std::map<std::wstring, std::list<labeler_rule> > freeling::dep_txala::rules [private] |
semanticDB* freeling::dep_txala::semdb [private] |
std::wstring freeling::dep_txala::start [private] |
std::set<std::wstring> freeling::dep_txala::unique [private] |
std::set<std::wstring> freeling::dep_txala::wordclasses [private] |