Background
The Python module regex allows fuzzy matching.
You can specify the allowable number of substitutions (s), insertions (i), deletions (d), and total errors (e).
The fuzzy_counts property of a match result returns a tuple (0,0,0), where:
match.fuzzy_counts[0] = count for 's'
match.fuzzy_counts[1] = count for 'i'
match.fuzzy_counts[2] = count for 'd'
Problem
The deletions and insertions are counted as expected, but not the substitutions.
In the example below, the only change is a single character deleted in the query, yet the substitutions count is 6 (7 if the BESTMATCH option is removed).
How are the substitutions counted?
I would be grateful of someone can anyone explain how this works to me.
>>> import regex
>>> reference = "(TATGGGA[CT][GC]AAAG[CT]CT[AC]AA[GA]CCATGTG){s<7,i<3,d<3,e<8}"
>>> query = "TATGGACCAAAGTCTCAAGCCATGTG"
>>> match = regex.search(reference, query, regex.BESTMATCH)
>>> print(match.fuzzy_counts)
(6,0,1)