Aho-Corasick Automata Construction via Concatenative Normal Forms
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for detecting string patterns in documents using regular expressions are inefficient due to the need for repeated reads of the target document and require significant storage space when dealing with large sets of character strings, leading to processing time delays and storage inefficiencies.
Innovation Solution
The construction of Aho-Corasick automata involves transforming regular expressions into concatenative normal forms, generating tries with character sets, and creating failure links, reducing the number of transitions and storage requirements, allowing for faster processing and reduced storage needs.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If repeated reads of the target document are performed for each string in a regular expression, then complete pattern detection is achieved, but processing time increases significantly
Solution Approach 1:
The patent pre-processes the regular expression into a compiled pattern object (such as a state machine or automaton) before actual text searching. This preliminary transformation creates a reusable detection mechanism that can scan text once while recognizing all pattern variations, eliminating the need for repeated document reads for each pattern element.
2Adaptability or versatility
If a trie structure is used to store all possible character strings from a regular expression, then pattern matching capability is improved, but storage space increases significantly
Solution Approach 1:
The patent merges multiple pattern paths in the trie structure by identifying and combining common substrings and shared nodes. When multiple regular expression patterns share common character sequences, the trie structure consolidates these into single paths, significantly reducing the total number of nodes and edges while preserving all pattern matching capabilities.
Solution Approach 2:
The patent creates a universal pattern matching structure where a single compiled regular expression object can detect multiple different character strings and patterns simultaneously. The state machine or automaton constructed from the regular expression serves multiple detection functions without requiring separate storage for each individual pattern variant.
3Ease of operation
If individual character transitions are used in the trie, then simple pattern matching is achieved, but the number of transitions and storage requirements increase
Solution Approach 1:
The patent merges multiple single-character transitions into multi-character transitions where possible. Instead of creating separate trie nodes for each character in a sequence, the system consolidates consecutive character matches into single transition edges that represent multiple-character patterns, reducing the total number of transitions while maintaining matching accuracy.
Data Source
AI summary
An apparatus for constructing Aho-Corasick automata according to the present invention includes a concatenative normal form transforming unit configured to receive a regular expression that is expressed using an operator including a concatenation and an alternation and transform the regular expression into concatenative normal forms (wherein each concatenative normal form is defined as a form in which character alternations are connected by concatenation); a trie generating unit configured to generate a trie from the concatenative normal forms by updating states and transitions of the trie (wherein each transition corresponds to a set of characters) while processing each concatenative normal form in order; and a failure link creating unit configured to create a failure link for each state of the trie by using a set of characters corresponding to each transition of the trie.


