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>
Construct a new writer from an object that implements the io::Write
trait.
fn get_ref(&self) -> &W
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 = Sentence::new(vec![ Token::new("hello"), Token::new("world"), ]); writer.write_sentence(&sent).unwrap(); println!("Output:\n{}", str::from_utf8(writer.get_ref()).unwrap());
Trait Implementations
impl<W: Write> WriteSentence for Writer<W>
[src]
fn write_sentence(&mut self, sentence: &Sentence) -> Result<()>
Write a Sentence
into this object. Read more