[][src]Struct conllu::graph::DepGraphMut

pub struct DepGraphMut<'a> { /* fields omitted */ }

A mutable graph view.

This data structure provides a mutable view of a CoNLL-U 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]

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.

impl<'a> IndexMut<usize> for DepGraphMut<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for DepGraphMut<'a>

impl<'a> Send for DepGraphMut<'a>

impl<'a> Sync for DepGraphMut<'a>

impl<'a> Unpin for DepGraphMut<'a>

impl<'a> !UnwindSafe for DepGraphMut<'a>

Blanket Implementations

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

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

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

impl<T> From<T> for T[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.