Trait rustfst::algorithms::compose::matchers::Matcher

source ·
pub trait Matcher<W: Semiring, F: Fst<W>, B: Borrow<F>>: Debug {
    type Iter: Iterator<Item = IterItemMatcher<W>>;

    // Required methods
    fn new(fst: B, match_type: MatchType) -> Result<Self>
       where Self: Sized;
    fn iter(&self, state: StateId, label: Label) -> Result<Self::Iter>;
    fn final_weight(&self, state: StateId) -> Result<Option<W>>;
    fn match_type(&self, test: bool) -> Result<MatchType>;
    fn flags(&self) -> MatcherFlags;
    fn priority(&self, state: StateId) -> Result<usize>;
    fn fst(&self) -> &B;
}
Expand description

Matchers find and iterate through requested labels at FST states. In the simplest form, these are just some associative map or search keyed on labels. More generally, they may implement matching special labels that represent sets of labels such as sigma (all), rho (rest), or phi (fail).

Required Associated Types§

Required Methods§

source

fn new(fst: B, match_type: MatchType) -> Result<Self>
where Self: Sized,

source

fn iter(&self, state: StateId, label: Label) -> Result<Self::Iter>

source

fn final_weight(&self, state: StateId) -> Result<Option<W>>

source

fn match_type(&self, test: bool) -> Result<MatchType>

source

fn flags(&self) -> MatcherFlags

source

fn priority(&self, state: StateId) -> Result<usize>

Indicates preference for being the side used for matching in composition. If the value is kRequirePriority, then it is mandatory that it be used. Calling this method without passing the current state of the matcher invalidates the state of the matcher.

source

fn fst(&self) -> &B

Implementors§

source§

impl<W, F, B> Matcher<W, F, B> for SortedMatcher<W, F, B>
where W: Semiring, F: Fst<W>, B: Borrow<F> + Debug,

§

type Iter = IteratorSortedMatcher<W, <F as CoreFst<W>>::TRS>

source§

impl<W, F, B, M> Matcher<W, F, B> for TrivialLookAheadMatcher<W, M>
where W: Semiring, F: Fst<W>, B: Borrow<F>, M: Matcher<W, F, B>,

§

type Iter = <M as Matcher<W, F, B>>::Iter

source§

impl<W, F, B, M> Matcher<W, F, B> for MultiEpsMatcher<W, F, B, M>
where W: Semiring, F: Fst<W>, B: Borrow<F> + Debug, M: Matcher<W, F, B>,

§

type Iter = IteratorMultiEpsMatcher<W, F, B, M>

source§

impl<W, F, B, M> Matcher<W, F, B> for SigmaMatcher<W, F, B, M>
where W: Semiring, F: Fst<W>, B: Borrow<F> + Debug, M: Matcher<W, F, B>,

§

type Iter = IteratorSigmaMatcher<W, F, B, M>

source§

impl<W, F, B, M, MFT> Matcher<W, F, B> for LabelLookAheadMatcher<W, F, B, M, MFT>
where W: Semiring, F: Fst<W>, B: Borrow<F> + Debug + Clone, M: Matcher<W, F, B>, MFT: MatcherFlagsTrait,

§

type Iter = <M as Matcher<W, F, B>>::Iter

source§

impl<W, F, B, M, MFT> Matcher<W, F, B> for TrLookAheadMatcher<W, F, B, M, MFT>
where W: Semiring, F: Fst<W>, B: Borrow<F> + Debug + Clone, M: Matcher<W, F, B>, MFT: MatcherFlagsTrait,

§

type Iter = <M as Matcher<W, F, B>>::Iter