pub enum Node {
NonTerminal(NonTerminal),
Terminal(Terminal),
}
Expand description
Enum representing Nodes in a constituency tree.
Variants§
Implementations§
Source§impl Node
impl Node
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Returns whether a self
is Terminal
.
Sourcepub fn terminal(&self) -> Option<&Terminal>
pub fn terminal(&self) -> Option<&Terminal>
Get a Option<&Terminal>
.
Returns None
if self
is a Node::NonTerminal
.
Sourcepub fn nonterminal(&self) -> Option<&NonTerminal>
pub fn nonterminal(&self) -> Option<&NonTerminal>
Get a Option<&NonTerminal>
.
Returns None
if self
is a Node::Terminal
.
Sourcepub fn nonterminal_mut(&mut self) -> Option<&mut NonTerminal>
pub fn nonterminal_mut(&mut self) -> Option<&mut NonTerminal>
Get a Option<&mut NonTerminal>
.
Returns None
if self
is a Node::Terminal
.
Sourcepub fn continuity(&self) -> Continuity
pub fn continuity(&self) -> Continuity
Returns whether this node’s span is continuous.
This does not return whether this node introduces a edge cutting another node’s span. It does return whether this node’s span is continuous.
Sourcepub fn terminal_mut(&mut self) -> Option<&mut Terminal>
pub fn terminal_mut(&mut self) -> Option<&mut Terminal>
Get a Option<&mut Terminal>
.
Returns None
if self
is a Node::NonTerminal
.
Sourcepub fn label(&self) -> &str
pub fn label(&self) -> &str
Get the node’s label.
Returns the part-of-speech for Terminal
s and the node label for NonTerminal
s.
Sourcepub fn set_label(&mut self, s: impl Into<String>) -> String
pub fn set_label(&mut self, s: impl Into<String>) -> String
Set the node’s label.
Returns the replaced label.
Sourcepub fn features_mut(&mut self) -> &mut Features
pub fn features_mut(&mut self) -> &mut Features
Get this Node
’s Features
mutably.
This method initializes the features if they are None
.
Trait Implementations§
Source§impl From<NonTerminal> for Node
impl From<NonTerminal> for Node
Source§fn from(nt: NonTerminal) -> Self
fn from(nt: NonTerminal) -> Self
impl Eq for Node
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more