Web Speech API自定义单词 [英] Web Speech API Custom Words

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

问题描述

我通读了 W3C docs 在这方面,我认为自定义单词来自自定义语法,但我尝试去此演示并在控制台中输入以下javascript:

I read through the W3C docs on this and I'm thinking that custom words come from custom grammar, but I tried going to this demo and in the console entered the following javascript:

recognition.grammars.addFromString('foo');

哪个运行良好且 recognition.grammars [0] .src 返回:data:application / xml,foo

Which ran fine and recognition.grammars[0].src returns: "data:application/xml,foo"

注意:'foo'不是我感兴趣的词,但我感兴趣的词不是英语单词,使用'foo'作为例子。当我正常地说出我的习惯词时,它认为我在说别的东西(这是有道理的)。我在这里使用'foo'来保护我的品牌:)

Note: 'foo' is not the word I'm interested in, but the word I'm interested in isn't an english word, using 'foo' for the example. When I speak my custom word normally, it thinks I'm saying something else (which makes sense). I'm using 'foo' here to protect my brand :)

所以我想要的是能够说嘿,foo 类似于Ok,Google的工作方式。但我的foo字不是真正的单词,所以 SpeechRecognitionResult 没有自定义单词。

So what I want is to be able to say "Hey, foo" similar to how "Ok, Google" works. But my "foo" word is not an actual word so the SpeechRecognitionResult doesn't have my custom word.

我误解了如何添加自定义单词,或者今天这不可能吗?

Am I misunderstanding how to add custom words, or is this not possible today?

推荐答案


当我通常说我的自定义词,它认为我说的是其他的东西(这是有道理的)。

When I speak my custom word normally, it thinks I'm saying something else (which makes sense).

Google提供非常有限的语音实现不支持语法的API,请参阅以下问题:

Google provides very limited implementation of speech API without support for grammars, see the question about that:

Google语音API中的语法

更多,即使原始规范在语法及其处理方面也不完整。

Morever, even the original specification is not complete in terms of grammars and their handling.


所以我想要的是能够说嘿,foo类似于Ok,Google的工作方式。但我的foo字不是一个真实的单词,所以SpeechRecognitionResult没有我的自定义单词。

So what I want is to be able to say "Hey, foo" similar to how "Ok, Google" works. But my "foo" word is not an actual word so the SpeechRecognitionResult doesn't have my custom word.

此任务不是语音识别任务因此无法通过语音识别引擎有效解决,它需要关键字识别,因为它需要过滤掉除关键字之外的所有语音。

This task is not a speech recognition task so it couldn't be solved effectively by a speech recognition engine, it requires keyword spotting because it need to filter all the speech except your keyword.

你可以尝试使用Pocketsphinx javascript库实现这一点( http: //cmusphinx.sourceforge.net/2013/06/voice-enable-your-website-with-cmusphinx/ )。使用pocketsphinx,在那里调试发音问题也更容易。

You could try to implement this using Pocketsphinx javascript library (http://cmusphinx.sourceforge.net/2013/06/voice-enable-your-website-with-cmusphinx/). With pocketsphinx, it's easier to debug pronunciation issues there too.

另请参阅 Web Speech API - SpeechGrammar ,专门描述对语法的支持。

See also Web Speech API - SpeechGrammar which specifically describes support for grammars.

这篇关于Web Speech API自定义单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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