Hi There👋
- Virtual Thread
C implementation Aho-Corasick string matching
License: MIT License
PR #6 is incomplete fix.
This make new segment fault case, unfortunately.
The engine does not locate all texts:
in sample_code():
If you add:
aho_add_match_text(&aho, "b", 1);
The text "b" will not be located.
It seems the code will return only return one result for each last matching letter
Additional example:
aho_add_match_text(&aho, "dab", 3);
The code wil not return a match for "ab" anymore
I want to check if there is a goto transition between state s
and state t
for some input character a
.
Also if there is a failure transition from some state s
to state t
.
What is the purpose of id? How do you use it?
src/main.c: In function ‘sample_code’: src/main.c:29:9: warning: variable ‘id’ set but not used [-Wunused-but-set-variable] 29 | int id[10] = {0}; | ^~ src/main.c: In function ‘sample_code2’: src/main.c:50:9: warning: variable ‘id’ set but not used [-Wunused-but-set-variable] 50 | int id[10] = {0}; | ^~ src/main.c: In function ‘sample_code3’: src/main.c:73:9: warning: variable ‘id’ set but not used [-Wunused-but-set-variable] 73 | int id[10] = {0}; | ^~ src/main.c: In function ‘sample_code_bench_file’: src/main.c:97:9: warning: variable ‘id’ set but not used [-Wunused-but-set-variable] 97 | int id[10] = {0}; | ^~ src/main.c: In function ‘sample_code_thread’: src/main.c:143:9: warning: variable ‘id’ set but not used [-Wunused-but-set-variable] 143 | int id[10] = {0}; | ^~
text: Lorem ipsum dolor sit amet, consectetur brown elit. Proin vehicula brown egestas. Aliquam a dui tincidunt, elementum sapien in, ultricies lacus. Phasellus congue, sapien nec
match text:
consectetur
Proin
egestasAliquam
elementum
ultricies
vehicula
Added a PR which replicates this issue: #1
iter->text may be constant which are not allocated from the heap
$ time ./ahocorasick
280503
./ahocorasick 1.29s user 0.08s system 99% cpu 1.364 total
$ time fgrep -c -e 1984 -e 1985 googlebooks-eng-all-1gram-20120701-0
280457
fgrep -c -e 1984 -e 1985 googlebooks-eng-all-1gram-20120701-0 9.76s user 0.06s system 99% cpu 9.846 total
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.