问题
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