- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我创建了一个语法
#JSGF V1.0;
/**
* JSGF Grammar
*/
grammar grammar;
public <number> = ( zero | one | two | three | four | five | six | seven | nine | ten
| eleven | twelve | thirteen | fourteen | fifteen | sixteen | seventeen | eighteen | nineteen | twenty
| thirty | forty | fifty | sixty | seventy | eighty | ninety |
hundred | thousand | million | billion)+;
public <operation> = <number>{1} (plus | minus | multiply | division){1} <number>{1};
public <greet> = ( hello | hey | hi )* world;
public <sport> = (football | tennis);
public <program> = (notepad | calculator);
public <run> = (run | open | start) <program>;
我在简单的 Sphinx4 语音识别器中使用它,我即将为程序答案创建基本逻辑。
这就是程序识别单词(代码片段)的方式:
Configuration configuration = new Configuration();
//SetVoice
textToSpeech.setVoice("cmu-bdl-hsmm");
// Load model from the jar
configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
configuration.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
configuration.setGrammarPath("resource:/grammars");
configuration.setGrammarName("grammar");
configuration.setUseGrammar(true);
try {
recognizer = new LiveSpeechRecognizer(configuration);
} catch (IOException ex) {
logger.log(Level.SEVERE, null, ex);
}
// Start recognition process pruning previously cached data.
recognizer.startRecognition(true);
SpeechResult speechResult = recognizer.getResult();
if (speechResult != null) {
result = speechResult.getHypothesis();
System.out.println("You said: [" + result + "]\n");
有没有办法获取可识别的语法规则名称?问候
最佳答案
没有办法做到这一点。如果您想执行语义分析,您可以简单地使用正则表达式解析语音识别器的输出。另请参阅
关于java - 接收 JSGF Gramma 规则名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44136918/
我需要在我的 Android 应用程序中离线训练 CMU Sphinx。我下载了this使用此参数的项目,但当我启动它时出现此错误:Fatal signal 11 (SIGSEGV) at 0x000
我创建了一个语法 #JSGF V1.0; /** * JSGF Grammar */ grammar grammar; public = ( zero | one | two | three |
我用 Java 编写了一个应用程序,它利用 CloudGarden API 来解析 JSAPI 语法,从语法规则中返回标签,然后相应地处理这些标签。 CloudGarden API 的问题在于它对 W
我将以下 JSGF 文件与 pocketsphinx 一起使用(抱歉,法语): #JSGF V1.0; /** * JSGF Grammar for music */ grammar music;
JSpeech Grammar Format允许用户为大括号中的单独字符串指定标签,如下所示: = jump { primitive jump } [up] | jump [to th
我在 python 中使用 pocketpshinx 使用 JSGF 语法文件进行语音识别。语法由规则组成,语音与这些规则相匹配才能被识别。 识别效果很好,但我似乎找不到如何检索每个单词的规则名称。我
我正在尝试通过此 link 实现新版本的 PocketSphinx我创建了一个新的绑定(bind)项目,但有编译错误。 错误CS0738“Jsgf”未实现接口(interface)成员“IIterab
我是一名优秀的程序员,十分优秀!