Parses CoNLL-U formatted input into a Treebank.
More...
#include <parser.hpp>
|
|
constexpr | Parser () noexcept=default |
| | Default constructor. Initializes a parser with default options.
|
| constexpr | Parser (ParserOptions options) noexcept |
| | Constructs a parser with the given options.
|
| std::expected< std::unique_ptr< Treebank >, std::error_code > | parse (std::istream &&stream) noexcept |
| | Parses a CoNLL-U formatted stream into a new Treebank.
|
| std::expected< std::unique_ptr< Treebank >, std::error_code > | parse_file (const std::filesystem::path &path) noexcept |
| | Opens the file at path and parses its contents as CoNLL-U formatted text into a new Treebank.
|
| std::expected< std::unique_ptr< Treebank >, std::error_code > | parse_memory (std::string_view data) noexcept |
| | Parses CoNLL-U formatted text already held in memory into a new Treebank.
|
template<typename DataType>
requires (sizeof(DataType) == sizeof(std::uint8_t)) |
| std::expected< std::unique_ptr< Treebank >, std::error_code > | parse_memory (const DataType *data, std::size_t size) noexcept |
| | Parses CoNLL-U formatted text from a raw byte buffer into a new Treebank.
|
|
constexpr | ~Parser () noexcept=default |
| | Destructor.
|
Parses CoNLL-U formatted input into a Treebank.
◆ Parser()
|
|
explicitconstexprnoexcept |
Constructs a parser with the given options.
- Parameters
-
| [in] | options | Parsing configuration to use. |
◆ parse()
| std::expected< std::unique_ptr< Treebank >, std::error_code > tg::conllu::Parser::parse |
( |
std::istream && | stream | ) |
|
|
nodiscardnoexcept |
Parses a CoNLL-U formatted stream into a new Treebank.
- Parameters
-
| [in] | stream | Input stream to read from. |
- Returns
- The parsed treebank, or an error_code describing the first failure encountered.
◆ parse_file()
| std::expected< std::unique_ptr< Treebank >, std::error_code > tg::conllu::Parser::parse_file |
( |
const std::filesystem::path & | path | ) |
|
|
nodiscardnoexcept |
Opens the file at path and parses its contents as CoNLL-U formatted text into a new Treebank.
- Parameters
-
| [in] | path | Path to the CoNLL-U file to read. |
- Returns
- The parsed treebank, or an error_code describing why the file could not be opened/read or why parsing failed.
◆ parse_memory() [1/2]
template<typename DataType>
requires (sizeof(DataType) == sizeof(std::uint8_t))
| std::expected< std::unique_ptr< Treebank >, std::error_code > tg::conllu::Parser::parse_memory |
( |
const DataType * | data, |
|
|
std::size_t | size ) |
|
nodiscardnoexcept |
Parses CoNLL-U formatted text from a raw byte buffer into a new Treebank.
- Template Parameters
-
| DataType | Element type of data; must be exactly one byte wide. |
- Parameters
-
| [in] | data | Pointer to the start of the buffer to parse. |
| [in] | size | Number of elements (bytes) pointed to by data. |
- Returns
- The parsed treebank, or an error_code describing the first failure encountered.
◆ parse_memory() [2/2]
| std::expected< std::unique_ptr< Treebank >, std::error_code > tg::conllu::Parser::parse_memory |
( |
std::string_view | data | ) |
|
|
nodiscardnoexcept |
Parses CoNLL-U formatted text already held in memory into a new Treebank.
- Parameters
-
| [in] | data | CoNLL-U formatted text to parse. |
- Returns
- The parsed treebank, or an error_code describing the first failure encountered.
The documentation for this class was generated from the following file: