How to compare a list of lists/sets in python?

So you want the difference between two lists of items. first_list = [[‘Test.doc’, ‘1a1a1a’, 1111], [‘Test2.doc’, ‘2b2b2b’, 2222], [‘Test3.doc’, ‘3c3c3c’, 3333]] secnd_list = [[‘Test.doc’, ‘1a1a1a’, 1111], [‘Test2.doc’, ‘2b2b2b’, 2222], [‘Test3.doc’, ‘8p8p8p’, 9999], [‘Test4.doc’, ‘4d4d4d’, 4444]] First I’d turn each list of lists into a list of tuples, so as tuples are hashable (lists are not) …

Read more

Text comparison algorithm

Typically this is accomplished by finding the Longest Common Subsequence (commonly called the LCS problem). This is how tools like diff work. Of course, diff is a line-oriented tool, and it sounds like your needs are somewhat different. However, I’m assuming that you’ve already constructed some way to compare words and sentences.