Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
aho-corasick2
Advanced tools
aho-corasick2 - Aho–Corasick string matching algorithm
$ npm install aho-corasick2
import * as AhoCorasick from 'aho-corasick2';
import AhoCorasick from 'aho-corasick2';
import AhoCorasick = require('aho-corasick2');
var i, len, ref, word;
var ac = new AhoCorasick();
ref = ['say', 'she', 'shr', 'he', 'her', 'h', 'hers', 'his'];
for (i = 0, len = ref.length; i < len; i++)
{
word = ref[i];
ac.add(word, {
word: word
});
}
ac.build_fail();
console.dir(ac, {
depth: null,
colors: true,
});
let actual = ac.search('yasherhs');
/*
{ matches: { h: [ 3, 6 ], she: [ 2 ], he: [ 3 ], her: [ 3 ] },
positions: { '2': [ 'she' ], '3': [ 'h', 'he', 'her' ], '6': [ 'h' ] },
count: { h: 2, she: 1, he: 1, her: 1 },
data:
{ h: [ { word: 'h' } ],
she: [ { word: 'she' } ],
he: [ { word: 'he' } ],
her: [ { word: 'her' } ] } }
*/
console.dir(actual, {
depth: null,
colors: true,
});
ac = new AhoCorasick()
ac.add word, word:word for word in ['say', 'she', 'shr', 'he', 'her']
ac.build_fail()
console.log ac.to_dot()
save output as trie.dot
and
$ dot -Tpng trie.dot -o trie.png
You also need to install GraphViz
Dejian Xu Google+
wikipedia: Aho-Corasick
FAQs
Aho–Corasick string matching algorithm
The npm package aho-corasick2 receives a total of 112 weekly downloads. As such, aho-corasick2 popularity was classified as not popular.
We found that aho-corasick2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.