How similar are these two strings?
npm install similarity[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
How similar are these two strings?
[npm][]:
``sh`
npm install similarity
`js
var similarity = require('similarity')
similarity('food', 'food') // 1
similarity('food', 'fool') // 0.75
similarity('ding', 'plow') // 0
similarity('chicken', 'chick') // 0.714285714
similarity('ES6-Shim', 'es6 shim') // 0.875 (case insensitive)
similarity('ES6-Shim', 'es6 shim', {sensitive: true}) // 0.5 (case sensitive)
`
Get the similarity (number) between two values (strings),0
where is dissimilar, and 1 is equal.
* options.sensitive (boolean, default: false)true
— Turn on () to treat casing differences as differences
`txt
Usage: similarity [options]
How similar are these two strings?
Options:
-h, --help output usage information
-v, --version output version number
-s, --sensitive be sensitive to casing differences
Usage:
See also
Note: This module uses [Levenshtein distance][wiki] to measure similarity, but
there are many other algorithms for string comparison.
Here are a few:
clj-fuzzy
— Handy collection of algorithms dealing with fuzzy strings and phonetics
* natural
— General natural language facilities for node
* string-similarity
— Finds degree of similarity between two strings, based on Dice’s
coefficient
* dice-coefficient
— Sørensen–Dice coefficient
* jaro-winkler`[ISC][license] © [Zeke Sikelianos][author]
[build-badge]: https://img.shields.io/travis/words/similarity.svg
[build]: https://travis-ci.org/words/similarity
[coverage-badge]: https://img.shields.io/codecov/c/github/words/similarity.svg
[coverage]: https://codecov.io/github/words/similarity
[downloads-badge]: https://img.shields.io/npm/dm/similarity.svg
[downloads]: https://www.npmjs.com/package/similarity
[size-badge]: https://img.shields.io/bundlephobia/minzip/similarity.svg
[size]: https://bundlephobia.com/result?p=similarity
[npm]: https://www.npmjs.com
[license]: license
[author]: http://zeke.sikelianos.com
[wiki]: https://en.wikipedia.org/wiki/Levenshtein_distance