@monyone/aho-corasick
v1.0.4
Published
Aho Corasick implementation written in TypeScript
Downloads
14
Readme
aho-corasick
Simple Aho-Corasick algorhythm implementaiton for TypeScript.
Getting Started
npm i @monyone/aho-corasick
Keyword Detection
import { AhoCorasick } from '@monyone/aho-corasick';
const ahocorasick = new AhoCorasick(keywords);
const hasAnyKeyword: boolean = aho.hasKeywordInText(text);
Keyword Matching
import { AhoCorasick } from '@monyone/aho-corasick';
const ahocorasick = new AhoCorasick(keywords);
const match: { begin: number, end: number, keyword: string}[] = aho.matchInText(text);
Dynamic Addition/Deletion
import { DynamicAhoCorasick } from '@monyone/aho-corasick';
const ahocorasick = new DynamicAhoCorasick(keywords);
ahocorasick.add('test')
ahocorasick.delete('test')
const match: { begin: number, end: number, keyword: string}[] = aho.matchInText(text);