CoNLL-U
Loading...
Searching...
No Matches
tg::conllu::Writer Class Referencefinal

Serializes a Treebank into CoNLL-U formatted output. More...

#include <writer.hpp>

Public Member Functions

Constructors
constexpr Writer () noexcept=default
 Default constructor. Initializes a writer with default options.
constexpr Writer (WriterOptions options) noexcept
 Constructs a writer with the given options.
Writing
std::error_code write (const Treebank *treebank, std::ostream &&stream) const noexcept
 Writes a treebank in CoNLL-U format to a stream.
std::error_code write_file (const Treebank *treebank, const std::filesystem::path &path) const noexcept
 Serializes treebank in CoNLL-U format and writes it to the file at path.
Destructor
constexpr ~Writer () noexcept=default
 Destructor.

Detailed Description

Serializes a Treebank into CoNLL-U formatted output.

Constructor & Destructor Documentation

◆ Writer()

tg::conllu::Writer::Writer ( WriterOptions options)
explicitconstexprnoexcept

Constructs a writer with the given options.

Parameters
[in]optionsWriting configuration to use.

Member Function Documentation

◆ write()

std::error_code tg::conllu::Writer::write ( const Treebank * treebank,
std::ostream && stream ) const
nodiscardnoexcept

Writes a treebank in CoNLL-U format to a stream.

Parameters
[in]treebankTreebank to serialize.
[in]streamOutput stream to write to.
Returns
Empty error_code on success, or an error describing the first failure encountered.

◆ write_file()

std::error_code tg::conllu::Writer::write_file ( const Treebank * treebank,
const std::filesystem::path & path ) const
nodiscardnoexcept

Serializes treebank in CoNLL-U format and writes it to the file at path.

Parameters
[in]treebankTreebank to serialize.
[in]pathPath to the file to write.
Returns
Empty error_code on success, or an error describing why the file could not be opened/written or why serialization failed.

The documentation for this class was generated from the following file: