从语音识别api结果中删除以前识别的单词
Remove previously recognized words from speech recognition api results
在使用Javascript语音识别API时,我发现我以前的所有语句都与最新的语句一起显示,有没有一种方法可以在识别新短语后清除所有以前的语句?
这是我处理语音识别的基本方法。
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
recognition.start();
recognition.onresult = function(event){
console.log(event);
}
通常我使用https://github.com/Manohar-Gunturu/rs.speech.js图书馆
speechRs.rec_start('en-IN',function(final_transcript,interim_transcript){
console.log(final_transcript,interim_transcript);
// final_transcript gives complete transcript from the beginning
// interim_transcript return the transcript the user has spoken
// from last break he took
});
点击此处查看演示https://jsfiddle.net/r6ftm7oq/
我认为您正在附加结果。您不应该附加结果。你应该把结果重写一遍。比方说在java 中
@Override
public void onResults(Bundle results) {
Log.i(LOG_TAG+">"+ "onResults");
ArrayList<String> matches = results
.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
String text = "";
for (String result : matches)
text += result + "'n";
if(text.contains(my key word list here)){
//you can skip this if part
}
我希望这能让你知道你做错了什么。(假设您有结果的数组列表)
相关文章:
- 如何识别我的网站中的慢速设备
- 当鼠标悬停在文本中的单词上时显示警报
- Google/html5语音识别JavaScript SDK Chrome网络工具包SpeechRecognition
- 匹配一个单词,其中候选人可以跨越顺序组(跨度)
- 如何使用jquery强制一个单词更改大小写等以保留品牌
- 拆分单词jquery
- 如何让程序检查所选单词中是否有按键
- AngularJS指令只识别双向绑定类型
- 如何在悬停时流畅地更改单词
- EmberJS中支持单字母单词模型
- 字母计数:返回重复字母数最多的第一个单词
- php脚本中无法识别ajax传递的值
- 如何在Javascript中从字符串中提取某些单词
- 如何创建一个“;表单弹出框“;在chrome中右键单击时位于突出显示的单词上方
- 在javascript中查找单词
- 从语音识别api结果中删除以前识别的单词
- 识别两个文本中的单词(if 语句在 for 循环中)
- 有没有一种好方法来识别一个单词,即使它在javascript中拼写错误
- 一种算法,用于判断从列表中识别一个单词需要多少个不同的先导字符
- 识别给定单词在哪个标签中