Skip to content

Instantly share code, notes, and snippets.

@kissrobber
Last active June 13, 2018 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kissrobber/3facfde95674f8ba00ccd073c12486f3 to your computer and use it in GitHub Desktop.
Save kissrobber/3facfde95674f8ba00ccd073c12486f3 to your computer and use it in GitHub Desktop.
with SampleAssistant(lang, device_model_id, device_id,
conversation_stream, display,
grpc_channel, grpc_deadline,
device_handler) as assistant:
wait_for_user_trigger = not once
import snowboydecoder
model = 'resources/models/anpanman.pmdl' # アンパンマンのホットワードモデル
detector = snowboydecoder.HotwordDetector(model, sensitivity=0.5)
print('Listening... Press Ctrl+C to exit')
def detected():
detector.terminate()
time.sleep(.05)
continue_conversation = assistant.assist()
wait_for_user_trigger = not continue_conversation
detector.start(detected_callback=detected,
interrupt_check=interrupt_callback,
sleep_time=0.03)
def interrupt_callback():
return not wait_for_user_trigger
detector.start(detected_callback=detected,
interrupt_check=interrupt_callback,
sleep_time=0.03)
detector.terminate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment