textA = 'the cat in the red hat'
textB = 'the feline in the blue hat'
dmp = diff_match_patch.diff_match_patch()
dmp.Diff_Timeout = 0
diffs = dmp.diff_main(textA, textB)
dmp.diff_cleanupSemantic(diffs)
htmlSnippet = dmp.diff_prettyHtml(diffs)
Внедрение Google DiffMatchPatch API для Python 2/3