Skip to content
jsonW Paper GitHub

Spelling, signals and block columns

Similar spelling and sound: "Kokakola" finds "Coca-Cola"

The filter's ~~ operator gives each value a score from 0 to 1 by spelling and by a phonetic key, in Brazilian Portuguese, American English, Spanish and Chinese.

· jsonW 1.3.11

The problem

People search for a brand, a name or a product the way they heard it. An exact filter does not find "Coca-Cola" when someone types "Kokakola", and neither does a prefix search.

How jsonW solves it

~~ computes two Dice measures over trigrams: one on the spelling without accents or case, another on a phonetic key for the requested language, and keeps the higher. In Portuguese, the key maps hard "c" and "k" to the same sound.

$ wjsw filtrar marcas.jsw "nome ~~pt Kokakola"
2 de 4 linhas em 0.0 ms · blocos 1, pulados pela zona 0 · linhas lidas 4
{id:1,nome:"Coca-Cola"}
{id:4,nome:"Kokakola Bebidas"}

Real output. ~~en, ~~es and ~~zh switch the language; [email protected] sets the threshold from 0 to 1.

Where it is

In wjsw filtrar in version 1.3.11. The filter uses no index: it scans only the requested column, in parallel. In Chinese, trigrams count character by character; the sound key for Chinese characters is not in this version yet.

Read the full section in the paper →