[−][src]Struct lumberjack::Terminal
Struct representing a Terminal.
Terminal
s are represented by:
form
- word formpos
- part of speech taglemma
- (optional) lemmamorph
- (optional) morphological featuresspan
- 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 Terminal
s 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]
S: Into<String>,
Replace lemma with new_lemma
. Return old value.
Trait Implementations
impl PartialEq<Terminal> for Terminal
[src]
fn eq(&self, other: &Terminal) -> bool
[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(&self) -> 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
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,