我将以下 JSGF 文件与 pocketsphinx 一起使用(法语对不起):
#JSGF V1.0;
/**
* JSGF Grammar for music
*/
grammar music;
<launch_app> = lance | ouvre;
<launch_radio> = commence | débute | démarre;
<launch_artist> = met (du) | joue;
<app_list> = spotify | youtube | soundcloud | deezer;
<radio_list> = rock | folk | pop | classique | métal | triste | joyeuse | détendu;
<artist_list> = moby | lori | kyo | shakira | pantera | mozart;
<name> = music;
<radio_command> = <name> <launch_radio> une radio <radio_list>;
<app_command> = <name> <launch_app> <app_list>;
<artist_command> = <name> <launch_artist> <artist_list>;
public <final_rule> = <radio_command> | <app_command> | <artist_command>;
它完美地工作。但是,如果我删除<final_rule>
标签并改用多个public
关键字,如下所示:
#JSGF V1.0;
/**
* JSGF Grammar for music
*/
grammar music;
<launch_app> = lance | ouvre;
<launch_radio> = commence | débute | démarre;
<launch_artist> = met (du) | joue;
<app_list> = spotify | youtube | soundcloud | deezer;
<radio_list> = rock | folk | pop | classique | métal | triste | joyeuse | détendu;
<artist_list> = moby | lori | kyo | shakira | pantera | mozart;
<name> = music;
public <radio_command> = <name> <launch_radio> une radio <radio_list>;
public <app_command> = <name> <launch_app> <app_list>;
public <artist_command> = <name> <launch_artist> <artist_list>;
不管我说什么,pocketsphinx 只承认三个公共规则之一。我觉得这种行为很奇怪,因为在使用这个语法文件运行时,pocketsphinx 不会给我错误。JSGF 文件是否只需要一个公共关键字还是链接到 pocketshphinx ?