{'fraction_non_alphanumeric': 0.012539184952978056, 'fraction_numerical': 0.004702194357366771, 'mean_word_length': 4.93953488372093, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Research of Pattern Matching Algorithm Based on KMP and BMHS2

The improvement of the time performance of pattern matching algorithm mainly lies in reducing the number of character comparisons and increasing the distance of the matching window moving to the right when mismatch. In this paper, it adopts the second idea of improvement. The paper first analyzes KMP algorithm and its improved one, and then introduces BMHS2 algorithm. The distance of moving to the right of two improved algorithms is calculated when mismatch occurs respectively, and then proposes an improved algorithm based on the combination of improved KMP and BMHS2. The idea of this matching algorithm is that the overall matching is carried out from left to right, and every time the matching is carried out from left to right. When the text substring in matching window is mismatched with the pattern string, the larger jump distance of the I_KMP and BMHS2 is adopted to move the matching window to the right. Finally, two experiments to compare the time performance of the three algorithms above are carried out. The result shows that in the same experiment condition, compared to improved KMP and BMHS2, the time performance of improved pattern matching algorithm I_KMP_BMHS2 improved to some extent.