Nucleus Powered Mitochondria

    close-word

    1.2.1 • Public • Published

    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

    Install

    npm i close-word

    DownloadsWeekly Downloads

    8

    Version

    1.2.1

    License

    ISC

    Unpacked Size

    6.08 kB

    Total Files

    6

    Last publish

    Collaborators

    • isuru1988