keenasr-web - v2.1
    Preparing search index...

    Class WordPronunciation

    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 wordPEAK” and tagWRONG” 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");
    
    Index

    Constructors

    Properties

    Constructors

    • Parameterized constructor.

      NOTE: both word and phones will internally be stored in uppercase.

      Parameters

      • word: string

        string specifying the word. For example "CAT".

      • pronunciation: string

        a space separated phone string.

      • tag: string = ''

        a tag suffix for the word.

      Returns WordPronunciation

      Error when the SDK (i.e. Recognizer) is not initialized

    Properties

    isValid: boolean

    Is this object is valid, for a given Recognizer.

    A word pronunciation is valid if:

    1. word does not contain < or > characters.
    2. tag is not equal to "INC" (a reserved tag) and it does not contain a # character.
    3. pronunciation is composed of valid phones (as defined in the ASR Bundle that was used to initialize the Recognizer).
    pronunciation: string

    The phonetic transcription of a word, provided as a space-separated sequence of phones.

    tag: string

    The 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.

    word: string

    The string specifying the word.

    Example: "CAT".