Tag Archives: python

Sentiment Analysis in Python with TextBlob

Welcome to the eleventh blog of 52 Technologies in 2016 blog series. If you are following this series then you would have probably noticed that I already wrote week 11 blog on tweet deduplication. I was not happy with the content so I decide to write another blog for week 11.

In week 11, I decided to spend time to learn about text processing using the Python programming language. We will only focus on Sentiment Analysis in this blog. I have written about sentiment analysis multiple times in last few years. We learnt how to do sentiment analysis in Scala using Stanford CoreNLP in week 3 blog. Sentiment analysis gives you the power to mine emotions in text. This can help you build awesome applications that understand human behavior. Few years back, I built an application that helped me decide if I should watch a movie or not by doing sentiment analysis on social media data for a movie. There are many possible applications of Sentiment analysis like understanding customer sentiment for a product by analysis of reviews.

You can read full blog here https://github.com/shekhargulati/52-technologies-in-2016/blob/master/11-textblob/README.md

Python json object_hook

Today, I was building a REST client for one of the REST server applications using Python. I decided to use Python requests library for writing my REST API client. Requests is a very easy to use library that you can use to quickly bootstrap your REST API client. Writing REST client for REST endpoints was a matter of an hour. This REST API client will be used from our custom Jython(JVM implementation of Python) REPL. REST API has only two endpoints that return JSON objects. Response of first endpoint was fed to the second endpoint. I was returning the JSON response as Python dictionary. User can change values of the first response and pass it to the second API call. In Python, you work with dictionary as shown below. Continue reading

Python abc.py Puzzle

Let me start with the confession that I am not an expert Python developer so this might not be a surprise for some of you. Yesterday, I was working on a Python REST API client using awesome requests library for one of my server application. To quickly hack my client, I created a Python virtual environment using virtualenv and installed required libraries using pip. I was ready to play with Python(again). I created a new file abc.py and added a method. For demonstration, let’s suppose our method is called hello, as shown below. Continue reading

Using boto3 with Jython

Few days back I had a requirement that I had to use boto3 with Jython. boto3 is AWS EC2 python SDK that you can use to work with various Amazon Cloud API’s. Jython is the JVM implementation of Python. We were packaging our Jython scripts and boto3 and its dependencies inside a JAR. boto3 and Jython work great together when you use them in a normal way i.e. when boto3 can load its data model files from file system. This does not work when you package your script and its dependencies inside a JAR as the model files are then not available on the filesystem but are available on the classpath. In this blog, I will show you how we used boto3 to overcome this limitation. Continue reading

Getting Started with vSphere EXSi — The Missing Tutorial

Getting Started with vSphere

Today, I got an opportunity to work with vSphere. The plan for the day was to install vSphere on one of our machine and then connect to it using a Python API so that we can launch virtual machines. The official documentation lacked clarity and it was not easy for a newbie like me to get started with vSphere. Throughout the day we faced numerous problems, stumbled across many blogs and vmware forum posts, and finally managed to create our first VM via the official vSphere Python API — pyvmomi. In this detailed blog, I will go over all the steps required to get started with vSphere. We will start with how to install vSphere on a machine, then look at how to install command-line client on a linux machine, and finally learn how to talk to the vSphere host using Python. This blog is a work in progress and I will continue updating it as I learn more about vSphere. Continue reading

Day 16: Goose Extractor–An Article Extractor That Just Works

Today for my 30 day challenge, I decided to learn how to do article extraction using the Python programming language. I have been interested in article extraction for a few month when I wanted to write a Prismatic clone. Prismatic creates a news feed based on user interest. Extracting article’s main content, images, and other meta information is a very common requirement in most of the content discovery websites like Prismatic. In this blog post, we will learn how we can use a Python package called goose-extractor to accomplish this task. We will first cover some basics, and then we will develop a simple Flask application which will use the Goose Extractor API. Read the full article here https://www.openshift.com/blogs/day-16-goose-extractor-an-article-extractor-that-just-works


Day 9: TextBlob–Finding Sentiments in Text

Today for my 30 day challenge, I decided to take a break from JavaScript and learn about text processing using the Python programming language. I will be focusing on Sentiment Analysis in this blog. My interest in sentiment analysis is few years old when I wanted to write an application which will process a stream of tweets about a movie, and then output the overall sentiment about the movie. Having this information would help me decide if I wanted to watch a particular movie or not. You can read full blog here https://www.openshift.com/blogs/day-9-textblob-finding-sentiments-in-text