#CognitiveServices – Text Analytics API, detección de lenguaje, análisis de sentimiento y más utilizando #Azure

Hola !

Otro ejemplo más para la serie de posts sobre Cognitive Services. En el post de hoy veré la API de Text Analytics:

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.

Esta API es genial, y es la base de bastantes herramientas que utilizamos hoy que nos permiten analizar en tiempo real información de redes sociales. Por ejemplo, podemos analizar el texto de un Tweet y ver el lenguaje en el que está escrito el mismo, identificar si el mismo tiene un mensaje positivo o negativo y más..

Sobre esta base he escrito un ejemplo donde hay una Client Library para interactuar con la API, inicialmente solo he implementado las funciones de análisis de idioma y de sentimiento. Esta API require el envío utilizando un body más complejo, así que he implementado el uso de una acción HTTP POST para esto. Y también es por esto que he creado contratos para las acciones de Request and Response para cada una de las APIs.

image

Ahora bien, para realizar el análisis de idioma y sentimiento en un mismo texto, hay que hacer 2 llamadas a la API. Son bastante similares y tienen el siguiente esquema:

image

Y el ejemplo final es con una Console App que pide un texto de entrada y realiza el análisis sobre el mismo. Un ejemplo con un texto en inglés con un mensaje positivo retornaría el siguiente resultado

image

Y un ejemplo en Español, con un mensaje un poco enfadado, retornaría:

image

Si en un mismo mensaje hay más de un lenguaje o no es claro el mismo, podemos encontrarnos con un score menor que uno para el lenguaje

image

La app en demo mode

2016 04 08 Sentiment Analysis

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

Saludos @ Toronto

-El Bruno

References

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.