|
|
constexpr | Token () noexcept=delete |
| | Default construction is disabled; tokens are created via Sentence::add_token or Token::add_empty_node.
|
|
constexpr Sentence * | sentence () const noexcept |
| | Pointer to the sentence that owns this token.
|
|
constexpr Token * | get_parent () const noexcept |
| | Pointer to the parent token, or nullptr if this is not an empty node.
|
|
constexpr TokenId | get_id () const noexcept |
| | Token identifier. For an empty node, this is its position among its parent's empty nodes.
|
| constexpr std::optional< Token * > | get_head () const noexcept |
| | Resolves the HEAD field to the referenced token.
|
| constexpr std::error_code | set_head (TokenId id) noexcept |
| | Sets the HEAD field, linking this token to its syntactic head.
|
|
constexpr bool | is_empty_node () const noexcept |
| | Whether this token is an empty node.
|
| constexpr std::optional< Word * > | get_word () const noexcept |
| | The Word this token belongs to, if any.
|
|
constexpr bool | is_in_word () const noexcept |
| | Whether this token belongs to a Word.
|
|
constexpr auto | fields () const noexcept |
| | View over the field values, in column order.
|
|
constexpr std::size_t | num_fields () const noexcept |
| | Number of fields on this token (normally equal to Treebank::num_columns).
|
| constexpr std::optional< std::string_view > | get_field_value (std::size_t position) const noexcept |
| | Looks up a field value by column position.
|
| constexpr std::optional< std::string_view > | get_field_value (std::string_view name) const noexcept |
| | Looks up a field value by column name.
|
| constexpr std::error_code | set_field_value (std::size_t position, std::string_view value) noexcept |
| | Sets a field value by column position.
|
| constexpr std::error_code | set_field_value (std::string_view name, std::string_view value) noexcept |
| | Sets a field value by column name.
|
| constexpr std::error_code | unset_field_value (std::size_t position) noexcept |
| | Unsets a field value by column position.
|
| constexpr std::error_code | unset_field_value (std::string_view name) noexcept |
| | Unsets a field value by column name.
|
|
constexpr auto | empty_nodes () const noexcept |
| | View over the empty nodes attached to this token, in order.
|
|
constexpr std::size_t | empty_node_count () const noexcept |
| | Number of empty nodes attached to this token.
|
| constexpr std::expected< Token *, std::error_code > | add_empty_node () noexcept |
| | Constructs and appends a new empty node.
|
| constexpr std::error_code | remove_empty_node (TokenId id) noexcept |
| | Removes the empty node with the given identifier.
|
| constexpr std::error_code | remove_empty_node (Token *node) noexcept |
| | Removes the given empty node.
|
|
constexpr void | remove_all_empty_nodes () noexcept |
| | Removes all empty nodes attached to this token.
|
| constexpr std::error_code | validate () const noexcept |
| | Checks the token for structural inconsistencies.
|
|
constexpr | ~Token () noexcept=default |
| | Destructor.
|
A single token within a Sentence, or an empty node within a Token.