Skip to content

trevorlinton/similarto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Similar To

Find text similar to another peice of text

This is a simple function that takes as a first argument a string and as a second argument an array of strings and returns the string that most closely resembles the original.

const similarto = require('@trevor.linton/similarto')
similarto('I\'m going to france', ['To be or not to be that is the question', 'You dont see that sort of behavior in major appliances', 'I will be traveling to europe'])
	.then((x) => console.log(x.text))

Note, similarto is an async func, if used without await keyword, you'll need to use the returned result as a promise.

The value returned is:

{
	"text":"The text that matched",
	"index":0,
	"value":0.324223
}

About

Find similar text from an array of text options

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages