The TOLERANCE modifier is used with the LEVENSHTEIN routine to set the maximum number of edit distance allowed for specified length of strings. If the number of distance exceeds the value set by the modifier, the Nomatch score (2) is returned.
Syntax
TOLERANCE (n1,n2, n3,...,n10)
where
- The values (n1-n10) are comma delimited and their position in the parenthesis represent the maximum number of edit distance allowed in the string. n1 represents an edit distance of 1, n2 represents an edit distance of 2 and so on. You can set a maximum of 10 values.
- Each n value specifies the maximum length of strings. The maximum length is based on the field length of the first record (String 1).
Example 1
TOLERANCE(,,8)
This indicates the following:
- No tolerance string length is set for an edit distance of 1 and 2.
- For String 1 with a length less than or equal to 8, edit distance must be 3 or less, otherwise Nomatch (2) is returned.
String 1 - ISABELLA
String 2 - ISAVEL
In this case, the length of String 1 is 8 and the edit distance is 3, one substitution ('V' for 'B') and two insertions ('L' and 'A'), therefore the result is valid and the score 99-3=96 is returned.
Example 2
TOLERANCE(,5,8,12)
This example indicates the following:
- No tolerance string length is set for an edit distance of 1.
- For String 1 with a length less than or equal to 5, edit distance must be 2 or less, otherwise Nomatch (2) is returned.
- For String 1 with a length greater than 5 but less than or equal to 8, edit distance must be 3 or less, otherwise Nomatch (2) is returned.
- For String 1 with a length greater than 8 but less than or equal to 12, edit distance must be 4 or less, otherwise Nomatch (2) is returned.
- For String 1 with a length greater than 12, edit distance of 5 or more is returned.
String 1 - William J
String 2 - Willy
In this case, the length of String 1 is 9 and the edit distance is 5, one substitution ('y' for 'i') and four insertions ('a', 'm', space, and 'J'). When the length of String 1 is greater than 8 but less than or equal to 12, edit distance must be 4 or less, therefore the result is invalid and Nomatch score of 2 is returned.