Last active
August 18, 2023 17:04
-
-
Save Linus-Albertus/8e3de4aff6d40d9f56a914e46bf282bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import pipeline | |
classifier = pipeline('sentiment-analysis', | |
model="nlptown/bert-base-multilingual-uncased-sentiment") | |
sentences = ["¡Me encantan los artículos de Medium, son lo máximo!", | |
"Odio los lunes, no sirven para nada.", | |
"El libro es medio bueno; me gustaron algunos personajes."] | |
results = classifier(sentences) | |
for result in results: | |
print(f"polaridad: {result['label']}, score: {round(result['score'], 4)}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment