deanshanahan
deanshanahan

Reputation: 320

Changing Choregraphe Dialog Confidence Interval for Nao

I am currently working with a Nao robot using Choregraphe and am trying to lower the confidence interval required to act upon a request made through QiChat from the default 50% to 30%.

I have found this solution, https://community.ald.softbankrobotics.com/en/forum/change-speech-engine-confidence-threshold-choregraphe-dialog-8624, but unfortunately the scripting functionality for Dialog boxes is deprecated in Choregraphe v2.1. Does anyone know what the "new" way to do this is?

Upvotes: 1

Views: 759

Answers (3)

user3708371
user3708371

Reputation: 13

setASRConfidenceThreshold is for Nao V5; in Pepper and Nao V6 you should use setConfidenceThreshold:

class MyClass(GeneratedClass):
    def onInput_onStart(self):
        # Lower confidence threshold from 50% to 30%
        ALProxy('ALDialog').setConfidenceThreshold("BNF", 0.3)

        self.onStopped() # activate the output of the box

Upvotes: 1

Emile
Emile

Reputation: 2971

Two solutions to increase recognition rate:

1) Add more variants to your input - for example, if you're listening for "yes", you should also make sure you listen for "yep", "yup", "yeah", "sure", "okay", "fine", etc. - concepts are useful for that, see the qichat doc.

1) as you suggest, set the confidence threshold - for a more compact version (I prefer less boilerplate):

class MyClass(GeneratedClass):
    def onInput_onStart(self):
        # Lower confidence threshold from 50% to 30%
        ALProxy('ALDialog').setASRConfidenceThreshold(0.3) 
        self.onStopped() # activate the output of the box

HOWEVER, note that this is not very elegant; you will need to reset it, and it greatly increases the risk of false positives, so you should only use this if you can't solve it just by adding more variants.

Upvotes: 1

deanshanahan
deanshanahan

Reputation: 320

I have found the solution. Scripting for Dialog boxes is not allowed but you can add a Python script before the Dialog box to change this interval. The code that should go in this box is below.

class MyClass(GeneratedClass):
def __init__(self):
    GeneratedClass.__init__(self)

def onLoad(self):
    #put initialization code here
    pass

def onUnload(self):
    #put clean-up code here
    pass

def onInput_onStart(self):
    # Lower confidence threshold from 50% to 30%
    ALDialog = ALProxy('ALDialog')
    ALDialog.setASRConfidenceThreshold(0.3) 
    self.onStopped() #activate the output of the box

def onInput_onStop(self):
    self.onUnload() #it is recommended to reuse the clean-up as the box is stopped
    self.onStopped() #activate the output of the box

Upvotes: 1

Related Questions