Ejemplo n.º 1
0
    def action(msg):
        import csv
        with open(JOKES, newline='') as csvfile:
            reader = csv.DictReader(csvfile)
            chosen_row = np_random_choice(list(reader))

            logging.info(f"chose joke #{chosen_row['ID']} from 231,657 jokes")
        return chosen_row['Joke']
Ejemplo n.º 2
0
def start_listen():
    logging.info(START_SCREEN)
    stt = SpeechToText()
    tts = TextToSpeech()

    while True:
        text = stt.transcribe()

        output = commands(text)

        tts.speak(output)
Ejemplo n.º 3
0
    def action(msg):
        import wikipedia

        split_msg = msg.split(' ')
        for key in ['is']:
            if key in split_msg:
                target = ' '.join(split_msg[split_msg.index(key) + 1:])
        logging.info(f"looking on wikipedia for: {target}")
        summary = threading(wikipedia.summary, target, sentences=2)

        return summary
Ejemplo n.º 4
0
 def listen(self) -> sr.AudioData:
     """
     listens to local microphone
     Returns:
         AudioData from record
     """
     with sr.Microphone() as source:
         t0 = time.time()
         logging.info('start listening...')
         audio = self.r.listen(source)
         t1 = time.time()
         logging.info(f'stopped ... after {t1 - t0}')
     return audio
Ejemplo n.º 5
0
 def onEnd(self, name, completed):
     logging.info('finishing', name, completed)
Ejemplo n.º 6
0
 def onWord(self, name, location, length):
     logging.info('word', name, location, length)
Ejemplo n.º 7
0
 def onStart(self):
     logging.info('starting')