In my last blog post I walked through TextBlob and showcased a quick app that can be a first-responder to incoming emails. In that example it would respond back differently based on the sentiment of the incoming email.
For this post, I want to dive further into Natural Language Processing and showcase how you can take advantage of the Alchemy API to find out other really interesting parts of your incoming email. This can be used for automatically responding to messages, categorizing messages, classifying messages, and more.
Data that Alchemy API can give you on text:
- Entity Extraction
- Sentiment Analysis
- Keyword Extraction
- Concept Tagging
- Relation Extraction
- Taxonomy Classification
- Author Extraction
- Language Detection
- Text Extraction
- Microformats Parsing
- Feed Detection
- Linked Data Support
For the sample app I’m building, we’re going to take advantage of a small portion of the capabilities of Alchemy’s API. I’d like to read the keywords, concepts, and entities of an incoming email before diving into the text.
How do we display the data?
The current solution I’m thinking of is to prepend the Alchemy Analysis to all incoming emails in my personal inbox. This is just to showcase the functionality; you can use that data in any other way that might make sense.
How do we accomplish this ?
To accomplish this, we can take advantage of the SendGrid Parse Webhook to create our new email address. In this case case we will create the email firstname.lastname@example.org. Anything emailed to that address will be broken down into its individual components and posted to my application.
I made a Python Flask app that gets the parts of the email posted from the Parse Webhook. I then analyze the text with the Alchemy API.
Prepend that data to the original body and send that new email to my personal inbox email@example.com.
Try it yourself!
You can send an email to firstname.lastname@example.org and it will analyze the body of the email and send you back the analysis.
Over the next few weeks, I’m going to continue writing about different technologies, so check back every Monday, Wednesday, and Friday for new tech posts! You can also visit my intro post that will have an updated list of everything I’ve written.