3

I am using pocketpshinx in python for speech recognition using a JSGF grammar file. The grammar is composed of rules, and speech is matched to those rules to be recognized.

The recognition works well, but I can´t seem to find how to retrieve the rule names for each word. I am not interested in tags, as I read it is not implemented in pocketsphinx, just in the rule names. For example, with this simple grammar file that I just made up :

#JSGF V1.0
grammar my_grammar;
<polite> = please | thank you ;
<command> = go left | wait here;
public <sentence> = <polite> <command> <polite>;

If the recognized speech is "Please wait here thank you", I would like to be able to retrieve the "command" part ("wait here") and manipulate it. I have read that regular expressions can be used, but I don´t really understand if there is already something taking care of that in pocketsphinx (which would be great) or if I have to build something myself. I don´t want to reinvent the wheel if it´s not necessary. =)

Limon Monte
  • 52,539
  • 45
  • 182
  • 213
Enaid
  • 305
  • 1
  • 18

1 Answers1

0

There is nothing for that in pocketsphinx. You can use regular expressions, they are part of Python library, not a part of pocketsphinx.

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
  • 1
    Okay, thanks for your answer. So I have to build a pattern corresponding to my grammar file and then match the text to it. I want to be able to use different grammar files without having to manually rewrite the pattern, so I´m thinking of parsing the grammar file (also using regular expressions) to automatically create the pattern. I think I should be able to do that, but if you have some advice about how to do it I´d take them gladly. – Enaid Sep 03 '15 at 12:55