Last active
April 13, 2021 08:18
-
-
Save kristjan-eljand/3cea29cdcf7869dca014a3baae407c06 to your computer and use it in GitHub Desktop.
est_to_eng sentiment analysis failed translation example
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
# Translate the text from input language to english | |
input_to_translate = "Parim argument demokraatia vastu on viieminutiline vestlus keskmise valijaga" | |
translated_input = translate(input_to_translate)[0]['translation_text'] | |
# Using the sentiment classifier is oneliner | |
result = classifier(translated_input)[0] | |
print(translated_input) | |
print(f"label: {result['label']}, with score: {round(result['score'], 4)}") | |
# Output: | |
# The best argument for democracy is a five-minute conversation with the average voter. | |
# label: POSITIVE, with score: 0.9969 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment