Eichhoernchen/SiriServer — Issue #311: Adding confidence to unanswered questions
Author: nuno12345
Created: 2012-02-19 11:28:33+00:00
State: open

Made some changes to siriServer.py so it outputs the recognition confidence.
Not a python scripter, feel free to use it :)

Modifications are in siriServer.py.

Find:
```
__not_recognized = {"de-DE": u"Entschuldigung, ich verstehe \"{0}\" nicht.", "en-US": u"Sorry I don't understand {0}"}
```
Change to:
```
__not_recognized = {"de-DE": u"Entschuldigung, ich verstehe \"{0}\" nicht.", "en-US": u"Sorry I don't understand {0}.\nConfidence: {1}%"}
```

Find:
```
view.views += [uiObjects.AssistantUtteranceView(errorText.format(best_match), errorText.format(best_match)]
```
Change to:
```
view.views += [uiObjects.AssistantUtteranceView(errorText.format(best_match, round(float(best_match_confidence)*100,2)), errorText.format(best_match, round(float(best_match_confidence)*100,2)))]
```

You can make a variable for confidence so it doesnt have to do the math (and get big) every time you want to use it