Parameterized constructor.
NOTE: both word and phones will internally be stored in uppercase.
string specifying the word. For example "CAT".
a space separated phone string.
a tag suffix for the word.
ReadonlyisIs this object is valid, for a given Recognizer.
A word pronunciation is valid if:
ReadonlypronunciationThe phonetic transcription of a word, provided as a space-separated sequence of phones.
ReadonlytagThe optional tag value.
When provided during construction, this tag will be appended together with the # symbol to the word if the variation of the word with the provided pronunciation is recognized. For example, PEAK#WRONG.
ReadonlywordThe string specifying the word.
Example: "CAT".
WordPronunciation is a class that defines a mapping between a word and its phonetic pronunciation. A phonetic pronunciation is a space separated string of phonemes that define how the word is pronounced. The names of the phonemes are language-specific and defined in the ASR Bundle. For some languages, where this mapping is not deterministic, the ASR Bundle will contain a large lookup table in the lang/lexicon.txt file.
You can use WordPronunciation to provide alternatives to existing pronunciations, or to define pronunciations for words that are not in the ASR Bundle lexicon. Some scenarios where this could be useful is modeling of: a) made-up words, b) common mispronunciations. The latter can be useful in use cases involving language learning and reading instruction. In those scenarios you can also provide an arbitrary tag value when constructing a WordPronunciation. The tag will be appended to the recognized word in the result, if such pronunciation was the most likely hypothesis. For example, given a word “PEAK” and tag “WRONG” the word in the result will be “PEAK#WRONG”.
Example: a pronunciation for PEAK that could potentially be tagged as WRONG is
let wordPronunciation = new WordPronunciation("PEAK", "B IY1 K", "WRONG");