An internal node in a parse tree.
More...
#include <internal_node.h>
|
std::vector< std::unique_ptr< node > > | children_ |
| A list of the children of this node, from left to right.
|
|
const leaf_node * | head_lexicon_ = nullptr |
| A pointer to the head word for this subtree.
|
|
const node * | head_constituent_ = nullptr |
| A pointer to the head constituent for this subtree (one of this tree's children)
|
|
An internal node in a parse tree.
Every node in the parse tree that is not a pre-terminal is an internal node.
template<class FwdIt >
meta::parser::internal_node::internal_node |
( |
class_label |
cat, |
|
|
FwdIt |
begin, |
|
|
FwdIt |
end |
|
) |
| |
|
inline |
Constructs a new internal node by moving the children into the node from a sequence denoted by iterators.
- Parameters
-
cat | The desired category for this node |
begin | An iterator to the beginning of a sequence of children for this node |
end | An iterator to the ending of a sequence of children for this node |
meta::parser::internal_node::internal_node |
( |
class_label |
cat, |
|
|
std::vector< std::unique_ptr< node >> && |
children |
|
) |
| |
Constructs a new internal node by moving the children into the node from another vector of children.
- Parameters
-
cat | The desired category for this node |
children | The vector of children, which will be moved into this node |
void meta::parser::internal_node::add_child |
( |
std::unique_ptr< node > |
child | ) |
|
Adds a child to this node.
- Parameters
-
child | The child to be added |
uint64_t meta::parser::internal_node::num_children |
( |
| ) |
const |
- Returns
- the number of children this node has
const node * meta::parser::internal_node::child |
( |
uint64_t |
idx | ) |
const |
- Parameters
-
idx | The index of the child to fetch |
- Returns
- a non-owning pointer to the child at that index from left to right
const leaf_node * meta::parser::internal_node::head_lexicon |
( |
| ) |
const |
- Returns
- the head lexicon of this node
void meta::parser::internal_node::head_lexicon |
( |
const leaf_node * |
l | ) |
|
- Parameters
-
l | The desired head lexicon for this node |
const node * meta::parser::internal_node::head_constituent |
( |
| ) |
const |
- Returns
- the head constituent for this node
void meta::parser::internal_node::head_constituent |
( |
const node * |
n | ) |
|
- Parameters
-
n | The desired head constituent for this node |
void meta::parser::internal_node::head |
( |
const node * |
n | ) |
|
Sets the head constituent and head lexicon based on a node whose head lexicon has already been determined.
- Parameters
-
n | The desired head constituent for this node (must have the head lexicon determined) |
template<class Fun >
void meta::parser::internal_node::each_child |
( |
Fun && |
fn | ) |
const |
|
inline |
Runs a functor over each child.
Const version.
- Parameters
-
fn | The functor to run over each child |
template<class Fun >
void meta::parser::internal_node::each_child |
( |
Fun && |
fn | ) |
|
|
inline |
Runs a functor over each child.
Non-const version.
- Parameters
-
fn | The functor to run over each child. |
The documentation for this class was generated from the following files: