Method for searching matched character string
A string and character technology, applied in the field of string matching and searching in text, can solve the problems of high time consumption, low efficiency of string matching and searching, and low efficiency of string matching and searching, so as to reduce the time consumed , the effect of improving efficiency
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
no. 1 example
[0051] As mentioned above, when searching for a string match, the length of the text and the length of the string to be matched and searched can be judged first. When it is judged that the length of the text is less than or equal to 100k, this embodiment is preferred.
[0052] In this embodiment, the string to be matched and searched is "match", and the string length is 5 digits. The string jump principle of this embodiment is consistent with the existing BM algorithm, that is, the character aligned with the last character of the string does not appear in the string, the string jumps backward, and the jump distance is equal to the length of the string. If the character aligned with the last character of the string exists in the string, the string jumps backward to align two identical characters in the string and text.
[0053] See image 3 , Assuming that the line labeled "1" (hereinafter referred to as line 1, and so on) is text, line 2 is a string, and the last character of the s...
no. 2 example
[0081] This embodiment is roughly the same as the first embodiment. The difference is that a group of extended character strings that are the same as the original character string are added after the original character string to form a comparison character string, and the comparison character string is used to match the characters of the text and jump in.
[0082] When applying this method, you need to create a jump-in table, and the jump-in table is a two-dimensional array, such as Picture 8 As shown, the first row of the table is the character aligned with the last character of the original string, the first column is the character aligned with the last character of the extended string, and the data in the table is the number of bits jumped in. Therefore, if the character aligned with the last character of the original string is "t", and the character aligned with the last character of the extended string is "m", the number of jumps in the string is 2, and so on.
[0083] See Pi...
no. 3 example
[0093] For the length of the text greater than the text length threshold, and the string length is also greater than the string length threshold, such as 8 characters, because the text character is the same as the last character of the string, there is a high probability that this embodiment will cause the extended string It cannot reflect its function, so it is necessary to query the two characters of the text at the same time, and judge whether the two characters are the same as the last two characters in the string to achieve jump.
[0094] In this embodiment, it is also necessary to establish a jump-in table. Assume that the character to be matched and searched is "onlymatch", which has a total of 9 characters. Such as Picture 10 As shown, the first row of the table represents the character aligned with the penultimate character of the string, the first column represents the character aligned with the last character of the string, and the data in the table is the jump distanc...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com