Hi there,
The test data for grading extract_features
in week one’s assignment appears to be incorrect.
Performing a loop over the words in word_l
with additive assignment always produces results that are slightly off the test data.
Please see the output for the first test below, where I have intentionally printed the freqs
value per-key.
['followfriday', 'top', 'engag', 'member', 'commun', 'week', ':)']
positive: :) 2964
negative: :) 6
positive: commun 31
negative: commun 5
positive: engag 11
positive: followfriday 27
positive: member 18
negative: member 10
positive: top 34
negative: top 9
positive: week 76
negative: week 51
[[1.000e+00 3.161e+03 8.100e+01]]
Expected output
[[1.000e+00 3.133e+03 6.100e+01]]
As can clearly be surmised, when using freqs[(word, 1.0)]
and freqs[(word, 0.0)]
, the summed values I return are accurate. The sum of negative values is very clearly 81 and not 61. The sum of positive values is also clearly 3,161 and not 3133.
Please note I am not using .lower()
on my strings.
Am I missing something crucial here?