abstract_distance_comparer

Distance comparer interface

class symspellpy.abstract_distance_comparer.AbstractDistanceComparer[source]

An interface to compute relative distance between two strings.

abstractmethod distance(string_1, string_2, max_distance)[source]

Returns a measure of the distance between two strings.

Parameters:
  • string_1 (Optional[str]) – One of the strings to compare.

  • string_2 (Optional[str]) – The other string to compare.

  • max_distance (int) – The maximum distance that is of interest.

Return type:

int

Returns:

-1 if the distance is greater than the max_distance, 0 if the strings

are equivalent, otherwise a positive number whose magnitude increases as difference between the strings increases.