ModErn Text Analysis
META Enumerates Textual Applications
|
Represents the parse tree for a sentence. More...
#include <parse_tree.h>
Public Member Functions | |
parse_tree (std::unique_ptr< node > root) | |
Creates a new parse tree by taking ownership of a subtree pointed to by the argument. More... | |
parse_tree (const parse_tree &) | |
Copy constructor. | |
parse_tree (parse_tree &&)=default | |
Move constructor. | |
parse_tree & | operator= (parse_tree) |
Assignment operator. | |
void | swap (parse_tree &) |
Swaps this parse tree with the given parse tree. | |
void | transform (tree_transformer &) |
Transforms the current parse tree by using the given tree_transformer. | |
template<class Visitor > | |
std::remove_reference< Visitor >::type::result_type | visit (Visitor &&vtor) |
Runs a visitor over the parse tree. More... | |
template<class Visitor > | |
std::remove_reference< Visitor >::type::result_type | visit (Visitor &&vtor) const |
Runs a visitor over the parse tree. More... | |
void | pretty_print (std::ostream &os) const |
Prints a parse tree to a stream. More... | |
Private Attributes | |
std::unique_ptr< node > | root_ |
The root of the parse tree. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const parse_tree &tree) |
Prints a parse tree to a stream. More... | |
bool | operator== (const parse_tree &lhs, const parse_tree &rhs) |
Represents the parse tree for a sentence.
This may either be a sentence parsed from training data, or the output from a trained parser on test data.
meta::parser::parse_tree::parse_tree | ( | std::unique_ptr< node > | root | ) |
Creates a new parse tree by taking ownership of a subtree pointed to by the argument.
root | The desired root of the parse tree |
|
inline |
Runs a visitor over the parse tree.
Non-const version.
|
inline |
Runs a visitor over the parse tree.
Const version.
void meta::parser::parse_tree::pretty_print | ( | std::ostream & | os | ) | const |
Prints a parse tree to a stream.
This is indented.
os | The stream to print to |
|
friend |
Prints a parse tree to a stream.
This is non-indented.
os | The stream to print to |
tree | The tree to be printed |
|
friend |
lhs | The left hand side of the expression |
rhs | The right hand side of the expression |