Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sonofmagic/modern-ahocorasick
modern-ahocorasick
https://github.com/sonofmagic/modern-ahocorasick
Last synced: 12 days ago
JSON representation
modern-ahocorasick
- Host: GitHub
- URL: https://github.com/sonofmagic/modern-ahocorasick
- Owner: sonofmagic
- License: mit
- Created: 2023-08-11T06:06:55.000Z (about 1 year ago)
- Default Branch: next
- Last Pushed: 2024-08-21T15:21:10.000Z (3 months ago)
- Last Synced: 2024-10-09T23:09:12.988Z (about 1 month ago)
- Language: TypeScript
- Size: 256 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# modern-ahocorasick
> Forked from `https://github.com/BrunoRB/ahocorasick` and make it modern! Thanks to the author(`BrunoRB`) of `ahocorasick`
Implementation of the Aho-Corasick string searching algorithm, as described in the paper "Efficient string matching: an aid to bibliographic search".
this pkg has `cjs` and `esm` format, and have `.d.ts` file.
## Install
```sh
i modern-ahocorasick
```## Usage
```ts
// cjs
const AhoCorasick = require('modern-ahocorasick');
// esm
import AhoCorasick from 'modern-ahocorasick'const ac = new AhoCorasick(['keyword1', 'keyword2', 'etc']);
const results = ac.search('should find keyword1 at position 19 and keyword2 at position 47.');// [ [ 19, [ 'keyword1' ] ], [ 47, [ 'keyword2' ] ] ]
```## Visualization
See for an interactive visualization of the algorithm.
## License
[The MIT License](LICENSE)