Module libmathcat::speech
source · Expand description
The speech module is where the speech rules are read in and speech generated.
The speech rules call out to the preferences and tts modules and the dividing line is not always clean. A number of useful utility functions used by other modules are defined here.
Structs§
- An array of rule
Replacements (text, xpath, tts commands, etc) SpeechRulesWithContextencapsulates a named group of speech rules (e.g, “ClearSpeak”) along with the preferences to be used for speech.SpeechRulesWithContextencapsulates a named group of speech rules (e.g, “ClearSpeak”) along with the preferences to be used for speech. Because speech rules can define variables, there is also a context that is carried with them
Enums§
Constants§
- A bit of a hack to concatenate replacements (without a ’ ’). The CONCAT_INDICATOR is added by a “ct:” (instead of ‘t:’) in the speech rules and checked for by the tts code.
- The current set of speech rules
Traits§
- As the name says, TreeOrString is either a Tree (Element) or a String It is used to share code during pattern matching
Functions§
- Returns the Yaml as a
Hashor an error if it isn’t. - Returns the Yaml as a
&stror an error if it isn’t. - Returns the Yaml as a
Vecor an error if it isn’t. - Given a string that should be Yaml, it calls
build_fnwith that string. The build function/closure should process the Yaml as appropriate and capture any errors and write them tostd_err. The returned value should be a Vector containing the paths of all the files that were included. - The main external call,
intent_from_mathmlreturns a string for the speech associated with themathml. It matches against the rules that are computed by user prefs such as “Language” and “SpeechStyle”. - Checks the string to see if it is “quoted”
- Converts ‘string’ into a “quoted” string – use is_quoted_string and unquote_string
- Converts ‘string’ into a “quoted” string – use is_quoted_string and unquote_string IMPORTANT: this assumes the string is quoted – no check is made
- Converts its argument to a string that can be used in a debugging message.