I am trying to make a dictionary of dictionaries, where the default values in the interior dictionary have a default value of 0.0
.
For example, it might look something like this: {'Jack':{'foo':0.0, 'bar':1.4, ...}, 'Mike': {'foo':6.2, ...} }
I want to initialize all of the words to a 0.0
value so that I can simply say:
for word in document:
my_dictionary['Jack'][word] += 1.4
I have tried using defaultdict(dict)
and Counter
but I can't say for sure if those are the right strategy here.
Any thoughts?