1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-6.git synced 2024-11-21 23:44:19 +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. Register the `nltk.sentiment.util.extract_unigram_feats` feature extrator on the model.
""" """
# Ignore the category and only access the tokens # 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 # Get all words in the documents
all_words = self.model.all_words(tokenbags, labeled=False) all_words = self.model.all_words(tokenbags, labeled=False)
# Create unigram `contains(*)` features from the previously gathered words # Create unigram `contains(*)` features from the previously gathered words