I have a dictionary of sets looking like this:
dictionary = {'0':{'apple','pear','banana'},'1':{'orange', 'apple'},'2':{'grape'}, '3': {'banana','peach'}
I would like to merge sets that have 1 or more of the same elements in the dictionary. Either keeping this dictionary or making a new one.
My goal is to have a dictionary like this:
dictionary = {'0':{'apple','pear','banana','orange','peach'},'1':{'grape'}}
The key names do not matter.