JSGF .gram and .dic files in openears 1.7

Home Forums OpenEars JSGF .gram and .dic files in openears 1.7

Viewing 17 posts - 1 through 17 (of 17 total)

  • Author
    Posts
  • #1022221
    hg111
    Participant

    Hi Halle,

    You mentioned that OpenEarsSampleApp already has a .gram and .dic files but I’m unable to find them. Can you direct me to these files and if you have any example of how they are used that will be great,

    Thank you in advance,

    Kind regards

    Hg

    #1022222
    Halle Winkler
    Politepix

    Welcome,

    Check out this blog post to learn how to use OpenEars’ grammar tools:

    https://www.politepix.com/2014/04/10/openears-1-7-introducing-dynamic-grammar-generation/

    There is also a grammar example in the tutorial now.

    #1022233
    hg111
    Participant

    Yes, nice post.

    After turning the flag LanguageModelIsJSGF:TRUE
    I get:

    “The file you have sent to the decoder appears to be an ARPA-style language model, but you have set LanguageModelIsJSGF to true…”

    So what am I doing wrong?

    Hv

    #1022242
    Halle Winkler
    Politepix

    Did you successfully create your grammar?

    #1022256
    hg111
    Participant

    not yet. I was hoping to first try the grammar that comes with the example. I was hoping to see it in action before I add or modify anything.

    Should I not expect to be able and distinguish between background noise and the example (English) model by simply running the example?

    #1022265
    Halle Winkler
    Politepix

    not yet. I was hoping to first try the grammar that comes with the example.

    Which grammar are you referring to? The issue is that you set LanguageModelIsJSGF to TRUE but it is still an ARPA language model being sent to the PocketsphinxController instance, so we just have to figure out why it isn’t a grammar being submitted.

    #1022278
    hg111
    Participant

    Sorry for the late reply…

    The grammar I was trying to use is the first default English model, so using words like Go, left, right, backward, forward…

    #1022279
    Halle Winkler
    Politepix

    OK, the error is because that isn’t a grammar, it’s an ARPA language model. If you read through the blog post it explains how to make your own grammar and use it with PocketsphinxController.

    #1022301
    hg111
    Participant

    Okay thx, let me try and create new grammar…

    #1022390
    hg111
    Participant

    Hi Halle,

    It appears that I am now able to generate the grammar (as below) but if I turn LanguageModelIsJSGF to TRUE, it won’t start speech recognition. Also, the content of the generated grammar in the .dic file looks like the array and not the dictionary file I created (based on your blog example) It seems to always generate the file based on the Array and not the dictionary. Not sure what I’m doing wrong? Can you tell?

    Thank you

    hg

    2014-08-27 23:09:18.165 OpenEarsTest[2296:793421] Dynamic language generator completed successfully, you can find your new files FirstOpenEarsDynamicLanguageModel.DMP
    and
    FirstOpenEarsDynamicLanguageModel.dic
    at the paths
    /var/mobile/Containers/Data/Application/20681198-FA77-4878-9109-57CBC02524C6/Library/Caches/FirstOpenEarsDynamicLanguageModel.DMP
    and
    /var/mobile/Containers/Data/Application/20681198-FA77-4878-9109-57CBC02524C6/Library/Caches/FirstOpenEarsDynamicLanguageModel.dic

    content of .dic file:

    BACKWARD B AE K W ER D
    CENTER S EH N T ER
    CENTER(2) S EH N ER
    CHANGE CH EY N JH
    FORWARD F AO R W ER D
    GO G OW
    LEFT L EH F T
    MODEL M AA D AH L
    RIGHT R AY T
    TURN T ER N

    #1022391
    Halle Winkler
    Politepix

    Hello,

    That is still generating a language model. The blog post and the docs show how to generate a grammar instead. To troubleshoot, always show your generation code and all of your OpenEarsLogging and your verbosePocketsphinx output.

    #1022392
    hg111
    Participant

    Halle,

    You are right of course. I just realized from your last email when you said ‘and the docs’ that I am missing the main openears docs. (shame on me :) I was unfamiliar with ‘webloc’ …) As soon as I downloaded the docs I see the class I need to use generateGrammarFromDictionary instead of generateLanguageModelFromArray. I should be able to get it right now.

    Thank you

    hg

    #1022395
    Halle Winkler
    Politepix

    Super, glad the docs helped!

    #1022402
    hg111
    Participant

    Hi Halle,

    Now getting some initial success with the new grammar I generated although it still seems to get confused by spoken words or phrases that are not in the dictionary. Is there a way to exclude these better? Can they not be excluded without ‘Reject’bv

    I read something about Rejecto which I don’t mind to purchase if there is no other way to filter non-relevant words, but I’m unclear about the bundle ID restriction. Right now I am using 2 different bundle IDs in development. I may need another one when I go for deployment. Does that mean that I will have to purchase 3 licenses?

    #1022407
    Halle Winkler
    Politepix

    Rejecto doesn’t currently work with grammars, but yes, you would need a license for each bundle ID. Generally in these cases I can give you a discount if it’s very clear that the bundles are for the same shipping app, so email to discuss that.

    If your grammar is frequently picking up random utterances that can sometimes indicate that it doesn’t have a lot of complexity – can you tell me a bit about the grammar? How many words/syllables are in a legal utterance in your grammar?

    #1022432
    hg111
    Participant

    Hi Halle,

    Thank you very much for offering a discount and sorry for the delay in response. Are you able to email me directly regarding the details? (I rather not publish my email) I plan to purchase as soon as I’m done testing the grammar, even if it can’t work with the grammar model for now. You are right that I don’t have a lot of complexity and was in fact trying to keep it as simple as possible. So for now, the basic ‘robotic commands’ that you had by default in the given example will suffice for, as bellow:

    NSDictionary *grammarDictionary = @{
    ThisWillBeSaidOnce : @[
    @{ OneOfTheseCanBeSaidOnce : @[@”HELLO ROBOT”, @”GREETINGS ROBOT”]},
    @{ThisWillBeSaidOnce : @[
    @{ OneOfTheseCanBeSaidOnce : @[@”GO”, @”MOVE”, @”TURN”]},
    @{ OneOfTheseWillBeSaidOnce : @[@”LEFT”, @”RIGHT”, @”FORWARD”, @”BACKWARD”, @”CENTER”, @”FACE ME”]}
    ]},
    ]
    };

    So, having the system recognize a few simple words or at most two words phrases (which I’ll want to customize further and add a few more later), rather than complex sentences is preferred for my case. But is should not confuse for example: “THAT’S RIGHT” with “MOVE RIGHT”.

    What do you think?

    Haggai

    #1022435
    Halle Winkler
    Politepix

    Hi,

    It’s fine to get in touch with my via the contact form here:

    https://www.politepix.com/contact

    What do you think?

    The most important thing is to develop and test for your real usage case, because a speech UI is one of those things where the best approach may be very different depending on the purpose of your app. It’s good to use a grammar if your ideal interaction can be described by rules, which might not be the case if it is very simple – if you want to pick up individual words you don’t really get ahead by using a grammar. Two-word phrases are a reasonable use for a grammar, but if you are trying to distinguish between a small number of different phrases and each phrase has the same number of syllables, there is a heightened probability of phrases being mistaken for each other under adverse conditions. Is this the issue? Can we talk more concretely about your actual grammar?

Viewing 17 posts - 1 through 17 (of 17 total)
  • You must be logged in to reply to this topic.