Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/winkjs/wink-jaro-distance

An Implementation of Jaro Distance Algorithm by Matthew A. Jaro
https://github.com/winkjs/wink-jaro-distance

jaro jaro-distance jaro-similarity natural-language-processing nlp string-matching

Last synced: 9 days ago
JSON representation

An Implementation of Jaro Distance Algorithm by Matthew A. Jaro

Awesome Lists containing this project

README

        

# wink-jaro-distance

An Implementation of [Jaro Distance](https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance#Jaro_distance) Algorithm by Matthew A. Jaro

### [![Build Status](https://api.travis-ci.org/winkjs/wink-jaro-distance.svg?branch=master)](https://travis-ci.org/winkjs/wink-jaro-distance) [![Coverage Status](https://coveralls.io/repos/github/winkjs/wink-jaro-distance/badge.svg?branch=master)](https://coveralls.io/github/winkjs/wink-jaro-distance?branch=master) [![Inline docs](http://inch-ci.org/github/winkjs/wink-jaro-distance.svg?branch=master)](http://inch-ci.org/github/winkjs/wink-jaro-distance) [![devDependencies Status](https://david-dm.org/winkjs/wink-jaro-distance/dev-status.svg)](https://david-dm.org/winkjs/wink-jaro-distance?type=dev) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/winkjs/Lobby)

De-duplicate short strings such as names by computing similarity and distance between a pair of strings using **`wink-jaro-distance`**. It is an implementation of Jaro Distance Algorithm that determines the similarity/distance by taking into account the insertions, deletions and transpositions.

### Installation

Use [npm](https://www.npmjs.com/package/wink-jaro-distance) to install:

npm install wink-jaro-distance --save

### Getting Started

```javascript
// Load Jaro Distance Function
var jaro = require( 'wink-jaro-distance' );

console.log( jaro( 'father', 'farther') );
// -> { distance: 0.04761904761904756, similarity: 0.9523809523809524 }

console.log( jaro( 'Angelina', 'Angelica') );
// -> { distance: 0.08333333333333337, similarity: 0.9166666666666666 }

console.log( jaro( 'Flikr', 'Flicker' ) );
// -> { distance: 0.09523809523809523, similarity: 0.9047619047619048 }

console.log( jaro( 'abcdef', 'fedcba' ) );
// -> { distance: 0.6111111111111112, similarity: 0.38888888888888884 }
```

Try [experimenting with this example on Runkit](https://npm.runkit.com/wink-jaro-distance) in the browser.

### API

##### Table of Contents

- [jaro](#jaro)
- [Parameters](#parameters)
- [Examples](#examples)

#### jaro

Computes Jaro distance and similarity between strings `s1` and `s2`.

Original Reference: UNIMATCH:
[A Record Linkage System: Users Manual pp 104.](https://books.google.co.in/books?id=Ahs9TABe61oC)

##### Parameters

- `s1` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** — the first string.
- `s2` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** — the second string.

##### Examples

```javascript
jaro( 'daniel', 'danielle' );
// -> { distance: 0.08333333333333337, similarity: 0.9166666666666666 }
jaro( 'god', 'father' );
// -> { distance: 1, similarity: 0 }
```

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `distance` and `similarity` values between 0 and 1.

### jaro

Computes Jaro distance and similarity between strings `s1` and `s2`.

Original Reference: UNIMATCH:
[A Record Linkage System: Users Manual pp 104.](https://books.google.co.in/books?id=Ahs9TABe61oC)

**Parameters**

- `s1` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** — the first string.
- `s2` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** — the second string.

**Examples**

```javascript
jaro( 'daniel', 'danielle' );
// -> { distance: 0.08333333333333337, similarity: 0.9166666666666666 }
jaro( 'god', 'father' );
// -> { distance: 1, similarity: 0 }
```

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `distance` and `similarity` values between 0 and 1.

### Need Help?

If you spot a bug and the same has not yet been reported, raise a new [issue](https://github.com/winkjs/wink-jaro-distance/issues) or consider fixing it and sending a pull request.

### About wink

[Wink](http://winkjs.org/) is a family of open source packages for **Statistical Analysis**, **Natural Language Processing** and **Machine Learning** in NodeJS. The code is **thoroughly documented** for easy human comprehension and has a **test coverage of ~100%** for reliability to build production grade solutions.

### Copyright & License

**wink-jaro-distance** is copyright 2017-18 [GRAYPE Systems Private Limited](http://graype.in/).

It is licensed under the terms of the MIT License.