#![warn(missing_docs)]
#![warn(rustdoc::missing_crate_level_docs)]
#![allow(clippy::clone_on_copy)]
#![allow(clippy::needless_borrow)]
#![allow(clippy::needless_range_loop)]
#![allow(clippy::type_complexity)]
#![allow(clippy::collapsible_if, clippy::collapsible_match)]
#![allow(clippy::manual_div_ceil, clippy::manual_is_multiple_of)]
#![allow(clippy::manual_strip)]
#![allow(clippy::unnecessary_cast)]
#![allow(clippy::field_reassign_with_default)]
#![allow(clippy::almost_complete_range)]
#![allow(clippy::unused_enumerate_index)]
#![allow(clippy::unwrap_or_default)]
#![allow(clippy::int_plus_one)]
#![allow(clippy::bool_comparison, clippy::nonminimal_bool)]
#![allow(clippy::map_entry)]
#![allow(clippy::expect_fun_call)]
#![allow(clippy::manual_range_contains)]
#![allow(clippy::redundant_closure)]
#![allow(clippy::should_implement_trait)]
#![allow(
// `for k in map.iter()` over `for k in map.keys()` documents that the value is intentionally ignored.
clippy::for_kv_map,
// `.iter().any(|x| x == &needle)` documents the comparator; `contains` hides it for non-Copy types.
clippy::manual_contains,
// `* 1.0` and similar appear in benchmark fixtures as load-bearing scaffolding.
clippy::no_effect,
// `map_or` chains stay because the call sites compose with other map_or chains.
clippy::unnecessary_map_or,
// Wide-arity builder/decoder functions are part of public API; renaming/grouping would break callers.
clippy::too_many_arguments,
// `vec![x].clone()` in tests reads more naturally than `std::slice::from_ref`.
clippy::single_element_loop, clippy::redundant_slicing,
// Reference-of-both-operands patterns appear in proptest predicates where keeping both sides borrowed avoids move warnings.
clippy::op_ref,
// Internal `module/module.rs` layouts (e.g. lattice/lattice.rs) are intentional for the public type sharing the module name.
clippy::module_inception,
// `match Option { Some(x) => x, None => Default::default() }` documents intent better than `unwrap_or_default`.
clippy::manual_unwrap_or_default,
// `(x as char) == ...` casts appear in tokenization for documentation purposes.
clippy::single_char_pattern,
// sort_by closure pattern is fine when the key extraction has side-effect-free arithmetic.
clippy::unnecessary_sort_by,
// `.max(lo).min(hi)` vs `.clamp(lo, hi)` is a wash; both are legible.
clippy::manual_clamp,
// `text.len() == 1` reads more naturally than `text.chars().count() == 1` for ASCII inputs.
clippy::comparison_to_empty,
)]
#![allow(
rustdoc::redundant_explicit_links,
clippy::doc_overindented_list_items,
clippy::doc_lazy_continuation,
clippy::empty_line_after_doc_comments
)]
pub mod acoustic;
pub mod algorithms;
pub mod asr;
pub mod backend;
pub mod cfg;
pub mod composition;
pub mod ctc;
pub mod differentiable;
pub mod error_models;
pub mod gpu;
pub mod lattice;
#[cfg(feature = "lattice")]
pub mod lattice_bridge;
pub mod layers;
pub mod llm;
pub mod multilingual;
pub mod multitape;
pub mod optimization;
pub mod path;
pub mod programming;
pub mod pushdown;
pub mod semiring;
pub mod simd;
pub mod subsequential;
pub mod text_processing;
pub mod training;
pub mod transducer;
pub mod tree_transducers;
pub mod wfst;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;
#[cfg(feature = "levenshtein")]
pub mod integration;
pub mod prelude {
pub use crate::acoustic::{
AcousticLanguageModel,
AcousticModel,
FramePosterior,
FusionConfig,
HmmStateId,
PosteriorSequence,
TransitionLogProb,
TransitionMatrix,
UnitId,
};
pub use crate::algorithms::{
all_pairs_shortest_distance, single_source_shortest_distance,
single_source_shortest_distance_with_queue, AutoQueue, FifoQueue, QueueType,
ShortestDistanceConfig, ShortestDistanceQueue, ShortestFirstQueue, TopologicalQueue,
};
pub use crate::asr::{
chain_factor,
rescore_lattice,
AsrCascade,
AuxiliarySymbol,
BackoffState,
CascadeBuilder,
CascadeConfig,
Chain,
ChainFactorConfig,
ChainFactorResult,
ChainId,
ContextDependencyBuilder,
ContextDependencyConfig,
ContextState,
DysfluencyConfig,
DysfluencyDetector,
DysfluencyPattern,
DysfluencySpan,
LatticeGrammar,
LexiconEntry,
NgramBuilder,
NgramConfig,
NgramOrder,
NgramTransducer,
NgramWeight,
PhoneId,
RescoreConfig,
RescorePass,
RescoreResult,
SyllableRepetitionBuilder,
TetraploneBuilder,
TriphoneBuilder,
WordRepetitionBuilder,
};
pub use crate::backend::{HashMapBackend, LatticeBackend, VocabId};
pub use crate::cfg::{
EarleyChart, EarleyParser, EarleyState, ForestNode, ForestNodeId, Grammar, GrammarBuilder,
GrammarError, NonTerminal, ParseError, ParseForest, ParseTree, Production, RuleId, Symbol,
SymbolKind, Terminal,
};
pub use crate::composition::{
compose, ComposedPath, CompositionStats, EpsilonFilter, EpsilonFilterType, FilterState,
FilteredLattice, LazyCfgComposition, LazyComposition, ParseState, ValidPathIterator,
};
pub use crate::ctc::{
compact_ctc,
correct_ctc,
minimal_ctc,
selfless_compact_ctc,
selfless_correct_ctc,
CtcDecoder,
CtcDecoderConfig,
CtcLabel,
CtcTopology,
CtcTopologyInfo,
DecodingError,
DecodingResult,
DecodingStats,
ObservationFst,
StreamingCtcDecoder,
BLANK,
};
pub use crate::differentiable::{
backward, forward_score, log_sum_exp_paths, viterbi_path_with_grad, viterbi_score,
ArcGradient, GradientAccumulator, GradientWfst, ViterbiGradResult,
};
pub use crate::gpu::{
csr_from_vector_wfst,
csr_memory_size,
pack_cost_arc,
reduce_with_k_vectors,
unpack_cost_arc,
AdaptiveBeam,
BatchedDecoder,
Channel,
ChannelState,
CsrArc,
CsrBuilder,
CsrState,
CsrWfst,
DecoderConfig,
KVector,
KVectorConfig,
KVectorStats,
Lane,
LaneState,
LoadBalancer,
PackedToken,
RecombinationBuffer,
SoftPruneBuffer,
SoftPruneConfig,
SoftPruneManager,
SoftPruneStats,
SoftToken,
TokenPacker,
WorkDispatcher,
WorkGroup,
WorkItem,
WorkQueue,
};
pub use crate::lattice::{
Edge, EdgeId, EdgeMetadata, Lattice, LatticeBuilder, LatticePath, Node, NodeId,
PathIterator,
};
pub use crate::layers::{
CfgFilterLayer,
ConfusionLayer,
ConfusionLayerConfig,
ConfusionMatrix,
CorrectionLayer,
LayerError,
LayerPipeline,
LayerPipelineBuilder,
LayerResult,
LayerStats,
};
pub use crate::multilingual::{
CodeSwitchBuilder,
CodeSwitchConfig,
CodeSwitchPath,
CodeSwitchTransducer,
DetectionResult,
LanguageConfig,
LanguageDetector,
LanguageId,
LanguageModel,
LanguageSpan,
SimpleLanguageModel,
SwitchPoint,
WordProbability,
};
pub use crate::multitape::{
MultiTapeLabel,
MultiTapeState,
MultiTapeTransition,
MultiTapeWfst,
MultiTapeWfstBuilder,
ProjectedWfst,
SyncConfig,
SynchronizedMultiTape,
TapeDelay,
VectorMultiTapeWfst,
};
pub use crate::optimization::{
apply_log_push, build_lookahead_table, compute_log_potentials, prepare_for_beam_search,
BeamSearchPrepResult, LogPushConfig, LookaheadConfig, LookaheadTable,
};
pub use crate::path::{
beam_search, nbest, viterbi, BeamSearchConfig, NBestIterator, ViterbiResult,
};
pub use crate::programming::{
ApiMigrationBuilder,
ApiMigrationRule,
ApiMigrationTransducer,
MigrationResult,
MigrationStats,
MigrationType,
NodeKind,
ParseResult,
ParserBackend,
ParserError,
PatternMatcher,
Position,
Range,
RepairAction,
RepairCandidate,
ReplacementAction,
SyntaxNode,
SyntaxNodeRef,
SyntaxRepairBuilder,
SyntaxRepairCosts,
SyntaxRepairRule,
SyntaxRepairTransducer,
Token,
TokenKind,
TokenPattern,
TokenPredicate,
TokenReplacement,
Version,
VersionRange,
};
pub use crate::pushdown::{
PdaAcceptMode,
PdaBuilder,
PdaConfiguration,
PdaState,
PdaTransition,
StackAction,
StackSymbol,
VectorPda,
WeightedPda,
};
pub use crate::semiring::{
BoolWeight, DivisibleSemiring, ExpectationWeight, FallibleStarSemiring, GodelWeight,
LeftStringWeight, LogWeight, ProbabilityWeight, ProductWeight, RightStringWeight, Semiring,
SignedTropicalWeight, StarDivergenceError, StarSemiring, TropicalWeight,
};
pub use crate::subsequential::{
DecompositionStats,
PiecewiseBuilder,
PiecewiseSubsequential,
SubsequentialTransducer,
};
pub use crate::tree_transducers::{
RankedAlphabet,
SimpleAlphabet,
Symbol as RankedSymbol,
TransducerState,
Tree,
TreeChild,
TreeNode,
TreePattern,
TreeRule,
TreeTransducerBuilder,
TreeTransducerOps,
VectorTreeTransducer,
WeightedTreeTransducer,
};
pub use crate::wfst::{
closure,
closure_plus,
compute_max_delay,
concat,
has_bounded_delay,
invert,
project_input,
project_output,
reverse,
synchronize,
synchronize_bounded,
union,
CachePolicy,
ClosureSource,
ClosureWfst,
ConcatSource,
ConcatWfst,
InvertSource,
InvertWfst,
LazyState,
LazyWfst,
LazyWfstWrapper,
MutableSyncSource,
MutableWfst,
ProjectInputWfst,
ProjectOutputWfst,
ProjectSource,
StateId,
StateSource,
StringDelay,
SyncSource,
SyncState,
SyncWfst,
UnionSource,
UnionWfst,
VectorWfst,
VectorWfstBuilder,
WeightedTransition,
Wfst,
WfstState,
};
}