Building an Article Extraction Python API with newspaper3k and flask

Today, I was working on an application that required me to extract the main content html for a web page. This is called article extraction. Most of the time you want to extract the text of the article but I wanted to extract HTML of the main content. For example, if you are reading following WashingtonPost article then I want to extract the main HTML content on the left. I don’t want sidebar HTML containing ads or other information.

Continue reading “Building an Article Extraction Python API with newspaper3k and flask”

Building a Sentiment Analysis Python Microservice with Flair and Flask

Flair delivers state-of-the-art performance in solving NLP problems such as named entity recognition (NER), part-of-speech tagging (PoS), sense disambiguation and text classification. It’s an NLP framework built on top of PyTorch.

In this post, I will cover how to build sentiment analysis Microservice with flair and flask framework.

Continue reading “Building a Sentiment Analysis Python Microservice with Flair and Flask”

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

Using Python Flask Jinja2 with Mustache

Today I was building a single page web application using Python Flask framework and Backbone.js and faced a problem where Jinja2 was parsing the mustache template. Both Jinja2 and Mustache use {{}} in their templates. When a user makes a first request, I render index.html that contains all my mustache templates as well. The solution to avoid Jinja2 from parsing Mustache templates is to put all the templates inside  {% raw %} and {% endraw %} as shown below.

{% raw %}
<script type="text/template" id="company-template">
	<a href="#companies/{{id}}/jobs" class="list-group-item">
    	<h4 class="list-group-item-heading">{{name}}</h4>
    	<p class="list-group-item-text">{{description}}</p>
  </a>
</script>
{% endraw %}

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

Day 3 : Flask — Instant Python Web Development with Python and OpenShift

Few days back Packtpub contacted me to review their recently published book on Flask. The book titled Instant Flask Web Development is written by Ron DuPlain. On my third day  of 30TechnologiesIn30Days challenge, I have decided to spend time on Flask. In this blog,  I will first talk about Flask framework basics and then will provide a small book review. Also, I will port the sample application to OpenShift. I am not entirely new to Flask and have built some sample applications using it. This would be a good refresher. Continue reading “Day 3 : Flask — Instant Python Web Development with Python and OpenShift”