The fuzzy_search library provides a set of predicates which calculate distance between words implementing levenshtein distance and damerau-levenshtein distance.
This is a simple example:
?- levenshtein_dist(append, apend, D). D = 1 ? yes ?- levenshtein_dist(append, appedn, D). D = 2 ? yes ?- ?- damerau_lev_dist(length, lenght, D). D = 1 ? yes ?-
Usage:levenshtein_dist(Word1,Word2,Distance)
Computes the levenshtein Distance between Word1 and Word2
Usage:damerau_lev_dist(Word1,Word2,Distance)
Computes the Damerau-Levenshtein Distance between Word1 and Word2
Usage:fuzzy_search(Word,Generator,Metric,MaxDistance,Suggestion)
Proposes atoms generated by Generator which have MaxDistance differences with Word