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)
  • SpeechRulesWithContext encapsulates a named group of speech rules (e.g, “ClearSpeak”) along with the preferences to be used for speech.
  • SpeechRulesWithContext encapsulates 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§

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 Hash or an error if it isn’t.
  • Returns the Yaml as a &str or an error if it isn’t.
  • Returns the Yaml as a Vec or an error if it isn’t.
  • Given a string that should be Yaml, it calls build_fn with that string. The build function/closure should process the Yaml as appropriate and capture any errors and write them to std_err. The returned value should be a Vector containing the paths of all the files that were included.
  • The main external call, intent_from_mathml returns a string for the speech associated with the mathml. 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.