Skip to content

msingleton/DidYouMean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

DidYouMean.js

DidYouMean takes a query and returns similar words based on a dictionary of words that you feed it.

Demo

Take a look at the demo

Example usage

var dym = new DidYouMean(['hello', 'goodbye']);
var suggestions = dym.query('helo'); // this returns ['hello']

Implementation

A BK-Tree is created with your dictionary words as nodes. When queried, it uses Levenshtein Distance to compare how similar your query is to the words in the tree. If a word is within a certain edit distance threshold (default: 2), it's returned as a suggestion.

About

A simple suggestion engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published