Struct conllx::Writer
[−]
[src]
pub struct Writer<W> { /* fields omitted */ }
A writer for CoNLL-X sentences.
This writer will write sentences to the embedded writer in CoNLL-X tabular format.
Methods
impl<W: Write> Writer<W>
[src]
fn new(write: W) -> Writer<W>
[src]
Construct a new writer from an object that implements the io::Write
trait.
fn get_ref(&self) -> &W
[src]
Borrow the embedded writer. Getting the underlying writer is often useful when the writer writes to a memory object.
Examples
use conllx::{Sentence, Token, WriteSentence, Writer}; use std::str; let output = Vec::new(); let mut writer = Writer::new(output); let sent = vec![ Token::new("hello"), Token::new("world"), ]; writer.write_sentence(&sent).unwrap(); println!("Output:\n{}", str::from_utf8(writer.get_ref()).unwrap());