I'm trying to find all occurrences of a word in paragraph and I want it to account for spelling mistakes as well. Code:
to_search="caterpillar"
search_here= "caterpillar are awesome animal catterpillar who like other humans but not other caterpilar"
#search_here has the word caterpillar repeated but with spelling mistakes
s= SequenceMatcher(None, to_search, search_here).get_matching_blocks()
print(s)
#Output : [Match(a=0, b=0, size=11), Match(a=3, b=69, size=0)]
#Expected: [Match(a=0, b=0, size=11), Match(a=0, b=32, size=11), Match(a=0, b=81, size=11)]
Difflib get_matching_blocks only detects the first instance of "caterpillar" in the search_here string. I want it to give me output of all closely matching blocks i.e. it should identify "caterpillar","catterpillar" and "caterpilar"
How can I solve this problem?