C-Plus-Plus icon indicating copy to clipboard operation
C-Plus-Plus copied to clipboard

Aho-Corasick pattern matching

Open egberts opened this issue 1 year ago • 13 comments

Detailed description

How about an Aho-Corasick algorithm?

Context

It is about O(1) searching.

Possible implementation

No response

Additional information

aho-corasick - https://en.m.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm

egberts avatar Aug 04 '23 23:08 egberts

will you be implementing this?

realstealthninja avatar Aug 25 '23 15:08 realstealthninja

can you please assign this issue to me ? and mark file location

Saket009 avatar Sep 15 '23 14:09 Saket009

Hi, I'm new to Hacktoberfest and I'm looking for a good first issue to contribute to. I noticed an issue in your repository regarding the "Aho-Corasick algorithm," which I've studied during my DSA course. I would like to request the opportunity to work on this issue.

I want to assure you that I will implement it in a time complexity of O(String_Size + Pattern_Size), if I'm unable to achieve this in O(1).

Krishna-rudraksh70 avatar Sep 25 '23 12:09 Krishna-rudraksh70

hi, I wanna contribute to this repository. can you please assign this issue to me ?

aniketkuma-r avatar Sep 28 '23 07:09 aniketkuma-r

I would like to work on this issue. Kindly assign it to me

Monachaudhary avatar Sep 30 '23 04:09 Monachaudhary

Can you please assign this issue to me. I can successfully complete it.

aniketmdinde avatar Sep 30 '23 17:09 aniketmdinde

hii , hoping you are doing well . i am an enthusiast of data structure and algorithm . it's always fascinating the implementation and working of any algorithm . i have a good command on dsa and i solved a lot of questions of dsa . so "I'm interested in working on this Aho-Corasick algorithm issue. Is it possible to assign it to me, or could you guide me on how to get started?"

sarvo123 avatar Sep 30 '23 19:09 sarvo123

can you please assgin this issue to me . I can complete it

muffinboy19 avatar Oct 01 '23 02:10 muffinboy19

Hi , I haved worked with Aho-Corasick algo and other pattern matching algorithms and would like to contribute to this issue. I am new to the world of open source contribution but have a decent knowledge of algorithms since I have been doing competitive programming since years. You may take a look at my coding profiles listed on my page. And I would be glad to contribute to this community of algorithms.

Taruns123 avatar Oct 01 '23 11:10 Taruns123

Aho-Corasick Algorithm in C++

Introduction

The Aho-Corasick algorithm is a string matching algorithm used for efficiently searching for multiple keywords in a given text. It operates with a time complexity of O(n + m + z), making it a powerful tool for text processing and pattern matching tasks.

This repository contains a C++ implementation of the Aho-Corasick algorithm.

Features

  • Efficient string searching for multiple keywords.
  • Aho-Corasick algorithm implementation in C++.
  • Easy-to-use interface for adding keywords and searching for matches.

Aho-Corasick Algorithm in C++ - Algorithm Explanation

The Aho-Corasick algorithm efficiently searches for multiple keywords in a given text. Here's a step-by-step explanation of how the algorithm works, along with how it's implemented in the provided C++ code:

Algorithm Explanation

  1. Keyword Addition:

    • Keywords, such as "apple," "banana," and "cherry," are added to a keyword trie data structure.
  2. Failure Link Construction:

    • The algorithm constructs failure links between nodes in the keyword trie to efficiently navigate to the next potential match if a mismatch occurs while searching.

    • For each node, the algorithm determines the next node to visit in case of a mismatch by following the failure link, which ensures that no potential match is missed.

  3. Text Searching:

    • During text searching, the algorithm processes each character in the input text.

    • It uses the constructed failure links to efficiently traverse the keyword trie while looking for keyword matches.

    • When a keyword match is found, the algorithm increments a counter associated with that keyword.

    • After processing the entire text, the algorithm provides a count of how many times each keyword was found in the text.

Code Implementation - by Abhay Nauityal

  1. Keyword Addition:

    • Use the addKeyword method to add keywords to the Aho-Corasick structure.
  2. Failure Link Construction:

    • Call the buildFailureLinks method to construct failure links between nodes in the keyword trie.
  3. Text Searching:

    • Input text is processed using the search method, which returns a vector with counts of keyword matches.
  4. Displaying Results:

    • The code prints out the keywords that were found in the text and the number of times each keyword was found.

please give me this opportunity

codetechie-abhay avatar Oct 02 '23 09:10 codetechie-abhay

I would really like to work on this file I have some code written and ready to be implemented. Please assign me the role

5ku11Cru5h3r avatar Dec 12 '23 15:12 5ku11Cru5h3r

Aho-Corasick Algorithm in C++

Introduction

The Aho-Corasick algorithm is a string matching algorithm used for efficiently searching for multiple keywords in a given text. It operates with a time complexity of O(n + m + z), making it a powerful tool for text processing and pattern matching tasks.

This repository contains a C++ implementation of the Aho-Corasick algorithm.

Features

  • Efficient string searching for multiple keywords.

  • Aho-Corasick algorithm implementation in C++.

  • Easy-to-use interface for adding keywords and searching for matches.

Aho-Corasick Algorithm in C++ - Algorithm Explanation

The Aho-Corasick algorithm efficiently searches for multiple keywords in a given text. Here's a step-by-step explanation of how the algorithm works, along with how it's implemented in the provided C++ code:

Algorithm Explanation

  1. Keyword Addition:

    • Keywords, such as "apple," "banana," and "cherry," are added to a keyword trie data structure.
  2. Failure Link Construction:

    • The algorithm constructs failure links between nodes in the keyword trie to efficiently navigate to the next potential match if a mismatch occurs while searching.

    • For each node, the algorithm determines the next node to visit in case of a mismatch by following the failure link, which ensures that no potential match is missed.

  3. Text Searching:

    • During text searching, the algorithm processes each character in the input text.

    • It uses the constructed failure links to efficiently traverse the keyword trie while looking for keyword matches.

    • When a keyword match is found, the algorithm increments a counter associated with that keyword.

    • After processing the entire text, the algorithm provides a count of how many times each keyword was found in the text.

Code Implementation - by Abhay Nauityal

  1. Keyword Addition:

    • Use the addKeyword method to add keywords to the Aho-Corasick structure.
  2. Failure Link Construction:

    • Call the buildFailureLinks method to construct failure links between nodes in the keyword trie.
  3. Text Searching:

    • Input text is processed using the search method, which returns a vector with counts of keyword matches.
  4. Displaying Results:

    • The code prints out the keywords that were found in the text and the number of times each keyword was found.

please give me this opportunity

What about dynamically doing addKeyword in-situ?

Callback support at last matched character?

Return string matched?

egberts avatar Dec 14 '23 15:12 egberts

hii i can work on this can you assign this to me

arsh-kamal avatar Jan 01 '24 09:01 arsh-kamal

This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 01 '24 00:02 github-actions[bot]

Please ping one of the maintainers once you add more information and updates here. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions!

github-actions[bot] avatar Feb 09 '24 00:02 github-actions[bot]