1.2.1 • Published 4 years ago

close-word v1.2.1

Weekly downloads
2
License
ISC
Repository
-
Last release
4 years ago

Introduction

get closest word for a specific word from given set of word list

installation

npm i close-word --save

Code sample to find closest word

var word_finder = require('close-word')

var result  = word_finder.findClosestOne('newbyrork',['new york','new delhi','kandy','paris','new jersey','london','colombo','jafna']);
 
console.log(result); // result =  { word: 'new york', score: 397.6190476190476 }

Code sample to find 5 closest words

var word_finder = require('close-word');

var result  = word_finder.findClosestFive('newbyrork',['new york','new delhi','kandy','paris','new jersey','london','colombo','jafna']);

console.log(result);
/*
 result  =  [
  { word: 'new york', score: 397.6190476190476 },
  { word: 'new jersey', score: 216.39344262295083 },
  { word: 'new delhi', score: 166.39344262295083 },
  { word: 'kandy', score: 112.34567901234568 },
  { word: 'london', score: 112.34567901234568 }
] */

Code sample to find any number closest words according to the 3rd param you given to the function.in this case 3

var word_finder = require('close-word');

var result  = word_finder.findClosestAny('newbyrork',['new york','new delhi','kandy','paris','new jersey','london','colombo','jafna'], 3 );

console.log(result);
/*
 result  =  [
  { word: 'new york', score: 397.6190476190476 },
  { word: 'new jersey', score: 216.39344262295083 },
  { word: 'new delhi', score: 166.39344262295083 }
]*/

if lib gives a word with very low score ,filter them from ur code using a threshold value

1.2.1

4 years ago

1.2.0

4 years ago

1.0.2

4 years ago

1.1.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago