load but dont use hotwords from $REACTOR_HOTWORDS
parent
0f12fbc8c1
commit
6282972374
|
|
@ -104,6 +104,25 @@ class Reactor(threading.Thread):
|
|||
threading.Thread.__init__(self)
|
||||
self.inq = inq
|
||||
self.outq = outq
|
||||
self.load_hotwords = Reactor.new_load_hotwords
|
||||
self.load_hotwords()
|
||||
|
||||
def new_load_hotwords():
|
||||
p = environ.get("REACTOR_HOTWORDS", None)
|
||||
if not p:
|
||||
return lambda: []
|
||||
|
||||
try:
|
||||
def load_hotwords_in_file():
|
||||
with open(p, "r") as f:
|
||||
return ["".join(i.strip().lower().split()) for i in f.readlines()]
|
||||
return load_hotwords_in_file
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def load_hotwords_as_literal():
|
||||
return ["".join(i.strip().split()) for i in p.lower().split(",")]
|
||||
return load_hotwords_as_literal
|
||||
|
||||
def run(self):
|
||||
log("Reactor.run: start")
|
||||
|
|
@ -116,6 +135,7 @@ class Reactor(threading.Thread):
|
|||
log("Reactor.run: stop")
|
||||
|
||||
def handle(self, text):
|
||||
hotwords = self.load_hotwords()
|
||||
print(text)
|
||||
|
||||
class Actor(threading.Thread):
|
||||
|
|
|
|||
Loading…
Reference in New Issue