【问题标题】:I want to use my own gram file or hello world demo updated gram file in Sphinx4我想在 Sphinx4 中使用我自己的 gram 文件或 hello world demo 更新的 gram 文件
【发布时间】:2015-12-11 04:57:00
【问题描述】:

实际上 hello world 演示示例有几个词,但我想在其中添加更多词。它似乎可以通过两种方式进行。 1.更新hello.gram文件 2. 创建我自己的 gram 文件。 但问题是我无法做到这两种方式。你能帮我吗?谢谢你的时间。抱歉英语不好。

这是我更新的 hello.gram 文件。我没有更新其他文件。请帮我解决这个问题。 hello.gram 文件

#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 );

我在这个 .gram 文件中添加了“Yes”、“No”和“Yummy”。

hello.config.xml(来自此文件的 jsgf 语法配置部分)

<!-- ******************************************************** -->
<!-- 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>

【问题讨论】:

  • 问题是这样的。更新 hello.gram 文件意味着通过在 gram 文件中添加新单词,程序会加载或识别 hello.gram 文件中添加的单词。我怎样才能加载它?

标签: java cmusphinx sphinx4


【解决方案1】:

您发布的文件不是有效的 JSGF 文件。这部分

<!-- ******************************************************** -->
<!-- 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>

来自配置文件。

【讨论】:

  • 我没有发送完整的文件。它与 helloworld 演示文件相同。我只是发送它的 jsfgGrammar 部分。
  • 除了上面给出的 gram 文件外没有任何变化。
  • 你混淆了语法文件和配置文件。建议你运行官方的例子,然后在语法文件中做些小改动。
  • #JSGF V1.0; /** * JSGF Grammar for Hello World example */ grammar hello; public &lt;greet&gt; = (Good morning | Hello | Yes | No | Yummy) ( Bhiksha | Evandro | Paul | Philip | Rita | Will );
  • 和帖子问题下面的代码是配置文件的一部分。
猜你喜欢
  • 2017-04-03
  • 2016-08-01
  • 1970-01-01
  • 2017-09-10
  • 1970-01-01
  • 1970-01-01
  • 2018-08-12
  • 2020-09-03
  • 2013-11-25
相关资源
最近更新 更多