docs / stdlib / search / fuzzy
Stdlib index
- Captured-borrow migration worklist (3.3.3)
- Owned-bind migration worklist (8.2.7)
- Return-side title audit — the ride-through enumeration
- stdlib ownership audit
- stdlib ownership dispositions (plan 1.3.1 / 4.3.1)
aot
codec
codec / csv
codec / json
collection
- ArrayList
- BPlusTree
- Cache
- Collectors
- HashMap
- HashSet
- Heap
- ImmutableList
- ImmutableMap
- ImmutableSet
- LinkedList
- RedBlackTree
- Sort
collection / ltm
concurrent
error
- Exception
- NoOptionalValueException
- NotProvidedException
- RecoverableException
- ScopedBuildFailedException
- ScopeNotActiveException
- Throwable
- UnrecoverableException
gfx
hash
ifx
io
io / file
io / net
io / net / dns
io / net / uri
lang
lang / stream
math
math / fft
math / linalg
math / npio
math / poly
math / random
math / stats
nucleo
- Columns — the Arrow-laid-out substrate
- Fused tensor expressions — Fuse
- Table — the lazy, typed dataframe
- Tape — define-by-run autograd
- Transform intrinsics — Grad, Vmap, Jit
process
reflect
search / distance
search / fuzzy
search / ngram
session
time
- Clock
- DateTimeFormatter
- Duration
- Instant
- LocalDate
- LocalDateTime
- LocalTime
- Period
- ZonedDateTime
- ZoneId
- ZoneOffset
wire
xpu
xpu / mesh
Matcher<T>
cajeta.search.fuzzy.Matcher — typo-tolerant key→value lookup: composes an
ngram.Index (recall prefilter) with
Distance.damerau (scoring) and a length-scaled
threshold, returning results ranked closest-first. The index uses bigrams
(n = 2): a single adjacent transposition (the common typo Fiel→File)
destroys every trigram of a short key but leaves a shared bigram, so bigrams
keep recall on exactly the typos damerau scores as distance 1. Ties rank by
key, so identical inputs always produce identical output — exact matches
(distance 0) rank first.
Matcher<int32> m = heap Matcher<int32>();
m.add("File", 10);
m.add("Edit", 20);
ArrayList<Match<int32>> hits #= m.match("Fiel"); // [File, distance 1]
int32 top = hits.get(0).value(); // 10
Methods
| Signature | |
|---|---|
Matcher() ⚑ | Construct an empty matcher (bigram index for transposition recall) |
void add(String key, T value) | Index value under key, remembering the key for later scoring |
#ArrayList<Match<T>> match(String query) | Every stored value whose key is within the length-scaled edit-distance threshold, ranked by ascending distance then key |
Each result is a Match<T> — value() (the stored value), key() (the key
it was indexed under), distance() (edit distance from the query; 0 = exact).
A Match owns a copy of its key, so a result list outlives the Matcher.
⚑ = @EntryPoint
See also
- Index — the n-gram prefilter behind
match - Distance — the scoring functions
- Source:
runtime/src/cajeta/search/fuzzy/Matcher.cajeta