Struct rustfst::FstPath

source ·
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>

source

pub fn new(ilabels: Vec<Label>, olabels: Vec<Label>, weight: W) -> Self

Creates a new Path.

source

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.

source

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.

source

pub fn concat(&mut self, other: FstPath<W>) -> Result<()>

Append a Path to the current Path. Labels are appended and weights multiplied.

source

pub fn is_empty(&self) -> bool

Trait Implementations§

source§

impl<W: Clone + Semiring> Clone for FstPath<W>

source§

fn clone(&self) -> FstPath<W>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<W: Debug + Semiring> Debug for FstPath<W>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<W: Semiring> Default for FstPath<W>

source§

fn default() -> Self

Creates an empty path with a weight one.

source§

impl<W: Semiring + Hash + Eq> Hash for FstPath<W>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<W: PartialEq + Semiring> PartialEq for FstPath<W>

source§

fn eq(&self, other: &FstPath<W>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<W: PartialOrd + Semiring> PartialOrd for FstPath<W>

source§

fn partial_cmp(&self, other: &FstPath<W>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<W: Semiring + Hash + Eq> Eq for FstPath<W>

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V