pre-calculated list of similar Persian words ordered by rating and best match.
npm:
npm install similar-persian-words
var { similarity } = require('similar-persian-words')
console.log(similarity("شهر"));
if finding similarity was successful will return :
{
total: 261,
words: [
{ word: 'اشهر', rating: 0.8 },
{ word: 'بشهر', rating: 0.8 },
{ word: 'شهرب', rating: 0.8 },
{ word: 'شهرت', rating: 0.8 },
{ word: 'شهرخ', rating: 0.8 },
{ word: 'شهرد', rating: 0.8 },
{ word: 'شهرق', rating: 0.8 },
{ word: 'شهرک', rating: 0.8 },
{ word: 'شهرگ', rating: 0.8 },
{ word: 'شهرو', rating: 0.8 },
{ word: 'شهرة', rating: 0.8 },
{ word: 'شهره', rating: 0.8 },
{ word: 'شهری', rating: 0.8 },
{ word: 'نشهر', rating: 0.8 },
{ word: 'هرشه', rating: 0.8 },
{ word: 'مشهر', rating: 0.8 },
{ word: 'آق شهر', rating: 0.6666666666666666 },
{ word: 'اشهری', rating: 0.6666666666666666 },
{ word: 'برشهر', rating: 0.6666666666666666 },
{ word: 'بوشهر', rating: 0.6666666666666666 },
{ word: 'بهشهر', rating: 0.6666666666666666 },
{ word: 'بی شهر', rating: 0.6666666666666666 },
{ word: 'درشهر', rating: 0.6666666666666666 },
{ word: 'دمشهر', rating: 0.6666666666666666 },
{ word: 'ری شهر', rating: 0.6666666666666666 },
// …and many more
],
bestMatch: { word: 'اشهر', rating: 0.8 }
}
if finding similarity is not successful will return "undefined"
object.<array|object>
— List of all similar words with rating in "words" array , best match word in "bestMatch" object.
Install the CLI globally:
npm i -g similar-persian-words
Usage: persiansimilarwords persian word to get similarty
persiansimilarwords آذر
Use --help
for more info :
Options:
--version Show version number [boolean]
-r, --raw return raw data [boolean]
-w, --words return words list [boolean]
-l, --limit limit words display [number]
-s, --string return word string [boolean]
--help Show help [boolean]
this library is heavy in size (around 3GB of JSON data for similarity db)
all of the data for this library is pre-calculated therefore the size of this library is large
because of that memory and CPU usage is very low and finding data is very fast but disk usage is high
using compression and decompression is defeating the purpose of precalculation of data