aho-corasick

Aho–Corasick string matching algorithm

Usage no npm install needed!

<script type="module">
  import ahoCorasick from 'https://cdn.skypack.dev/aho-corasick';
</script>

README

About Build Status

aho-corasick - Aho–Corasick string matching algorithm

Installation

$ npm install hsujian/aho-corasick

Example (coffee)


  ac = new AhoCorasick()

  ac.add word, word:word for word in ['say', 'she', 'shr', 'he', 'her']

  ac.build_fail()

  actual = {}
  
  ac.search 'yasherhs', (found_word)->
    actual[found_word] ?= 0
    actual[found_word]++