finesse.utilities.text.get_close_matches

finesse.utilities.text.get_close_matches(word: str, options: Iterable[str], edit_distance: int = 2, case_sensitive: bool = True) collections.abc.Iterable[str] | None[source]

Wrapper around the py-spellchecker module. Filters words from options that are similar to word, using the ‘Levenshtein distance’.

Parameters
wordstr

word to match

optionsIterable[str]

Iterable to select matches from

edit_distanceint, optional

See https://en.wikipedia.org/wiki/Levenshtein_distance, by default 2

case_sensitivebool, optional

Whether to consider different case different characters, by default True

Returns
Iterable[str] | None

Words that are within edit_distance of word