fnielsen / afinn

AFINN sentiment analysis in Python
Apache License 2.0
448 stars 222 forks source link

key error for Finnish #38

Open ali-unlu opened 2 years ago

ali-unlu commented 2 years ago

I install as suggested in your GitHub page (also tested on Google Colab) but there is a problem with the Finnish language

from afinn import Afinn afinn = Afinn(language = 'fi') afinn.score('Siellä on uusi hyvä juttu, katsokaa ja kuunnelkaa ihmeessä.')

Here is the results

KeyError Traceback (most recent call last) Input In [11], in <cell line: 2>() 1 from afinn import Afinn ----> 2 afinn = Afinn(language = 'fi') 3 afinn.score('Siellä on uusi hyvä juttu, katsokaa ja kuunnelkaa ihmeessä.')

File ~/opt/anaconda3/lib/python3.9/site-packages/afinn/afinn.py:72, in Afinn.init(self, language, emoticons, word_boundary) 57 def init(self, language="en", emoticons=False, word_boundary=True): 58 """Setup dictionary from data file. 59 60 The language parameter can be set to English (en) or Danish (da). (...) 70 71 """ ---> 72 filename = LANGUAGE_TO_FILENAME[language] 73 full_filename = self.full_filename(filename) 74 if emoticons: 75 # Words

KeyError: 'fi'

fnielsen commented 2 years ago

The PyPI package is not updated to Finish (I ought to do that). In the mean time: The GitHub version can be clone or installed and has the Finish support.