lingoe

1.0.0 • Public • Published

Lingoe

Word search algorithms

Install

Node.js

npm install lingoe

Usage

Add node module

const Lingoe = require('lingoe');

Trie

let trie = new Lingoe.Trie();
 
let words = ['word', 'the', 'apple', 'there', 'ape', 'bananas'];
for (let i in words) {
    trie.add(words[i]);
}
 
console.log(trie.contains('apple'));
// outputs true
 
console.log(trie.prefixes('ap'));
// outputs ['apple', 'ape']
 
console.log(trie.words());
// outputs ['word', 'the', 'apple', 'there', 'ape', 'bananas']

Levenshtien Distance

console.log(Lingoe.distance('kitten', 'sitting'));
// outputs 3

Levenshtien Distance Ratio

console.log(Lingoe.ratio('flaw', 'lawn'));
// outputs 0.5

Package Sidebar

Install

npm i lingoe

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

10.1 kB

Total Files

8

Last publish

Collaborators

  • zyion