def on_handler_started(self, message): """When a skill begins executing turn on the LED ring""" handler = message.data.get('handler', '') if self._skip_handler(handler): return pixel_ring.set_color_palette(self.main_blue, self.tertiary_green) pixel_ring.think()
def __init__(self): self._nouns = list() self._verbs = list() self._polarities = list() self._response = dict() self._text = None self._tags = list() self._words = list() self._ngrams = list() self._state = None self._classifier = None self._credentials = dict() self._telegram = dict() self.WAKE = ReSpeaker.listen self.ASRM = ReSpeaker.think self.BACK = ReSpeaker.trace self.IDLE = ReSpeaker.speak self.KNXM = ReSpeaker.think self.NLPM = ReSpeaker.spin self.POST = Requests.post self.PUTS = Requests.put ReSpeaker.set_color_palette(0x6C3082, 0xDA70D6) self.state = self.NLPM self.configurations = self.get_configuration_file() self.microphone = Speech.Microphone( device_index=self.get_microphone_index()) self.recognizer = Speech.Recognizer() self.classifier = NaiveBayes(train_set=self.build_training_data(), feature_extractor=self.extract_features) self.state = self.IDLE
def on_handler_audio_start(self, message): """Light up LED when speaking, show volume if requested""" if self.show_volume: pixel_ring.set_volume(int(self.volume * self.num_leds)) else: self.speaking = True pixel_ring.set_color_palette(self.main_blue, self.tertiary_blue) pixel_ring.speak()
def handle_listener_started(self, message): """Light up LED when listening""" pixel_ring.set_color_palette(self.main_blue, self.main_blue) pixel_ring.listen()