Expand description
§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
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
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 |
Modules§
- arpabet
- ARPABET-to-svara phoneme mapping.
- dictionary
- Pronunciation dictionary for common/irregular words.
- engine
- The G2P engine — ties normalization, dictionary, rules, and prosody together.
- error
- Error types for the shabda crate.
- heteronym
- Heteronym disambiguation using preceding-word context.
- normalize
- Text normalization: lowercasing, punctuation handling, number expansion.
- prelude
- Convenience re-exports for common usage.
- prosody
- Prosody assignment from text features.
- rules
- Rule-based grapheme-to-phoneme conversion for English.
- ssml
- SSML subset parser for speech synthesis markup.
- syllable
- Syllabification of phoneme sequences.