FreeLing  3.1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
freeling::completer Class Reference

The class completer implements a parse tree completer, which given a partial parse tree (chunker output), completes the full parse according to some grammar rules. More...

#include <dependencies.h>

List of all members.

Public Member Functions

 completer (const std::wstring &)
 Constructor. Load a tree-completion grammar.
parse_tree complete (parse_tree &, const std::wstring &, dep_txala_status *) const
 find best completions for given parse tree

Static Public Member Functions

static void load_classes (const std::wstring &, const std::wstring &, const std::wstring &, std::set< std::wstring > &)
 auxiliary to load CLASS section of config file, used both by completer and labeler.

Private Member Functions

completerRule find_grammar_rule (const std::vector< parse_tree * > &, const size_t, dep_txala_status *) const
 retrieve rule from grammar
parse_treeapplyRule (const completerRule &, int, parse_tree *, parse_tree *, dep_txala_status *) const
 apply a completion rule
bool match_condition (parse_tree::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 completerRule &) const
 check if the current context matches the given rule
bool matching_operation (const std::vector< parse_tree * > &, const size_t, const completerRule &, dep_txala_status *) const
 check if the operation is executable (for last_left/last_right cases)
bool match_side (const int, const std::vector< parse_tree * > &, const size_t, const std::vector< matching_condition > &) const
 check left or right context
void extract_conds (std::wstring &, matching_condition &) const
 Separate extra lemma/form/class conditions from the chunk label.
bool enabled_rule (const completerRule &, dep_txala_status *) const
 Find out if currently active flags enable the given rule.

Private Attributes

std::map< std::pair
< std::wstring, std::wstring >
, std::list< completerRule > > 
chgram
 set of rules, indexed by labels of nodes
std::set< std::wstring > wordclasses

Detailed Description

The class completer implements a parse tree completer, which given a partial parse tree (chunker output), completes the full parse according to some grammar rules.


Constructor & Destructor Documentation

freeling::completer::completer ( const std::wstring &  )

Member Function Documentation

parse_tree * freeling::completer::applyRule ( const completerRule r,
int  chk,
parse_tree chunkLeft,
parse_tree chunkRight,
dep_txala_status st 
) const [private]
parse_tree freeling::completer::complete ( parse_tree ,
const std::wstring &  ,
dep_txala_status  
) const
bool freeling::completer::enabled_rule ( const completerRule r,
dep_txala_status st 
) const [private]

Find out if currently active flags enable the given rule.

References freeling::dep_txala_status::active_flags, and freeling::completerRule::enabling_flags.

void freeling::completer::extract_conds ( std::wstring &  ,
matching_condition  
) const [private]
completerRule freeling::completer::find_grammar_rule ( const std::vector< parse_tree * > &  ,
const size_t  ,
dep_txala_status  
) const [private]

retrieve rule from grammar

Look for a completer grammar rule matching the given chunk in "chk" position of "trees" and his right-hand-side mate.

References int2wstring, and TRACE.

void freeling::completer::load_classes ( const std::wstring &  ,
const std::wstring &  ,
const std::wstring &  ,
std::set< std::wstring > &   
) [static]

auxiliary to load CLASS section of config file, used both by completer and labeler.

References ERROR_CRASH.

Referenced by freeling::depLabeler::depLabeler().

check if the extra lemma/form/class conditions are satisfied

check if the extra lemma/form/class conditions are satisfied.

References freeling::matching_condition::attrs, freeling::word::get_form(), freeling::word::get_lemma(), freeling::word::get_tag(), freeling::matching_condition::label, freeling::matching_condition::neg, TRACE, and WARNING.

bool freeling::completer::match_side ( const int  ,
const std::vector< parse_tree * > &  ,
const size_t  ,
const std::vector< matching_condition > &   
) const [private]

check left or right context

References first_chk, first_cond, int2wstring, last, LEFT, next, prev, and TRACE.

bool freeling::completer::matching_context ( const std::vector< parse_tree * > &  ,
const size_t  ,
const completerRule  
) const [private]

check if the current context matches the given rule

Check if the current context matches the one specified in the given rule.

References freeling::completerRule::context_neg, LEFT, freeling::completerRule::leftContext, RIGHT, freeling::completerRule::rightContext, and TRACE.

bool freeling::completer::matching_operation ( const std::vector< parse_tree * > &  ,
const size_t  ,
const completerRule ,
dep_txala_status  
) const [private]

Member Data Documentation

std::map<std::pair<std::wstring,std::wstring>,std::list<completerRule> > freeling::completer::chgram [private]

set of rules, indexed by labels of nodes

std::set<std::wstring> freeling::completer::wordclasses [private]

The documentation for this class was generated from the following files: