|
|
@@ -2,6 +2,7 @@ import Queue
|
|
|
import threading
|
|
|
import console
|
|
|
import google_cloud_speech
|
|
|
+import slack_bot
|
|
|
|
|
|
LANGUAGE = 'en-GB'
|
|
|
PREFERRED_PHRASES = None
|
|
|
@@ -31,7 +32,8 @@ def launch_input_sources():
|
|
|
|
|
|
services = [
|
|
|
console.ConsoleInput(_TOKEN_STREAM),
|
|
|
- google_cloud_speech.GoogleCloudSpeech(_TOKEN_STREAM),
|
|
|
+ #google_cloud_speech.GoogleCloudSpeech(_TOKEN_STREAM),
|
|
|
+ slack_bot.SlackBot(_TOKEN_STREAM),
|
|
|
]
|
|
|
|
|
|
for s in services:
|
|
|
@@ -40,15 +42,21 @@ def launch_input_sources():
|
|
|
t.start()
|
|
|
|
|
|
def get_token(timeout=120, preferred_phrases=None):
|
|
|
+ global PREFERRED_PHRASES
|
|
|
+ PREFERRED_PHRASES = preferred_phrases
|
|
|
return _TOKEN_STREAM.get_token(timeout)
|
|
|
|
|
|
def get_line(timeout=120, preferred_phrases=None):
|
|
|
+ global PREFERRED_PHRASES
|
|
|
+ PREFERRED_PHRASES = preferred_phrases
|
|
|
return _TOKEN_STREAM.get_line(timeout)
|
|
|
|
|
|
def token_available():
|
|
|
return not _TOKEN_STREAM.buffer.empty()
|
|
|
|
|
|
def get_until_terminated(timeout=120, terminators=['done', 'cancel'], preferred_phrases=None):
|
|
|
+ global PREFERRED_PHRASES
|
|
|
+ PREFERRED_PHRASES = preferred_phrases
|
|
|
res = []
|
|
|
t = get_token(timeout=timeout, preferred_phrases=preferred_phrases)
|
|
|
while t not in terminators:
|