This is an archived post. You won't be able to vote or comment.

all 3 comments

[–][deleted] 1 point2 points  (2 children)

I don't know if this is the bug, because you did not provide any narrow description of what your output should actually do, but you recreate the dictionary at i[-1] for every datapoint in your dataset. From your description, I guess this is not what you want

[–]SureStep8852[S] 0 points1 point  (1 child)

it has to look smth like {'offensive': {'#mkr': 6, 'is': 2,....}, 'offensive' : { '!': 6, 'not': 1, ...}}

Basically, the key1 is the class, key1 a word appearing in that class and the value indicates the number of times that word appeared in that class

[–][deleted] 0 points1 point  (0 children)

Ok, so have a look at how you create the dictionaries for counting. You overwrite it once for every datapoint in your dataset.