MCPcopy Create free account
hub / github.com/daisy/MathCAT / get_spoken_text

Function get_spoken_text

src/interface.rs:119–132  ·  view source on GitHub ↗

Get the spoken text of the MathML that was set. The speech takes into account any AT or user preferences.

()

Source from the content-addressed store, hash-verified

117/// Get the spoken text of the MathML that was set.
118/// The speech takes into account any AT or user preferences.
119pub fn get_spoken_text() -> Result<String> {
120 // use std::time::{Instant};
121 // let instant = Instant::now();
122 return MATHML_INSTANCE.with(|package_instance| {
123 let package_instance = package_instance.borrow();
124 let mathml = get_element(&package_instance);
125 let new_package = Package::new();
126 let intent = crate::speech::intent_from_mathml(mathml, new_package.as_document())?;
127 debug!("Intent tree:\n{}", mml_to_string(&intent));
128 let speech = crate::speech::speak_mathml(intent, "")?;
129 // info!("Time taken: {}ms", instant.elapsed().as_millis());
130 return Ok( speech );
131 });
132}
133
134/// Get the spoken text for an overview of the MathML that was set.
135/// The speech takes into account any AT or user preferences.

Callers 3

mainFunction · 0.85
timing_testFunction · 0.85
check_answerFunction · 0.85

Calls 3

get_elementFunction · 0.85
intent_from_mathmlFunction · 0.85
speak_mathmlFunction · 0.85

Tested by

no test coverage detected