HomeForumsOpenEarsother hmms

This topic has 2 voices, contains 3 replies, and was last updated by  Halle 305 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
July 17, 2011 at 5:22 pm #7277

sarinsukumar

Hi halle,
thanks for that, i already fixed it , but i expect a much better way in your code.
I am now trying the openers with other hmms.

do you have any experience with that?

still i am not able to do the on the fly language model change.
it works 2 times but not the third time.
do you have any advice in on the fly JSGF grammar generation.

thanks in advance halle.

July 17, 2011 at 7:29 pm #7278

Halle

I am now trying the openers with other hmms.

do you have any experience with that?

I don’t have a lot of experience with other HMMs, but the most important thing in my experience is to completely remove the old HMM folder before adding the new one to your project, because all the parts of the HMMs must be loose in your app bundle in your compiled app in order to OpenEars to find them when starting Pocketsphinx, so multiple HMM files with the same names that are part of different HMM groups in your project are going to cause trouble. It is important in the case of OpenEars that your new HMM uses the same phonemes that come out of LanguageModelGenerator and the CMU language tool, but I think if it’s an English HMM the odds are pretty great that it does. VERBOSEPOCKETSPHINX will show you every complaint that Pocketsphinx might emit about an HMM, so take a close look at the logs if you have issues and search for the text “error” in the logs.

still i am not able to do the on the fly language model change.
it works 2 times but not the third time.

What exactly happened the third time you switched models? Is this with your app that has changes in the engine, and is this on the device or the simulator?

do you have any advice in on the fly JSGF grammar generation.

It’s actually pretty do-able to make JSGF on the fly yourself, because there is no probability calculation or finding all the n-grams for every given “chunk” of words that are in a phrase. You only have to worry about creating valid JSGF markup by appending characters to an NSMutableString and then writing it out as your file at the end. Knowing what you want to achieve and deciding on the needed markup is the part that needs attention.

This code will create a valid JSGF grammar from an array of words, but the grammar is overly simple. Probably helpful for getting started:


NSString *nameOfMyGramFile = @"MyGrammar";

	NSMutableArray *wordsArray = [[NSMutableArray alloc] initWithObjects:
						   @"Monday",
						   @"Tuesday",
						   @"Wednesday",
						   @"Thursday",
						   @"Friday",
						   nil];

	NSMutableString *mutableJSGFString = [[NSMutableString alloc] init];
	[mutableJSGFString appendString:[NSString stringWithFormat:@"#JSGF V1.0;\n\ngrammar %@;\n\npublic <s> = %@\n",nameOfMyGramFile,[[wordsArray objectAtIndex:0]uppercaseString]]];

	[wordsArray removeObjectAtIndex:0];

	for(NSString *string in wordsArray) {

		[mutableJSGFString appendString:[NSString stringWithFormat:@"|%@\n",[string uppercaseString]]];
	}

	[mutableJSGFString appendString:@";"];

	[wordsArray release];

	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents directory

	NSError *error = nil;

	BOOL writeSuccess = [(NSString *)mutableJSGFString writeToFile:[documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.gram",nameOfMyGramFile]] atomically:YES encoding:NSUTF8StringEncoding error:&error];

	if (!writeSuccess || error) {
		// Handle error here

	}
	[mutableJSGFString release];
July 18, 2011 at 4:51 am #7280

sarinsukumar

Hi halle,
That was great, and you are so helpful,

Can I give individual words and whole phrases for lm generation and does phrases gives any kind of accuracy improvement?

when i give 30 words the recognition accuracy degrades, do you know any solution for this?

Thanks

July 18, 2011 at 9:03 am #7281

Halle

For ARPA or JSGF? Giving phrases for ARPA generation will improve recognition of phrases. JSGF rules to improve recognition for various applications are outside the scope of support here but I posted some links here:

http://www.politepix.com/forums/topic/force-recognition-of-phrases-rather-than-individual-words/#post-7263

In general, it sounds a little bit like your recognition accuracy might be impacted by the customizations you’ve made to the engine. My experience with the circumstances under which you are seeing decreased accuracy doesn’t really match.

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

You must be logged in to reply to this topic.