KeenASR React Native Plugin (v2.2)
    Preparing search index...

    Function createDecodingGraphFromPhrases

    • Create a decoding graph optimized for recognizing specific phrases.

      A decoding graph is a compiled recognition grammar that the recognizer uses to constrain what it listens for. The graph is stored persistently on disk and can be reused across sessions.

      Parameters

      • dgName: string

        Unique name for this graph. Used in prepareForListening to activate it. Must not contain the - (hyphen) character.

      • phrases: string[]

        Array of phrases the user might say.

      • Optionaloptions: {
            task?: SpeakingTask;
            alternativePronunciations?: (
                | WordPronunciation
                | { word: string; pronunciation: string; tag?: string }
            )[];
            spokenNoiseProbability?: number;
        }

        Optional configuration.

        • Optionaltask?: SpeakingTask

          Speaking task type (affects language model optimization). Defaults to SpeakingTask.Default.

        • OptionalalternativePronunciations?: (WordPronunciation | { word: string; pronunciation: string; tag?: string })[]

          Custom pronunciation definitions. See WordPronunciation.

        • OptionalspokenNoiseProbability?: number

          Probability of <SPOKEN_NOISE> token appearing in results (0.0–1.0, default 0.5). Lower values reduce its frequency; higher values increase it.

      Returns Promise<boolean>

      true if the graph was created successfully.

      await createDecodingGraphFromPhrases('greetings', [
      'hello', 'good morning', 'goodbye',
      ], {
      task: SpeakingTask.Default,
      spokenNoiseProbability: 0.3, // lower the probability (e.g. to be more lenient for accented speech)
      });