JSPM

lingoe

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q28448F
  • License ISC

Word search algorithms

Package Exports

  • lingoe

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lingoe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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