def register_rasa_intent(self, name, samples, handler):
        message = "rasa:register_intent"
        name = str(self.skill_id) + ':' + name
        data = {"name": name, "samples": samples}

        self.emitter.emit(Message(message, data))
        self.add_event(name, handler, 'mycroft.skill.handler')
Beispiel #2
0
    def speak(self, utterance, expect_response=False, metadata=None):
        """
            Speak a sentence.

                   Args:
                       utterance:          sentence mycroft should speak
                       expect_response:    set to True if Mycroft should expect
                                           a response from the user and start
                                           listening for response.
                       metadata:           Extra data to be transmitted
                                           together with speech
               """
        metadata = metadata or {}
        # translate utterance for skills that generate speech at runtime
        utterance, message_context = self._translate_utterance(utterance,
                                                               self.lang, {})

        # registers the skill as being active
        self.enclosure.register(self.name)
        data = {'utterance': utterance,
                'expect_response': expect_response,
                "metadata": metadata}
        message = dig_for_message()
        if message:
            self.emitter.emit(message.reply("speak", data, message_context))
        else:
            self.emitter.emit(Message("speak", data, message_context))
 def register_rasa_regex(self, name, pattern):
     message = "rasa:register_regex"
     name = str(self.skill_id) + ':' + name
     data = {"name": name, "pattern": pattern}
     self.emitter.emit(Message(message, data))
 def register_rasa_entity(self, name, samples):
     message = "rasa:register_entity"
     name = str(self.skill_id) + ':' + name
     data = {"name": name, "samples": samples}
     self.emitter.emit(Message(message, data))
Beispiel #5
0
 def register_fuzzy_entity(self, name, samples):
     message = "fuzzy:register_entity"
     name = str(self.skill_id) + ':' + name
     data = {"name": name, "samples": samples}
     self.bus.emit(Message(message, data))
Beispiel #6
0
 def notify(text):
     self.emitter.emit(Message(text))