smart-synonyms

1.0.1 • Public • Published

smart-synonyms

JavaScript library that first checks if a word or a multiword is misspelled. If it is found misspelled, it returns a list of typo suggestions. Then, it returns the desired number of synonyms using a synonyms database of 113690+ English words, with respect with the wanted termination time.

Installation

Run the following command to install npm install smart-synonyms --save

Methods

smartSearch

smartSearch(searchText: string, returnItems: number, timeLimit: number)
This method returns returnItems number of synonyms of the inputted searchText.
It will try to complete within timeLimit microseconds.

Demo example

var smartSearch = require("smart-synonyms");

smartSearch("peak", 8, 60)
// (synonyms) returns an object like this:
[  'top', 'eyeshade', 'apex',  'extreme point',  'vertex', 'height', 'tiptop', 'crest' ]

smartSearch("beutiful", 5, 80)
// (typo + synonyms) returns an object like this:
[ 'beautiful', 'attractive', 'charming', 'exquisite', 'handsome' ]

smartSearch("high school", 3, 20)
// (multiword + synonyms) returns an object like this:
[ 'senior high school', 'highschool', 'high gear' ]

Size

This library has 113690+ words in it's dictionary.

Expanding the dictionary must be through the file src.json then run node build to build a new dictionary.

The dictionary src.json file is around 13.2MB while the minified and built version (dictionary.js) is less than 10MB.

License

The MIT License

Package Sidebar

Install

npm i smart-synonyms

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

25.1 MB

Total Files

12

Last publish

Collaborators

  • iulia.lidia