pub struct Ssml { /* private fields */ }
Expand description
Holds parsed SSML string with the text minus tags and the tag information
Implementations§
Source§impl Ssml
impl Ssml
Sourcepub fn get_text_from_span(&self, span: &Span) -> &str
pub fn get_text_from_span(&self, span: &Span) -> &str
From a given span with start/end characters return the text within that span.
§Panics
Will panic if span exceeds the bounds of the text.
Get an iterator over the SSML tags - traversed depth first.
Sourcepub fn write_ssml(&self) -> String
pub fn write_ssml(&self) -> String
Write out the SSML text again - mainly used for testing correctness of implementation.
Sourcepub fn write_ssml_with_transform<F>(&self, f: F) -> TransformedSsml
pub fn write_ssml_with_transform<F>(&self, f: F) -> TransformedSsml
For each parser event to write out apply a transformation to it or return None if it should be filtered out. It is up to the implementor to make sure that if an open tag is removed the corresponding close tag is removed as well.
TODO this doesn’t track if there are tags where inner text shouldn’t be synthesised so certain transformations will lead to synthesisable_text being incorrect.
Sourcepub fn event_iter(&self) -> impl Iterator<Item = ParserEvent> + '_
pub fn event_iter(&self) -> impl Iterator<Item = ParserEvent> + '_
Turns the SSML document into a stream of events with open/close tags, text and empty elements. This will not filter out text that shouldn’t be synthesised so it’s on the user to keep track of this.