oxicuda_seq/lib.rs
1//! `oxicuda-seq` — Sequence Models & Structured Prediction for OxiCUDA.
2//!
3//! # Architecture
4//!
5//! ```text
6//! oxicuda-seq
7//! ├── hmm/ — Hidden Markov Models (discrete/Gaussian), forward-backward, Viterbi, Baum-Welch
8//! ├── crf/ — Linear-chain CRF: forward-backward in score space, L-BFGS training, Viterbi decoding
9//! ├── memm/ — Maximum-Entropy Markov Models
10//! ├── ssvm/ — Structured SVM (linear-chain) with cutting-plane optimisation
11//! ├── structured/ — Sinkhorn CRF: entropy-regularised optimal-transport normalisation
12//! ├── beam/ — Generic beam search with length normalisation and diversity penalty
13//! ├── ctc/ — CTC loss (forward-backward) + greedy / prefix-beam decoding
14//! ├── decoders/ — Stochastic decoders: top-k, nucleus (top-p), typical sampling
15//! ├── alignment/ — Needleman-Wunsch, Smith-Waterman, Gotoh affine-gap, Hirschberg
16//! ├── grid_crf/ — Pairwise 2D CRF + mean-field inference
17//! ├── kalman/ — Linear/EKF Kalman filter, RTS smoother, EM parameter learning
18//! ├── mrf/ — General MRF + Ising, Gibbs sampler, loopy belief propagation
19//! ├── perceptron/ — Structured + averaged perceptron sequence taggers (Collins 2002)
20//! ├── matching/ — Aho–Corasick multi-pattern matching automaton
21//! ├── string/ — Manacher longest-palindrome, suffix automaton (DAWG),
22//! │ Z-algorithm, suffix array + LCP (SA-IS/Kasai), BWT/FM-index
23//! ├── tagging/ — BIO/BIOES conversion + validation, span-based F1 (seqeval)
24//! └── metrics/ — Token/sequence accuracy, edit distance, BLEU, perplexity, log-loss
25//! ```
26//!
27//! NOTE on lints: numerical kernels in this crate use straight integer-index
28//! loops (`for i in 0..n`) because every body indexes multiple parallel arrays.
29//! Rewriting them in iterator form obscures the math and forces awkward `zip`
30//! chains, so `clippy::needless_range_loop` is allowed crate-wide.
31
32#![allow(clippy::needless_range_loop)]
33#![allow(clippy::type_complexity)]
34
35pub mod align;
36pub mod alignment;
37pub mod beam;
38pub mod crf;
39pub mod ctc;
40pub mod decoders;
41pub mod distance;
42pub mod error;
43pub mod folding;
44pub mod grid_crf;
45pub mod handle;
46pub mod hmm;
47pub mod kalman;
48pub mod matching;
49pub mod memm;
50pub mod metrics;
51pub mod mrf;
52pub mod perceptron;
53pub mod ptx_kernels;
54pub mod ssvm;
55pub mod string;
56pub mod structured;
57pub mod tagging;
58
59pub use error::{SeqError, SeqResult};
60pub use handle::{LcgRng, SeqHandle, SmVersion};
61
62#[cfg(test)]
63mod e2e_tests;
64
65#[cfg(all(test, feature = "gpu-tests"))]
66mod gpu_tests;