Get the spoken text of the MathML that was set. The speech takes into account any AT or user preferences.
()
| 117 | /// Get the spoken text of the MathML that was set. |
| 118 | /// The speech takes into account any AT or user preferences. |
| 119 | pub 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. |
no test coverage detected