So at work I had to dig a bit into Levenshtein distance.
I made the first implementation in pure Ruby, and then I found out that:
- Postgres has extension that lets you calculate Levenshtein distance.
- Postgres has temporary tables that can be configured to get dropped after the current transaction.
I'm tempted to make this an implementation but I reckon it'd be a bit too much raw SQL (and also maybe a bit overengineered).