Reply To: Responding to Speech Recognition

Home Forums OpenEars Responding to Speech Recognition Reply To: Responding to Speech Recognition

Halle Winkler


OK, I think this may be more about getting started with Objective-C than with OpenEars specifically, and I can unfortunately only provide a very limited amount of help with general programming questions here since support time and resources are limited. But, I can see if I can help a bit in this question to get you on the right track while you can look into more general programming sites in order to connect with people who can help with getting started.

A few things that would help:

• it’s always very important to provide some specific information about what happened when things didn’t work correctly. So, in order to get good help with bugs and glitches, it’s really important to show the full errors you receive or to very specifically describe the bugs and the glitches, or there isn’t any way to give help from the other side.

• in C, which includes the C aspects of Objective-C, this kind of equal sign is for assignment (giving variables new values): “=” and this kind of equal sign is for equality (comparing values as you have done above): “==”. You can’t use a single equal sign to see if two values are the same. That will instead assign a new value and will always evaluate as true in an if statement. To see if two values are the same you have to compare them with “==”.

• But more importantly, in Objective-C, NSStrings are not compared with each other with “==” in order to see if they have the same characters in them because they are pointers to objects and not primitive types like a single char or int value that could be compared with “==”. There is a method of NSString called isEqualToString: which performs this comparison check and returns a BOOL that is true or false, so that is what has to be used in order to check if your NSString is the same as some other NSString.

There are examples of doing exactly this kind of comparison in the sample app that ships with OpenEars, so check it out and you can see many different kinds of processes that are part of a speech recognition app.