CN115935961A - Multi-mode matching high-performance algorithm and device for realizing multi-stage matching - Google Patents

Multi-mode matching high-performance algorithm and device for realizing multi-stage matching Download PDF

Info

Publication number
CN115935961A
CN115935961A CN202211327692.1A CN202211327692A CN115935961A CN 115935961 A CN115935961 A CN 115935961A CN 202211327692 A CN202211327692 A CN 202211327692A CN 115935961 A CN115935961 A CN 115935961A
Authority
CN
China
Prior art keywords
rule
variable
matched
matching
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211327692.1A
Other languages
Chinese (zh)
Inventor
张大伟
姚纪卫
鲍春杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anxin Wangdun Beijing Technology Co ltd
Original Assignee
Anxin Wangdun Beijing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anxin Wangdun Beijing Technology Co ltd filed Critical Anxin Wangdun Beijing Technology Co ltd
Priority to CN202211327692.1A priority Critical patent/CN115935961A/en
Publication of CN115935961A publication Critical patent/CN115935961A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Machine Translation (AREA)

Abstract

The invention discloses a high-performance algorithm and a device for realizing multi-stage matching by multi-mode matching, wherein the algorithm comprises the following steps: receiving a text to be matched, performing multi-mode matching, and acquiring the rule segment number and the rule number after matching; acquiring a corresponding rule array according to the rule number, and acquiring a first variable representing a result bitmap and a second variable representing a temporary bitmap; judging whether a second variable value representing the temporary bitmap is the same as a first variable value representing the result bitmap, if so, judging that all the rule segment numbers in the rule numbers are matched, and otherwise, judging that the rule segment numbers of the rule numbers are partially matched; and judging whether the text string traversal of the text to be matched is finished, if so, ending the matching process of the text to be matched, and otherwise, performing the multi-mode matching again. The multi-stage and high-efficiency operation is realized on the basis of the multi-mode matching algorithm, and the problem that the detection performance is low due to the multi-stage and operation in the algorithm is solved.

Description

Multi-mode matching high-performance algorithm and device for realizing multi-stage matching
Technical Field
The invention relates to the technical field of text feature matching, in particular to a high-performance algorithm and a high-performance device for realizing multi-level matching by multi-mode matching.
Background
In the prior art, one rule segment in the multi-level sum is mostly selected when the multi-level sum is realized, then the selected rule segment is compiled into a state machine for matching through a multi-mode matching algorithm, and if a segment rule selected by a certain rule is hit, the remaining other rule segments are matched by using single-mode matching or character string matching, and the input text is sequentially matched; if the rule segment of the 'and' is M, the average length of the rule segment is M, the length of the input text is n, the fastest algorithm of the single-mode algorithm is BM, and the slowest algorithm is bubbling, the time complexity is MO (M) to MO (n 2), which also means that the more the number of the 'and' is, the more the matching times of each rule is, the higher the occupancy rate of the CPU is, thereby reducing the matching performance.
Disclosure of Invention
The embodiment of the invention aims to provide a high-performance algorithm and a high-performance device for realizing multi-stage AND by multi-mode matching, and the high-efficiency operation of multi-stage AND is realized on the basis of the multi-mode high-performance algorithm, so that the problem that the detection performance is lowered due to multi-stage AND operation is solved, the detection performance is improved, the CPU occupancy rate is reduced, and the detection bottleneck is broken through.
In order to solve the above technical problem, a first aspect of the embodiments of the present invention provides a high performance algorithm for implementing multi-stage matching by multi-mode matching, including the following steps:
receiving a text to be matched, performing multi-mode matching, and acquiring the rule segment number and the rule number after matching; acquiring a corresponding rule array according to the rule number, and acquiring a first variable representing a result bitmap and a second variable representing a temporary bitmap;
judging whether the second variable value of the temporary bitmap is the same as the first variable value of the result bitmap, if so, judging that all the rule segment numbers in the rule numbers are matched, and otherwise, judging that the rule segment numbers of the rule numbers are partially matched;
and judging whether the text string traversal of the text to be matched is finished, if so, ending the matching process of the text to be matched, and otherwise, re-executing the step of performing multimode matching by using a state machine compiled by a rule segment.
Further, after receiving the text to be matched and performing multi-mode matching, the method further includes:
judging whether the text to be matched is matched with the rule segment;
if so, executing the step of acquiring the corresponding rule segment number and the rule number;
if not, directly executing the step of judging whether the text string traversal of the text to be matched is completed.
Further, the air conditioner is provided with a fan,
before the determining whether the value of the second variable representing the temporary bitmap is the same as the value of the first variable representing the result bitmap, the method further includes:
acquiring a unique identification value in the rule array;
judging whether the unique identification value is a global shaping variable value or not;
if yes, left-shifting the hexadecimal 0x01 value by the rule segment number, and carrying out an OR operation on the rule segment number and the second variable representing the temporary bitmap;
and if not, clearing the second variable value representing the temporary bitmap, and assigning the identification unique value as the global shaping variable value.
Further, the air conditioner is provided with a fan,
before the receiving the text to be matched, the method further comprises the following steps:
dividing the multi-level and rule into a plurality of rule segments and numbering the rule segments correspondingly;
obtaining a second variable value of the temporary bitmap of the rule according to the serial number of the rule segment;
creating the rule array, the rule array comprising: the rule number, the second variable representing the temporary bitmap, the first variable representing the result bitmap and the unique identification value;
loading an object set comprising the rule segment, the rule segment number and the rule number into the state machine based on a multi-mode matching algorithm;
and creating a global preset variable, and adding a preset value to the global preset variable after the global preset variable acquires the text to be matched each time.
Accordingly, a second aspect of the embodiments of the present invention provides a high performance apparatus for implementing multi-stage matching by multi-mode matching, including:
the text acquisition module is used for receiving a text to be matched, performing multi-mode matching and acquiring the rule segment number and the rule number after matching;
the data acquisition module is used for acquiring a corresponding rule array according to the rule number, and acquiring a first variable representing a result bitmap and a second variable representing a temporary bitmap;
a value judging module, configured to judge whether a second variable value representing the temporary bitmap is the same as a first variable value representing the result bitmap, if so, judge that all the rule segment numbers in the rule numbers match, and otherwise, judge that part of the rule segment numbers of the rule numbers match;
and the process judgment module is used for judging whether the text string traversal of the text to be matched is finished, if so, ending the matching process of the text to be matched, and otherwise, re-executing the step of performing multimode matching by using the state machine compiled by the rule segment.
Further, the high-performance apparatus for implementing multi-stage and by multi-mode matching further comprises: a rule matching module, comprising:
the matching judgment unit is used for judging whether the text to be matched is matched with the rule segment;
the matching control unit is used for executing the step of acquiring the corresponding rule segment number and the rule number when the text to be matched is matched with the rule segment;
and the matching control unit is also used for directly judging whether the text string traversal of the text to be matched is completed or not when the text to be matched is not matched with the rule segment.
Further, the high-performance apparatus for implementing multi-stage and by multi-mode matching further includes:
a data processing module, comprising:
a data obtaining unit, configured to obtain the unique identification value in the rule array;
a variable judgment unit for judging whether the unique identification value is a global shaping variable value;
a variable control unit, configured to shift a hexadecimal 0x01 value left by the rule segment number and perform an or operation with the second variable representing the temporary bitmap when the ident is the global shaping variable value;
the variable control unit is further configured to empty the second variable value representing the temporary bitmap and assign the ident as the global shaping variable value when the identification unique value is not the global shaping variable value.
Further, the high-performance apparatus for implementing multi-stage and by multi-mode matching further comprises: a rule creation module, comprising:
the rule splitting unit is used for splitting the multi-level AND rule into a plurality of rule segments and correspondingly numbering the rule segments;
a value calculation unit, configured to obtain a second variable value of the temporary bitmap according to the rule segment number;
an array creation unit for creating the rule array, the rule array including: the rule number, the second variable representing the temporary bitmap, the first variable representing the result bitmap and the unique identification value;
a set loading unit for loading an object set comprising the rule segment, the rule segment number, and the rule number into the state machine based on a multi-mode matching algorithm;
and the variable creating unit is used for creating a global preset variable and adding a preset value to the global preset variable after the text to be matched is obtained every time.
Accordingly, a third aspect of an embodiment of the present invention provides an electronic device, including: at least one processor; and a memory coupled to the at least one processor; wherein the memory stores instructions executable by the one processor to cause the at least one processor to perform the multi-mode matching high performance method.
Accordingly, a fourth aspect of embodiments of the present invention provides a computer-readable storage medium having stored thereon computer instructions, which when executed by a processor, implement the multi-mode matching high-performance method for implementing multi-stage AND as described above.
The technical scheme of the embodiment of the invention has the following beneficial technical effects:
the multi-stage and high-efficiency operation is realized on the basis of the multi-mode matching algorithm, the algorithm that the detection performance is lowered due to the multi-stage and operation is solved, the detection performance is improved, the CPU occupancy rate is reduced, and the detection bottleneck is broken through.
Drawings
Fig. 1 is a flowchart of a matching method for implementing multi-level matching by multi-mode matching according to an embodiment of the present invention;
FIG. 2 is a logic diagram of a matching method for implementing multi-level AND by multi-mode matching according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an AC state machine provided by an embodiment of the invention;
FIG. 4 is a block diagram of a high performance apparatus for implementing multi-level AND by multi-mode matching according to an embodiment of the present invention;
FIG. 5 is a block diagram of a rule matching module provided by an embodiment of the invention;
FIG. 6 is a block diagram of a data processing module provided by an embodiment of the invention;
fig. 7 is a block diagram of a rule creation module provided by an embodiment of the present invention.
Reference numerals:
1. the system comprises a text acquisition module, 2, a data acquisition module, 3, a numerical value judgment module, 4, a process judgment module, 5, a rule matching module, 51, a matching judgment unit, 52, a matching control unit, 6, a data processing module, 61, a data acquisition unit, 62, a variable judgment unit, 63, a variable control unit, 7, a rule creation module, 71, a rule splitting unit, 72, a numerical value calculation unit, 73, an array creation unit, 74, a set loading unit, 75 and a variable creation unit.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings in conjunction with the following detailed description. It is to be understood that these descriptions are only illustrative and are not intended to limit the scope of the present invention. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present invention.
Referring to fig. 1 and fig. 2, a first aspect of an embodiment of the present invention provides a high performance algorithm for implementing multi-level and by multi-mode matching, including the following steps:
and S200, receiving the text to be matched, performing multi-mode matching, and acquiring the rule segment number and the rule number after matching.
Step S400, acquiring a corresponding rule array according to the rule number, and acquiring a first variable (result _ bitmap) representing a result bitmap and a second variable (temp _ bitmap) representing a temporary bitmap. Step S600, determining whether the value of the second variable (temp _ bitmap) representing the temporary bitmap is the same as the value of the first variable (result _ bitmap) representing the result bitmap, if so, determining that all the rule segment numbers in the rule number are matched, otherwise, determining that the rule segment numbers of the rule number are partially matched.
And step S800, judging whether the text string traversal of the text to be matched is completed, if so, ending the matching process of the text to be matched, and otherwise, re-executing the step of performing multimode matching by using a state machine compiled by the rule segments.
According to the technical scheme, the multi-stage and high-efficiency operation is realized on the basis of the multi-mode high-performance algorithm, the problem that the detection performance is low due to the multi-stage and operation is solved, the detection performance is improved, the CPU occupancy rate is reduced, and the detection bottleneck is broken through.
In a specific implementation manner of the embodiment of the present invention, before receiving the text to be matched in step S200, the method further includes:
and S110, splitting the multi-level and rule into a plurality of rule segments and numbering the rule segments correspondingly.
And splitting a rule containing multiple levels and (&) to form rule segments, wherein each rule segment is numbered continuously from 0, each rule segment (sub _ rule) and the corresponding number and rule ID (rule _ ID) are stored in an object, and finally an object set is formed. Although the rule segments are numbered in sequence, the rule segments do not need to appear in the matching sequence of the rule segments during matching, even if the appearance sequence of each matched rule segment is different, as long as the matched text hits all the rule segments, the final result is that the multi-level rule and the rule are hit, the hit does not depend on the matching sequence, and the number set of the rule segments is as shown in table 1.
TABLE 1
Figure BDA0003912597340000061
And S120, obtaining a second variable (temp _ bitmap) value which represents the temporary bitmap according to the rule segment number.
According to each rule, the rule segment number of each rule segment is calculated by 0x01< < ID or together to obtain a first variable (result _ bitmap) representing the result bitmap, for example, rule ID1000, result _ bitmap = (0 x01< < 0) | (0 x01< < 1) | ((0 x01< < 2) =0x07.
S130, creating a rule array, wherein the rule array comprises: the rule number, a second variable representing the temporary bitmap, a first variable representing the result bitmap, and an identification unique value.
Specifically, a rule array (rule _ id _ array) is created, and each item in the rule array includes the following information: a rule number (rule _ id), a second variable (temp _ bitmap) representing the temporary bitmap, a first variable (result _ bitmap) representing the result bitmap, and an identification unique value (ident). Wherein, the memory size of the second variable (temp _ bitmap) representing the temporary bitmap is consistent with the first variable (result _ bitmap) representing the result bitmap, the initial value is null, and it is used for recording the state in the matching process; ident is an integer initial value of 0, and is used in matching; each rule number has such an integer value that is used to record a unique value for each match, as shown in table 2.
TABLE 2
Figure BDA0003912597340000071
And S140, loading an object set comprising the rule segments, the rule segment numbers and the rule numbers into a state machine based on a multi-mode matching algorithm.
As shown in fig. 3, the sub _ rule set in the first step is loaded into the state machine by using a multi-pattern matching algorithm, and a rule number (rule _ id) and a rule segment number (sub _ id) corresponding to each rule segment (sub _ rule) are recorded in the state machine.
And S150, creating a global preset variable, and adding a preset value to the global preset variable after the text to be matched is obtained each time.
Specifically, a global integer variable (ident _ match) is created, the initial value is 0, and the value is increased by 1 each time a text is input, and 0 is not cleared, as shown in table 3.
TABLE 3
Sequence of Inputting text to be matched ident _ match value
First time matching Zhengzhichengxin 1
Second matching Tupochuangxin 2
Matching for the nth time Yongyudandang n
In a specific implementation manner of the embodiment of the present invention, after receiving the text to be matched and performing the multi-mode matching in step S200, the method further includes:
and S310, judging whether the text to be matched is matched with the rule segment.
And S320, if so, executing the step of acquiring the corresponding rule segment number and the rule number.
S330, if not, directly executing the step of judging whether the text string traversal of the text to be matched is completed.
In a specific implementation manner of the embodiment of the present invention, before the determining in step S600 whether the value of the second variable (temp _ bitmap) representing the temporary bitmap is the same as the value of the first variable (result _ bitmap) representing the result bitmap, the method further includes:
s510, obtaining the identification unique value (ident) in the rule array.
S520, judging whether the unique identification value (ident) is a global shaping variable value or not;
s530, if yes, the hexadecimal 0x01 value is left-shifted by the number of the regular segment, and the hexadecimal 0x01 value and a second variable (temp _ bitmap) representing the temporary bitmap are subjected to OR operation;
and S540, if not, clearing a second variable (temp _ bitmap) value representing the temporary bitmap, and assigning the identification unique value (ident) as a global shaping variable value.
The technical scheme can be applied to any multi-mode matching algorithm, such as algorithms of AC, hyperscan, wu-Manber and the like, hit multi-level and rules can be output only by traversing the text string once, the number of times of matching the text string is reduced, the matching performance is improved, the multi-level and high-performance algorithm is realized mainly by using counting and temp _ bitmap modes, and the method is simple to realize and easy to realize.
Accordingly, referring to fig. 4, a second aspect of the embodiments of the present invention provides a high performance apparatus for implementing multi-level and by multi-mode matching, including:
the text acquisition module 1 is used for receiving a text to be matched, performing multi-mode matching and acquiring a rule segment number and a rule number after matching;
the data acquisition module 2 is used for acquiring a corresponding rule array according to the rule number, and acquiring a first variable representing a result bitmap and a second variable representing a temporary bitmap;
the numerical value judging module 3 is used for judging whether a second variable value representing the temporary bitmap is the same as a first variable value representing the result bitmap, if so, the number of the rule segment in the rule number is judged to be completely matched, and if not, the number of the rule segment of the rule number is judged to be partially matched;
and the process judgment module 4 is used for judging whether the text string traversal of the text to be matched is completed, if so, ending the matching process of the text to be matched, and otherwise, re-executing the step of performing the multimode matching by using the state machine compiled by the rule segment.
Optionally, referring to fig. 5, the high performance apparatus for implementing multi-stage and by multi-mode matching further includes: a rule matching module 5, comprising:
a matching judgment unit 51 for judging whether the text to be matched is matched with the rule segment;
a matching control unit 52, configured to execute the step of obtaining the corresponding rule segment number and rule number when the text to be matched matches the rule segment;
the matching control unit 52 is further configured to directly perform the step of determining whether the text string traversal of the text to be matched is completed when the text to be matched does not match the rule segment.
Optionally, referring to fig. 6, the high performance apparatus for implementing multi-stage and by multi-mode matching further includes: a data processing module 6, comprising:
a data obtaining unit 61 for obtaining the identification unique value in the rule array;
a variable judgment unit 62 for judging whether the identification unique value is a global shaping variable value;
a variable control unit 63 for shifting the hexadecimal 0x01 value left by the rule segment number and performing an or operation with a second variable representing the temporary bitmap when the identification unique value is the global shaping variable value;
the variable control unit 63 is further configured to empty the second variable value representing the temporary bitmap and assign the identification unique value as the global shaping variable value when the identification unique value is not the global shaping variable value.
Optionally, referring to fig. 7, the high performance apparatus for implementing multi-stage and by multi-mode matching further includes: a rule creation module 7, comprising:
a rule splitting unit 71, configured to split the multi-level and rule into a plurality of rule segments and corresponding numbers;
a value calculating unit 72, configured to obtain a second variable value of the rule representing the temporary bitmap according to the rule segment number;
an array creating unit 73 for creating a rule array including: the rule number, a second variable representing the temporary bitmap, a first variable representing the result bitmap and the unique identification value;
a set loading unit 74, configured to load an object set including the rule segment, the rule segment number, and the rule number into a state machine based on a multi-mode matching algorithm;
and a variable creating unit 75, configured to create a global preset variable, and add a preset value to the global preset variable after the text to be matched is obtained each time.
Accordingly, a third aspect of embodiments of the present invention provides an electronic device, comprising: at least one processor; and a memory coupled to the at least one processor; wherein the memory stores instructions executable by a processor to cause at least one processor to perform the multi-mode matching described above to implement a high performance method of multi-mode matching.
Accordingly, a fourth aspect of embodiments of the present invention provides a computer-readable storage medium having stored thereon computer instructions, which when executed by a processor, implement the multi-mode matching high-performance method for implementing multi-stage AND as described above.
The embodiment of the invention aims to protect a high-performance algorithm and a device for realizing multi-stage matching by multi-mode matching, wherein the method comprises the following steps: receiving a text to be matched, performing multi-mode matching, and acquiring the rule segment number and the rule number after matching; acquiring a corresponding rule array according to the rule number, and acquiring a first variable representing a result bitmap and a second variable representing a temporary bitmap; judging whether a second variable value representing the temporary bitmap is the same as a first variable value representing the result bitmap, if so, judging that all the rule segment numbers in the rule numbers are matched, and otherwise, judging that the rule segment numbers of the rule numbers are partially matched; and judging whether the text string traversal of the text to be matched is finished, if so, ending the matching process of the text to be matched, and otherwise, performing the multi-mode matching again. The technical scheme has the following effects:
the multi-stage and high-efficiency operation is realized on the basis of the multi-mode matching algorithm, the algorithm that the detection performance is lowered due to the multi-stage and operation is solved, the detection performance is improved, the CPU occupancy rate is reduced, and the detection bottleneck is broken through.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting the same, and although the present invention is described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: modifications and equivalents may be made to the embodiments of the invention without departing from the spirit and scope of the invention, which is to be covered by the claims.

Claims (10)

1. A high-performance algorithm for realizing multi-stage matching by multi-mode matching is characterized by comprising the following steps:
receiving a text to be matched, performing multi-mode matching, and acquiring the rule segment number and the rule number after matching; acquiring a corresponding rule array according to the rule number, and acquiring a first variable representing a result bitmap and a second variable representing a temporary bitmap;
judging whether the second variable value of the temporary bitmap is the same as the first variable value of the result bitmap, if so, judging that all the rule segment numbers in the rule numbers are matched, and otherwise, judging that the rule segment numbers of the rule numbers are partially matched;
and judging whether the text string traversal of the text to be matched is finished, if so, ending the matching process of the text to be matched, and otherwise, re-executing the step of performing multimode matching by using a state machine compiled by a rule segment.
2. The multi-mode matching multi-stage and high-performance algorithm according to claim 1, wherein after receiving the text to be matched and performing multi-mode matching, the method further comprises:
judging whether the text to be matched is matched with the rule segment;
if so, executing the step of acquiring the corresponding rule segment number and the rule number;
if not, directly executing the step of judging whether the text string traversal of the text to be matched is completed.
3. The multi-mode matching multi-level and high-performance algorithm according to claim 1, wherein before determining whether the value of the second variable representing the temporary bitmap is the same as the value of the first variable representing the result bitmap, the method further comprises:
acquiring a unique identification value in the rule array;
judging whether the unique identification value is a global shaping variable value or not;
if yes, left-shifting the hexadecimal 0x01 value by the rule segment number, and carrying out an OR operation on the rule segment number and the second variable representing the temporary bitmap;
and if not, clearing the second variable value representing the temporary bitmap, and assigning the identification unique value as the global shaping variable value.
4. The multi-mode matching high-performance algorithm for realizing multi-stage matching according to claim 1, wherein before receiving the text to be matched, the method further comprises:
splitting the multi-level and rule into a plurality of rule segments and corresponding numbers;
obtaining a second variable value of the temporary bitmap of the rule according to the serial number of the rule segment;
creating the rule array, the rule array comprising: the rule number, the second variable representing the temporary bitmap, the first variable representing the result bitmap and the unique identification value;
loading an object set comprising the rule segment, the rule segment number and the rule number into the state machine based on a multi-mode matching algorithm;
and creating a global preset variable, and adding a preset value to the global preset variable after the global preset variable acquires the text to be matched each time.
5. A high performance apparatus for implementing multi-stage matching by multi-mode matching, comprising:
the text acquisition module is used for receiving a text to be matched, performing multi-mode matching and acquiring the rule segment number and the rule number after matching;
the data acquisition module is used for acquiring a corresponding rule array according to the rule number, and acquiring a first variable representing a result bitmap and a second variable representing a temporary bitmap;
a value judging module, configured to judge whether a second variable value of the temporary bitmap is the same as a first variable value of the result bitmap, if so, judge that all the rule segment numbers in the rule numbers match, and if not, judge that part of the rule segment numbers of the rule numbers match;
and the process judgment module is used for judging whether the text string traversal of the text to be matched is finished, if so, ending the matching process of the text to be matched, and otherwise, re-executing the step of performing multimode matching by using the state machine compiled by the rule segment.
6. The multi-mode matching high-performance apparatus according to claim 5, further comprising: a rule matching module, comprising:
the matching judgment unit is used for judging whether the text to be matched is matched with the rule segment;
the matching control unit is used for executing the step of acquiring the corresponding rule segment number and the rule number when the text to be matched is matched with the rule segment;
and the matching control unit is also used for directly judging whether the text string traversal of the text to be matched is completed or not when the text to be matched is not matched with the rule segment.
7. The multi-mode matching multi-stage AND high-performance apparatus according to claim 5, further comprising: a data processing module, comprising:
a data obtaining unit, configured to obtain the unique identification value in the rule array;
a variable judgment unit for judging whether the unique identification value is a global shaping variable value;
a variable control unit, configured to shift a hexadecimal 0x01 value left by the rule segment number and perform an or operation with the second variable representing the temporary bitmap when the unique identification value is the global shaping variable value;
the variable control unit is further configured to empty the second variable value representing the temporary bitmap and assign the ident as the global shaping variable value when the identification unique value is not the global shaping variable value.
8. The multi-mode matching multi-stage AND high-performance apparatus according to claim 5, further comprising: a rule creation module, comprising:
the rule splitting unit is used for splitting the multi-level AND rule into a plurality of rule segments and corresponding numbers;
a value calculation unit, configured to obtain a second variable value of the temporary bitmap according to the rule segment number;
an array creation unit for creating the rule array, the rule array including: the rule number, the second variable representing the temporary bitmap, the first variable representing the result bitmap and the unique identification value;
a set loading unit for loading an object set comprising the rule segment, the rule segment number, and the rule number into the state machine based on a multi-mode matching algorithm;
and the variable creating unit is used for creating a global preset variable and adding a preset value to the global preset variable after the text to be matched is obtained each time.
9. An electronic device, comprising: at least one processor; and a memory coupled to the at least one processor; wherein the memory stores instructions executable by the one processor to cause the at least one processor to perform the multi-mode matching implementation multi-stage and high performance method of any one of claims 1-4.
10. A computer readable storage medium having stored thereon computer instructions which, when executed by a processor, implement a high performance method of multi-mode matching implementing multi-stage and as claimed in any one of claims 1 to 4.
CN202211327692.1A 2022-10-27 2022-10-27 Multi-mode matching high-performance algorithm and device for realizing multi-stage matching Pending CN115935961A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211327692.1A CN115935961A (en) 2022-10-27 2022-10-27 Multi-mode matching high-performance algorithm and device for realizing multi-stage matching

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211327692.1A CN115935961A (en) 2022-10-27 2022-10-27 Multi-mode matching high-performance algorithm and device for realizing multi-stage matching

Publications (1)

Publication Number Publication Date
CN115935961A true CN115935961A (en) 2023-04-07

Family

ID=86551498

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211327692.1A Pending CN115935961A (en) 2022-10-27 2022-10-27 Multi-mode matching high-performance algorithm and device for realizing multi-stage matching

Country Status (1)

Country Link
CN (1) CN115935961A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105045808A (en) * 2015-06-08 2015-11-11 北京天元特通科技有限公司 Composite rule set matching method and system
CN110516118A (en) * 2019-08-13 2019-11-29 出门问问(武汉)信息科技有限公司 A kind of character string matching method, equipment and computer storage medium
CN111241138A (en) * 2020-01-14 2020-06-05 北京恒光信息技术股份有限公司 Data matching method and device
CN112579839A (en) * 2019-09-30 2021-03-30 奇安信安全技术(珠海)有限公司 Multi-mode matching method and device for large-scale features and storage medium
CN113760876A (en) * 2021-02-08 2021-12-07 北京沃东天骏信息技术有限公司 Data filtering method and device
CN114168954A (en) * 2021-12-08 2022-03-11 中国电信股份有限公司 Intrusion detection method and device based on regular matching

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105045808A (en) * 2015-06-08 2015-11-11 北京天元特通科技有限公司 Composite rule set matching method and system
CN110516118A (en) * 2019-08-13 2019-11-29 出门问问(武汉)信息科技有限公司 A kind of character string matching method, equipment and computer storage medium
CN112579839A (en) * 2019-09-30 2021-03-30 奇安信安全技术(珠海)有限公司 Multi-mode matching method and device for large-scale features and storage medium
CN111241138A (en) * 2020-01-14 2020-06-05 北京恒光信息技术股份有限公司 Data matching method and device
CN113760876A (en) * 2021-02-08 2021-12-07 北京沃东天骏信息技术有限公司 Data filtering method and device
CN114168954A (en) * 2021-12-08 2022-03-11 中国电信股份有限公司 Intrusion detection method and device based on regular matching

Similar Documents

Publication Publication Date Title
CN106649346B (en) Data repeatability checking method and device
KR101617696B1 (en) Method and device for mining data regular expression
CN109804363B (en) Connection using format modification by way of example
US10176627B2 (en) Tree-based graphics primitive rendering
CN112287916B (en) Video image text courseware text extraction method, device, equipment and medium
CN111640089B (en) Defect detection method and device based on feature map center point
CN106909901B (en) Method and device for detecting object from image
CN112016697A (en) Method, device and equipment for federated learning and storage medium
CN111209341B (en) Data storage method, device, equipment and medium of block chain
US11037356B2 (en) System and method for executing non-graphical algorithms on a GPU (graphics processing unit)
CN106156245B (en) Line element merging method and device in electronic map
CN111191778A (en) Deep learning network processing method, device and compiler
CN115935961A (en) Multi-mode matching high-performance algorithm and device for realizing multi-stage matching
CN112270384A (en) Loop detection method and device, electronic equipment and storage medium
CN107305522A (en) The apparatus and method detected for the repetition collapse to application program
CN110069772A (en) Predict device, method and the storage medium of the scoring of question and answer content
CN112567377A (en) Expression recognition using character skipping
CN108304467A (en) For matched method between text
CN111159996B (en) Short text set similarity comparison method and system based on text fingerprint algorithm
CN107491481B (en) LOD model searching method and system, method for establishing LOD model database and computer-readable storage medium
US20170270243A1 (en) Method for finding associated positions of bases of a read on a reference genome
KR20220068357A (en) Deep learning object detection processing device
CN113495901A (en) Variable-length data block oriented quick retrieval method
CN111831622A (en) Data index generation method and device, electronic equipment and readable storage medium
CN115049899B (en) Model training method, reference expression generation method and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination