This repository provides an implementation of the Aho-Corasick string matching algorithm using two data structures:
- Hash Table
- Transition Matrix
Both implementations are designed to efficiently find all occurrences of multiple patterns within a given text.
Navigate to the main directory and run:
makeThis will generate the following executables:
genere-texte: Generates random texts.genere-mots: Generates random words.ac-hachage: Executes the Aho-Corasick algorithm using a hash table.ac-matrice: Executes the Aho-Corasick algorithm using a transition matrix.
./genere-texte <text_length> <alphabet_size> > text.txt./genere-mots <word_count> <min_length> <max_length> <alphabet_size> > words.txtHash Table Implementation:
./ac-hachage words.txt text.txtTransition Matrix Implementation:
./ac-matrice words.txt text.txt- Generate a text of length 5,000,000 with an alphabet of size 4:
./genere-texte 5000000 4 > text.txt - Generate 100 words with lengths between 5 and 15:
./genere-mots 100 5 15 4 > words.txt - Run the Aho-Corasick algorithm:
./ac-hachage words.txt text.txt ./ac-matrice words.txt text.txt