I have 5 long lists with word pairs as given in the example below. Note that this could include word pair lists like [['Salad', 'Fat']]
AND word pair list of lists like [['Bread', 'Oil'], ['Bread', ' Salt']]
list_1 = [ [['Salad', 'Fat']], [['Bread', 'Oil'], ['Bread', 'Salt']], [['Salt', 'Sugar'] ]
list_2 = [ [['Salad', 'Fat'], ['Salt', 'Sugar']], [['Protein', 'Soup']] ]
list_3 = [ [['Salad', ' Protein']], [['Bread', ' Oil']], [['Sugar', 'Salt'] ]
list_4 = [ [['Salad', ' Fat'], ['Salad', 'Chicken']] ]
list_5 = [ ['Sugar', 'Protein'], ['Sugar', 'Bread'] ]
Now I want to calculate the frequency of word pairs.
For example, in the above 5 lists, I should get the output as follows, where the word pairs and its frequency is shown.
output_list = [{'['Salad', 'Fat']': 3}, {['Bread', 'Oil']: 2}, {['Salt', 'Sugar']: 2,
{['Sugar','Salt']: 1} and so on]
What is the most efficient way of doing it in python?