get_response()
and passed it the name of our dialog file 'what.is.your.favorite.flavor.dialog'
. This is the simplest form of this method. It will speak dialog from the given file, then activate the microphone for 3-10 seconds allowing the User to respond. The transcript of their response will then be assigned to our variable favorite_flavor
. To confirm that we have heard the User correctly we then speak a confirmation dialog passing the value of favorite_flavor
to be spoken as part of that dialog.get_response()
method also takes the following optional arguments:data
(dict) - used to populate the dialog file, just like speak_dialog()
validator
(function) - returns a boolean to define whether the response meets some criteria for successon_fail
(function) - returns a string that will be spoken if the validator returns Falsenum_retries
(int) - number of times the system should repeat the question to get a successful resultyes.voc
and no.voc
files (if they exist), as well as mycroft-cores defaults (contained within mycroft-core/res/text/en-us/yes.voc
). A longer phrase containing the required vocab is considered successful eg both "yes" and "yeah that would be great thanks" would be considered a successful "yes".None
.IceCreamSkill
to see how this works.ask_selection()
provides a list of options to the User for them to select from. The User can respond with either the name of one of these options or select with a numbered ordinal eg "the third".IceCreamSkill
to give the User a list of options to choose from.welcome.dialog
. The list of flavors is then spoken, followed by the what.flavor.dialog
. Finally we confirm the Users selection by speaking coming.right.up.dialog
min_conf
(float) defines the minimum confidence level for fuzzy matching the Users response against the list of options. numeric
(bool) if set to True will speak the options as a numbered list eg "One, vanilla. Two, chocolate. Or three, mint"expect_response
parameter of the speak_dialog()
method.