[][src]Struct lumberjack::Terminal

pub struct Terminal { /* fields omitted */ }

Struct representing a Terminal.

Terminals are represented by:

  • form - word form
  • pos - part of speech tag
  • lemma - (optional) lemma
  • morph - (optional) morphological features
  • span - position in the sentence

Methods

impl Terminal[src]

pub fn new(form: impl Into<String>, pos: impl Into<String>, idx: usize) -> Self[src]

Construct new Terminal.

Constructs a new Terminal with the given form and part-of-speech tag at the specified index.

pub fn span(&self) -> &Span[src]

Returns the Terminal's span.

A Terminal's span is defined as a tuple (n, n+1) where n is the 0-based position of the Terminal in the sentence.

pub fn idx(&self) -> usize[src]

Returns the Terminal's linear position in the sentence.

pub fn form(&self) -> &str[src]

Return the Terminals form.

pub fn set_form(&mut self, new_form: impl Into<String>) -> String[src]

Replace form with new_form. Return old value.

pub fn label(&self) -> &str[src]

Return part of speech.

pub fn set_label(&mut self, new_pos: impl Into<String>) -> String[src]

Replace part of speech with new_pos. Return old value.

pub fn features(&self) -> Option<&Features>[src]

Get this Terminal's Features.

pub fn features_mut(&mut self) -> &mut Features[src]

Get this Terminal's Features mutably.

This method initializes the features if they are None.

pub fn set_features(&mut self, features: Option<Features>) -> Option<Features>[src]

Set this Terminal's Features.

Returns the replaced value.

pub fn lemma(&self) -> Option<&str>[src]

Return lemma if present, else None.

pub fn set_lemma<S>(&mut self, new_lemma: Option<S>) -> Option<String> where
    S: Into<String>, 
[src]

Replace lemma with new_lemma. Return old value.

Trait Implementations

impl PartialEq<Terminal> for Terminal[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'a> From<&'a Terminal> for Token[src]

impl From<Terminal> for Node[src]

impl Clone for Terminal[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Eq for Terminal[src]

impl Debug for Terminal[src]

impl Display for Terminal[src]

Auto Trait Implementations

impl Send for Terminal

impl Sync for Terminal

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]