Ask Oxford in Slack through a Direct Message. Alternatively, Oxford is available through messenger on Facebook too.
Definitions are returned right away, or if multiple parts of speech are found, Oxford asks for clarification.
If multiple results are returned, Oxford asks if you would like to see additional examples.
Oxford can even lookup words based on their possible meaning! Ask Oxford for descriptive adjectives for your favorite nouns too.
Pronunciations are returned from the Oxford dictionary or created using AWS Polly and IPA Phonetic spelling.
Oxford can provide synonyms and antonyms for words as well.
Oxford was inspired by my personal desire to learn. Regularly while in conversation, reading, or watching TV, I would pause what I was doing to look up a word's meaning, pronunciation, example sentence, or origin in the hopes of improving my vocabulary. While writing, I would search for descriptive words to enhance my correspondence. I wanted to find an easier way to lookup vocabulary that would let me use natural language for straight-to-the-point results on the messaging platforms I frequently use.
What it does
Oxford does nearly everything you want related to vocabulary. It can provide word definitions, origins, pronunciations (using AWS Polly when required), example sentences, synonyms, and antonyms. Oxford will also do reverse word lookups! Provide Oxford with a definition and it will give you possible words that fit that meaning. Last but not least, Oxford can suggest descriptive adjectives for nouns, helping you improve your writing skills.
How I built it
I avoided the need for storing results in a database by developing a trick to store JSON data objects into the Lex SessionAttributes property on the response and request. This allows follow up requests to skip the need to query an API for new information on the same word.
Challenges I ran into
One major challenge I ran into was having to learn new AWS services and technologies I have never used before to achieve my development goal. Creating deployment files was a real challenge too, but I was able to piece together a completely automated deployment script after teaching myself CloudFormation, AWS CLI, and Python.
Another challenge I faced was figuring out how to pass data results within a user session without the use of a database. I thought that since the bot is informational and user sessions are short-lived, using a database to store user results would be overkill and should be avoided if possible. Within the AWS Documentation, I read about the ability to pass basic strings as properties within SessionAttributes, but I discovered an error was thrown when I tried to assign JSON data objects to it. I read in the documentation that the SessionAttributes property must be a String type, however the length could be fairly long. This gave me the idea to see if I could use BASE64 encoding to convert my JSON object into a compatible string and then decode it within the next user request. This worked, and I was able to develop my bot solution without the need of a database!
Accomplishments that I'm proud of
I am proud of a number of accomplishments, including;
- Publishing my first NPM Package to create an API wrapper for the Oxford Dictionary API
- Passing complex data objects across requests through the use of BASE64 encoding / decoding on the SessionAttributes property to avoid the necessity of a database
- Building a fully automated deployment process using CloudFormation and custom Lambda resources
- Publishing the Oxford bot to both Slack and Facebook
What I learned
I learned a lot while building this bot. I learned;
- How to build and publish an NPM Package
- How to work with the AWS Lex, S3, Lambda, CloudFormation, CLI, and Polly services
- How to code with Python
- How to build and deploy bots on both Slack and Facebook
What's next for Oxford
I hope to expand Oxford to provide even more word services such as; queries for descriptive for words based on a related topic (e.g. "Words that describe ocean that is related to temperature"), and word translation services so users can convert words from English into other languages and hear how they are pronounced. I would like to also continue to improve the way users interact with Oxford, so users can keep the context of a single word across intent types (definitions, pronunciations, synonyms, etc.) in a simpler way.