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:
parent
bf193bcd93
commit
d4373f8c02
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue