pub struct FstPath<W: Semiring> {
pub ilabels: Vec<Label>,
pub olabels: Vec<Label>,
pub weight: W,
}
Expand description
Structure representing a path in a FST (list of input labels, list of output labels and total weight).
Fields§
§ilabels: Vec<Label>
List of input labels.
olabels: Vec<Label>
List of output labels.
weight: W
Total weight of the path computed by multiplying the weight of each transition.
Implementations§
source§impl<W: Semiring> FstPath<W>
impl<W: Semiring> FstPath<W>
sourcepub fn add_to_path(
&mut self,
ilabel: Label,
olabel: Label,
weight: &W
) -> Result<()>
pub fn add_to_path( &mut self, ilabel: Label, olabel: Label, weight: &W ) -> Result<()>
Adds the content of an FST transition to the Path. Labels are added at the end of the corresponding vectors and the weight is multiplied by the total weight already stored in the Path.
sourcepub fn add_weight(&mut self, weight: &W) -> Result<()>
pub fn add_weight(&mut self, weight: &W) -> Result<()>
Add a single weight to the Path by multiplying the weight by the total weight of the path.
sourcepub fn concat(&mut self, other: FstPath<W>) -> Result<()>
pub fn concat(&mut self, other: FstPath<W>) -> Result<()>
Append a Path to the current Path. Labels are appended and weights multiplied.
pub fn is_empty(&self) -> bool
Trait Implementations§
source§impl<W: PartialEq + Semiring> PartialEq for FstPath<W>
impl<W: PartialEq + Semiring> PartialEq for FstPath<W>
source§impl<W: PartialOrd + Semiring> PartialOrd for FstPath<W>
impl<W: PartialOrd + Semiring> PartialOrd for FstPath<W>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<W: Semiring + Hash + Eq> Eq for FstPath<W>
impl<W: Semiring> StructuralPartialEq for FstPath<W>
Auto Trait Implementations§
impl<W> Freeze for FstPath<W>where
W: Freeze,
impl<W> RefUnwindSafe for FstPath<W>where
W: RefUnwindSafe,
impl<W> Send for FstPath<W>where
W: Send,
impl<W> Sync for FstPath<W>
impl<W> Unpin for FstPath<W>where
W: Unpin,
impl<W> UnwindSafe for FstPath<W>where
W: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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