Skip to content

hanyaonian/word-match-helper

Repository files navigation

word-match-helper

Aho–Corasick based word checking. Match words fast.

Installation

npm install word-match-helper

development & test

npm run build
npm run dev
npm run test # basic cases 

Basic Usage

import { WordMatcher } from 'word-match-helper';

const wordChecker = new WordMatcher({
  targets: ['her', 'he', 'hers'],
});

// excepted matched result: ['her', 'he', 'hers']
wordChecker.search('ushers');

// add additional word list 
wordChecker.addWord(['she'])

// excepted matched result: ['her', 'he', 'hers', she]
wordChecker.search('ushers');

About

Using Aho–Corasick to do word matching.

Resources

License

Stars

Watchers

Forks