Liking cljdoc? Tell your friends :D
Clojure only.

commensura.suggest

Dependency-free fuzzy name matching for "did you mean?" hints. A restricted Damerau-Levenshtein (optimal string alignment) ranker: given a misspelling and a pool of candidate names, return the closest few. Used to enrich the reader's unknown-unit error, and reusable anywhere a name lookup misses.

Dependency-free fuzzy name matching for "did you mean?" hints. A restricted
Damerau-Levenshtein (optimal string alignment) ranker: given a misspelling and a
pool of candidate names, return the closest few. Used to enrich the reader's
unknown-unit error, and reusable anywhere a name lookup misses.
raw docstring

distanceclj

(distance a b)

Normalized restricted Damerau-Levenshtein (optimal string alignment) edit distance between a and b, case- and underscore-insensitive (adjacent transpositions cost 1). The public counterpart to nearest — handy for ranking an already-chosen set of matches by closeness (e.g. commensura.discover/search-units).

Normalized restricted Damerau-Levenshtein (optimal string alignment) edit distance between
`a` and `b`, case- and underscore-insensitive (adjacent transpositions cost 1). The public
counterpart to `nearest` — handy for *ranking* an already-chosen set of matches by closeness
(e.g. `commensura.discover/search-units`).
sourceraw docstring

nearestclj

(nearest s candidates)
(nearest s candidates limit)
(nearest s candidates limit cutoff)

Up to limit (default 3) candidates closest to s, nearest first, within an edit-distance cutoff. candidates is a seq of names — e.g. (keys (registry/all-units)). Case- and underscore-insensitive. Returns [] when nothing is close, so a caller can stay silent on a wild miss. Ties break by shorter, then lexicographic, name — stable and deterministic. cutoff defaults to a conservative length-relative bound (~one edit per three characters); pass an explicit long to widen or tighten recall.

Up to `limit` (default 3) `candidates` closest to `s`, nearest first, within an
edit-distance `cutoff`. `candidates` is a seq of names — e.g. `(keys (registry/all-units))`.
Case- and underscore-insensitive. Returns `[]` when nothing is close, so a caller can
stay silent on a wild miss. Ties break by shorter, then lexicographic, name — stable and
deterministic. `cutoff` defaults to a conservative length-relative bound (~one edit per
three characters); pass an explicit `long` to widen or tighten recall.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close