mwg API
    Preparing search index...

    Function levenshteinDistance

    • The classic edit distance: how many single-character insertions, deletions or substitutions turn a into b. The primitive findSimilarMessages is built on, exposed on its own since "how different are these two strings" is useful wherever a catalog's own message text is not the only thing worth comparing.

      Parameters

      • a: string
      • b: string

      Returns number

      import { levenshteinDistance } from '@datamoc/mw_games/i18n';

      levenshteinDistance('kitten', 'sitting'); // 3
      levenshteinDistance('same', 'same'); // 0