JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 23
  • Score
    100M100P100Q52864F
  • License MIT

Package Exports

  • js-speech-rekognition

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (js-speech-rekognition) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

HTLM5 based speech recognition

Usage

Usage:

import {Rekognition} from 'js-speech-rekognition';

const r = new Rekognition();
r.setParams({
  lang: 'en-US',
  interimResults: false,
  matchThreshold: 0.8,
  grammar: [{
    phrase_id: 1,
    phrase: 'hello',
    aliases: ['hi there', 'wassup']
  },{
    phrase_id: 2,
    phrase: 'green',
    aliases: ['color']
  }, {
    phrase_id: 3,
    phrase: 'blue',
    aliases: ['color']
  }, {
    phrase_id: 4,
    phrase: 'red',
    aliases: ['color']
  }, {
    phrase_id: 5,
    phrase: 'yellow',
    aliases: ['color']
  }]
});

To enable debugging call:

r.debugOn();

To disable debugging call:

r.debugOff();

The service supports for the following custom events:

  1. match - When the spoken command matches with the phrases in the grammar
  2. error - When there's an error with the SpeechAPI
  3. start - When speech rekognition service starts
  4. stop - When speech rekognition service stops

Attach event listeners as follow:

  r.on('match', e => {
    // do something
  });
  r.on('error', e => {
    // error occured
  });

To start the recognition service:

r.startRekognition();

To stop the recognition service:

r.stopRekognition();

To remove all listeners:

  r.removeListeners();

To reset all commands:

r.reset();