Socket
Socket
Sign inDemoInstall

hermetrics

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.8 to 1.0.10

15

package.json
{
"name": "hermetrics",
"version": "1.0.8",
"version": "1.0.10",
"description": "Javascript version of hermetrics.py",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "https://github.com/weylermaldonado/hermetricsjs",
"repository": {
"type": "git",
"url": "https://github.com/weylermaldonado/hermetricsjs.git"
},
"keywords": [

@@ -19,3 +22,4 @@ "hermetrics",

"lint": "eslint \"src/**/*.ts\" --fix",
"prepublish": "npx tsc"
"prepublish": "npx tsc",
"semantic-release": "semantic-release"
},

@@ -42,4 +46,5 @@ "author": " <wmaldonado@soldai.com>",

"ts-node": "^8.6.2",
"typescript": "^3.8.3"
}
"typescript": "^3.8.3",
"semantic-release": "^17.0.4"
}
}

@@ -9,2 +9,3 @@ ![](https://res.cloudinary.com/dlacw28m9/image/upload/v1583255567/hermetrics.js_wmbdhh.png)

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/03f72b3394744c8bb5a874d4b1156350)](https://app.codacy.com/manual/weylermaldonado/hermetricsjs?utm_source=github.com&utm_medium=referral&utm_content=weylermaldonado/hermetricsjs&utm_campaign=Badge_Grade_Dashboard)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

@@ -18,2 +19,10 @@

* [Levenshtein](#levenshtein)
* Hamming (work in progress)
* OSA (work in progress)
* Damerau-Levenshtein (work in progress)
* Jaccard (work in progress)
* Dice (work in progress)
* Jaro (work in progress)
* Jaro-Winkler (work in progress)
* Metric comparator (work in progress)

@@ -40,2 +49,20 @@ # Installation <a name="installation"></a>

```
Using [custom](#custom) operation costs:
```javascript
const { Levenshtein } = require('hermetrics');
const levenshtein = new Levenshtein();
const opts = {
deletionCost: 3,
substitutionCost: 2,
deletionCost: 5
};
levenshtein.distance('start', 'end', opts);
levenshtein.maxDistance('start', 'end', opts);
```
# Metrics <a name="metrics"></a>

@@ -49,3 +76,3 @@

A metric has three main methods distance, normalized_distance and similarity. In general the distance method computes the absolute distance between two strings, whereas normalized_distance can be used to scale the distance to a particular range, usually (0,1), and the similarity method being normally defined as (1-normalized_distance).
A metric has three main methods distance, normalizeDistance and similarity. In general the distance method computes the absolute distance between two strings, whereas normalizeDistance can be used to scale the distance to a particular range, usually (0,1), and the similarity method being normally defined as (1-normalizeDistance).

@@ -56,5 +83,5 @@ The normalization of the distance can be customized overriding the auxiliary methods for its computation. Those methods are maxDistance, minDistance and normalize.

Metric is a base class that can receive as arguments six specific functions to be used as methods for the metric being implemented. The class constructor just assign the functions received as parameters to the class methods. If you omit some parameter then a default method is used, which allows you to implement metrics without the need to rewrite some of the functionality that is common among metrics.
Metric is a base class that can receive as arguments an metric name, and contains six specific functions to be used as methods for the metric being implemented.
## Default methods
## Default methods <a name="custom"></a>

@@ -73,2 +100,6 @@ Description of default methods for the Metric class.

|maxDistance| Returns the maximum value of the distance between source and target given a specific cost for edit operations. The default method just return 1 given source and target don't have both length=0, in that case just return 0. |
|minDistance| *work in progress* |
|normalize|*work in progress*|
|normalized distance|*work in progress*|
|similarity|*work in progress*|

@@ -75,0 +106,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc