The word API runs in AWS lambda, so it can take a moment to warm up on a
cold start. This API powers my spelling games at
orthogra.fish. There's
some interesting challenges in efficiently determining what can be spelled
with a set of letters. The underlying approach here involves storing a
string of sorted letters for each entry. Then you can perform a 'text
matching' lookup for each sorted subset of letters from the search string.
Take for example the corpus: [act, chat, cat, ha, ah]. Here are the
processed records for the corpus:
word | sorted
--------------
chat | acht
act | act
cat | act
ah | ah
ha | ah
You can see already how we have some 'doubles' in the sorted column. So if
we take the search string "cat", and sort it ("act"), we can find entries
for both
act AND
cat for the price of a single match.
Fundamentally, this approach lets us search against a set of combinations,
instead of the much larger set of permutations.