/text-similarity

Sentences relatedness checker

Primary LanguageJavaScript

text-similarity-scorer

npm

text-similarity-scorer is your goto similarity score between two strings

For more informatiom about the future of the package, check out the discussion here.

Table of contents

Install

npm i --save text-similarity-scorer

Usage

const similarity = require("text-similarity-scorer");

const score = similarity(
  "I HAVE A DREAM", //first sentence
  "I HAD A NAP" //second sentence
);
// NOTE : Order matters
console.log(score);
/*
{
  matched: [ 0, -1, 2, -1 ],
  matchScore: [ 1, 0, 1, 0 ],
  exact: 2,
  literal: 0,
  score: 2,
  score_pct: 0.5,
  order: 1,
  size: 0.25
}
*/

To Do

  • Adding ability to choose similarity algorithm

License

MIT