similarity

WebJar for similarity

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

similarity
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

similarity
WebJar for similarity
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/words/similarity

Download similarity

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/similarity/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>similarity</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/similarity/
implementation 'org.webjars.npm:similarity:1.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/similarity/
implementation ("org.webjars.npm:similarity:1.1.1")
'org.webjars.npm:similarity:jar:1.1.1'
<dependency org="org.webjars.npm" name="similarity" rev="1.1.1">
  <artifact name="similarity" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='similarity', version='1.1.1')
)
libraryDependencies += "org.webjars.npm" % "similarity" % "1.1.1"
[org.webjars.npm/similarity "1.1.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : leven jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

similarity

Build Coverage Downloads Size

How similar are these two strings?

Install

npm:

npm install similarity

Use

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)

API

similarity(left, right[, options])

Get the similarity (number) between two values (strings), where 0 is dissimilar, and 1 is equal.

  • options.sensitive (boolean, default: false) — Turn on (true) to treat casing differences as differences

CLI

Usage: similarity [options] <word> <word>

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:

# output similarity
$ similarity sitting kitten
0.5714285714285714
$ similarity saturday sunday
0.625

See also

Note: This module uses Levenshtein distance 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 — The Jaro-Winkler distance metric

License

ISC © Zeke Sikelianos

org.webjars.npm
linguistic javascript modules

Versions

Version
1.1.1