[][src]Trait lumberjack::io::Encode

pub trait Encode {
    fn encode_absolute(&self) -> Result<AbsoluteEncoding, Error>;
fn annotate_absolute(&mut self) -> Result<(), Error>;
fn encode_relative(&self) -> Result<RelativeEncoding, Error>;
fn annotate_relative(&mut self) -> Result<(), Error>; }

Encode trait.

Defines methods that encode a tree through a sequence of labels.

All methods expect trees without unary chains. Unary chains can get collapsed through TreeOps::collapse_unary_chains.

All methods return Error on non-projective trees.

Required methods

fn encode_absolute(&self) -> Result<AbsoluteEncoding, Error>

Absolute scale encoding.

Encode a tree as a sequence of labels where each label is a tuple consisting of the lowest common ancestor of the current terminal with the next terminal in the tree and an optional leaf-unary-chain. Common ancestors consist of a (label, num_common) tuple, where num_common describes the number of common ancestors.

fn annotate_absolute(&mut self) -> Result<(), Error>

Annotate absolute scale tags as features.

The feature key is "abs_ancestor".

fn encode_relative(&self) -> Result<RelativeEncoding, Error>

Relative scale encoding.

Similar to the absolute scale encoding, each terminal also gets assigned a tuple consisting of the lowest common ancestor with the following terminal and an optional leaf-unary-chain.

fn annotate_relative(&mut self) -> Result<(), Error>

Annotate relative scale tags as features.

The feature key is "rel_ancestor".

Loading content...

Implementors

Loading content...