JSGF语法中的语法错误

时间:2015-05-10 12:19:42

标签: speech-recognition cmusphinx pocketsphinx

我使用以下语法:

#JSGF V1.0;


 public <basicCmd> = <startPolite> <command> <endPolite>;
  <command> = <action> <object>;
  <action> = /10/ open |/2/ close |/1/ delete |/1/ move;
  <object> = [the | a] (window | file | menu);
  <startPolite> = (please | kindly | could you | oh mighty computer) *;
  <endPolite> = [ please | thanks | thank you ];

我已将其从Sphinx JSGF Tutorial.复制并保存为main.gram。

每当我使用以下命令启动pocketsphinx时:

pocketsphinx_continuous -inmic yes -jsgf main.gram

我收到以下错误:

ERROR: "jsgf_parser.y", line 155: syntax error, unexpected PUBLIC, expecting GRAMMAR at line 2 current token 'public'
ERROR: "jsgf.c", line 904: Failed to parse JSGF grammar from 'main.gram'

我认为语法是正确的,我正确地传递了所需的参数。 可能是什么问题呢?请帮忙!

1 个答案:

答案 0 :(得分:1)

我明白了!问题是我没有包含语法声明。

grammar sample;
#JSGF V1.0;

之后