How to fetch the phrase user said

Home Forums OpenEars How to fetch the phrase user said

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

  • Author
    Posts
  • #1025252
    stefan_brankovic
    Participant

    Hey all,

    I successfully implemented OpenEars into my project and everything works fine. I just have one trivial thing that I cannot figure out.

    How to know which words the user has said? Where is that stored?

    This is my code:

    self.openEarsEventsObserver = [[OEEventsObserver alloc] init];
    [self.openEarsEventsObserver setDelegate:self];

    OELanguageModelGenerator *lmGenerator = [[OELanguageModelGenerator alloc] init];

    NSArray *words = [NSArray arrayWithObjects:
    @”WHAT’S”,
    @”WHAT IS”,
    @”SHOW ME”,
    @”SHOW”,
    @”TELL ME”,
    @”TELL ME ABOUT”,
    @”I’M LOOKING FOR”,
    @”WHAT’S COMING”,
    @”WHAT’S COMING UP”,
    @”HERE”,
    @”AT THE NEXT STOP”,
    @”AT THE NEXT EXIT”,
    @”FOOD”,
    @”GAS”,
    @”RESTAURANT”,
    nil];
    NSString *name = @”LanguageModelFiles”;
    NSError *err = [lmGenerator generateLanguageModelFromArray:words withFilesNamed:name forAcousticModelAtPath:[OEAcousticModel pathToModel:@”AcousticModelEnglish”]];

    if(err == nil) {

    _lmPath = [lmGenerator pathToSuccessfullyGeneratedLanguageModelWithRequestedName:name];
    _dicPath = [lmGenerator pathToSuccessfullyGeneratedDictionaryWithRequestedName:name];

    } else {
    NSLog(@”Error: %@”,[err localizedDescription]);
    }

    – (IBAction)startListening:(UIButton *)sender {
    [[OEPocketsphinxController sharedInstance] setActive:TRUE error:nil];
    [[OEPocketsphinxController sharedInstance] startListeningWithLanguageModelAtPath:_lmPath dictionaryAtPath:_dicPath acousticModelAtPath:[OEAcousticModel pathToModel:@”AcousticModelEnglish”] languageModelIsJSGF:NO];
    }

    And I have all the pocketsphinx methods implemented. I just need to do next:

    If user said this word, do that.
    If user said some other word, do something else.

    So where is information about user spoken words stored?

    thanks

    #1025253
    Halle Winkler
    Politepix

    Welcome,

    You receive the speech hypothesis (what was said) in your OEEventsObserver callback method. You can see examples of this in the tutorial (https://www.politepix.com/openears/tutorial) and the sample app. I recommend the tutorial for the simplest example. It is not stored anywhere, just reported in the callback for you to use in whatever way works for your app.

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