Skip to main content

MaterializationStrategy

Enum MaterializationStrategy 

Source
pub enum MaterializationStrategy<'h> {
    TopDownCondensed,
    IndexedCondensed,
    Astar {
        heuristic: AstarHeuristic<'h>,
        options: AstarOptions,
    },
}
Expand description

Which algorithm to use when materializing an intersection.

The strategies recognize the same derivations but explore the product automaton differently:

  • TopDownCondensed is the recommended default when a complete chart is needed.
  • IndexedCondensed is primarily useful for algorithm comparison, statistics, or workloads where benchmarking shows it is advantageous. It can generate very large candidate sets for some ambiguous or discontinuous decompositions.
  • Astar is intended for weight-directed search and can stop early when only the best derivation is needed.

Strategy choice depends on the resulting IRTG, its decomposition automata, and representative inputs—not on the grammar’s source filename or codec. See the parsing-algorithm guide for a user-facing comparison.

Variants§

§

TopDownCondensed

Top-down condensed intersection.

This is the default used by Irtg::parse. It starts from accepting product states and follows compatible condensed rules downward, producing a complete explicit parse chart.

Prefer this as the general chart-building default unless measurements on the intended workload support another choice.

§

IndexedCondensed

Bottom-up indexed condensed intersection.

This grows reachable product states through partial-child indexes and returns detailed intersection statistics. It also produces a complete chart; it is not an early-exit one-best parser.

Candidate generation can become substantially more expensive than the top-down strategy for some workloads, including some TAG-derived IRTGs. This is a property of the automata and inputs, not of a .tag filename.

§

Astar

A* intersection with a configurable heuristic.

Precondition: all grammar rule weights must be ≤ 1 (probability weights). If any weight exceeds 1 the strategy is rejected at parse time with IrtgError::AstarWeightPrecondition.

Use this when weight-directed search or early one-best termination is more important than constructing the complete parse chart. Heuristic compatibility depends on the input algebra; SX-family heuristics are specific to compatible string interpretations.

Fields

§heuristic: AstarHeuristic<'h>

Heuristic to guide the A* search.

§options: AstarOptions

Options for the A* materializer.

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