From d31fabf8cff5dae02e3fc759a4203bd374dddc99 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sun, 30 Mar 2014 16:03:44 -0400 Subject: Initial commit --- client/local_mic.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 client/local_mic.py (limited to 'client/local_mic.py') diff --git a/client/local_mic.py b/client/local_mic.py new file mode 100644 index 0000000..3fc742e --- /dev/null +++ b/client/local_mic.py @@ -0,0 +1,26 @@ +""" +A drop-in replacement for the Mic class that allows for all I/O to occur +over the terminal. Useful for debugging. Unlike with the typical Mic +implementation, Jasper is always active listening with local_mic. +""" + + +class Mic: + prev = None + + def __init__(self, lmd, dictd, lmd_persona, dictd_persona): + return + + def passiveListen(self, PERSONA): + return True, "JASPER" + + def activeListen(self, THRESHOLD=None, LISTEN=True, MUSIC=False): + if not LISTEN: + return self.prev + + input = raw_input("YOU: ") + self.prev = input + return input + + def say(self, phrase, OPTIONS=None): + print "JASPER: " + phrase -- cgit v1.3.1