Sentiment Analysis model for Spanish

I barely know about Data Analysis tools and techniques, so bare with me if I'm asking something too trivial.

I'm looking for a Sentiment Analysis tool to process comments in Spanish. I do know some options for Sentiment analysis but those all work for English.

Is there a model/tool that already works with Spanish?

I'm language agnostic so it does not matter if it's a Java, Python or even Go code.

Topic sentiment-analysis social-network-analysis nlp machine-learning

Category Data Science


You can try the python package sentiment-analysis-spanish

First to install the package:

pip install sentiment-analysis-spanish

Import the package:

from sentiment_analysis_spanish import sentiment_analysis

Run the sentiment analysis:

sentiment = sentiment_analysis.SentimentAnalysisSpanish()
print(sentiment.sentiment("me gusta la tombola es genial"))

You will see that it outputs:

0.9304396176531412


A lot of progress has been made on sentiment analysis in Spanish since you asked your question 6 years ago. Today, you have very good Hugging Face Transformer based models, fine-tuned for sentiment analysis in Spanish. For example see these models:

You also have ready-to-use APIs for sentiment analysis in Spanish such as:

(Disclaimer: I am a developer of NLP Cloud)


You can try pysentimiento, a wrapper for transformer-based models:

from pysentimiento import SentimentAnalyzer
analyzer = SentimentAnalyzer(lang="es")

analyzer.predict("Qué gran jugador es Messi")
# returns SentimentOutput(output=POS, probas={POS: 0.998, NEG: 0.002, NEU: 0.000})
analyzer.predict("Esto es pésimo")
# returns SentimentOutput(output=NEG, probas={NEG: 0.999, POS: 0.001, NEU: 0.000})
analyzer.predict("Qué es esto?")
# returns SentimentOutput(output=NEU, probas={NEU: 0.993, NEG: 0.005, POS: 0.002})

Disclaimer: I'm one of the developers of the library :-)


The Indico.io API supports Spanish (and Chinese (Mandarin), Japanese, Italian, French, Russian, Arabic, German, English).

eg in Python:

>>> import indicoio
>>> indicoio.config.api_key = <YOUR_API_KEY>
>>> indicoio.sentiment("¡Jamás voy a usar esta maldita aplicación!  No funciona para nada.")
0.02919392219306888
>>> indicoio.sentiment("¡Es patrón!  La mejor que he visto.  Punto.")
0.8860221705630639

If this isn't your area, then that's probably the easiest sort of solution to integrate.


TM7 of The Netherlands has an advanced NLP engine named CARP that could do this for you. Their examples are largely in Dutch and English language, but they have established ontologies for Spanish for a number of their functional modules, including sentiment analysis.

Find the public 'playground' at http://www.tm7.nl . Select 'Carp Language Technologie' and follow the link in the blue box to the Playground.

Information about available APIs using SOAP services is available as well under the link 'SOAP Webservices' in English

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.