aho-corasick.js

0.0.1 • Public • Published

About Build Status

A Javascript implementation of the Aho-Corasick algorithm. It has one difference in that it will return the longest possible match.

Installation

$ npm install aho-corasick.js

Usage

var AhoCorasick = require('aho-corasick.js'),
    trie = new AhoCorasick.TrieNode();

['ab', 'bcr', 'caa'].forEach(function(word) { trie.add(word, { word: word }); });

AhoCorasick.add_suffix_links(trie);

AhoCorasick.search('foab', trie, function(found_word, data) {
   console.log(found_word, data);
});

Links

Coffeescript port by @hsujian https://github.com/hsujian/aho-corasick

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    1

Package Sidebar

Install

npm i aho-corasick.js

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • tombooth