I've got 2 lists with bigrams in them. E.g:
List1 = [('bribe charge'), ('brilliant loss'), ('brisk isolated'), ('brutal divorce')]
List2 = [['bribe', 'charge'], ['a', 'baby'], ['a', 'shoe'], ['a', 'brisk'], ['the', 'goat']]
So I want to check and compare the 2 lists and check for the bigrams that are the same in both lists and output it.
So the desired output should be : "bribe charge."
Any help would be greatly appreciated
答案 0 :(得分:1)
First you have to make both lists the same types and then you can convert them to sets and do an intersect.
List2 = {' '.join(x) for x in List2}
isct = set(List1) & List2