Just recently I was looking up about Levenshtein algorithm and after searching for an hour I couldn’t find a javascript file like:
var dictionary =
[
'coke',
'cokeman',
'cokeney'
]
Is there a faster way to do this? I haven’t found any files like this and I’ve heard this function is kind of slow. If I could how could I do this with php?
In order to get that javascript file you could run
cat /usr/share/dict/words | sed "s/^.*$/\'&\'\,/g"replacing
/usr/share/dict/wordswith a newline separated wordfile. Then all you have to do is addvar dictionary = [and]maybe throwing in a semicolon at the end if you feel like it.