1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-6.git synced 2024-11-21 15:34:18 +00:00

Fix access to ratings instead of tokens

This commit is contained in:
Steffo 2023-02-13 15:43:46 +01:00
parent bf193bcd93
commit d4373f8c02
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -33,7 +33,7 @@ class NLTKSentimentAnalyzer(BaseSentimentAnalyzer):
Register the `nltk.sentiment.util.extract_unigram_feats` feature extrator on the model.
"""
# Ignore the category and only access the tokens
tokenbags = map(lambda r: r.rating, dataset)
tokenbags = map(lambda r: r.tokens, dataset)
# Get all words in the documents
all_words = self.model.all_words(tokenbags, labeled=False)
# Create unigram `contains(*)` features from the previously gathered words