|
|
constexpr | Sentence () noexcept=delete |
| | Default construction is disabled; sentences are created via Treebank::add_sentence.
|
|
constexpr Treebank * | treebank () const noexcept |
| | Pointer to the treebank that owns this sentence.
|
|
constexpr std::string_view | get_sent_id () const noexcept |
| | Sentence identifier (sent_id metadata).
|
| constexpr std::error_code | set_sent_id (std::string_view sent_id) noexcept |
| | Changes the sentence identifier.
|
|
constexpr std::string_view | get_text () const noexcept |
| | Sentence text (text metadata).
|
| constexpr std::error_code | set_text (std::string_view text) noexcept |
| | Sets the sentence text.
|
|
constexpr auto | tokens () const noexcept |
| | View over the tokens, in sentence order.
|
|
constexpr std::size_t | num_tokens () const noexcept |
| | Number of tokens in the sentence.
|
| constexpr std::optional< Token * > | get_token_by_id (TokenId id) const noexcept |
| | Looks up a token by its identifier.
|
| constexpr std::expected< Token *, std::error_code > | add_token () noexcept |
| | Constructs and appends a new token.
|
| constexpr std::error_code | remove_token (TokenId id, bool skip_dependency_validation=false) noexcept |
| | Removes the token with the given identifier.
|
| constexpr std::error_code | remove_token (Token *token, bool skip_dependency_validation=false) noexcept |
| | Removes the given token.
|
|
constexpr void | remove_all_tokens () noexcept |
| | Removes all tokens from the sentence.
|
|
constexpr auto | words () const noexcept |
| | View over the words, in treebank/range order.
|
|
constexpr std::size_t | num_words () const noexcept |
| | Number of words in the sentence.
|
| constexpr std::expected< Word *, std::error_code > | add_word (TokenId first, TokenId last) noexcept |
| | Constructs and appends a new word spanning the given token range.
|
| constexpr std::expected< Word *, std::error_code > | add_word (Word::Range range) noexcept |
| | Constructs and appends a new word spanning the given token range.
|
| constexpr std::error_code | remove_word (const Word *word, bool remove_tokens=false) noexcept |
| | Removes the given word.
|
| constexpr void | remove_all_words (bool remove_tokens=false) noexcept |
| | Removes all words from the sentence.
|
|
constexpr auto | metadata () const noexcept |
| | View over the metadata entries, as key/value pairs.
|
|
constexpr std::size_t | num_metadata_entries () const noexcept |
| | Number of metadata entries.
|
| constexpr std::optional< std::string_view > | get_metadata (std::string_view key) const noexcept |
| | Looks up a metadata value by key.
|
| constexpr std::error_code | set_metadata (std::string_view key, std::string_view value=std::string_view{}) noexcept |
| | Adds a new metadata entry.
|
| constexpr std::error_code | set_metadata_from_comment_line (std::string_view line) noexcept |
| | Parses a #-prefixed comment line and adds it as a metadata entry.
|
| constexpr std::error_code | unset_metadata (std::string_view key) noexcept |
| | Removes a metadata entry.
|
|
constexpr void | remove_all_metadata () noexcept |
| | Removes all metadata entries except sent_id, and clears the text.
|
|
constexpr bool | empty () const noexcept |
| | Whether the sentence contains no tokens.
|
|
constexpr void | clear () noexcept |
| | Removes all tokens and metadata (except sent_id), resetting the sentence's content.
|
| constexpr std::error_code | validate () const noexcept |
| | Checks the sentence for structural inconsistencies.
|
|
constexpr | ~Sentence () noexcept=default |
| | Destructor.
|
A single sentence within a Treebank.