spelling_variants
spelling_variants
Return the spellings units could be, given letters the recognizer confuses. The
spelling as heard comes first, then the variants with one change, then two, and so
on, up to limit. Look each one up in your own records, in order: the first that
matches is the likeliest.
Which letters a recognizer confuses depends on the recognizer and the voice, so no confusion groups are built in. Measure them on your own calls.
Parameters
units
The units as heard, such as the list read_spelled() returns.
groups
For each unit, the units it may have been, such as
{"S": "F", "F": "S", "M": "N", "N": "M"}. A string value is read as its letters.
positions
Keyword-only. The positions in units that may vary, such as the letters the
recognizer was least sure of: AgentBase.speech_finals() gives a confidence for
each word the recognizer heard. None lets every position vary.
limit
Keyword-only. The most spellings to return, the spelling as heard included.
Returns
list[str] — The spellings, each joined into one string.
Example
Part of the speech helpers module.