Skip to main content

sentiment-spanish

PyPI version

How does it work?

sentiment-spanish is a python library that uses convolutional neural networks to predict the sentiment of spanish sentences. The model was trained using over 800000 reviews of users of the pages eltenedor, decathlon, tripadvisor, filmaffinity and ebay. This reviews were extracted using web scraping with the project opinion-reviews-scraper

Using the rate in the user reviews we trained the model to learn from the language in them. For that we use the libraries Keras and Tensorflow. We achieved a validation accuracy (accuracy over fresh data, no used for training) of 88%. For more details regarding the training of the neural network model check the repo sentiment-analysis-model-neural-network

Why?

I believe there are not many solutions to sentiment analysis in spanish based on neural networks.

Install and use

First to install the package

pip install sentiment-analysis-spanish

You will also need keras and tensorflow

pip install keras tensorflow

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

1

For instance if you use the text

sentiment = sentiment_analysis.SentimentAnalysisSpanish()
print(sentiment.sentiment("me parece terrible esto que me estás diciendo"))

you will see that it outputs

9.460418e-14s

which as you see is very close to 0.

Output and meaning

The function sentiment(text) returns a number between 0 and 1. This is the probability of string variable text of being "positive". Low probabilities mean that the text is negative (numbers close to 0), high probabilities (numbers close to 1) mean that the text is positive. The space in between corespond to neutral texts.

Release files for sentiment-analysis-spanish 0.0.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sentiment-analysis-spanish 0.0.25
File Size Uploaded
sentiment_analysis_spanish-0.0.25.tar.gz 30.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for sentiment-analysis-spanish 0.0.25
File Interpreter ABI Platform
sentiment_analysis_spanish-0.0.25-py3-none-any.whl Python 3 none any Details

Total release size: 60.0 MB

Release files / sentiment_analysis_spanish-0.0.25.tar.gz

Download URL sentiment_analysis_spanish-0.0.25.tar.gz
Size 30.0 MB
Tags Source
SHA-256 checksum
How to use checksums
3ff8be0ac00398f4bbf2b3e8d728d493f75240bea9ab2f74cc11482275b2f122
BLAKE2b-256 checksum
How to use checksums
f7c93b7de30ed4ba6951eddb4596b8e1bb370d943de0fedc2929538816ba4b7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / sentiment_analysis_spanish-0.0.25-py3-none-any.whl

Download URL sentiment_analysis_spanish-0.0.25-py3-none-any.whl
Size 30.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
7b2bf32aab0dc1287c12118cd88bd111b349db1f168ef99fb0db429489c9a195
BLAKE2b-256 checksum
How to use checksums
cb3c104f7abeff16e347cf7b795ed9b5c841e1c5df9c1bfbd2d00d7684942a80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.0.25 This release

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.10

2 release files

0.0.8

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page