phunkytube

Forum Replies Created

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

  • Author
    Posts
  • phunkytube
    Participant

    Will do, thanks!

    It seems inconsistent on their website. Although the second most recent blog post has “Pocketsphinx” in the title, it also has “PocketSphinx” in the body. The API docs also have “PocketSphinx” (http://cmusphinx.sourceforge.net/api/pocketsphinx/). :)

    phunkytube
    Participant

    Perfectly.

    No, the delegate methods used in the sample app don’t work correctly in my app – none of the delegate methods are called. I can’t imagine what is wrong with my setup… Do you have any other ideas of where to look?

    phunkytube
    Participant

    Unfortunately not. It’s not an issue with my device, either, since the sample app runs correctly. And the ‘private’ instance variables (instead of, say, in the public header interface declaration) aren’t the problem either :(

    phunkytube
    Participant

    Hi Halle, thanks for the swift reply! My code is the following (with names replaced for simplicity):

    // OpenEarsWrapper.h
    #import <Foundation/Foundation.h>
    #import <OpenEars/OpenEarsEventsObserver.h>
    
    @interface OpenEarsWrapper : NSObject <OpenEarsEventsObserverDelegate>
    
    - (id)initAndStartListeningWithWordsArray:(NSArray *)_words filename:(NSString *)_filename;
    
    @end
    
    // OpenEarsWrapper.m
    #import "OpenEarsWrapper.h"
    #import <OpenEars/LanguageModelGenerator.h>
    #import <OpenEars/PocketsphinxController.h>
    #import <OpenEars/OpenEarsLogging.h>
    
    @interface OpenEarsWrapper ()
    
    @property (nonatomic, strong) OpenEarsEventsObserver *openEarsEventsObserver;
    
    @property (nonatomic, strong) NSString *languageModelPath;
    @property (nonatomic, strong) NSString *dictionaryPath;
    
    @property (nonatomic, strong) PocketsphinxController *pocketSphinxController; // out of curiosity why is the 's' in "sphinx" lowercase???
    
    @end
    
    @implementation OpenEarsWrapper
    
    @synthesize openEarsEventsObserver;
    @synthesize languageModelPath, dictionaryPath;
    @synthesize pocketSphinxController;
    
    - (id)initAndStartListeningWithWordsArray:(NSArray *)_words filename:(NSString *)_filename {
    	self = [super init];
    	
    	if (self) {
    		//[OpenEarsLogging startOpenEarsLogging];
    		
    		openEarsEventsObserver = [[OpenEarsEventsObserver alloc] init];
    		[openEarsEventsObserver setDelegate:self];
    		
    		LanguageModelGenerator *languageModelGenerator = [[LanguageModelGenerator alloc] init];
    		
    		NSError *error = [languageModelGenerator generateLanguageModelFromArray:_words withFilesNamed:_filename];
    		
    		NSDictionary *languageGeneratorResults = nil;
    		
    		if ([error code] == noErr) {
    			languageGeneratorResults = [error userInfo];
    			
    			languageModelPath = [languageGeneratorResults objectForKey:kLanguageModelPathKey];
    			dictionaryPath = [languageGeneratorResults objectForKey:kDictionaryPathKey];
    		} else {
    			NSLog(@"Error: %@", [error localizedDescription]);
    			return self;
    		}
    		
    		pocketSphinxController = [[PocketsphinxController alloc] init];
    		
    		[pocketSphinxController startListeningWithLanguageModelAtPath:languageModelPath dictionaryAtPath:dictionaryPath languageModelIsJSGF:NO];
    	}
    	
    	return self;
    }
    
    - (void)pocketsphinxDidReceiveHypothesis:(NSString *)hypothesis recognitionScore:(NSString *)recognitionScore utteranceID:(NSString *)utteranceID {
    	NSLog(@"why doesn't this fire!!!!");
    }
    
    @end
Viewing 4 posts - 1 through 4 (of 4 total)