From c46fe808fd8aed98402c3b7dbe49cf1fde3ec669 Mon Sep 17 00:00:00 2001 From: bel Date: Sat, 25 Mar 2023 21:44:05 -0600 Subject: [PATCH] hotwords is K --- whisper-2023/hotwords.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/whisper-2023/hotwords.py b/whisper-2023/hotwords.py index f7e9d4d..bcdc2ec 100644 --- a/whisper-2023/hotwords.py +++ b/whisper-2023/hotwords.py @@ -118,12 +118,15 @@ class Reactor(threading.Thread): def load_hotwords_in_file(): with open(p, "r") as f: return ["".join(i.strip().lower().split()) for i in f.readlines()] + load_hotwords_in_file() return load_hotwords_in_file except Exception: pass + hotwords = ["".join(i.lower().strip().split()) for i in p.split(",")] + log(f'$HOTWORDS: {hotwords}') def load_hotwords_as_literal(): - return ["".join(i.strip().split()) for i in p.lower().split(",")] + return hotwords return load_hotwords_as_literal def run(self): @@ -144,7 +147,7 @@ class Reactor(threading.Thread): cleantext = "".join([i for i in "".join(text.lower().split()) if i.isalpha()]) for i in hotwords: if i in cleantext: - log("hotword", i, "in", text, "as", cleantext) + log(f"Reactor.handle: found hotword '{i}' in '{text}' as '{cleantext}'") self.outq.put(i) class Actor(threading.Thread):