A Chinese character string matching prediction method

Through the prediction method of Chinese character frequency encoding and pattern index establishment, the master string that may match successfully is selected, solving the time consumption problem caused by a large number of invalid matches in the Chinese character string matching process, and achieving significant savings in operation time.

CN112307277BActive Publication Date: 2024-11-26INNER MONGOLIA CHUANXING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011048161.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-29
Publication Date
2024-11-26
Estimated Expiration
2040-09-29

AI Technical Summary

Technical Problem

During the Chinese string matching process, when substrings match a large number of master strings one by one, although one-to-one matching can achieve the minimum calculation time, due to the large number of matches, it will still consume a lot of time, especially if only a few master strings can match Success leads to a longer overall calculation time.

Method used

A method of predicting Chinese string matching is proposed. By re-encoding Chinese characters according to frequency, establishing an index of merged and head-to-tail modes, pre-screening of the parent string that may match successfully, reducing the number of matches, thereby saving operation time. The specific steps include Chinese character frequency encoding, transformation, storage and index establishment, and prejudgment operations to determine the successful matching of the parent string for standard matching.

Benefits of technology

It significantly reduces the number of matching operations, saves calculation time, and improves matching efficiency. Especially when most of the parent strings do not match, invalid matching can be effectively eliminated and processing speed can be improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112307277B_ABST
    Figure CN112307277B_ABST
Patent Text Reader

Abstract

The invention discloses a Chinese character string matching prediction method, firstly, all Chinese characters are re-encoded according to the frequency; then the encoded Chinese characters are transformed to obtain two modes, namely, merging and head-end mode; the Chinese character string and its merging mode are stored, and then an index is established according to the head-end mode; the input Chinese character string is used as a substring, all pre-stored Chinese character strings are used as a mother string, and each mother string is predicted to determine whether the match is successful; the Chinese character string matching prediction method of the invention performs a prediction before matching, and only performs a matching operation if the prediction is successful; if the prediction is unsuccessful, no matching operation is performed. When the number of prediction operations is significantly less than the number of mother strings, and the prediction itself does not take much time, the operation time will be significantly saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of Chinese character processing and relates to a Chinese character string matching prediction method. Background Art

[0002] The operation of searching for the existence of another Chinese character string (substring) in a Chinese character string (mother string) is called Chinese character string matching. If it exists, it is a successful match, and if it does not exist, it is an unsuccessful match. If the mother string is "patent system", then the substring "patent" exists in the mother string, and the match is successful when "patent" is used as the substring; if the substring "application" does not exist, the match is unsuccessful when "application" is used as the substring; similarly, the match is successful when "system" is used as the substring; and the match is unsuccessful when "dictatorship" is used as the substring. Chinese character string matching uses a general string matching algorithm, which is mature. The current problem is that when a substring matches a large number of mother strings one by one and only a few mother strings can be matched successfully, although one-to-one matching can minimize the operation time, it still consumes a lot of time due to the large number of matching times. If a pre-judgment method is found, the mother strings that cannot be matched successfully are eliminated as much as possible before matching, leaving only a small number of mother strings that may be matched successfully to match one by one, the number of matches can be reduced, thereby fundamentally reducing the operation time. The present invention proposes such a pre-judgment method. Summary of the invention

[0003] The purpose of the present invention is to provide a Chinese character string matching prediction method, which performs a prediction before matching, and performs a matching operation only if the prediction is successful; if the prediction is unsuccessful, the matching operation is not performed. When the number of prediction operations is significantly less than the number of mother strings, and the prediction itself does not take much time, the calculation time will be significantly saved.

[0004] The technical solution adopted by the present invention is a Chinese character string matching prediction method, which is specifically implemented according to the following steps:

[0005] Step 1, recode all Chinese characters according to frequency;

[0006] Step 2, transforming the Chinese characters encoded in step 1 to obtain two modes: merging and head-to-tail modes;

[0007] Step 3, store the Chinese character string and its merging pattern, and then create an index according to the head and tail pattern;

[0008] Step 4, taking the input Chinese character string as the substring and all pre-stored Chinese character strings as the main string, pre-judge each main string to determine whether the match is successful.

[0009] The present invention is also characterized in that:

[0010] Wherein step 1 is specifically implemented as follows:

[0011] Step 1.1, arrange all Chinese characters in descending order of frequency;

[0012] Step 1.2, create a table containing G*2 groups, each group has C / 2 codes, and a total of G*C elements; each element contains a group number, a code number, a temporarily empty Chinese character set, and a temporarily 0 frequency value;

[0013] Step 1.3, fill the Chinese characters one by one into the table established in step 1.2;

[0014] Step 1.4, transfer the elements of the table filled in step 1.3 into a two-dimensional table, which has C / 2 rows and G*2 columns in each row, and fills in the elements according to the rule that the group number corresponds to the column number and the code number corresponds to the row number;

[0015] Step 1.5, re-arrange the two-dimensional table obtained in step 1.4 by columns according to the encoding frequency of the elements; the odd columns are arranged in the order of the element encoding frequency from small to large; the even columns are arranged in the order of the element encoding frequency from large to small;

[0016] Step 1.6, merge the even columns into the previous column, that is, merge the original 2nd column into the original 1st column, merge the original 4th column into the original 3rd column, ..., merge the original G*2th column into the original G*2-1th column; the merging method is to keep the rows of the odd columns unchanged, add new rows, and add the elements of the even columns to new rows one by one in the order of the original 1st row to the N / 2th row, with one row for each element, and finally obtain a new two-dimensional table with N rows and G columns;

[0017] Step 1.7, using the column number of the new two-dimensional table obtained in step 1.6 as the group number and the row number as the code number, reallocate the group number and code number of each element, so that each Chinese character has a code;

[0018] In step 1.3, Chinese characters are filled into the table established in step 1.2 one by one. When filling, the Chinese characters are filled into the first element of the table, that is, the Chinese characters are added to the Chinese character set of the element, and the frequency value of the Chinese characters is accumulated to the encoding frequency of the element. After filling, the element is moved to the previous position of the first element whose encoding frequency is greater than the encoding frequency of the element from the front to the back, and the element at the original position and all the previous elements are pushed forward in sequence;

[0019] Wherein step 2 is specifically implemented as follows:

[0020] Step 2.1, remove repeated Chinese characters in the Chinese character string;

[0021] Step 2.2, each Chinese character is re-encoded using the temporary code according to the encoding method of step 1;

[0022] Step 2.3, group the Chinese characters according to the newly encoded group numbers;

[0023] Step 2.4, remove duplicate codes from each group of codes, and arrange the codes in ascending order. The resulting code sequence is the merge pattern. If the group of codes is empty, the merge pattern is also empty.

[0024] Step 2.5, keep only the smallest (C1) and the largest (C2) codes in the merge pattern, and remove the others. The resulting integer pair together with the number of codes in the merge pattern is called the head and tail pattern, expressed as [C1, C2, n]; if the merge pattern is empty, the head and tail pattern is also empty; if the merge pattern has only one code Ct, the head and tail pattern is [Ct, Ct, 1]; if n is greater than nMax, let n = nMax;

[0025] If nMax=1, the head and tail patterns mentioned above can be expressed as [C1, C2];

[0026] Step 3 is specifically implemented as follows:

[0027] Step 3.1, create a Chinese character string table, which is an empty table, and the current row number is set to 0;

[0028] Step 3.2, create the head and tail pattern index table, add all rows (C*(C+1)*nMax / 2 rows) at one time, and set the value of each start row number and end row number of each row to 0;

[0029] Step 3.3, store a Chinese character string in the table;

[0030] Step 3.4 delete a Chinese character string in the table;

[0031] In step 3.3, storing a Chinese character string in the table is specifically implemented by the following steps:

[0032] Step 3.3.1, search the Chinese character string table according to the condition of equal Chinese character string, if the same Chinese character string already exists, it will not be added;

[0033] Step 3.3.2, find the merge mode according to the Chinese character string, there are G in total, add a new row to the Chinese character string table, the row number column is the current row number plus 1, set the number to Sn, the Chinese character string column is the input Chinese character string, and the merge mode columns are the merge modes just found;

[0034] Step 3.3.3, check each group, if there is a merge pattern, execute step 3.3.4; if not, no operation;

[0035] Step 3.3.4, find the first and last patterns according to the merge pattern, find the row number i in the index table according to the first and last patterns, and find the starting row number x and the ending row number y of the group from this row;

[0036] If there is no starting row number, that is, x = 0, set the value of the starting row number column to Sn;

[0037] If there is a starting row number but no ending row number, that is, x≠0, y=0, set the next number of the group in row x of the Chinese character string table to Sn, and set the ending row number column to Sn;

[0038] If both the starting row number and the ending row number are available, that is, x≠0, y≠0, set the next row number of the group in row y of the Chinese character string table to Sn, and also set the ending row number column to Sn;

[0039] Step 3.4 deletes a Chinese character string from the table, which is implemented by the following steps:

[0040] Step 3.4.1, search the Chinese character string table according to the condition of Chinese character string equality. If the Chinese character string is not found, no operation is performed. If it is found, the row number of the found Chinese character string is set to Sn;

[0041] Step 3.4.2, find the first and last patterns of each group according to the merge pattern of Sn row. If the merge pattern of the corresponding group is empty, do no operation. If it is not empty, execute step 3.4.3 for each group.

[0042] Step 3.4.3, find the row position i in the index table according to the head and tail pattern, and find the starting row number x and the ending row number y of the group from this position;

[0043] Step 3.4.4, if x=Sn, find the next row number x1 of the group of row x in the Chinese character string table. If x1=0, that is, there is no next row in the group of row x, the starting row number and the ending row number of the group of row i in the index table are both set to 0, that is, the data of the group of row i in the index table is empty; if x1≠0, the starting row number of the group of row i in the index table is set to x1, and the step ends. If x≠Sn, continue to step 3.4.5;

[0044] Step 3.4.5, starting from row x1, find the next row number x2, then find the next row number x3 of x2, and then find the next row number xi of row i-1, and so on. Perform the following operations for each row:

[0045] If the next row number of xi is equal to Sn, set the next row number of xi to the next row number of Sn. If Sn does not have a next row number, set the next row number of xi to empty and set the end row number to xi. The step ends. If the next row number of xi is not equal to Sn, continue to find the next row number and perform the same operation.

[0046] Step 3.4.6, mark line n in the Chinese character string table as abolished, and its line number will not be recycled; it will not be used in the future;

[0047] Among them, step 4 is specifically as follows: The inputs are a substring, a Chinese character string table, and a head and tail pattern index table; the output is the successfully matched Chinese character string. For the input substring, all Chinese character strings in the Chinese character string table are used as the main strings, searched in the Chinese character string table, the pre-judged successful main strings are found and matched one by one, and finally the successfully matched main string is obtained. The specific implementation steps are as follows:

[0048] Step 4.1, obtain the merging pattern and head and tail pattern of each group of the substring:

[0049] The merging pattern of each group is expressed as g{C1,C2,……,Cn}, where 1≤g≤G is the group number; 1≤Ci≤C (1≤i≤n); C1<C2<……<Cn; the merging pattern being empty is expressed as g{};

[0050] The head and tail pattern of each group is expressed as: g[C1,C2,n], where 1≤g≤G is the group number; 1≤C1≤C is the start code of the head and tail pattern; C1≤C2≤C is the end code of the head and tail pattern. The head and tail patterns of each group are processed as follows: If the head and tail pattern is empty, no operation is performed; if it is not empty, execute step 4.2 to generate the number chain table of this group, and execute step 4.4 for the number chain tables of all groups;

[0051] Step 4.2, the input of this step is g[C1,C2,n]. Traverse from 1 to C1, and set each value as x; for each x, traverse from C2 to C, and set each value as y;

[0052] For each pair of x and y, find the lower limit m1 and upper limit m2 of the corresponding code value count. The method for finding the lower limit m1 is as follows:

[0053] x = C1, y = C2: m1 = n;

[0054] x = C1, y≠C2: m1 = n + 1;

[0055] x≠C1, y = C2: m1 = n + 1;

[0056] x≠C1, y≠C2: m1 = n + 2;

[0057] The upper limit m2 = y - x + 1. If m2>nMax, then take m2 = nMax;

[0058] If the upper and lower limits are inverted, that is, m1>m2, then the operation for this pair of x and y ends; if m1≤m2, then traverse from m1 to m2, and set each value as m;

[0059] Each of the above groups of x, y, and m forms a head-tail pattern g[x, y, m]. Find the row position of this head-tail pattern in the index table. From this row, find a row number chain according to the group number g, denoted as Lg[x, y, m], which means the row number chain of g[x, y, m]. The specific value of the row number chain is represented by the starting row number h1 and the ending row number h2 as Lg(h1, h2), or it can also be represented only by the starting row number as Lg(h1), where h1 < h2; if there is only one row number h1 in the row number chain, it is represented as Lg(h1, 0);

[0060] Each of the above head-tail patterns g[x, y, m] corresponds to a row number chain. Exclude the empty chains among them, and the remaining row number chains form a row number chain table; a row number chain table contains multiple row number chains, which are represented by the row number chains enclosed in {} and separated by commas;

[0061] Step 4.3, operations on the row number chain tables of all groups generated in Step 4.1, the specific content is as follows:

[0062] Step 4.3.1, obtain the current row number of each row number chain table. If the current row number of a row number chain table is empty, the operation ends here; if not, continue with the following operations;

[0063] Step 4.3.2, if the current row numbers of the row number chain tables are not all equal, find the maximum value m among them, and perform Get(m), that is, the row number extraction operation, on all the row number chain tables whose current row numbers are not m. Then execute this step again. If the extraction result of a row number chain table is empty, the operation ends;

[0064] Step 4.3.3, if the current row numbers are all equal, set this equal row number as n and execute Step 4.3. After execution, continue with this step;

[0065] Step 4.4, find the data of the nth row of the Chinese character string table. Use the merging pattern of this row of data as the mother pattern and the merging pattern of the substring as the child pattern, and perform pattern matching according to Step 4.4. If the matching fails, this operation ends;

[0066] If the matching is successful, it means that the prediction that the substring is included in the mother string is successful. Next, the mother string and the substring should be matched using the standard pattern;

[0067] Regardless of whether the prediction and matching are successful, perform the Get(n + 1) operation on each row number chain table. If the result is empty, the operation ends; otherwise, execute Step 4.3;

[0068] Step 4.5, both the mother pattern and the child pattern include G merging patterns. The condition for the successful matching of the mother pattern and the child pattern is that the non-empty merging patterns in the child pattern are also non-empty in the mother pattern;

[0069] Among them, the operations involving the line number chain and the line number chain table in step 4.2 are as follows:

[0070] Step 4.2.1, line number chain operation. The line number chain consists of several line number nodes that are linked to each other. Each node has two fields: line number and next line number. Among them, the next line number is the number of another node in this line number chain. Among all the nodes, there is exactly one head node, and the head node is not the next node of any other node. Here, the line number chain is arranged in ascending order, that is, the line number of the next node of any node must be greater than its own line number;

[0071] Step 4.2.1.1, current line number. Let the line number chain be L, and the current line number is expressed as L.Get. The initial value of the current line number is set to the line number of the head node. During the operation process, the current line number can be changed. If there is no head node, the current line number is empty. The current line number being empty is also called this line number chain being empty;

[0072] Step 4.2.1.2, extract line number. Let the line number chain be L, and the extract line number operation is expressed as L.Get(x). Start looking from the current line number, and take the first line number not less than x encountered as the result, and also set the current line number to this line number. If there is no line number that meets the condition until the last line number, the result is empty;

[0073] Step 4.2.2, line number chain table operation. The line number chain table is a set, and its elements are line number chains. All the line numbers in each line number chain do not overlap, that is, none of them are equal;

[0074] Step 4.2.2.1, current line number. Let the line number chain table be B, and the current line number is expressed as B.Get, which is the smallest among the current line numbers of each element. Among them, the empty line number chain does not participate in the comparison. If the current line numbers of all elements are empty, then the current line number of this line number chain table is also empty, which is also called this line number chain table being empty;

[0075] Step 4.2.2.2, extract line number. Let the line number chain table be B, and the extract line number operation is expressed as B.Get(x). Execute Get(x) on each element in the line number linked list, and return the minimum value among them. Among them, the empty line number chain does not participate in the operation;

[0076] Among them, the specific matching process of step 4.5 is as follows:

[0077] The following steps are for a mother pattern Ai and a sub-pattern Bi in the same group. Among them, the encoding of Ai is a1, a2......an, where a1 < a2 <...... < an; the encoding of Bi is b1, b2......bn, where b1 < b2 <...... < bn;

[0078] Step 4.5.1, let i = 1 and j = 1;

[0079] Step 4.5.2, if bj does not exist, the merging pattern matching is successful;

[0080] If ai does not exist, the merging pattern matching fails;

[0081] If ai = bj, increment i by 1 and j by 1, and execute Step 4.5.2;

[0082] If ai < bj, increment i by 1 and keep j unchanged, and execute Step 4.5.2;

[0083] If ai > bj, keep i unchanged and increment j by 1, and execute Step 4.5.2.

[0084] The beneficial effects of the present invention are:

[0085] A Chinese character string matching pre-judgment method of the present invention performs a pre-judgment before matching. If the pre-judgment is successful, the matching operation is performed; if the pre-judgment is not successful, the matching operation is not performed. When the number of pre-judgment operations is significantly less than the number of mother strings and the pre-judgment itself does not take much time, the operation time will be significantly saved. Description of the Drawings

[0086] Figure 1 It is a schematic diagram of the implementation steps of adding a Chinese character string in Step 3.3 of a Chinese character string matching pre-judgment method of the present invention;

[0087] Figure 2 It is a schematic diagram of the implementation steps of deleting a Chinese character string in Step 3.4 of a Chinese character string matching pre-judgment method of the present invention;

[0088] Figure 3a It is a schematic diagram of the complete process of pre-judgment when all mother strings in a sub-string matching table in a Chinese character string matching pre-judgment method of the present invention are matched, Figure 3b is Figure 3a the flow schematic diagram of Step B in;

[0089] Figure 4a and Figure 4b is an example table of Chinese character temporary encoding in a Chinese character string matching pre-judgment method of the present invention;

[0090] Figure 5 is an example of the storage structure of a Chinese character string and a merging pattern in a Chinese character string matching pre-judgment method of the present invention;

[0091] Figure 6 is an example of the storage structure of the head and tail pattern index in Content 3 of a Chinese character string matching pre-judgment method of the present invention. Detailed Implementation Manner

[0092] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0093] The present invention provides a Chinese character string matching prediction method, which specifically includes four parts, specifically a Chinese character encoding scheme, a Chinese character transformation scheme, a Chinese character string storage scheme and a matching prediction process;

[0094] Step 1, Chinese character encoding scheme (called temporary encoding), the encoding result is as follows Figure 4a and Figure 4b As shown, Figure 4a and Figure 4b It is the result of encoding the 1500 most frequent Chinese characters in 4 groups, with 64 codes in each group. The specific implementation steps are as follows:

[0095] Step 1.1, arrange all Chinese characters in descending order of frequency. The Chinese character frequency table can use the publicly released common Chinese character frequency table, or you can collect corpus statistics according to the usage environment;

[0096] Step 1.2, create a table containing G*2 groups, each group has C / 2 codes, and a total of G*C elements. Each element contains a group number, a code number, a temporarily empty Chinese character set, and a temporarily 0 frequency value (coding frequency);

[0097] Step 1.3, fill the Chinese characters into the above table one by one. When filling, fill the Chinese characters into the first element of the table, that is, add the Chinese characters to the Chinese character set of the element, and add the frequency value of the Chinese characters to the encoding frequency of the element. After filling, move the element to the previous position of the first element whose encoding frequency is greater than the encoding frequency of the element from the front to the back. The element in the original position and all the previous elements are pushed forward in sequence. In this way, the elements of the table will always be arranged in order from small to large in terms of element encoding frequency. The first element is always the element with the smallest encoding frequency, and it is also the filling position of the next Chinese character;

[0098] Step 1.4, transfer the elements in the above table into a two-dimensional table with C / 2 rows and G*2 columns in each row, and fill in the elements according to the rule that group number corresponds to column number and code number corresponds to row number;

[0099] Step 1.5, re-arrange the above two-dimensional table by column according to the encoding frequency of the elements; the odd columns (column 1, column 3, ...) are arranged in the order of element encoding frequency from small to large; the even columns (column 2, column 4, ...) are arranged in the order of element encoding frequency from large to small;

[0100] Step 1.6, merge the even columns (column 2, column 4, ...) into the first column, that is, merge the original column 2 into the original column 1, merge the original column 4 into the original column 3, ..., merge the original G*2 column into the original G*2-1 column. The merging method is to keep the rows of the odd columns unchanged, add new rows, and add the elements of the even columns to new rows one by one in the order of the original 1st row to the N / 2th row, with one row for each element, and finally get a new two-dimensional table with N rows and G columns;

[0101] Step 1.7, using the column number of the new two-dimensional table as the group number and the row number as the code number, redistribute the group number and code number of each element, so that each Chinese character has a code, each code includes a group number and a code number; each code includes one or more Chinese characters; the sum of the frequencies of multiple Chinese characters in each code is roughly equal; the frequency of each group of codes increases from small to large, with small at both ends and large in the middle;

[0102] Step 2, the solution for transforming the Chinese character string is implemented in the following steps:

[0103] Step 2.1, remove repeated Chinese characters in the Chinese character string;

[0104] Step 2.2, each Chinese character is re-encoded using a temporary code;

[0105] Step 2.3, group the Chinese characters according to the newly encoded group numbers;

[0106] Step 2.4, remove duplicate codes from each group of codes, and arrange the codes in ascending order. The resulting code sequence is the merge pattern. If the group of codes is empty, the merge pattern is also empty.

[0107] Step 2.5, keep only the smallest (C1) and the largest (C2) codes in the merge pattern, and remove the others. The resulting integer pair together with the number of codes in the merge pattern is called the head and tail pattern, expressed as [C1, C2, n]; if the merge pattern is empty, the head and tail pattern is also empty; if the merge pattern has only one code Ct, the head and tail pattern is [Ct, Ct, 1], where n is greater than nMax, then let n = nMax;

[0108] If nMax=1, the number of codes is actually ignored and does not participate in the calculation. In this case, the head and tail pattern can be expressed as [C1, C2];

[0109] Step 3, such as Figure 6 As shown, a two-dimensional table is used to store Chinese character strings and their merging patterns, and indexes are established according to the head and tail patterns. The specific implementation steps are as follows:

[0110] Step 3.1, create a Chinese character string table, which is an empty table, and the current row number is set to 0;

[0111] Step 3.2, create a head and tail pattern index table (index table for short), add all rows (C*(C+1)*nMax / 2 rows) at one time, and set the value of each start row number and end row number of each row to 0;

[0112] Step 3.3, store a Chinese character string in the table (add a Chinese character string), the specific process is as follows:

[0113] Step 3.3.1, search the Chinese character string table according to the condition of equal Chinese character string, if the same Chinese character string already exists, it will not be added;

[0114] Step 3.3.2, find the merge mode according to the Chinese character string (there are G in total), add a new row to the Chinese character string table, the row number column is the current row number plus 1 (assuming the number is Sn), the Chinese character string column is the input Chinese character string, and each merge mode column is the merge mode just found;

[0115] Step 3.3.3, check each group, if there is a merge pattern, execute step 3.3.4; if not, no operation;

[0116] Step 3.3.4, find the first and last patterns according to the merge pattern, find the row number i in the index table according to the first and last patterns, and find the starting row number x and the ending row number y of the group from this row;

[0117] If there is no starting row number, that is, x = 0, set the value of the starting row number column to Sn;

[0118] If there is a starting row number but no ending row number, that is, x≠0, y=0, set the next number of the group in row x of the Chinese character string table to Sn, and set the ending row number to Sn;

[0119] If both the starting row number and the ending row number are available, that is, x≠0, y≠0, set the next row number of the group in row y of the Chinese character string table to Sn, and also set the ending row number column to Sn;

[0120] Step 3.4 delete a Chinese character string in the table;

[0121] Step 3.4.1, search the Chinese character string table according to the condition of Chinese character string equality. If the Chinese character string is not found, no operation is performed. If it is found, the row number of the found Chinese character string is set to Sn;

[0122] Step 3.4.2, find the first and last patterns of each group according to the merge pattern of Sn row. If the merge pattern of the corresponding group is empty, do no operation. If it is not empty, execute step 3.4.3 for each group.

[0123] Step 3.4.3, find the row position i in the index table according to the head and tail pattern, and find the starting row number x and the ending row number y of the group from this position;

[0124] Step 3.4.4, if x = Sn, find the next line number x1 of this group in the x-th row of the Chinese character string table. If x1 = 0 (there is no next line in this group of the x-th row), set both the starting line number and the ending line number of this group in the index table i to 0 (the data in this group of the index table i is empty); if x1 ≠ 0, set the starting line number of this group in the index table i to x1, and the step ends. If x ≠ Sn, continue to Step 3.4.5;

[0125] Step 3.4.5, start from the x1-th row to find its next line number x2, then find the next line number x3 of x2... then find the next line number xi of the (i - 1)-th row... For each row, perform the following operations:

[0126] If the next line number of xi is equal to Sn, set the next line number of xi to the next line number of Sn. When Sn has no next line number, set the next line number of xi to be empty, and set the ending line number to xi, and the step ends. If the next line number of xi is not equal to Sn, continue to find the next line number and perform the same operation;

[0127] Step 3.4.6, mark the n-th row in the Chinese character string table as abolished, and its line number is not recycled and will not be used in the future;

[0128] Step 4, the specific matching prediction method is as follows. The input is: substring, Chinese character string table, start - end pattern index table; the output is: the Chinese character string that matches successfully. For this substring, regard all Chinese character strings in the Chinese character string table as the main strings, search in the Chinese character string table, find the main strings with successful prediction and match them one by one, and finally obtain the main strings that match successfully. The specific implementation is as follows:

[0129] Step 4.1, find the merging pattern and start - end pattern of each group of the substring;

[0130] The merging pattern of each group is expressed as g{C1,C2,……,Cn}, where 1 ≤ g ≤ G is the group number; 1 ≤ Ci ≤ C (1 ≤ i ≤ n); C1 < C2 < …… < Cn. The merging pattern is empty and is expressed as g{};

[0131] The start - end pattern of each group is expressed as: g[C1,C2,n], where 1 ≤ g ≤ G is the group number; 1 ≤ C1 ≤ C is the start code of the start - end pattern; C1 ≤ C2 ≤ C is the end code of the start - end pattern. The start - end patterns of each group are processed as follows: If the start - end pattern is empty, no operation is performed; if it is not empty, execute Step 4.2 to generate the number chain table of this group, and execute Step 4.4 for the number chain tables of all groups;

[0132] Step 4.2, the input of this step is g[C1,C2,n]. Traverse from 1 to C1, and set each value as x; for each x, traverse from C2 to C, and set each value as y;

[0133] For each pair of x and y, find the lower limit m1 and upper limit m2 of the corresponding code value. The method for finding the lower limit m1 is as follows:

[0134] x = C1, y = C2: m1 = n;

[0135] x = C1, y ≠ C2: m1 = n + 1;

[0136] x ≠ C1, y = C2: m1 = n + 1;;

[0137] x ≠ C1, y ≠ C2: m1 = n + 2;

[0138] The upper limit m2 = y - x + 1. If m2 > nMax, then take m2 = nMax;

[0139] If the upper and lower limits are inverted, that is, m1 > m2, then the operation for this pair of x and y ends; if m1 ≤ m2, then traverse from m1 to m2, and let each value be m;

[0140] Each group of the above x, y, and m forms a head - tail pattern g[x, y, m]. Find the row position of this head - tail pattern in the index table. From this row, find a row - number chain according to the group number g, denoted as Lg[x, y, m], which means the row - number chain of g[x, y, m]. The specific values of the row - number chain are represented by the starting row number h1 and the ending row number h2 as Lg(h1, h2), or it can also be represented only by the starting row number as Lg(h1), where h1 < h2; if there is only one row number h1 in the row - number chain, it is represented as Lg(h1, 0); this row - number chain may also be empty;

[0141] The row - number chain can also be represented by a single letter, or a letter plus the group number, such as L, Lg, etc.; each of the above head - tail patterns g[x, y, m] corresponds to a row - number chain. Excluding the empty chains, the remaining row - number chains form a row - number chain table. A row - number chain table contains multiple row - number chains, represented by row - number chains enclosed in {} and separated by commas. The specific operations on the row - number chain and the row - number chain table are as follows:

[0142] Step 4.2.1, row - number chain operation. The row - number chain is composed of several mutually linked row - number nodes (abbreviated as nodes). Each node has two fields: row number and next row number, where the next row number is the number of another node (the next node) in this row - number chain. Among all the nodes, there is exactly one head node, and the head node is not the next node of any other node. Here, the row - number chain is arranged in ascending order, that is, the row number of any next node must be greater than its own row number;

[0143] Step 4.2.1.1, current row number, set the row number chain to L, the current row number is represented by L.Get, the initial value of the current row number is set to the row number of the first node, the current row number can be changed during the operation, if there is no first node, the current row number is empty, the current row number is empty is also called the current row number chain is empty;

[0144] Step 4.2.1.2, extract the row number, set the row number chain to L, and the operation of extracting the row number is represented by L.Get(x). Start from the current row number, take the first row number not less than x as the result, and set the current row number to this row number. If there is no row number that meets the conditions until the last row number, the result is empty;

[0145] Step 4.2.2, row number chain table operation, the row number chain table is a set, whose elements are row number chains, and all row numbers in each row number chain do not overlap, that is, no two are equal;

[0146] Step 4.2.2.1, current row number, let row number chain table be B, current row number is represented as B.Get, which is the smallest current row number of each element. The empty row number chain does not participate in the comparison. If the current row number of each element is empty, the current row number of this row number chain table is also empty, which is also called this row number chain table is empty;

[0147] Step 4.2.2.2, extract the row number, set the row number chain table to B, and the operation of extracting the row number is represented by B.Get(x). Execute Get(x) for each element in the row number chain table, and return the minimum value. The empty row number chain does not participate in the operation;

[0148] Step 4.3 is the operation of the row number chain table of all groups generated in step 4.1. The details are as follows:

[0149] Step 4.3.1, get the current row number of each row number chain table. If the current row number of the row number chain table is empty, the operation ends here. If not, continue with the following operation;

[0150] Step 4.3.2, if the current row numbers of the row number chain tables are not all equal, find the maximum value m among them, perform the Get(m) (extract row number) operation on all row number chain tables whose current row numbers are not m, and then execute this step. If the extraction result of any row number chain table is empty, the operation ends.

[0151] Step 4.3.3, if the current row numbers are all equal, set the row numbers that are all equal to n and execute step 4.4. After execution, continue with this step.

[0152] Step 4.4 Locate the data of the nth row in the Chinese character string table. Use the merging pattern of this row of data as the parent pattern and the merging pattern of the substring as the child pattern, and perform pattern matching according to Step 4.5. If the matching is unsuccessful, this operation ends;

[0153] If the matching is successful, it indicates that the prediction that the substring is included in the parent string is successful. Next, the standard pattern should be used to perform matching operations on the parent string and the substring.

[0154] Regardless of whether the prediction and matching are successful, next, perform the Get(n + 1) operation on each row number chain table. If the result is empty, the operation ends; otherwise, execute Step 4.3;

[0155] Step 4.5, both the parent pattern and the child pattern include G merging patterns. The condition for the successful matching of the parent pattern and the child pattern is that the non-empty merging patterns in the child pattern are also non-empty in the parent pattern, and both are successfully matched according to the following steps:

[0156] The following steps are for a parent pattern Ai and a child pattern Bi in the same group. The encoding of Ai is a1, a2......an, where a1 < a2 <...... < an; the encoding of Bi is b1, b2......bn, where b1 < b2 <...... < bn;

[0157] Step 4.5.1, let i = 1 and j = 1, and execute Step 4.6.2;

[0158] Step 4.5.2, if bj does not exist, the merging pattern matching is successful;

[0159] If ai does not exist, the merging pattern matching fails;

[0160] If ai = bj, increment i by 1 and increment j by 1, and execute Step 4.6.2;

[0161] If ai < bj, increment i by 1 and keep j unchanged, and execute Step 4.6.2;

[0162] If ai > bj, keep i unchanged and increment j by 1, and execute Step 4.6.2.

[0163] The Chinese character string matching prediction method of the present invention has the following advantages:

[0164] 1. Extract the features related to the matching of the Chinese character string and store them together with the Chinese character string. Although the storage space is increased, the prediction operation can be performed on the stored features, avoiding unnecessary operations on irrelevant parent strings, thus greatly saving the operation time. This is a strategy of trading space for time.

[0165] 2. By re-encoding Chinese characters and allowing multiple Chinese characters to occupy one code, the total number of codes is controlled, avoiding the increase in codes caused by the increase in the number of Chinese characters, and always controlling the storage space within a reasonable range, so that the prediction operation can be realized.

[0166] 3. By having multiple Chinese characters occupy the same code, the frequencies of the various codes (the sum of the frequencies of all Chinese characters corresponding to each code) are made substantially equal, thus avoiding the waste of storage space caused by the large frequency disparity and the difficulty in algorithm design caused by the fluctuation of computing time.

[0167] 4. When the frequencies of the codes cannot be completely equal, the coding frequencies of the codes at both ends are arranged to be less than the coding frequencies of the middle codes, so that the occurrence probabilities of different head and tail patterns are as consistent as possible. Because the closer the code is to the two ends, the more codes can appear in the merged pattern corresponding to the head and tail patterns, and the fewer codes cannot appear, and the greater the probability of the head and tail patterns themselves appearing. By reducing the probabilities of the first and last codes of the head and tail patterns, this relatively large probability is balanced, so that the probability of the occurrence of different head and tail patterns tends to be consistent.

[0168] 5. Prediction performance can be improved by selecting an appropriate number of code groups. The more code groups there are, the fewer codes there are for each merge pattern of the Chinese character string, and the closer the corresponding head and tail patterns are to the characteristics of the merge pattern, the higher the efficiency of mother string screening. Of course, an increase in the number of code groups will increase storage space, increase the number of cases where the merge pattern is empty or has only one code, and will also restrict the improvement of prediction efficiency. Therefore, an appropriate number of code groups should be selected. Generally, it is more appropriate to select a value around half of the average length of the Chinese character string.

[0169] 6. Prediction performance can also be improved by selecting an appropriate number of codes. The more codes there are, the more the total number of merge patterns and head and tail patterns will be, the fewer Chinese character strings will correspond to each merge pattern and head and tail pattern, and the higher the accuracy of prediction will be. However, the index table will become larger and occupy more storage space. Too many codes will also have a poor effect on improving prediction accuracy, so the number of codes should also be selected to an appropriate value. Generally, the size of the index table is selected according to the number of Chinese character strings, and the number of codes is deduced based on the size of the index table.

[0170] 7. The head and tail mode proposed in the present invention can express the main features related to matching in the data storage structure. Only through a certain search method, it avoids checking all mother strings one by one, thereby reducing the number of matches, which fully reflects the role and significance of prediction.

[0171] 8. The merging mode proposed in the present invention retains the characteristics of the Chinese character string to the maximum extent while simplifying it; the merging mode enables the code to be sorted, thereby improving the operation speed, eliminating the mother string that cannot be matched successfully as early as possible, and improving the prediction speed.

[0172] 9. In practical applications, it is often necessary to accurately search for a Chinese character string in a large number of samples. The traditional approach is to search for each mother string one by one, but after all, the number of mother strings that can find this Chinese character string is very small. Although there is an optimal algorithm that can be used when searching in a mother string, it still takes a certain amount of time. The present invention proposes a prejudgment idea and a feasible prejudgment method, which effectively reduces the number of operations, thereby saving the overall search time and has a wide range of uses.

[0173] Implementation 1

[0174] This example illustrates the implementation of step 4. The Chinese character string table is shown in Figure 4, and the first and last pattern index table is shown in Figure 4. Figure 5 As shown, the number of codes of the head and tail patterns are omitted, which can also be said that the maximum value nMax of the number of codes is 1. Now take "innovation ability" as the substring and all the Chinese character strings in Figure 4 as the parent string to find the Chinese character string where "innovation ability" appears. The step number corresponds to the number of each step in step 4, and the number of codes of the head and tail patterns is ignored;

[0175] Step 4.1, find the merge mode and head and tail mode of each group as follows:

[0176] Merge mode: 1{44}, 2{22}, 3{21}, 4{53};

[0177] First and last pattern: 1[44,44], 2[22,22], 3[21,21], 4[53,53];

[0178] Execute step 4.2 to obtain the row number chain table of each group as follows, where Li represents the row number chain table of group i:

[0179] L1={(5,0),(13,0),(2,3),(14,0),(11,0),(4,0)}

[0180] L2={(12,0),(13,0),(5,0),(8,0),(4,0)}

[0181] L3={(1,0),(12,0),(14,0),(4,7),(11,0)}

[0182] L4={(14,0),(4,0)}

[0183] Perform step 4.4 on L1, L2, L3, L4;

[0184] Step 4.3,

[0185] (1) Find the numbered linked list of the first and last pattern 1[44,44];

[0186] x ranges from 1 to 44, y ranges from 44 to 64, find the row number chain of each 1[x,y], and form the row number chain table as follows:

[0187] {[3,60],[24,48],[27,44],[32,54],[32,60,[44,44]]}

[0188] ={(5,0),(13,0),(2,3),(14,0),(11,0),(4,0)};

[0189] (2) Find the numbered linked list of the first and last pattern 2[22,22];

[0190] x ranges from 1 to 22, y ranges from 22-64, find the row number chain for each 2[x,y], and form the row number chain table as follows:

[0191] {[12,48],[12,58],[16,52],[18,18],[22,49]}={(12,0),(13,0),(5,0),(8,0),(4,0)};

[0192] (3) Find the numbered linked list of the first and last pattern 3[21,21];

[0193] x ranges from 1 to 21, y ranges from 21-64, find the row number chain for each 3[x,y], and form the row number chain table as follows:

[0194] {[2,60],[6,61],[11,60],[21,21],[21,62]}={(1,0),(12,0),(14,0),(4,7),(11,0)};

[0195] (4) Find the numbered linked list of the first and last pattern 4[53,53];

[0196] x ranges from 1 to 53, y ranges from 53-64, find the row number chain of each 4[x,y], and form the row number chain table: {[14,62],[53,53]}={(14,0),(4,0)};

[0197] Step 4.4,

[0198] L1={(5,0),(13,0),(2,3),(14,0),(11,0),(4,0)}

[0199] L2={(12,0),(13,0),(5,0),(8,0),(4,0)}

[0200] L3={(1,0),(12,0),(14,0),(4,7),(11,0)}

[0201] L4={(14,0),(4,0)}

[0202] The operations are performed in the order shown in the table below.

[0203]

[0204] The header of each column of L1, L2, L3, and L4 displays the row number linked list of each group. Each column of each row of L1, L2, L3, and L4 displays the current row number of each group. When the current row numbers are not all equal, the maximum value m is calculated, and the Get(m) operation is performed on all row number linked lists whose current row numbers are not m. The row number linked lists that perform this operation are displayed in the "Extracted Row Number" column, and the current row number after the row number is extracted is displayed in the next line.

[0205] When the current row numbers are all equal, use the merge mode to perform the prediction operation:

[0206] Step 4.5, perform a pre-judgment operation on the 4th row in the mother string table;

[0207] Group 1: The parent pattern {44} contains the child pattern {44};

[0208] Group 2: The parent pattern {22,40,49} contains the child pattern {22};

[0209] Group 3: The parent pattern {21} contains the child pattern {21};

[0210] Group 4: The parent pattern {53} contains the child pattern {53};

[0211] Therefore, the prediction of row 4, “improving innovation ability”, is successful, and the matching is performed, and the matching result includes “innovation ability”;

[0212] When extracting the row number, if the row number linked list is empty, the prediction ends.

[0213] Example 2

[0214] The Chinese character string table is shown in Figure 4, and the head and tail pattern index table is shown in Figure 5 , now take "Patent application" as the substring and all the Chinese character strings in Figure 4 as the parent string, and search for the Chinese character string where "Patent application" appears. The step number corresponds to the number of each step in step 4, and the number of codes is ignored in the head and tail mode;

[0215] Step 4.1, find the merge mode and head and tail mode of each group as follows:

[0216] Merge mode: 1{}, 2{}, 3{60}, 4{14,22,37};

[0217] Head and tail mode: 1 is empty, 2 is empty, 3[60,60], 4[14,37];

[0218] Execute step 4.2 to obtain the row number chain table of each group as follows, where Li represents the row number chain table of the i-th group:

[0219] L1 is empty

[0220] L2 is empty

[0221] L3={(1,0),(12,0),(14,0),(11,0),(10,0),(13,0),(9,0)}

[0222] L4={(2,0),(12,0),(14,0)}

[0223] Perform step 4.4 on L3 and L4;

[0224] Step 4.3

[0225] (1) The first group merge pattern is empty, and the L1 head and tail patterns are also empty;

[0226] (2) The second group merge pattern is empty, and the L2 head and tail patterns are also empty;

[0227] (3) Find the numbered linked list of the first and last pattern 3[60,60];

[0228] x ranges from 1 to 60, y ranges from 60 to 64, find the row number chain for each 3[x,y], and form the row number chain table as follows:

[0229] {[2,60],[6,61],[11,60],[21,62],[32,60],[56,60],[60,60]}

[0230] ={(1,0),(12,0),(14,0),(11,0),(10,0),(13,0),(9,0)}

[0231] (4) Find the numbered linked list of the first and last pattern 4[14,37].

[0232] x ranges from 1 to 14, y ranges from 37 to 64, find the row number chain for each 4[x,y], and form the row number chain table as follows:

[0233] {[8,43],[14,41],[14,62]}={(2,0),(12,0),(14,0)}

[0234] Step 4.4,

[0235] L3={(1,0),(12,0),(14,0),(11,0),(10,0),(13,0),(9,0)}

[0236] L4={(2,0),(12,0),(14,0)}

[0237] The operations are performed in the order shown in the table below.

[0238]

[0239] The header of each column of L3 and L4 displays the row number linked list of each group. Each row of L3 and L4 displays the current row number of each group. When the current row numbers are not all equal, the row number linked list with non-maximum current row number is subjected to the row number extraction operation. The target parameter is the maximum value of the current row number. The row number linked list subjected to this operation is displayed in the "Extracted Row Number" column. The current row number after the extraction is displayed in the next row.

[0240] When the current row numbers are all equal, use the merge mode to perform the prediction operation:

[0241] Step 4.5, perform a pre-judgment operation on the 14th row in the mother string table:

[0242] Group 3: The parent pattern {11,24,60} contains the child pattern {60};

[0243] Group 4: The parent pattern {14,,60,62} does not contain the child pattern {14,22,37};

[0244] Prediction failed;

[0245] When extracting the row number, if the row number linked list is empty, the prediction ends.

Claims

1. A Chinese character string matching prediction method, characterized in that: Please follow the steps below to implement: Step 1, recode all Chinese characters according to frequency; Please follow the steps below to implement: Step 1.1, arrange all Chinese characters in descending order of frequency; Step 1.2, create a table containing G*2 groups, each group has C / 2 codes, and a total of G*C elements; each element contains a group number, a code number, a temporarily empty Chinese character set, and a temporarily 0 frequency value; Step 1.3, fill the Chinese characters one by one into the table established in step 1.2; Step 1.4, transfer the elements of the table filled in step 1.3 into a two-dimensional table, which has C / 2 rows and G*2 columns in each row, and fills in the elements according to the rule that the group number corresponds to the column number and the code number corresponds to the row number; Step 1.5, re-arrange the two-dimensional table obtained in step 1.4 by columns according to the encoding frequency of the elements; the odd columns are arranged in the order of the element encoding frequency from small to large; the even columns are arranged in the order of the element encoding frequency from large to small; Step 1.6, merge the even columns into the previous column, that is, merge the original 2nd column into the original 1st column, merge the original 4th column into the original 3rd column, ..., merge the original G*2th column into the original G*2-1th column; the merging method is to keep the rows of the odd columns unchanged, add new rows, and add the elements of the even columns to new rows one by one in the order of the original 1st row to the N / 2th row, with one row for each element, and finally obtain a new two-dimensional table with N rows and G columns; Step 1.7, using the column number of the new two-dimensional table obtained in step 1.6 as the group number and the row number as the code number, reallocate the group number and code number of each element, so that each Chinese character has a code; Step 2, transforming the Chinese characters encoded in step 1 to obtain two modes: merging and head-to-tail modes; Step 3, store the Chinese character string and its merging pattern, and then create an index according to the head and tail pattern; Please follow the steps below to implement: Step 3.1, create a Chinese character string table, which is an empty table, and the current row number is set to 0; Step 3.2, create the head and tail pattern index table, add all rows (C*(C+1)*nMax / 2 rows) at one time, and set the value of each start row number and end row number of each row to 0; Step 3.3, store a Chinese character string in the table; Step 3.4 delete a Chinese character string in the table; Step 4, taking the input Chinese character string as the substring and all pre-stored Chinese character strings as the main string, pre-judge each main string to determine whether the match is successful.

2. A Chinese character string matching prediction method according to claim 1, characterized in that: In the step 1.3, the Chinese characters are filled one by one into the table established in step 1.

2. When filling, the Chinese characters are filled into the first element of the table, that is, the Chinese characters are added to the Chinese character set of the element, and the frequency value of the Chinese characters is accumulated to the coding frequency of the element. After filling, the element is moved to the previous position of the first element whose coding frequency is greater than the coding frequency of the element from the front to the back, and the element in the original position and all the previous elements are pushed forward in sequence.

3. A Chinese character string matching prediction method according to claim 1, characterized in that: The step 2 is specifically implemented according to the following steps: Step 2.1, remove repeated Chinese characters in the Chinese character string; Step 2.2, each Chinese character is re-encoded using the temporary code according to the encoding method of step 1; Step 2.3, group the Chinese characters according to the newly encoded group numbers; Step 2.4, remove duplicate codes from each group of codes, and arrange the codes in ascending order. The resulting code sequence is the merge pattern. If the group of codes is empty, the merge pattern is also empty. Step 2.5, keep only the smallest (C1) and the largest (C2) codes in the merge pattern, and remove the others. The resulting integer pair together with the number of codes in the merge pattern is called the head and tail pattern, expressed as [C1, C2, n]; if the merge pattern is empty, the head and tail pattern is also empty; if the merge pattern has only one code Ct, the head and tail pattern is [Ct, Ct, 1]; if n is greater than nMax, let n = nMax; If nMax=1, the head and tail patterns mentioned above can be expressed as [C1, C2].

4. A Chinese character string matching prediction method according to claim 1, characterized in that: In step 3.3, storing a Chinese character string in the table is specifically implemented by the following steps: Step 3.3.1, search the Chinese character string table according to the condition of equal Chinese character string, if the same Chinese character string already exists, it will not be added; Step 3.3.2, find the merge mode according to the Chinese character string, there are G in total, add a new row to the Chinese character string table, the row number column is the current row number plus 1, set the number to Sn, the Chinese character string column is the input Chinese character string, and the merge mode columns are the merge modes just found; Step 3.3.3, check each group, if there is a merge pattern, execute step 3.3.4; if not, no operation; Step 3.3.4, find the first and last patterns according to the merge pattern, find the row number i in the index table according to the first and last patterns, and find the starting row number x and the ending row number y of the group from this row; If there is no starting row number, that is, x = 0, set the value of the starting row number column to Sn; If there is a starting row number but no ending row number, that is, x≠0, y=0, set the next number of the group in row x of the Chinese character string table to Sn, and set the ending row number column to Sn; If both the starting row number and the ending row number are available, that is, x≠0, y≠0, set the next row number of the group in row y of the Chinese character string table to Sn, and also set the ending row number column to Sn.

5. A Chinese character string matching prediction method according to claim 1, characterized in that: The step 3.4 deletes a Chinese character string from the table, and is specifically implemented by the following steps: Step 3.4.1, search the Chinese character string table according to the condition of Chinese character string equality. If the Chinese character string is not found, no operation is performed. If it is found, the row number of the found Chinese character string is set to Sn; Step 3.4.2, find the first and last patterns of each group according to the merge pattern of Sn row. If the merge pattern of the corresponding group is empty, do no operation. If it is not empty, execute step 3.4.3 for each group. Step 3.4.3, find the row position i in the index table according to the head and tail pattern, and find the starting row number x and the ending row number y of the group from this position; Step 3.4.4, if x=Sn, find the next row number x1 of the group of row x in the Chinese character string table. If x1=0, that is, there is no next row in the group of row x, the starting row number and the ending row number of the group of row i in the index table are both set to 0, that is, the data of the group of row i in the index table is empty; if x1≠0, the starting row number of the group of row i in the index table is set to x1, and the step ends. If x≠Sn, continue to step 3.4.5; Step 3.4.5: Starting from line x1, find its next line number x2, then find the next line number x3 of x2... then find the next line number xi of line i - 1... For each line, perform the following operations: If the next line number of xi is equal to Sn, set the next line number of xi to the next line number of Sn. When Sn has no next line number, set the next line number of xi to be empty, and set the end line number to xi. The step ends. If the next line number of xi is not equal to Sn, continue to find the next line number and perform the same operation; Step 3.4.6: Mark line n as abolished in the Chinese character string table, and its line number is not recycled.

6. A Chinese character string matching prediction method according to claim 1, characterized in that: The specific content of Step 4 is as follows: The inputs are a substring, a Chinese character string table, and a start - end pattern index table; the output is the successfully matched Chinese character string. For the input substring, take all the Chinese character strings in the Chinese character string table as the mother strings, search in the Chinese character string table, find the mother strings with successful pre - judgment and match them one by one, and finally obtain the successfully matched mother string. It is specifically implemented according to the following steps: Step 4.1: Calculate the merging pattern and start - end pattern of each group of the substring: The merging pattern of each group is expressed as g{C1,C2,……,Cn}, where 1 ≤ g ≤ G is the group number; 1 ≤ Ci ≤ C (1 ≤ i ≤ n); C1 < C2 < …… < Cn; when the merging pattern is empty, it is expressed as g{}; The start - end pattern of each group is expressed as: g[C1,C2,n], where 1 ≤ g ≤ G is the group number; 1 ≤ C1 ≤ C is the start code of the start - end pattern; C1 ≤ C2 ≤ C is the end code of the start - end pattern. The start - end patterns of each group are processed as follows: When the start - end pattern is empty, no operation is performed; when it is not empty, perform Step 4.2 to generate the number chain table of this group, and perform Step 4.4 for the number chain tables of all groups; Step 4.2: The input of this step is g[C1,C2,n]. Traverse from 1 to C1, and set each value as x; for each x, traverse from C2 to C, and set each value as y; For each pair of x and y, calculate the lower limit m1 and upper limit m2 of the corresponding number of code values. The method for calculating the lower limit m1 is as follows: x = C1, y = C2: m1 = n; x = C1, y ≠ C2: m1 = n + 1; x ≠ C1, y = C2: m1 = n + 1; x ≠ C1, y ≠ C2: m1 = n + 2; The upper limit m2 = y - x + 1. If m2 > nMax, then take m2 = nMax; If the upper and lower limits are inverted, that is, m1 > m2, then the operation for this pair of x and y ends; if m1 ≤ m2, then traverse from m1 to m2, and set each value as m; Each group of x, y, and m above forms a start - end pattern g[x,y,m]. Find the row position of this start - end pattern in the index table, and find a row number chain according to the group number g from this row, which is expressed as Lg[x,y,m], meaning the row number chain of g[x,y,m]. The specific values of the row number chain are represented by the start row number h1 and the end row number h2 as Lg(h1,h2), where h1 < h2; if there is only one row number h1 in the row number chain, it is expressed as Lg(h1,0); Each of the above head and tail patterns g[x,y,m] corresponds to a line number chain. Excluding the empty chains, the remaining line number chains form a line number chain table. A line number chain table contains multiple line number chains, which are represented by line number chains enclosed in {} pairs and separated by commas. Step 4.3, operations on the row number chain table of all groups generated in step 4.1, the specific contents are as follows: Step 4.3.1, obtain the current row number of each row number chain table. If the current row number of the row number chain table is empty, the operation ends here. If not, continue with the following operation; Step 4.3.2, if the current row numbers of the row number chain_tables are not all equal, find the maximum value m among them, execute Get(m) for all the row number chain_tables whose current row numbers are not m, that is, extract the row number operation, and then execute this step. If the extraction result of any row number chain_table is empty, the operation ends; Step 4.3.3, if the current row numbers are all equal, set the row numbers that are all equal to n and execute step 4.

4. After execution, continue with this step; Step 4.4, find n rows of data in the Chinese character string table, use the merge pattern of the row of data as the parent pattern, and the merge pattern of the substring as the sub-pattern, and perform pattern matching according to step 4.

5. If the match fails, this operation ends; If the match is successful, it means that the substring is included in the parent string. Then the standard mode should be used to match the parent string and the substring. Regardless of whether the prediction and matching are successful, the Get(n+1) operation is performed on each row number chain table. If any result is empty, the operation ends. Otherwise, proceed to step 4.4; Step 4.5, both the parent pattern and the child pattern include G merge patterns. The condition for the successful matching of the parent pattern and the child pattern is that the merge pattern that is not empty in the child pattern is also not empty in the parent pattern.

7. A Chinese character string matching prediction method according to claim 6, characterized in that: The operations involving the row number chain and the row number chain table in step 4.2 are specifically as follows: Step 4.2.1, row number chain operation. The row number chain consists of several row number nodes linked to each other. Each node has two fields: row number and next row number. The next row number is the number of another node in the row number chain. Among all the nodes, there is only one first node. The first node is not the next node of any other node. The row number chain here is arranged in ascending order, that is, the row number of the next node of any node must be greater than its own row number. Step 4.2.1.1, current row number, set the row number chain to L, the current row number is represented by L.Get, the initial value of the current row number is set to the row number of the first node, the current row number can be changed during the operation, if there is no first node, the current row number is empty, the current row number is empty is also called the current row number chain is empty; Step 4.2.1.2, extract the row number, set the row number chain to L, and the operation of extracting the row number is represented by L.Get(x). Start from the current row number, take the first row number not less than x as the result, and set the current row number to this row number. If there is no row number that meets the conditions until the last row number, the result is empty; Step 4.3.2, row number chain table operation, the row number chain table is a set, whose elements are row number chains, all row numbers in each row number chain do not overlap, that is, no two are equal; Step 4.3.2.1: Set the current line number. Let the line number list be B, and the current line number be expressed as B.Get, which is the smallest among the current line numbers of all elements. Here, an empty line number list does not participate in the comparison. If the current line numbers of all elements are empty, the current line number of this line number list is also empty, which is also called this line number list being empty. Step 4.3.2.2: Extract the line number. Let the line number list be B, and the line number extraction operation be expressed as B.Get(x). Execute Get(x) for each element in the line number linked list and return the minimum value among them. Here, an empty line number list does not participate in the operation.

8. A Chinese character string matching prediction method according to claim 6, characterized in that: The specific matching process of所述 step 4.5 is as follows: The following steps are for a mother pattern Ai and a child pattern Bi in the same group. The encoding of Ai is a1, a2......an, where a1 < a2 <...... < an; the encoding of Bi is b1, b2......bn, where b1 < b2 <...... < bn. Step 4.5.1: Let i = 1, j = 1. Step 4.5.2: If bj does not exist, the merge pattern matching is successful. If ai does not exist, the merge pattern matching fails. If ai = bj, increment i by 1 and j by 1, and execute step 4.5.

2. If ai < bj, increment i by 1 and keep j unchanged, and execute step 4.5.

2. If ai > bj, keep i unchanged and increment j by 1, and execute step 4.5.2.