Skip to main content

StringDecompositionAutomaton

Struct StringDecompositionAutomaton 

Source
pub struct StringDecompositionAutomaton { /* private fields */ }
Expand description

Lazy CKY-style string decomposition automaton.

Implementations§

Source§

impl StringDecompositionAutomaton

Source

pub fn new(concat: Symbol, sentence: Vec<Symbol>) -> Self

Build a lazy decomposition automaton for sentence.

Source

pub fn concat_symbol(&self) -> Symbol

Return the concat operation symbol.

Source

pub fn len(&self) -> usize

Return the sentence length.

Source

pub fn sentence(&self) -> &[Symbol]

Return the sentence tokens (used by the obligatory-leaf F heuristic to build per-input terminal supply).

Source

pub fn is_empty(&self) -> bool

Return whether the sentence is empty.

Source

pub fn rule_count(&self) -> usize

Count explicit CKY-style decomposition rules without materializing them.

Trait Implementations§

Source§

impl BottomUpTa for StringDecompositionAutomaton

Source§

type State = Span

State type carried by the automaton. Read more
Source§

fn step(&self, f: Symbol, children: &[Span], out: &mut dyn FnMut(Span))

Report all possible parent states for f(children...). Read more
Source§

fn is_accepting(&self, q: &Span) -> bool

Return whether q is an accepting state. Read more
Source§

impl Clone for StringDecompositionAutomaton

Source§

fn clone(&self) -> StringDecompositionAutomaton

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 CondensedTa for StringDecompositionAutomaton

Source§

fn condensed_rules(&self, out: &mut dyn FnMut(&[Span], &SymbolSet, Span))

Enumerate every distinct (children, result) pair, reporting the set of symbols that have that shape. Read more
Source§

fn condensed_nullary_rules(&self, out: &mut dyn FnMut(&SymbolSet, Span))

Enumerate condensed nullary rules. Read more
Source§

fn condensed_rules_by_child( &self, position: usize, state: &Span, out: &mut dyn FnMut(&[Span], &SymbolSet, Span), )

Enumerate condensed rules whose child at position is state. Read more
Source§

impl Debug for StringDecompositionAutomaton

Source§

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

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

impl DetBottomUpTa for StringDecompositionAutomaton

Source§

fn step_det(&self, f: Symbol, children: &[Span]) -> Option<Span>

Return the unique result state, or None if no transition exists. Read more
Source§

fn det_group(&self, f: Symbol) -> u32

Group key for symbols that share a transition function. Read more
Source§

impl IndexedBottomUpTa for StringDecompositionAutomaton

Source§

fn step_partial( &self, f: Symbol, position: usize, state_at_position: &Span, out: &mut dyn FnMut(&[Span], Span), )

Report every rule f(children...) -> q where children[position] equals state_at_position. Read more
Source§

impl IntersectionHeuristic<StringDecompositionAutomaton> for SentenceSxHeuristic<'_>

Source§

fn outside_estimate(&self, left: StateId, span: &Span) -> f64

Return an optimistic (admissible) upper bound in (0, 1] on the best outside weight of any completion around product state (left, right).
Source§

fn admits(&self, _left: StateId, _right: &R::State) -> bool

Sound hard filter consulted at candidate-construction time: return false iff (left, right) provably has zero outside weight (it can appear in no valid completion), so the A* loop may skip building the edge entirely rather than merely deprioritizing it. Read more
Source§

fn estimate_if_admitted(&self, left: StateId, right: &R::State) -> Option<f64>

Return the outside estimate when the product is admitted, and None when it is provably unable to occur in an accepting derivation. Read more
Source§

fn memoize_admission(&self) -> bool

Whether A* should memoize the admission decision by product pair. Read more
Source§

fn estimate_after_admission(&self, left: StateId, right: &R::State) -> f64

Return the outside estimate when admission for this pair is already known to succeed. Read more
Source§

impl IntersectionHeuristic<StringDecompositionAutomaton> for ObligatoryLeafHeuristic<'_>

Source§

fn outside_estimate(&self, left: StateId, span: &Span) -> f64

Return an optimistic (admissible) upper bound in (0, 1] on the best outside weight of any completion around product state (left, right).
Source§

fn admits(&self, left: StateId, span: &Span) -> bool

Sound hard filter consulted at candidate-construction time: return false iff (left, right) provably has zero outside weight (it can appear in no valid completion), so the A* loop may skip building the edge entirely rather than merely deprioritizing it. Read more
Source§

fn estimate_if_admitted(&self, left: StateId, span: &Span) -> Option<f64>

Return the outside estimate when the product is admitted, and None when it is provably unable to occur in an accepting derivation. Read more
Source§

fn memoize_admission(&self) -> bool

Whether A* should memoize the admission decision by product pair. Read more
Source§

fn estimate_after_admission(&self, _left: StateId, _span: &Span) -> f64

Return the outside estimate when admission for this pair is already known to succeed. Read more
Source§

impl StateUniverse for StringDecompositionAutomaton

Source§

fn all_states(&self, out: &mut dyn FnMut(Span))

Report every state in the finite universe exactly once.
Source§

impl TopDownTa for StringDecompositionAutomaton

Source§

fn step_topdown(&self, parent: &Span, out: &mut dyn FnMut(Symbol, &[Span]))

Report every rule f(children...) -> parent. Read more
Source§

fn initial_states(&self, out: &mut dyn FnMut(Span))

Report the initial states of the top-down view. Read more

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