New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

string-comparison

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-comparison - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

2

package.json
{
"name": "string-comparison",
"version": "1.0.5",
"version": "1.0.6",
"description": "A library implementing different string similarity",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -8,4 +8,28 @@

[TOC]
- [Download & Usage](#download--usage)
- [OverView](#overview)
- [Normalized, metric, similarity and distance](#normalized-metric-similarity-and-distance)
- [(Normalized) similarity and distance](#normalized-similarity-and-distance)
- [Levenshtein](#levenshtein)
- [Longest Common Subsequence](#longest-common-subsequence)
- [Metric Longest Common Subsequence](#metric-longest-common-subsequence)
- [Cosine similarity](#cosine-similarity)
- [Sorensen-Dice coefficient](#sorensen-dice-coefficient)
- [API](#api)
- [similarity](#similarity)
- [params](#params)
- [return](#return)
- [distance](#distance)
- [params](#params-1)
- [return](#return-1)
- [sortMatch](#sortmatch)
- [params](#params-2)
- [return](#return-2)
- [Params](#params)
- [Return](#return)
- [Release Notes](#release-notes)
- [1.x version](#1x-version)
- [MIT](#mit)
## Download & Usage

@@ -37,3 +61,4 @@

## OverViews
## OverView
The main characteristics of each implemented algorithm are presented below. The "cost" column gives an estimation of the computational cost to compute the similarity between two strings of length m and n respectively.

@@ -50,2 +75,3 @@

## Normalized, metric, similarity and distance
Although the topic might seem simple, a lot of different algorithms exist to measure text similarity or distance. Therefore the library defines some interfaces to categorize them.

@@ -124,2 +150,3 @@

## Metric Longest Common Subsequence
Distance metric based on Longest Common Subsequence, from the notes "An LCS-based string metric" by Daniel Bakkelund.

@@ -149,2 +176,3 @@ http://heim.ifi.uio.no/~danielry/StringMetric.pdf

```
## Cosine similarity

@@ -158,2 +186,3 @@

## Sorensen-Dice coefficient
Similar to Jaccard index, but this time the similarity is computed as 2 * |V1 inter V2| / (|V1| + |V2|).

@@ -163,3 +192,2 @@

## API

@@ -170,7 +198,7 @@ * `similarity`.

### `similarity`
### similarity
Implementing algorithms define a similarity between strings
#### Params
#### params

@@ -180,11 +208,11 @@ 1. thanos [String]

#### Return
#### return
Return a similarity between 0.0 and 1.0
### `distance`
### distance
Implementing algorithms define a distance between strings (0 means strings are identical)
#### Params
#### params

@@ -194,10 +222,23 @@ 1. thanos [String]

#### Return
#### return
Return a number
### `sortMatch`
### sortMatch
介绍
#### params
1. thanos [String]
2. avengers [Array]
#### return
Return an array of objects
```js
[
{ member: 'edward', index: 0, rating: 0.5 },
{ member: 'theatre', index: 2, rating: 0.6153846153846154 },
{ member: 'sealed', index: 1, rating: 0.8333333333333334 }
]
```
#### Params

@@ -233,5 +274,3 @@

## MIT
[MIT](./LICENCE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc