Mercurial > hg > easaier-soundaccess
view widgets/SpeechFileHandler.cpp @ 274:96121bc067fb
Displays only results that have confidence <> 0.0
author | lbarthelemy |
---|---|
date | Thu, 03 Jul 2008 10:16:16 +0000 |
parents | 63a485275ed6 |
children |
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){ _resultAux+="<br>"; if(!_resultAux.contains("0.0")){ _result += _resultAux; } _resultAux = ""; } 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){ _resultAux+="<b>"; _resultAux+=attribs.value(i); _resultAux+="</b>"; }else if(aux == _tag_confidence ){ _resultAux+=" "; _resultAux+=attribs.value(i); } } } return true; } QString SpeechFileHandler::getResult(){ return _result; }