pub struct StreamingG2P { /* private fields */ }Expand description
The core engine for streaming Text-to-Phoneme (G2P) conversion.
StreamingG2P processes text incrementally, expanding abbreviations/numbers
and resolving phonemes dynamically. It supports multi-language text using
internal heuristics.
Implementations§
Source§impl StreamingG2P
impl StreamingG2P
Sourcepub fn with_languages(
languages: &[Language],
default_language: Language,
) -> Result<Self>
pub fn with_languages( languages: &[Language], default_language: Language, ) -> Result<Self>
Constructs a multi-language streaming G2P engine.
It intelligently detects the language of the incoming stream from the provided
languages list. If detection fails or is ambiguous, it falls back to the
default_language.
Sourcepub fn new_session(&self) -> StreamingG2pSession
pub fn new_session(&self) -> StreamingG2pSession
Creates a new isolated phonemization session.
The session must be mutated with push_text and finalized with finish.
Sourcepub fn push_text(
&self,
session: &mut StreamingG2pSession,
text: &str,
) -> Result<Vec<G2pToken>>
pub fn push_text( &self, session: &mut StreamingG2pSession, text: &str, ) -> Result<Vec<G2pToken>>
Pushes a chunk of text into the streaming g2p processor.
Yields any phonemes that have been fully resolved (typically at word boundaries).
Partial words or unresolved expansions are buffered internally within the session.
Auto Trait Implementations§
impl Freeze for StreamingG2P
impl RefUnwindSafe for StreamingG2P
impl Send for StreamingG2P
impl Sync for StreamingG2P
impl Unpin for StreamingG2P
impl UnsafeUnpin for StreamingG2P
impl UnwindSafe for StreamingG2P
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more