Mercurial > hg > easaier-soundaccess
view widgets/SpeechFileHandler.cpp @ 263:63a485275ed6
Speech recognition is integrated
author | benoitrigolleau |
---|---|
date | Fri, 20 Jun 2008 14:06:54 +0000 |
parents | 3f41cb822166 |
children | 96121bc067fb |
line wrap: on
line source
#include "SpeechFileHandler.h" SpeechFileHandler::SpeechFileHandler(){ _tag_vocal_query_result="vocal_query_result"; _tag_word="word"; _tag_confidence = "confidence"; _result = ""; } SpeechFileHandler::~SpeechFileHandler(){ } bool SpeechFileHandler::fatalError (const QXmlParseException & exception){ return false; } bool SpeechFileHandler::characters ( const QString &str){ return true; } bool SpeechFileHandler::endDocument (){ return true; } bool SpeechFileHandler::endElement (const QString &namespaceURI, const QString &localName, const QString &qName ){ _currentTag = ""; if(localName==_tag_vocal_query_result){ _result+="<br>"; } return true; } bool SpeechFileHandler::startDocument (){ return true; } bool SpeechFileHandler::startElement (const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attribs ){ _currentTag = localName; if(localName == _tag_vocal_query_result){ for(int i = 0 ; i < attribs.length() ; i++){ QString aux = attribs.localName(i); if(aux==_tag_word){ _result+="<b>"; _result+=attribs.value(i); _result+="</b>"; }else if(aux == _tag_confidence){ _result+=" "; _result+=attribs.value(i); } } } return true; } QString SpeechFileHandler::getResult(){ return _result; }