I want to use my own gram file or hello world demo updated gram file in Sphinx4

和自甴很熟 提交于 2019-12-13 08:08:15

问题


Actually hello world demo example has a few words but I want to add more words in it. Its seems possible to do either two ways. 1. Update the hello.gram file 2. create my own gram file. But the issue is that I'm unable to do either way. Can you please help me in it. Thanks for your time. Sorry for bad english.

Here is my hello.gram file which I updated. I updated no other file. Please help me in this sort. hello.gram file

#JSGF V1.0;



/**
* JSGF Grammar for Hello World example
*/

grammar hello;

public <greet> = (Good morning | Hello | Yes | No | Yummy) ( Bhiksha | Evandro | Paul | Philip | Rita | Will );

I added 'Yes','No' and 'Yummy' in my this .gram file.

hello.config.xml (jsgf Grammar configuration part from this file)

<!-- ******************************************************** -->
<!-- The Grammar  configuration                               -->
<!-- ******************************************************** -->

<component name="jsgfGrammar" type="edu.cmu.sphinx.jsapi.JSGFGrammar">
    <property name="dictionary" value="dictionary"/>
    <property name="grammarLocation" 
         value="resource:/demo.sphinx.helloworld.elloWorld!/demo/sphinx/helloworld/"/>
    <property name="grammarName" value="hello"/>
<property name="logMath" value="logMath"/>
</component>

回答1:


The file that you posted is not a valid JSGF file. This part

<!-- ******************************************************** -->
<!-- The Grammar  configuration                               -->
<!-- ******************************************************** -->

<component name="jsgfGrammar" type="edu.cmu.sphinx.jsapi.JSGFGrammar">
    <property name="dictionary" value="dictionary"/>
    <property name="grammarLocation" 
         value="resource:/demo.sphinx.helloworld.elloWorld!/demo/sphinx/helloworld/"/>
    <property name="grammarName" value="hello"/>
<property name="logMath" value="logMath"/>
</component>

is from the configuration file.



来源:https://stackoverflow.com/questions/33786658/i-want-to-use-my-own-gram-file-or-hello-world-demo-updated-gram-file-in-sphinx4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!