Ok, so that means there is something wrong with the return value from your āget wordsā function. What do you see from the previous two cells that execute that function. Hereās what I get for the first one with the negative label:
{':(': {'positive': 1, 'negative': 3675, 'ratio': 0.000544069640914037},
':-(': {'positive': 0, 'negative': 386, 'ratio': 0.002583979328165375},
'zayniscomingbackonjuli': {'positive': 0, 'negative': 19, 'ratio': 0.05},
'26': {'positive': 0, 'negative': 20, 'ratio': 0.047619047619047616},
'>:(': {'positive': 0, 'negative': 43, 'ratio': 0.022727272727272728},
'lost': {'positive': 0, 'negative': 19, 'ratio': 0.05},
'ā': {'positive': 0, 'negative': 210, 'ratio': 0.004739336492890996},
'ć': {'positive': 0, 'negative': 210, 'ratio': 0.004739336492890996},
'beliĢev': {'positive': 0, 'negative': 35, 'ratio': 0.027777777777777776},
'wiĢll': {'positive': 0, 'negative': 35, 'ratio': 0.027777777777777776},
'justiĢn': {'positive': 0, 'negative': 35, 'ratio': 0.027777777777777776},
'ļ½ļ½
ļ½
': {'positive': 0, 'negative': 35, 'ratio': 0.027777777777777776},
'ļ½ļ½
': {'positive': 0, 'negative': 35, 'ratio': 0.027777777777777776}}
What does your output look like?
Notice in the output I show, it is a dictionary with the āwordā as the key. But also notice that the value for each word key is also a dictionary with three entries. Thatās the meaning of the doubly nested curly braces there.
Also please check to make sure that your previous get_ratio
function passes its tests as well, since the value for each word is the return value from get_ratio
.