#CognitiveServices – Text Analytics API, detect language, sentiment and more using #Azure

Hi !

Another sample for the Cognitive Services posts series. Today’s post is on Text Analytics API, and as always, let’s start with the official description

Understanding and analyzing unstructured text is an increasingly popular field and includes a wide spectrum of problems such as sentiment analysis, key phrase extraction, topic modeling/extraction, aspect extraction and more.

Text Analytics API is a suite of text analytics services built with Azure Machine Learning. We currently offer APIs for sentiment analysis, key phrase extraction and topic detection for English text, as well as language detection for 120 languages.In this initial preview release, we offer APIs for sentiment analysis and key phrase extraction of English text. No labeled or training data is needed to use the service – just bring your text data. This service is based on research and engineering that originated in Microsoft Research and which has been battle-tested and improved over the past few years by product teams such as Bing and Office.

The API is great, and is the base of some fundamental tasks that we perform today, like analyze in real time information from social media to find sentiment, languages, etc.

In the sample source code, there is the Client Library to analyze language and sentiment. In this sample the send of information requires a more complex body, so a HTTP POST action is used. That’s why there are a couple of Request and Response contracts for each one of the APIs.

image

To perform the language analysis and the sentiment analysis, we must perform 2 different call to the API. They are very similar, and this is the code for the language one.

image

Finally, the console app request a input text and perform and display the analysis for language and sentiment. A sample with normal English text detected

image

And a second sample with some “angry text” in spanish.

image

If you send a text with some mix between different languages, the language analysis will return a score lower than 1

image

And finally the app running in demo mode

2016 04 08 Sentiment Analysis

You can download and use the sample from the GitHub source Code.

GitHub Sample https://github.com/elbruno/Blog/tree/master/CognitiveServices

Greetings @ Toronto

-El Bruno

References

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s