Web Speech API中的语法效果 [英] The effect of the grammar in the Web Speech API

查看:70
本文介绍了Web Speech API中的语法效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Web Speech API的示例中,始终指定语法.例如,在 MDN的颜色更改示例,语法为:

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 ;

但是,在实际使用API​​(在Chrome 54.0.2840.71上)时,

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

  1. 有时返回的字符串不符合所提供的语法
  2. 不提供描述语音的解析树

那么语法实际上是做什么的?如何获得这些行为中的任何一种(限制语法并查看语法分析树)?

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

推荐答案

当前存在一个与此相关的公开Chromium问题:

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

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆