Module speech

Module 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§

FileAndTime
FilesAndTimes
MyXPath
ReplacementArray
An array of rule Replacements (text, xpath, tts commands, etc)
SpeechRules
SpeechRulesWithContext encapsulates a named group of speech rules (e.g, “ClearSpeak”) along with the preferences to be used for speech.
SpeechRulesWithContext
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§

RulesFor

Constants§

BRAILLE_RULES
CONCAT_INDICATOR
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.
CONCAT_STRING
INTENT_RULES
The current set of speech rules
NAVIGATION_RULES
NAV_NODE_SPEECH_NOT_FOUND
OVERVIEW_RULES
SPEECH_RULES

Traits§

TreeOrString
As the name says, TreeOrString is either a Tree (Element) or a String It is used to share code during pattern matching

Functions§

as_hash_checked
Returns the Yaml as a Hash or an error if it isn’t.
as_str_checked
Returns the Yaml as a &str or an error if it isn’t.
as_vec_checked
Returns the Yaml as a Vec or an error if it isn’t.
braille_replace_chars
Hack to allow replacement of str with braille chars.
compile_rule
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.
intent_from_mathml
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”.
is_quoted_string
Checks the string to see if it is “quoted”
make_quoted_string
Converts ‘string’ into a “quoted” string – use is_quoted_string and unquote_string
overview_mathml
process_include
remove_optional_indicators
speak_mathml
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
yaml_to_type
Converts its argument to a string that can be used in a debugging message.