levenshtein: Levenshtein Distance Metric
(require levenshtein) | package: levenshtein |
1 Introduction
2 Basic Comparisons
procedure
→ exact-nonnegative-integer? a : vector? b : vector? pred : (-> any/c any/c boolean?) (vector-levenshtein/eq a b) → exact-nonnegative-integer? a : vector? b : vector? (vector-levenshtein/eqv a b) → exact-nonnegative-integer? a : vector? b : vector? (vector-levenshtein/equal a b) → exact-nonnegative-integer? a : vector? b : vector? (vector-levenshtein a b) → exact-nonnegative-integer? a : vector? b : vector?
> (vector-levenshtein '#(6 6 6) '#(6 35 6 24 6 32)) 3
procedure
→ exact-nonnegative-integer? a : list? b : list? pred : (-> any/c any/c boolean?) (list-levenshtein/eq a b) → exact-nonnegative-integer? a : list? b : list? (list-levenshtein/eqv a b) → exact-nonnegative-integer? a : list? b : list? (list-levenshtein/equal a b) → exact-nonnegative-integer? a : list? b : list? (list-levenshtein a b) → exact-nonnegative-integer? a : list? b : list?
> (list-levenshtein/eq '(b c e x f y) '(a b c d e f)) 4
> (string-levenshtein "adresse" "address") 2
3 Type-Coercing Comparisons
procedure
(levenshtein/predicate a b pred) → exact-nonnegative-integer?
a : (or/c vector? string? list?) b : (or/c vector? string? list?) pred : (-> any/c any/c boolean?)
> (levenshtein/predicate '#(#\A #\B #\C #\D) "aBXcD" char-ci=?) 1
procedure
a : (or/c vector? string? list?) b : (or/c vector? string? list?)
> (define g '#(#\g #\u #\m #\b #\o))
> (levenshtein g "gambol") 2
> (levenshtein g "dumbo") 1
> (levenshtein g "umbrage") 5
4 History
- Version 2:0 —
2016-02-28 Moved from PLaneT to new package system.
Converted to McFly, including quickly guessing at contracts.
Fixed two dead URLs, urgently.
- Version 1:3 —
2009-03-14 Documentation fixes.
- Version 1:2 —
2009-02-24 License is now LGPL 3.
Tests moved out of main file.
Converted to author’s new Scheme administration system.
- Version 1:1 —
2005-07-10 Added Testeez tests.
- Version 1:0 —
2005-07-09 PLaneT release, and minor documentation changes.
- Version 0.2 —
2004-07-06 Documentation changes.
- Version 0.1 —
2004-05-13 First release. Tested only lightly, and today is the 13th, so caveat emptor.
5 Legal
Copyright 2004, 2005, 2009, 2016 Neil Van Dyke. This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See http://www.gnu.org/licenses/ for details. For other licenses and consulting, please contact the author.