Public Member Functions | |
def | __init__ (self, name=None, bus=None) |
def | bind (self, bus) |
def | CQS_action (self, phrase, data) |
def | CQS_match_query_phrase (self, phrase) |
Private Member Functions | |
def | __calc_confidence (self, match, phrase, level) |
def | __handle_query_action (self, message) |
def | __handle_question_query (self, message) |
Question answering skills should be based on this class. The skill author needs to implement `CQS_match_query_phrase` returning an answer and can optionally implement `CQS_action` to perform additional actions if the skill's answer is selected. This class works in conjunction with skill-query which collects answers from several skills presenting the best one available.
Definition at line 43 of file common_query_skill.py.
def mycroft.skills.common_query_skill.CommonQuerySkill.__init__ | ( | self, | |
name = None , |
|||
bus = None |
|||
) |
Definition at line 52 of file common_query_skill.py.
|
private |
Definition at line 95 of file common_query_skill.py.
|
private |
Message handler for question:action. Extracts phrase and data from message forward this to the skills CQS_action method.
Definition at line 117 of file common_query_skill.py.
|
private |
Definition at line 66 of file common_query_skill.py.
def mycroft.skills.common_query_skill.CommonQuerySkill.bind | ( | self, | |
bus | |||
) |
Overrides the default bind method of MycroftSkill. This registers messagebus handlers for the skill during startup but is nothing the skill author needs to consider.
Definition at line 55 of file common_query_skill.py.
def mycroft.skills.common_query_skill.CommonQuerySkill.CQS_action | ( | self, | |
phrase, | |||
data | |||
) |
Take additional action IF the skill is selected. The speech is handled by the common query but if the chosen skill wants to display media, set a context or prepare for sending information info over e-mail this can be implemented here. Args: phrase (str): User phrase uttered after "Play", e.g. "some music" data (dict): Callback data specified in match_query_phrase()
Definition at line 146 of file common_query_skill.py.
def mycroft.skills.common_query_skill.CommonQuerySkill.CQS_match_query_phrase | ( | self, | |
phrase | |||
) |
Analyze phrase to see if it is a play-able phrase with this skill. Needs to be implemented by the skill. Args: phrase (str): User phrase uttered after "Play", e.g. "some music" Returns: (match, CQSMatchLevel[, callback_data]) or None: Tuple containing a string with the appropriate matching phrase, the PlayMatch type, and optionally data to return in the callback if the match is selected.
Definition at line 129 of file common_query_skill.py.