[−][src]Struct conllx::graph::DepGraphMut
A mutable graph view.
This data structure provides a mutable view of a CoNLL-X dependency
graph. The view can be used to retrieve the dependents of a head or
the head of a dependent. In addition, the add_deprel
method can be
used to add dependency relations to the graph.
Methods
impl<'a> DepGraphMut<'a>
[src]
pub fn add_deprel<S>(&mut self, triple: DepTriple<S>) where
S: Into<String>,
[src]
S: Into<String>,
Add a dependency relation between head
and dependent
.
If dependent
already has a head relation, this relation is removed
to ensure single-headedness.
pub fn dependents(&self, head: usize) -> impl Iterator<Item = DepTriple<&str>>
[src]
Return an iterator over the dependents of head
.
pub fn head(&self, dependent: usize) -> Option<DepTriple<&str>>
[src]
Return the head relation of dependent
, if any.
pub fn remove_head_rel(&mut self, dependent: usize) -> Option<DepTriple<String>>
[src]
Remove relation of a token to its head.
Returns the index of the head iff a head was removed.
pub fn len(&self) -> usize
[src]
Get the number of nodes in the dependency graph.
This is equal to the number of tokens, plus one root node.
Trait Implementations
impl<'a> Index<usize> for DepGraphMut<'a>
[src]
type Output = Node
The returned type after indexing.
fn index(&self, idx: usize) -> &Self::Output
[src]
impl<'a> IndexMut<usize> for DepGraphMut<'a>
[src]
Auto Trait Implementations
impl<'a> Send for DepGraphMut<'a>
impl<'a> Unpin for DepGraphMut<'a>
impl<'a> Sync for DepGraphMut<'a>
impl<'a> !UnwindSafe for DepGraphMut<'a>
impl<'a> RefUnwindSafe for DepGraphMut<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,