ASHUTOSH
ASHUTOSH

Reputation: 892

Syntax error in JSGF grammar

I am using the following grammar:

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

I have copied this from Sphinx JSGF Tutorial. and is saved as main.gram .

whenever I launch the pocketsphinx using the following command:

pocketsphinx_continuous -inmic yes -jsgf main.gram

I get the following error:

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'

I think the grammar is correct and I am passing the required parameters correctly. What could be the problem? Please help!

Upvotes: 1

Views: 818

Answers (1)

ASHUTOSH
ASHUTOSH

Reputation: 892

I figured it out!. The problem was I hadnt included the grammar declaration.

grammar sample;

after #JSGF V1.0;

Upvotes: 1

Related Questions