1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-6.git synced 2024-11-25 01:04:19 +00:00

Completely remove language parameter from VanillaSA

This commit is contained in:
Steffo 2023-02-02 04:26:58 +01:00
parent c212be37c3
commit a34baebeb5
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -22,11 +22,11 @@ class VanillaSA(BaseSA, metaclass=abc.ABCMeta):
super().__init__()
self.model: nltk.sentiment.SentimentAnalyzer = nltk.sentiment.SentimentAnalyzer()
def _tokenize_text(self, text: str, language: str = "english") -> list[str]:
def _tokenize_text(self, text: str) -> list[str]:
"""
Convert a text string into a list of tokens, using the language of the model.
"""
tokens = nltk.word_tokenize(text, language=language)
tokens = nltk.word_tokenize(text)
nltk.sentiment.util.mark_negation(tokens, shallow=True)
return tokens