Skip to main content

TropicalWeight

Struct TropicalWeight 

Source
#[repr(transparent)]
pub struct TropicalWeight(pub OrderedFloat<f64>);
Expand description

Tropical semiring weight.

Internally stores an f64 representing cost. Lower values are better. Infinity represents unreachable/impossible states.

Tuple Fields§

§0: OrderedFloat<f64>

Implementations§

Source§

impl TropicalWeight

Source

pub fn is_valid_raw(value: f64) -> bool

Return true when a raw f64 belongs to the verified tropical domain: any finite real cost or positive infinity for the additive identity.

Source

pub fn new(value: f64) -> TropicalWeight

Create a new tropical weight from a raw f64.

The verified Rocq model is R ∪ {+∞}. This constructor rejects NaN and -∞, which have no counterpart in that model and break semiring laws under IEEE-754 arithmetic.

Source

pub fn try_new(value: f64) -> Option<TropicalWeight>

Try to create a tropical weight in the verified domain.

Source

pub const fn new_unchecked(value: f64) -> TropicalWeight

Create a tropical weight without checking the verified-domain boundary.

This is only for low-level interop that must preserve arbitrary IEEE-754 payloads. Semiring algorithms and verified paths should use Self::new or Self::try_new.

Source

pub fn value(self) -> f64

Get the underlying f64 value.

Source

pub const fn infinity() -> TropicalWeight

Create a tropical weight representing infinity (unreachable).

Source

pub fn is_infinite(self) -> bool

Check if this weight represents infinity.

Trait Implementations§

Source§

impl Add for TropicalWeight

Source§

fn add(self, other: TropicalWeight) -> TropicalWeight

Operator + implements semiring ⊕ (min).

Source§

type Output = TropicalWeight

The resulting type after applying the + operator.
Source§

impl AddAssign for TropicalWeight

Source§

fn add_assign(&mut self, other: TropicalWeight)

Performs the += operation. Read more
Source§

impl Clone for TropicalWeight

Source§

fn clone(&self) -> TropicalWeight

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl CommutativeTimesSemiring for TropicalWeight

TropicalWeight has commutative multiplication: a + b = b + a

Source§

impl Copy for TropicalWeight

Source§

impl Debug for TropicalWeight

Source§

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

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

impl Default for TropicalWeight

Source§

fn default() -> TropicalWeight

Default is zero (multiplicative identity), not infinity.

Source§

impl DivisibleSemiring for TropicalWeight

Source§

fn divide(&self, other: &TropicalWeight) -> Option<TropicalWeight>

Division: a - b

Source§

impl Eq for TropicalWeight

Source§

impl From<f64> for TropicalWeight

Source§

fn from(value: f64) -> TropicalWeight

Converts to this type from the input type.
Source§

impl Hash for TropicalWeight

Source§

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

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 IdempotentSemiring for TropicalWeight

TropicalWeight is idempotent: min(a, a) = a

Source§

impl KClosedSemiring for TropicalWeight

TropicalWeight is k-closed with k=0 for non-negative weights.

For the tropical semiring with non-negative weights:

  • a* = min(0, a, 2a, 3a, ...) = 0 immediately (k=0)

Note: This assumes the domain is restricted to non-negative weights. Negative weights would cause the star to diverge.

Source§

fn closure_bound() -> Option<usize>

Returns the closure bound k such that star converges in at most k+1 iterations. Read more
Source§

impl<V, D> LazyWfst<char, TropicalWeight> for UniversalLevenshteinWfst<V, D>

Source§

fn is_expanded(&self, state: StateId) -> bool

Check if a state has been expanded (transitions computed).
Source§

fn expand(&mut self, state: StateId)

Force expansion of a state. Read more
Source§

fn transitions_lazy( &mut self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get transitions, computing them lazily if needed. Read more
Source§

fn cache_policy(&self) -> CachePolicy

Get the current cache policy.
Source§

fn set_cache_policy(&mut self, policy: CachePolicy)

Set the cache policy.
Source§

fn computed_states(&self) -> usize

Get the number of states that have been computed so far.
Source§

fn clear_cache(&mut self)

Clear the state cache. Read more
Source§

impl<D> LazyWfst<char, TropicalWeight> for LevenshteinWfst<D>
where D: Dictionary + Clone + Send + Sync, D::Node: Send + Sync, <D::Node as DictionaryNode>::Unit: Into<char> + TryFrom<char> + Copy + Send + Sync,

Source§

fn is_expanded(&self, state: StateId) -> bool

Check if a state has been expanded (transitions computed).
Source§

fn expand(&mut self, state: StateId)

Force expansion of a state. Read more
Source§

fn transitions_lazy( &mut self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get transitions, computing them lazily if needed. Read more
Source§

fn cache_policy(&self) -> CachePolicy

Get the current cache policy.
Source§

fn set_cache_policy(&mut self, policy: CachePolicy)

Set the cache policy.
Source§

fn computed_states(&self) -> usize

Get the number of states that have been computed so far.
Source§

fn clear_cache(&mut self)

Clear the state cache. Read more
Source§

impl LazyWfst<char, TropicalWeight> for PhoneticNfaWfst

Available on crate feature phonetic-rules only.
Source§

fn is_expanded(&self, state: StateId) -> bool

Check if a state has been expanded (transitions computed).
Source§

fn expand(&mut self, state: StateId)

Force expansion of a state. Read more
Source§

fn transitions_lazy( &mut self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get transitions, computing them lazily if needed. Read more
Source§

fn cache_policy(&self) -> CachePolicy

Get the current cache policy.
Source§

fn set_cache_policy(&mut self, policy: CachePolicy)

Set the cache policy.
Source§

fn computed_states(&self) -> usize

Get the number of states that have been computed so far.
Source§

fn clear_cache(&mut self)

Clear the state cache. Read more
Source§

impl LazyWfst<char, TropicalWeight> for RewriteWfst

Source§

fn is_expanded(&self, state: StateId) -> bool

Check if a state has been expanded (transitions computed).
Source§

fn expand(&mut self, state: StateId)

Force expansion of a state. Read more
Source§

fn transitions_lazy( &mut self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get transitions, computing them lazily if needed. Read more
Source§

fn cache_policy(&self) -> CachePolicy

Get the current cache policy.
Source§

fn set_cache_policy(&mut self, policy: CachePolicy)

Set the cache policy.
Source§

fn computed_states(&self) -> usize

Get the number of states that have been computed so far.
Source§

fn clear_cache(&mut self)

Clear the state cache. Read more
Source§

impl<D> LazyWfst<char, TropicalWeight> for PhoneticWfst<D>
where D: Dictionary + Clone + Send + Sync, D::Node: Send + Sync, <D::Node as DictionaryNode>::Unit: Into<char> + TryFrom<char> + Copy + Send + Sync,

Available on crate feature phonetic-rules only.
Source§

fn is_expanded(&self, state: StateId) -> bool

Check if a state has been expanded (transitions computed).
Source§

fn expand(&mut self, state: StateId)

Force expansion of a state. Read more
Source§

fn transitions_lazy( &mut self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get transitions, computing them lazily if needed. Read more
Source§

fn cache_policy(&self) -> CachePolicy

Get the current cache policy.
Source§

fn set_cache_policy(&mut self, policy: CachePolicy)

Set the cache policy.
Source§

fn computed_states(&self) -> usize

Get the number of states that have been computed so far.
Source§

fn clear_cache(&mut self)

Clear the state cache. Read more
Source§

impl<D> LazyWfst<char, TropicalWeight> for GeneralizedWfst<D>
where D: Dictionary + Clone + Send + Sync, D::Node: DictionaryNode<Unit = char>,

Source§

fn is_expanded(&self, state: StateId) -> bool

Check if a state has been expanded (transitions computed).
Source§

fn expand(&mut self, state: StateId)

Force expansion of a state. Read more
Source§

fn transitions_lazy( &mut self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get transitions, computing them lazily if needed. Read more
Source§

fn cache_policy(&self) -> CachePolicy

Get the current cache policy.
Source§

fn set_cache_policy(&mut self, policy: CachePolicy)

Set the cache policy.
Source§

fn computed_states(&self) -> usize

Get the number of states that have been computed so far.
Source§

fn clear_cache(&mut self)

Clear the state cache. Read more
Source§

impl<'a, D> LazyWfst<char, TropicalWeight> for WallBreakerWfst<'a, D>

Source§

fn is_expanded(&self, state: StateId) -> bool

Check if a state has been expanded (transitions computed).
Source§

fn expand(&mut self, state: StateId)

Force expansion of a state. Read more
Source§

fn transitions_lazy( &mut self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get transitions, computing them lazily if needed. Read more
Source§

fn cache_policy(&self) -> CachePolicy

Get the current cache policy.
Source§

fn set_cache_policy(&mut self, policy: CachePolicy)

Set the cache policy.
Source§

fn computed_states(&self) -> usize

Get the number of states that have been computed so far.
Source§

fn clear_cache(&mut self)

Clear the state cache. Read more
Source§

impl Mul for TropicalWeight

Source§

fn mul(self, other: TropicalWeight) -> TropicalWeight

Operator * implements semiring ⊗ (+).

Source§

type Output = TropicalWeight

The resulting type after applying the * operator.
Source§

impl MulAssign for TropicalWeight

Source§

fn mul_assign(&mut self, other: TropicalWeight)

Performs the *= operation. Read more
Source§

impl NonnegativeSemiring for TropicalWeight

TropicalWeight is non-negative when used for shortest-path problems.

Note: This is a semantic guarantee. The tropical semiring can represent negative costs, but when used with non-negative edge weights (the common case for shortest-path problems), it satisfies this property.

Source§

impl NumericalWeight for TropicalWeight

Source§

fn numerical_value(&self) -> f64

Get the underlying numerical value of this weight. Read more
Source§

impl Ord for TropicalWeight

Source§

fn cmp(&self, other: &TropicalWeight) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for TropicalWeight

Source§

fn eq(&self, other: &TropicalWeight) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for TropicalWeight

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl QuantizableSemiring for TropicalWeight

TropicalWeight can be quantized for approximate comparison.

Source§

fn quantize(&self, epsilon: f64) -> i64

Quantize the weight to an integer for hashing. Read more
Source§

impl Semiring for TropicalWeight

Source§

fn zero() -> TropicalWeight

Additive identity: ∞ (unreachable)

Source§

fn one() -> TropicalWeight

Multiplicative identity: 0 (zero cost)

Source§

fn plus(&self, other: &TropicalWeight) -> TropicalWeight

Addition: min(a, b)

Source§

fn times(&self, other: &TropicalWeight) -> TropicalWeight

Multiplication: a + b

Source§

fn natural_less(&self, other: &TropicalWeight) -> Option<bool>

Natural ordering: smaller is better (shorter path).

Source§

fn is_zero(&self) -> bool

Check if this weight is the additive identity.
Source§

fn is_one(&self) -> bool

Check if this weight is the multiplicative identity.
Source§

fn approx_eq(&self, other: &TropicalWeight, epsilon: f64) -> bool

Approximate equality check for floating-point semirings. Read more
Source§

fn to_bytes(&self) -> Vec<u8>

Convert weight to bytes for hashing/merkleization. Read more
Source§

impl StarSemiring for TropicalWeight

Source§

fn star(&self) -> Option<TropicalWeight>

Kleene closure for tropical semiring.

For tropical semiring:

  • If weight > 0: star = 0 (taking zero copies is optimal)
  • If weight = 0: star = 0 (any number of copies has cost 0)
  • If weight < 0: series diverges to -∞ (no finite star)
Source§

impl<D> StateSource<char, TropicalWeight> for LevenshteinStateSource<D>
where D: Dictionary + Clone + Send + Sync, D::Node: Send + Sync, <D::Node as DictionaryNode>::Unit: Into<char> + TryFrom<char> + Copy + Send + Sync,

Source§

fn compute_state(&self, state: StateId) -> LazyState<char, TropicalWeight>

Compute the state information for a given state ID. Read more
Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn num_states_hint(&self) -> Option<usize>

Get an upper bound on the number of states. Read more
Source§

impl<V, D> StateSource<char, TropicalWeight> for UniversalLevenshteinStateSource<V, D>

Source§

fn compute_state(&self, state: StateId) -> LazyState<char, TropicalWeight>

Compute the state information for a given state ID. Read more
Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn num_states_hint(&self) -> Option<usize>

Get an upper bound on the number of states. Read more
Source§

impl StateSource<char, TropicalWeight> for PhoneticNfaWfst

Available on crate feature phonetic-rules only.
Source§

fn compute_state(&self, _state: StateId) -> LazyState<char, TropicalWeight>

Compute the state information for a given state ID. Read more
Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn num_states_hint(&self) -> Option<usize>

Get an upper bound on the number of states. Read more
Source§

impl StateSource<char, TropicalWeight> for RewriteWfst

Source§

fn compute_state(&self, state: StateId) -> LazyState<char, TropicalWeight>

Compute the state information for a given state ID. Read more
Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn num_states_hint(&self) -> Option<usize>

Get an upper bound on the number of states. Read more
Source§

impl<D> StateSource<char, TropicalWeight> for PhoneticStateSource<D>
where D: Dictionary + Clone + Send + Sync, D::Node: Send + Sync, <D::Node as DictionaryNode>::Unit: Into<char> + TryFrom<char> + Copy + Send + Sync,

Available on crate feature phonetic-rules only.
Source§

fn compute_state(&self, state: StateId) -> LazyState<char, TropicalWeight>

Compute the state information for a given state ID. Read more
Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn num_states_hint(&self) -> Option<usize>

Get an upper bound on the number of states. Read more
Source§

impl<D> StateSource<char, TropicalWeight> for GeneralizedWfst<D>
where D: Dictionary + Clone + Send + Sync, D::Node: DictionaryNode<Unit = char>,

Source§

fn compute_state(&self, _state: StateId) -> LazyState<char, TropicalWeight>

Compute the state information for a given state ID. Read more
Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn num_states_hint(&self) -> Option<usize>

Get an upper bound on the number of states. Read more
Source§

impl<'a, D> StateSource<char, TropicalWeight> for WallBreakerWfst<'a, D>

Source§

fn compute_state(&self, _state: StateId) -> LazyState<char, TropicalWeight>

Compute the state information for a given state ID. Read more
Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn num_states_hint(&self) -> Option<usize>

Get an upper bound on the number of states. Read more
Source§

impl StochasticSemiring for TropicalWeight

TropicalWeight can be converted to probability for sampling.

Uses exp(-cost) to convert costs to probability-like values. Lower costs (better paths) map to higher probabilities.

Source§

fn to_probability(&self) -> f64

Convert weight to a non-negative value suitable for probability sampling. Read more
Source§

impl StructuralPartialEq for TropicalWeight

Source§

impl TotallyOrderedSemiring for TropicalWeight

TropicalWeight has a total order via OrderedFloat.

All real numbers (including infinity) are totally ordered.

Source§

fn total_cmp(&self, other: &Self) -> Ordering

Total comparison, guaranteed to never return None. Read more
Source§

impl TryFrom<SignedTropicalWeight> for TropicalWeight

Source§

fn try_from( w: SignedTropicalWeight, ) -> Result<TropicalWeight, <TropicalWeight as TryFrom<SignedTropicalWeight>>::Error>

Convert to standard tropical weight.

Fails if the weight is negative.

Source§

type Error = &'static str

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

impl WeaklyLeftDivisibleSemiring for TropicalWeight

TropicalWeight is weakly left-divisible.

For tropical semiring where ⊕ = min and ⊗ = +:

  • Given a and divisor = min(a, b), we need c such that c + divisor = a
  • This is c = a - divisor
Source§

fn left_divide(&self, divisor: &TropicalWeight) -> Option<TropicalWeight>

Computes the left quotient c such that c ⊗ divisor = self. Read more
Source§

impl<V, D> Wfst<char, TropicalWeight> for UniversalLevenshteinWfst<V, D>

Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn is_final(&self, state: StateId) -> bool

Check if a state is final (accepting).
Source§

fn final_weight(&self, state: StateId) -> TropicalWeight

Get the final weight for a state. Read more
Source§

fn transitions( &self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get the outgoing transitions from a state. Read more
Source§

fn num_states(&self) -> usize

Get the number of states in the transducer.
Source§

fn is_empty(&self) -> bool

Check if the transducer is empty (no states).
Source§

fn is_valid_state(&self, state: StateId) -> bool

Check if a state ID is valid.
Source§

fn num_transitions(&self, state: u32) -> usize

Get the number of transitions from a state.
Source§

fn total_transitions(&self) -> usize

Get total number of transitions in the transducer.
Source§

fn state(&self, state: u32) -> Option<WfstState<L, W>>
where L: Clone,

Get state info including transitions.
Source§

impl<D> Wfst<char, TropicalWeight> for LevenshteinWfst<D>
where D: Dictionary + Clone + Send + Sync, D::Node: Send + Sync, <D::Node as DictionaryNode>::Unit: Into<char> + TryFrom<char> + Copy + Send + Sync,

Source§

fn is_empty(&self) -> bool

For lazy WFSTs, is_empty() returns false if there’s a valid start state.

Source§

fn is_valid_state(&self, state: StateId) -> bool

For lazy WFSTs, any encoded state is potentially valid. The actual validity is determined when the state is expanded.

Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn is_final(&self, state: StateId) -> bool

Check if a state is final (accepting).
Source§

fn final_weight(&self, state: StateId) -> TropicalWeight

Get the final weight for a state. Read more
Source§

fn transitions( &self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get the outgoing transitions from a state. Read more
Source§

fn num_states(&self) -> usize

Get the number of states in the transducer.
Source§

fn num_transitions(&self, state: u32) -> usize

Get the number of transitions from a state.
Source§

fn total_transitions(&self) -> usize

Get total number of transitions in the transducer.
Source§

fn state(&self, state: u32) -> Option<WfstState<L, W>>
where L: Clone,

Get state info including transitions.
Source§

impl Wfst<char, TropicalWeight> for PhoneticNfaWfst

Available on crate feature phonetic-rules only.
Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn is_final(&self, state: StateId) -> bool

Check if a state is final (accepting).
Source§

fn final_weight(&self, state: StateId) -> TropicalWeight

Get the final weight for a state. Read more
Source§

fn transitions( &self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get the outgoing transitions from a state. Read more
Source§

fn num_states(&self) -> usize

Get the number of states in the transducer.
Source§

fn is_empty(&self) -> bool

Check if the transducer is empty (no states).
Source§

fn is_valid_state(&self, state: StateId) -> bool

Check if a state ID is valid.
Source§

fn num_transitions(&self, state: u32) -> usize

Get the number of transitions from a state.
Source§

fn total_transitions(&self) -> usize

Get total number of transitions in the transducer.
Source§

fn state(&self, state: u32) -> Option<WfstState<L, W>>
where L: Clone,

Get state info including transitions.
Source§

impl Wfst<char, TropicalWeight> for RewriteWfst

Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn is_final(&self, state: StateId) -> bool

Check if a state is final (accepting).
Source§

fn final_weight(&self, state: StateId) -> TropicalWeight

Get the final weight for a state. Read more
Source§

fn transitions( &self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get the outgoing transitions from a state. Read more
Source§

fn num_states(&self) -> usize

Get the number of states in the transducer.
Source§

fn is_empty(&self) -> bool

Check if the transducer is empty (no states).
Source§

fn is_valid_state(&self, state: StateId) -> bool

Check if a state ID is valid.
Source§

fn num_transitions(&self, state: u32) -> usize

Get the number of transitions from a state.
Source§

fn total_transitions(&self) -> usize

Get total number of transitions in the transducer.
Source§

fn state(&self, state: u32) -> Option<WfstState<L, W>>
where L: Clone,

Get state info including transitions.
Source§

impl<D> Wfst<char, TropicalWeight> for PhoneticWfst<D>
where D: Dictionary + Clone + Send + Sync, D::Node: Send + Sync, <D::Node as DictionaryNode>::Unit: Into<char> + TryFrom<char> + Copy + Send + Sync,

Available on crate feature phonetic-rules only.
Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn is_final(&self, state: StateId) -> bool

Check if a state is final (accepting).
Source§

fn final_weight(&self, state: StateId) -> TropicalWeight

Get the final weight for a state. Read more
Source§

fn transitions( &self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get the outgoing transitions from a state. Read more
Source§

fn num_states(&self) -> usize

Get the number of states in the transducer.
Source§

fn is_empty(&self) -> bool

Check if the transducer is empty (no states).
Source§

fn is_valid_state(&self, state: StateId) -> bool

Check if a state ID is valid.
Source§

fn num_transitions(&self, state: u32) -> usize

Get the number of transitions from a state.
Source§

fn total_transitions(&self) -> usize

Get total number of transitions in the transducer.
Source§

fn state(&self, state: u32) -> Option<WfstState<L, W>>
where L: Clone,

Get state info including transitions.
Source§

impl<D> Wfst<char, TropicalWeight> for GeneralizedWfst<D>
where D: Dictionary + Clone + Send + Sync, D::Node: DictionaryNode<Unit = char>,

Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn is_final(&self, state: StateId) -> bool

Check if a state is final (accepting).
Source§

fn final_weight(&self, state: StateId) -> TropicalWeight

Get the final weight for a state. Read more
Source§

fn transitions( &self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get the outgoing transitions from a state. Read more
Source§

fn num_states(&self) -> usize

Get the number of states in the transducer.
Source§

fn is_empty(&self) -> bool

Check if the transducer is empty (no states).
Source§

fn is_valid_state(&self, state: StateId) -> bool

Check if a state ID is valid.
Source§

fn num_transitions(&self, state: u32) -> usize

Get the number of transitions from a state.
Source§

fn total_transitions(&self) -> usize

Get total number of transitions in the transducer.
Source§

fn state(&self, state: u32) -> Option<WfstState<L, W>>
where L: Clone,

Get state info including transitions.
Source§

impl<'a, D> Wfst<char, TropicalWeight> for WallBreakerWfst<'a, D>

Source§

fn start(&self) -> StateId

Get the start state ID.
Source§

fn is_final(&self, state: StateId) -> bool

Check if a state is final (accepting).
Source§

fn final_weight(&self, state: StateId) -> TropicalWeight

Get the final weight for a state. Read more
Source§

fn transitions( &self, state: StateId, ) -> &[WeightedTransition<char, TropicalWeight>]

Get the outgoing transitions from a state. Read more
Source§

fn num_states(&self) -> usize

Get the number of states in the transducer.
Source§

fn is_empty(&self) -> bool

Check if the transducer is empty (no states).
Source§

fn is_valid_state(&self, state: StateId) -> bool

Check if a state ID is valid.
Source§

fn num_transitions(&self, state: u32) -> usize

Get the number of transitions from a state.
Source§

fn total_transitions(&self) -> usize

Get total number of transitions in the transducer.
Source§

fn state(&self, state: u32) -> Option<WfstState<L, W>>
where L: Clone,

Get state info including transitions.
Source§

impl ZeroSumFreeSemiring for TropicalWeight

TropicalWeight is zero-sum-free: min(a, b) = ∞ only if both a = ∞ and b = ∞

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> HashableSemiring for S
where S: Semiring + Eq + Hash,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

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>,

Source§

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>,

Source§

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