1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! Composition operators for WFSTs.
//!
//! This module provides lazy composition operators that compute product states
//! on-demand during traversal, avoiding state explosion.
//!
//! # Composition Types
//!
//! | Operator | Description | Use Case |
//! |----------|-------------|----------|
//! | FST ∘ FST | WFST composition | Cascaded transducers |
//! | NFA ∩ FST | NFA intersection | Phonetic matching |
//! | CFG × FST | CFG filtering | Grammar constraints |
//!
//! # Lazy Evaluation
//!
//! All composition operators use lazy evaluation:
//! - Product states computed on first access
//! - Configurable cache policy (CacheAll, Lru, NoCache)
//! - Memory bounded by actual traversal, not theoretical maximum
//!
//! # Example
//!
//! ```rust,ignore
//! use lling_llang::composition::compose;
//! use lling_llang::wfst::VectorWfst;
//!
//! let composed = compose(fst1, fst2);
//! // States computed lazily during iteration
//! for path in composed.accepting_paths() {
//! println!("{:?}", path);
//! }
//! ```
//!
//! # Materialization
//!
//! For eager access to the full composed FST, use [`materialize`]:
//!
//! ```rust,ignore
//! use lling_llang::composition::{compose, materialize};
//!
//! let lazy = compose(fst1, fst2);
//! let eager: VectorWfst<_, _> = materialize(lazy);
//! ```
pub use ;
pub use ;
pub use ;
pub use materialize;