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

Oxford is built using NodeJS 6.10.1 and JavaScript. It utilizes AWS Lex for natural language processing, AWS Lambda for Lex request processing and responding, AWS S3 for MP3 file storage, and AWS Polly for creating pronunciation files for words using IPA phonetic spelling. The Lambda function utilizes two APIs for querying data about words. The first, Oxford Dictionary API, provides detailed results for word queries based on the Oxford American English dictionary. The majority of requests utilize the Oxford Dictionary API for optimized query results. The second API, Datamuse, is a free API that provides complex word query results from a number of sources.

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.

Share this project: