3

Possible Duplicate:
javascript text similarity Algorithm

I'd like to know whether there is any library, in JavaScript, to measure the similarity of two strings (like "john" and "Johhn"). In postgresql I'm using the pg_trgm module, which works with trigrams. I'd like to know what is available in JavaScript.

The only one found so far is one based on the Levenshtein distance.

Community
  • 1
  • 1
cdarwin
  • 4,141
  • 9
  • 42
  • 66
  • Did you check [this plugin](https://gist.github.com/1562394)? It's quite simple to implement just as a plain JS function; jQuery is used just for convenience. – raina77ow Jul 13 '12 at 14:26
  • 2
    http://en.wikipedia.org/wiki/Soundex is what you are looking for. – jbabey Jul 13 '12 at 14:28
  • @raina77ow: interesting, thank you – cdarwin Jul 13 '12 at 14:33
  • @jbabey: thanks, however the implementations linked from there seem to be wrong (from the desc) – cdarwin Jul 13 '12 at 14:34
  • see also this question about levenshtein: http://stackoverflow.com/questions/6178708/is-there-a-faster-less-precise-algorithm-than-levenshtein-for-string-distance its an algorithm for calculating the distance of two strings – Dreen Jul 13 '12 at 22:21

0 Answers0