As we were driving to this hackathon, we came up with some criteria for this project:
- No sentiment analysis
- It had to be dumb
- Cat facts
And thus, lolChat was born.
What it does
LolChat is an SMS chatbot with lots of features! Text anything you want to (661) 347-1343. Here are some things you can say:
- "fact": responds with a random cat fact
- "newfact" + your_new_fact: adds a new fact to the fact database
- "lastfact": sends you the last fact entered into the database
- "poem" + author_name: responds with a randomly generated poem in the style of the specified term. Current supported terms include "darwin", "warren", "alice", "carroll", "plato", "bella", "bard", "bee", "Don Quixote", and "america".
- "collage" + search_terms: creates a collage of all your search terms and sends it back to you
- "word cloud": responds with a word cloud ;)
- "dog": don't even try this one
- "helpme": sends you a list of things you can do
Alternatively, you can start a conversation with Ron Obvious, our smart-ish chat bot! Text anything other than the above terms and he'll respond.
Some things I like to text it:
- "collage goat goat goat goat"
- "poem alice"
- "poem darwin"
- "poem bella"
- "poem bard"
- "collage college trees mountain cat"
- "collage house mouse louse grouse"
- "word cloud"
- "What's up?"
- "Do you like robots?"
Poetry example (Twilight):
But can you he was clearly beginning
I turned to disappear.
Like you to believe to be satisfied with winning Working relationships are better motivated by fear.
How we built it
Everything is called from the main flask app when texts come in through Twilio. Feature integration is very easy because of this, as all you need to do is write some helper function in another file, add the route in the Flask app, and bam! You're ready to go.
All of the features work in different ways (like they should), but the general idea is that we tokenize the user's text to pull out the noun keywords, and then use those words to determine the response to the user. If they want a collage created, we find some images and stitch them together to make a pretty picture. If they want a poem, they get a poem generated by the term they send us.
Challenges we ran into
Integrating everything was a challenge, especially with how the Flask app for Twilio integration had to be deployed to Heroku. Heroku doesn't work well with Python libraries that depend on C, so we had to create a custom buildpack for our app in order to support the Python Imaging Library (PIL). This took much longer than it should have. Working with PIL was no walk in the park, either.
Accomplishments that we're proud of
Getting all this stuff to work together, especially on Heroku, was a challenge. We're especially proud of how lolChat is available to anyone with a cell phone right now!
What we learned
- Heroku does some things well, other things not so much.
- Sleeping at hackathons is so much better than not sleeping at hackathons.
- Deploy early and often.
What's next for lolChat
More features! Generated youtube haikus? Performing Google's deep dream algorithm on the generated images? Automatically texting you random cat facts ever 2.57 minutes with no way to cancel? The possibilities are endless!