From: Bladepopper <bla...@gm...> - 2009-07-20 12:57:01
|
Hi all, this is more of a C++ question than a sphinx2 question. Thanks to Toby i've made great progress in the voice control program. Now i'm stuck with a rather basic c++ problem. I've read some c++ info on the matter and havn't come up with something useful so far. Now i need to obtain the word/variable that sphinx2 detected upon speech. I've read the official webpage on the SpeechRecognitionProxy class members and found that "std::string PlayerCc::SpeechRecognitionProxy::operator[] (uint aWord) [inline]" might be useful to me but i'm not sure how to use it? It says operator[] is the word access operator and GetWord is the one to get words. I've also located a piece of code that i'm fairly sure is that process of obtaining the word sphinx2 detects: std::ostream& std::operator << (std::ostream &os, const PlayerCc::SpeechRecognitionProxy &c) { os << "#SpeechRecognition (" << c.GetInterface() << ":" << c.GetIndex() << ")" << std::endl; os << " words [" << c.GetCount() << "]: "; for (uint32_t i=0; i < c.GetCount(); i++) { std::cout << c.GetWord(i) << " " ; } os << std::endl; return os; } Problem is that with my minimum skill in c++ i'm not sure how to use this. I wish to print out the word and at the same time do some decisions. Something like if i say "FORWARD", sphinx2 will send a variable with the content "FORWARD" to player and i can do a printout on the screen with "Command: FORWARD" and at the background if(detected_word == FORWARD) then ACTIVATE_WHEELS. This is just a basic concept that i'm not sure how to integrate. I think this is more of a c++ problem rather than a technical sphinx/player problem. Thanks for any help. -- View this message in context: http://www.nabble.com/Sphinx2-Class-tp24569322p24569322.html Sent from the playerstage-users mailing list archive at Nabble.com. |