hotwords is K

master
bel 2023-03-25 21:44:05 -06:00
parent 8d608c7470
commit c46fe808fd
1 changed files with 5 additions and 2 deletions

View File

@ -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):