All Projects → guofei → aho-corasick-node

guofei / aho-corasick-node

Licence: other
A Node implementation of the Aho-Corasick string matching algorithm based on DoubleArray Trie.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to aho-corasick-node

Algo Tree
Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design. Creating and designing excellent algorithms is required for being an exemplary programmer. It contains solutions in various languages such as C++, Python and Java.
Stars: ✭ 166 (+937.5%)
Mutual labels:  string, trie
Competitive Programming Repository
Competitive Programming templates that I used during the past few years.
Stars: ✭ 367 (+2193.75%)
Mutual labels:  string, matching
poplar-trie
C++17 implementation of memory-efficient dynamic tries
Stars: ✭ 47 (+193.75%)
Mutual labels:  string, trie
fuzzywuzzyR
fuzzy string matching in R
Stars: ✭ 32 (+100%)
Mutual labels:  string, matching
triebeard
Radix trees in Rcpp and R
Stars: ✭ 29 (+81.25%)
Mutual labels:  trie
PSStringScanner
Provides lexical scanning operations on a String
Stars: ✭ 45 (+181.25%)
Mutual labels:  string
Data-Structures
Algorithmic Problems Solutions -- hash table code featured in geeksforgeeks
Stars: ✭ 44 (+175%)
Mutual labels:  trie
split-on-first
Split a string on the first occurrence of a given separator
Stars: ✭ 68 (+325%)
Mutual labels:  string
Fmt.jl
Python-style format strings for Julia
Stars: ✭ 31 (+93.75%)
Mutual labels:  string
tplv
👣 Nano string template library for modern, based on ES6 template string syntax.
Stars: ✭ 31 (+93.75%)
Mutual labels:  string
case-extensions
Change any string case to PascalCase/camelCase/kebab-case/snake_case
Stars: ✭ 31 (+93.75%)
Mutual labels:  string
normalize-text
📝 Provides a simple API to normalize texts, whitespaces, paragraphs & diacritics.
Stars: ✭ 54 (+237.5%)
Mutual labels:  string
stringext
Extra string functions for OCaml
Stars: ✭ 20 (+25%)
Mutual labels:  string
sixarm ruby unaccent
SixArm.com » Ruby » Unaccent replaces a string's accented characters with ASCII characters.
Stars: ✭ 15 (-6.25%)
Mutual labels:  string
radix
Golang radix tree implementation
Stars: ✭ 30 (+87.5%)
Mutual labels:  trie
Prestyler
Elegant text formatting tool in Swift 🔥
Stars: ✭ 36 (+125%)
Mutual labels:  string
couplet
Unicode code points support for Clojure
Stars: ✭ 21 (+31.25%)
Mutual labels:  string
AlgoDaily
just for fun
Stars: ✭ 118 (+637.5%)
Mutual labels:  trie
myleetcode
♨️ Detailed Java & Python solution of LeetCode.
Stars: ✭ 34 (+112.5%)
Mutual labels:  string
DeepCD
[ICCV17] DeepCD: Learning Deep Complementary Descriptors for Patch Representations
Stars: ✭ 39 (+143.75%)
Mutual labels:  matching

aho-corasick-node

A Node implementation of the Aho-Corasick string matching algorithm based on DoubleArray Trie.

Install

npm install aho-corasick-node --save

Usage

Build

const AhoCorasick = require('aho-corasick-node');

const keywords = ['b', 'ba', 'nan', 'ab'];
const builder = AhoCorasick.builder();
keywords.forEach(k => builder.add(k));
const ac = builder.build();

Match

const text = 'banana';
const hits = ac.match(text); // ['b', 'ba', 'nan']

Export

const buf = ac.export();
console.log(buf);
// {
//   base: 'string...',
//   check: 'string...',
//   failurelink: 'string...',
//   output: 'string...',
// };

Load

const loadedAC = AhoCorasick.from(buf);
const hits = loadedAC.match(text); // ['b', 'ba', 'nan']

Licence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].