Inspiration
To make a game and a chatbot at the same time.
What it does
Our hack uses the Amazon lex chatbot api to communicate with the user. First the user says something, then the bot says something, then the user again, and so on to generate a story. The idea is that each sentence said is another sentence in a story. In other words, the bot tries to reply to the user with the next sentence in a story that both the bot and the person create. In order to test the working of our model, this is all in the context of Harry Potter. So the characters and setting are from the Harry Potter universe (specifically from _ Harry Potter And The Sorcerer's Stone _). This can be generalized later.
How we built it
Python component
Originally we thought that to generate sentences, it would be good to modify a markov model such that new words that it generates are conditioned on words from the previous sentence. We also had a bunch of further plans to cluster on word2vec vectors from the words in the previous sentence and cluster them and take those clusters centroids to create seed words to condition on when generating the next sentence. The results from this were not satisfactory. The words were mildly relevant, but had no grammatical structure at all.
So, all of these ideas were scrapped in favor of a better algorithm. Instead of trying to generate a good sentence right off the bat, we use a simple 3-gram 1st order markov model to generate a bunch of random sentences, then used a scoring function to determine which one of those proposed sentences we want to say. Switching to 3-grams granted it a far better handling of grammar, and the scoring function allowed us to stop worrying about exactly how to come up with sentence and just worry about what makes a sentence a good follow-up to what the user said.
AWS component
The AWS lambda function was used to condition the responses based on the input of the user and previously seen utterances.
Android app
The Android app serves as an interface to converse with the bot. It provides a text and voice interface.
Challenges we ran into
One of our team members got very sick in the beginning of the hackathon and had to head home.
We started out with a very complex model (a modified markov model that conditioned on words in a previous sentence), but it returned lots of bad results.
When we uploaded the original script to Amazon Lambda, it complained about a missing package, so we added it and reuploaded. Then there was a different missing package. This went on a for a while, until we decided that it would be best to remove a bunch of unnecessary package dependencies.
It was challenging to learn how to use Amazon Lambda.
Accomplishments that we're proud of
Scrapping the old complex model in favor of a score-based algorithm on top of a naive markov chain model.
What we learned
How to use amazon lambda How to generate grammatically convincing sentences
What's next for Novella
Add more books beside Harry Potter. Get lambda to accept a large model so it can use the whole Harry Potter series.
Built With
- amazon-lex
- aws-lambda
- markovify
- python


Log in or sign up for Devpost to join the conversation.