@monyone/aho-corasick
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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);

Readme

Keywords

Package Sidebar

Install

npm i @monyone/aho-corasick

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

34.5 kB

Total Files

8

Last publish

Collaborators

  • monyone