shabda 2.0.0

shabda — Grapheme-to-phoneme (G2P) conversion: text to phoneme sequences for vocal synthesis
Documentation
//! # shabda — Grapheme-to-Phoneme Conversion
//!
//! **shabda** (Sanskrit: word / sound) provides text-to-phoneme conversion for
//! vocal synthesis. It bridges the gap between text input and svara's phoneme
//! sequences — turning "hello world" into synthesizable phoneme events.
//!
//! ## Architecture
//!
//! ```text
//! Input text
//!     |
//!     v
//! Normalizer (lowercase, expand numbers, handle punctuation)
//!     |
//!     v
//! Tokenizer (split into words, detect sentence boundaries)
//!     |
//!     v
//! G2P Engine (dictionary lookup → rule-based fallback)
//!     |
//!     v
//! Prosody Mapper (stress, intonation from punctuation/syntax)
//!     |
//!     v
//! Vec<PhonemeEvent> (ready for svara)
//! ```
//!
//! ## Quick Start
//!
//! ```rust
//! use shabda::prelude::*;
//!
//! let g2p = G2PEngine::new(Language::English);
//! let events = g2p.convert("hello world").unwrap();
//! // events is a Vec<svara::sequence::PhonemeEvent> ready for rendering
//! ```
//!
//! ## Feature Flags
//!
//! | Feature | Default | Description |
//! |---------|---------|-------------|
//! | `std` | Yes | Standard library. Disable for `no_std` + `alloc` |
//! | `logging` | No | Structured logging via tracing-subscriber |
//! | `json` | No | JSON serialization via serde_json |
//! | `varna` | No | Phoneme inventory validation and language detection via varna |
//! | `full` | No | All of the above |

#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub use shabdakosh::arpabet;
pub use shabdakosh::dictionary;
pub mod engine;
pub mod error;
pub mod heteronym;
pub mod normalize;
pub mod prosody;
pub mod rules;
pub mod ssml;
pub mod syllable;
#[cfg(feature = "varna")]
pub mod validate;

/// Convenience re-exports for common usage.
pub mod prelude {
    #[cfg(feature = "varna")]
    pub use crate::engine::detect_language;
    pub use crate::engine::{ConvertOptions, G2PEngine, Language, TimingProfile};
    pub use crate::error::{Result, ShabdaError};
}

// Compile-time trait assertions.
#[cfg(test)]
mod assert_traits {
    fn _assert_send_sync<T: Send + Sync>() {}

    #[test]
    fn public_types_are_send_sync() {
        _assert_send_sync::<crate::error::ShabdaError>();
        _assert_send_sync::<crate::engine::G2PEngine>();
        _assert_send_sync::<crate::engine::Language>();
        _assert_send_sync::<crate::engine::ConvertOptions>();
        _assert_send_sync::<crate::engine::TimingProfile>();
        _assert_send_sync::<crate::dictionary::PronunciationDict>();
    }
}