hotwords is K
parent
8d608c7470
commit
c46fe808fd
|
|
@ -118,12 +118,15 @@ class Reactor(threading.Thread):
|
||||||
def load_hotwords_in_file():
|
def load_hotwords_in_file():
|
||||||
with open(p, "r") as f:
|
with open(p, "r") as f:
|
||||||
return ["".join(i.strip().lower().split()) for i in f.readlines()]
|
return ["".join(i.strip().lower().split()) for i in f.readlines()]
|
||||||
|
load_hotwords_in_file()
|
||||||
return load_hotwords_in_file
|
return load_hotwords_in_file
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
hotwords = ["".join(i.lower().strip().split()) for i in p.split(",")]
|
||||||
|
log(f'$HOTWORDS: {hotwords}')
|
||||||
def load_hotwords_as_literal():
|
def load_hotwords_as_literal():
|
||||||
return ["".join(i.strip().split()) for i in p.lower().split(",")]
|
return hotwords
|
||||||
return load_hotwords_as_literal
|
return load_hotwords_as_literal
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
@ -144,7 +147,7 @@ class Reactor(threading.Thread):
|
||||||
cleantext = "".join([i for i in "".join(text.lower().split()) if i.isalpha()])
|
cleantext = "".join([i for i in "".join(text.lower().split()) if i.isalpha()])
|
||||||
for i in hotwords:
|
for i in hotwords:
|
||||||
if i in cleantext:
|
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)
|
self.outq.put(i)
|
||||||
|
|
||||||
class Actor(threading.Thread):
|
class Actor(threading.Thread):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue