alkove.Word
class Word(data: dict, warnings: Sequence[dict] = ())A word Spot listens for: its text, pronunciations and thresholds, bound to this version’s Spot. Store to_json(), read it back with Word.from_json.
Methods
Section titled “Methods”from_json()
Section titled “from_json()”Word.from_json(j: Union[dict, str]) -> Optional[Word]None for a word compiled for another Spot: its thresholds no longer hold, compile its text again.
Word.of(w: Union[Word, dict, str]) -> WordA word, its JSON or the JSON string, as a Word; AlkoveError (word.outdated) for one compiled for another Spot.
to_json()
Section titled “to_json()”to_json() -> dictThe word as plain JSON, to store and read back with Word.from_json.
Attributes
Section titled “Attributes”| Attribute | Type | Description |
|---|---|---|
text |
str |
The word as it was typed. |
lang |
List[str] |
The languages it was compiled in; empty for phonemes written between slashes. |
phonemes |
List[dict] |
Its pronunciations, [{ipa, lang, p}], each with its probability. |
thresholds |
dict |
The score that wakes in each context, {anywhere, pause}: log-probabilities, a word said clearly scores near 0. |
calibrated |
bool |
True once enrolled on the user’s voice, False for a typed word (its language’s default thresholds). |
chain |
str |
The audio its thresholds suit: “raw” (the microphone) or “focus” (Focus’s output). |
warnings |
list |
What to fix in the text or the takes, [{code, message, …}] (word.too-short…); empty for a word read from JSON. |