Spiral String Matching Algorithm for Text Pattern Search
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional string matching methods, such as the naive method and Aho-Corasick Algorithm, are time-consuming and inefficient when searching for patterns in large texts, especially when dealing with multiple patterns, as they compare characters one by one and require extensive processing.
Innovation Solution
The spiral string matching method divides the text and patterns into 'folds' based on a folding width, allowing for a faster search by initially checking for pattern folds in selected text folds and then performing a more detailed search if a match is found, utilizing a combination of vertical and latitudinal searches to determine pattern matches.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If conventional string matching methods (naive method or Aho-Corasick Algorithm) are used to search for patterns in text, then the matching process is thorough and accurate, but the time consumption increases significantly
Solution Approach 1:
The patent divides both the text and patterns into multiple folds (segments) based on a folding width parameter. Each fold contains a subset of characters from the original string. This segmentation allows the algorithm to process multiple characters in parallel during the vertical search phase, reducing the overall time complexity while maintaining matching accuracy through subsequent verification phases.
Solution Approach 2:
The patent introduces a new dimension by arranging characters in a folded structure where characters at the same position across different folds can be processed simultaneously. The vertical search operates along the fold dimension, enabling parallel comparison of multiple character positions, while the latitudinal search operates along the original text dimension for verification.
2Reliability
If character-by-character comparison is performed for each pattern, then all patterns are thoroughly checked, but the processing complexity and time increase
Solution Approach 1:
The patent segments the comparison process into two distinct phases: vertical search that compares folded characters in parallel to quickly identify potential matches, and latitudinal search that performs detailed verification. This segmentation reduces processing complexity by avoiding exhaustive character-by-character comparison while ensuring no matches are missed through the verification phase.
Solution Approach 2:
The vertical search performs a preliminary filtering action by comparing folded characters before committing to full pattern verification. This preliminary action eliminates non-matching portions of the text early in the process, reducing the overall processing complexity while maintaining reliability through subsequent verification of promising candidates.
3Reliability
If the entire text is searched for each pattern, then no matches are missed, but the search efficiency decreases
Solution Approach 1:
The patent extracts and processes only the essential folded character positions during the vertical search phase, taking out the most informative comparisons. Non-matching portions are effectively extracted and discarded without full verification, while potential matches are extracted for detailed examination in the latitudinal search phase, improving efficiency while maintaining completeness.
Solution Approach 2:
The patent applies partial action by performing complete vertical searches on all folds but only performing exhaustive latitudinal verification on positions where vertical search indicates potential matches. This partial verification approach maintains reliability for detected matches while significantly improving productivity by avoiding unnecessary verification of non-matching regions.
Data Source
AI summary
A string matching method is provided for searching a text received in a string matching system for any of a predetermined set of patterns, each of the text and the patterns including a string of characters or symbols. The method includes generating a number of pattern folds for each of the patterns and generating a number of text folds for the text, both the number of pattern folds for each of the patterns and the number of text folds being equal to a folding width, generating a set of pattern folds from the pattern folds of all the patterns, selecting one of the text folds, performing a first search on the selected text fold for matches of any pattern folds, and if a pattern fold is found, performing a second search to determine if the text contains a match of any of the predetermined set of pattern.


