Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The effect of the grammar in the Web Speech API

In examples for the Web Speech API, a grammar is always specified. For example, in MDN's colour change example, the grammar is:

#JSGF V1.0;
grammar colors;
public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;

However, in actually using the API (on Chrome 54.0.2840.71), the result function:

  1. Sometimes returns strings that do not fit the supplied grammar
  2. Does not provide the parse tree that describes the speech

What then does the grammar actually do? How can I get either of these behaviours (restricting to the grammar and seeing the parse tree)?

like image 441
Migwell Avatar asked Dec 29 '16 05:12

Migwell


People also ask

What is speech recognition API?

The speech recognition part of the Web Speech API allows authorized Web applications to access the device's microphone and produces a transcript of the voice being recorded. This allows Web applications to use voice as one of the input & control method, similar to touch or keyboard.

How do I integrate text to speech on my website?

Open the Google website on your desktop computer and you'll find a little microphone icon embedded inside the search box. Click the icon, say something and your voice is quickly transcribed into words.

What is window webkitSpeechRecognition?

The speech recognition interface lives on the browser's window object as SpeechRecognition in Firefox and as webkitSpeechRecognition in Chrome. Start by setting the recognition interface to SpeechRecognition (regardless of the browser) using: window. SpeechRecognition = window. webkitSpeechRecognition || window.


1 Answers

There's currently an open Chromium issue specifically about this:

https://bugs.chromium.org/p/chromium/issues/detail?id=799849&q=SpeechRecognition%20grammar&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified

like image 114
ngea Avatar answered Sep 18 '22 01:09

ngea