summaryrefslogtreecommitdiff
path: root/client/modules/Joke.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-07-23 21:21:17 -0700
committerschneefux <schneefux+commit@schneefux.xyz>2014-07-23 21:21:17 -0700
commit2c55f4da462383ee6c7b89ea44e5c40cd5badf0c (patch)
tree078672f2b221cfb7d0aa765f438002a277914c9f /client/modules/Joke.py
parent8a5e5ed385a5c467260c2f1b20816a66cebfc1c6 (diff)
downloadjasper-client-2c55f4da462383ee6c7b89ea44e5c40cd5badf0c.tar.gz
jasper-client-2c55f4da462383ee6c7b89ea44e5c40cd5badf0c.zip
Google STT works on OS X
Diffstat (limited to 'client/modules/Joke.py')
-rw-r--r--client/modules/Joke.py63
1 files changed, 0 insertions, 63 deletions
diff --git a/client/modules/Joke.py b/client/modules/Joke.py
deleted file mode 100644
index 52b3eb9..0000000
--- a/client/modules/Joke.py
+++ /dev/null
@@ -1,63 +0,0 @@
-import random
-import re
-
-WORDS = ["JOKE", "KNOCK KNOCK"]
-
-
-def getRandomJoke(filename="../static/text/JOKES.txt"):
- jokeFile = open(filename, "r")
- jokes = []
- start = ""
- end = ""
- for line in jokeFile.readlines():
- line = line.replace("\n", "")
-
- if start == "":
- start = line
- continue
-
- if end == "":
- end = line
- continue
-
- jokes.append((start, end))
- start = ""
- end = ""
-
- jokes.append((start, end))
- joke = random.choice(jokes)
- return joke
-
-
-def handle(text, mic, profile):
- """
- Responds to user-input, typically speech text, by telling a joke.
-
- Arguments:
- text -- user-input, typically transcribed speech
- mic -- used to interact with the user (for both input and output)
- profile -- contains information related to the user (e.g., phone number)
- """
- joke = getRandomJoke()
-
- mic.say("Knock knock")
-
- def firstLine(text):
- mic.say(joke[0])
-
- def punchLine(text):
- mic.say(joke[1])
-
- punchLine(mic.activeListen())
-
- firstLine(mic.activeListen())
-
-
-def isValid(text):
- """
- Returns True if the input is related to jokes/humor.
-
- Arguments:
- text -- user-input, typically transcribed speech
- """
- return bool(re.search(r'\bjoke\b', text, re.IGNORECASE))