FreeLing
4.0
|
Class parse tree is used to store the results of parsing. More...
#include <language.h>
Public Member Functions | |
parse_tree () | |
Class parse tree is used to store the results of parsing. | |
parse_tree (parse_tree::const_iterator p) | |
parse_tree (const node &) | |
void | build_node_index (const std::wstring &) |
assign an id to each node and build index | |
void | rebuild_node_index () |
rebuild index maintaining node id's | |
parse_tree::const_iterator | get_node_by_id (const std::wstring &) const |
access the node with given id | |
parse_tree::const_iterator | get_node_by_pos (size_t) const |
access the node by word position | |
parse_tree::iterator | get_node_by_id (const std::wstring &) |
access the node with given id | |
parse_tree::iterator | get_node_by_pos (size_t) |
access the node by word position | |
parse_tree::const_iterator | get_subsuming_node (size_t i, size_t j) const |
get lowest tree node subsuming whole word span i..j | |
parse_tree::iterator | get_subsuming_node (size_t i, size_t j) |
parse_tree::const_iterator | get_left_subsuming_node (size_t i, size_t j) const |
get tree node subsuming longest span i..k such that k<=j | |
parse_tree::iterator | get_left_subsuming_node (size_t i, size_t j) |
parse_tree::const_iterator | get_right_subsuming_node (size_t i, size_t j) const |
get tree node subsuming longest span k..j such that i<=k | |
parse_tree::iterator | get_right_subsuming_node (size_t i, size_t j) |
Static Public Member Functions | |
static const word & | get_head_word (parse_tree::const_iterator) |
obtain a reference to head word of a parse_tree | |
static const std::wstring & | get_head_label (parse_tree::const_iterator) |
obtain the head label of a parse_tree | |
static int | get_head_position (parse_tree::const_iterator) |
obtain position of head word of a parse_tree (or -1 if no head) | |
static bool | C_commands (parse_tree::const_iterator, parse_tree::const_iterator) |
C-commands 1 - pt1 does not dominate pt2 2 - pt2 does not dominate pt1 3 - The first branching node that dominates pt1 also dominates pt2. | |
static void | PrintTree (parse_tree::const_iterator n, int k, int depth) |
print a parse tree (debugging purposes mainly) | |
Private Attributes | |
std::map< std::wstring, parse_tree::iterator > | node_index |
std::vector< parse_tree::iterator > | word_index |
Class parse tree is used to store the results of parsing.
Class parse tree is used to store the results of parsing.
Methods for parse_tree
freeling::parse_tree::parse_tree | ( | const node & | n | ) |
void freeling::parse_tree::build_node_index | ( | const std::wstring & | ) |
assign an id to each node and build index
assign id's to nodes and build index
References freeling::tree< node >::begin(), freeling::tree< node >::end(), int2wstring, and node_index.
bool freeling::parse_tree::C_commands | ( | parse_tree::const_iterator | pt1, |
parse_tree::const_iterator | pt2 | ||
) | [static] |
C-commands 1 - pt1 does not dominate pt2 2 - pt2 does not dominate pt1 3 - The first branching node that dominates pt1 also dominates pt2.
References freeling::basic_tree_iterator< T, N >::get_parent(), freeling::basic_tree_iterator< T, N >::is_root(), freeling::basic_tree_iterator< T, N >::num_children(), and freeling::tree< node >::parent.
const wstring & freeling::parse_tree::get_head_label | ( | parse_tree::const_iterator | pt | ) | [static] |
obtain the head label of a parse_tree
References freeling::basic_tree_iterator< T, N >::num_children(), freeling::basic_tree_iterator< T, N >::sibling_begin(), and freeling::basic_tree_iterator< T, N >::sibling_end().
int freeling::parse_tree::get_head_position | ( | parse_tree::const_iterator | pt | ) | [static] |
obtain position of head word of a parse_tree (or -1 if no head)
obtain the position in the sentence of the head word of a parse_tree
References freeling::basic_tree_iterator< T, N >::num_children(), freeling::basic_tree_iterator< T, N >::sibling_begin(), and freeling::basic_tree_iterator< T, N >::sibling_end().
const word & freeling::parse_tree::get_head_word | ( | parse_tree::const_iterator | pt | ) | [static] |
obtain a reference to head word of a parse_tree
References freeling::basic_tree_iterator< T, N >::num_children(), freeling::basic_tree_iterator< T, N >::sibling_begin(), and freeling::basic_tree_iterator< T, N >::sibling_end().
Referenced by freeling::mention::mention().
parse_tree::const_iterator freeling::parse_tree::get_left_subsuming_node | ( | size_t | i, |
size_t | j | ||
) | const |
get tree node subsuming longest span i..k such that k<=j
parse_tree::iterator freeling::parse_tree::get_left_subsuming_node | ( | size_t | i, |
size_t | j | ||
) |
parse_tree::const_iterator freeling::parse_tree::get_node_by_id | ( | const std::wstring & | ) | const |
access the node with given id
parse_tree::iterator freeling::parse_tree::get_node_by_id | ( | const std::wstring & | ) |
access the node with given id
parse_tree::const_iterator freeling::parse_tree::get_node_by_pos | ( | size_t | pos | ) | const |
access the node by word position
get leaf node corresponding to word at given position in sentence, const iterator
References word_index.
parse_tree::iterator freeling::parse_tree::get_node_by_pos | ( | size_t | pos | ) |
access the node by word position
get leaf node corresponding to word at given position in sentence, normal iterator
References word_index.
parse_tree::const_iterator freeling::parse_tree::get_right_subsuming_node | ( | size_t | i, |
size_t | j | ||
) | const |
get tree node subsuming longest span k..j such that i<=k
parse_tree::iterator freeling::parse_tree::get_right_subsuming_node | ( | size_t | i, |
size_t | j | ||
) |
parse_tree::const_iterator freeling::parse_tree::get_subsuming_node | ( | size_t | i, |
size_t | j | ||
) | const |
get lowest tree node subsuming whole word span i..j
parse_tree::iterator freeling::parse_tree::get_subsuming_node | ( | size_t | i, |
size_t | j | ||
) |
void freeling::parse_tree::PrintTree | ( | parse_tree::const_iterator | n, |
int | k, | ||
int | depth | ||
) | [static] |
print a parse tree (debugging purposes mainly)
Print a parse tree -- tracing purposes mainly.
References freeling::word::get_form(), freeling::word::get_lemma(), freeling::word::get_tag(), freeling::basic_tree_iterator< T, N >::num_children(), freeling::basic_tree_iterator< T, N >::sibling_begin(), and freeling::basic_tree_iterator< T, N >::sibling_end().
rebuild index maintaining node id's
References freeling::tree< node >::begin(), freeling::tree< node >::end(), node_index, and word_index.
std::map<std::wstring,parse_tree::iterator> freeling::parse_tree::node_index [private] |
Referenced by build_node_index(), and rebuild_node_index().
std::vector<parse_tree::iterator> freeling::parse_tree::word_index [private] |
Referenced by get_node_by_pos(), and rebuild_node_index().