Feature matching rule construction, feature matching method, device, equipment and medium
By constructing a feature matching rule tree and establishing node relationships, the problem of repeated calculations in feature matching rules in row and column matrix structure is solved, and the feature matching efficiency is improved.
Patent Information
- Application Number
- CN202210130341.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-11
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2042-02-11
AI Technical Summary
There are duplicate calculations in the existing feature matching rules based on row and column matrix structures, resulting in low feature matching efficiency.
By building a feature matching rule tree, identify the elements and logical relational words in the sub-rule text string, and establish node and connection relationships in the feature matching rule tree, avoid repeated calculations and improve matching efficiency.
The efficiency of feature matching is improved, repeated calculations are avoided, and the efficiency of the matching process is improved.
Smart Images

Figure CN114564624B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of feature matching technology, and in particular to a feature matching rule construction, a feature matching method, a device, a equipment and a medium. Background Art
[0002] At present, when determining the interchange fees, billing codes, etc. (for the convenience of description, called result values) applicable to user data (for the convenience of description, called account feature data), it is usually necessary to construct feature matching rules based on a row and column matrix structure. The feature matching rules usually include multiple sub-rules. The account feature data can be matched with multiple sub-rules respectively (for the convenience of description, called feature matching) to determine the sub-rules that are applicable (matched) to the account feature data, and then the result values such as interchange fees, billing codes, etc. applicable to the account feature data are obtained.
[0003] However, since the row-column matrix structure often has the characteristics of a sparse matrix, etc., the multiple sub-rules contained in the feature matching rules constructed based on the row-column matrix structure usually contain the same sub-judgment conditions, that is, the same sub-judgment conditions usually appear repeatedly in the feature matching rules. This means that when the account feature data is matched with multiple sub-rules separately, there is usually repeated calculation (matching), which leads to low feature matching efficiency.
[0004] Therefore, there is an urgent need for a technical solution that can improve the efficiency of feature matching. Summary of the invention
[0005] The present application provides a feature matching rule construction, a feature matching method, an apparatus, a device and a medium to improve the feature matching efficiency.
[0006] In a first aspect, the present application provides a method for constructing a feature matching rule, the method comprising:
[0007] For each received sub-rule text string, determine each first element contained in the sub-rule text string and the first logical relationship word associated with the first element; for any first element contained in the sub-rule text string, determine whether the first element is different from any element contained in the current feature matching rule tree; if so, establish a first node corresponding to the first element in the current feature matching rule tree; identify the target first logical relationship word associated with the first element in the sub-rule text string, establish a second node corresponding to the target first logical relationship word in the current feature matching rule tree, connect the first node and the second node, and save the correspondence between the rule identification information of the sub-rule text string and the first element and the target first logical relationship word.
[0008] In a possible implementation, the method further includes:
[0009] If the first element is the same as the second element of the target sub-rule text string contained in the current feature matching rule tree, determine whether the second logical relationship word connected to the second element in the current feature matching rule tree is the same as the target first logical relationship word associated with the first element in the sub-rule text string;
[0010] If so, the node group consisting of the node corresponding to the second element and the node corresponding to the second logical relationship word in the current feature matching rule tree is determined as the common node group of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; the correspondence between the rule identification information of the sub-rule text string and the second element and the second logical relationship word is saved;
[0011] If not, the node corresponding to the second element in the current feature matching rule tree is determined as the common node of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; a second node corresponding to the target first logical relationship word is established in the current feature matching rule tree, and the second node is connected to the node corresponding to the second element, and the correspondence between the rule identification information of the sub-rule text string and the second element and the target first logical relationship word is saved.
[0012] In a possible implementation manner, determining each first element contained in the sub-rule text string and a first logical relation word associated with the first element includes:
[0013] Identify a preset separator contained in the sub-rule text string, and divide the sub-rule text string into a plurality of morphemes based on the separator;
[0014] For each morpheme, the target morpheme type corresponding to the morpheme is determined according to the pre-saved correspondence between morphemes and morpheme types; based on the target morpheme type, the morpheme is determined to be the first element or the first logical relationship word associated with the first element.
[0015] In a possible implementation, after determining each first element contained in the sub-rule text string and the first logical relationship word associated with the first element, and before determining, for any first element contained in the sub-rule text string, whether the first element is different from any element contained in the current feature matching rule tree, the method further includes:
[0016] Based on the context-free grammar and the recursive descent algorithm, the sub-rule text string is parsed; if the parsing result of the sub-rule text string is qualified, the subsequent steps are performed.
[0017] In a possible implementation, if the grammatical analysis result of the sub-rule text string is qualified, before determining, for any first element contained in the sub-rule text string, whether the first element is different from any element contained in the current feature matching rule tree, the method further includes:
[0018] The first element is used as the first child node included in the sub-rule tree corresponding to the sub-rule text string, the target first logical relationship word is used as the second child node included in the sub-rule tree, and the first child node and the second child node that have an association relationship in the sub-rule text string are connected to establish a sub-rule tree corresponding to the sub-rule text string; based on the sub-rule tree, subsequent steps are performed for the first child node corresponding to any first element included in the sub-rule tree corresponding to the sub-rule text string, to determine whether the first element of the first child node is different from the elements of any node included in the current feature matching rule tree.
[0019] In a possible implementation, after the sub-rule tree corresponding to the sub-rule text string is established, before the subsequent step of determining, based on the sub-rule tree, whether the first element of the first sub-node corresponding to any first element contained in the sub-rule tree corresponding to the sub-rule text string is different from the elements of any node contained in the current feature matching rule tree, the method further includes:
[0020] Based on the preset predicate deduction algorithm and sub-node sorting rules, the sub-nodes and the sorting order of the sub-nodes contained in the sub-rule tree are sorted.
[0021] In a possible implementation manner, the first element includes: a singleton element or a derived element.
[0022] In a second aspect, the present application also provides a feature matching method, the method comprising:
[0023] receiving account characteristic data, and determining each third element contained in the account characteristic data and a third logical relational word associated with the third element;
[0024] Determine, according to the correspondence between each rule identification information and the elements and logical relationship words contained in the feature matching rule tree, target rule identification information matching each third element and the third logical relationship word associated with the third element;
[0025] The target result value corresponding to the preset target rule identification information is determined as the result value applicable to the account feature data.
[0026] In a possible implementation, determining the target rule identification information matching each third element and the third logical relationship word associated with the third element according to the correspondence between each rule identification information contained in the feature matching rule tree and the element and the logical relationship word includes:
[0027] For each node corresponding to any rule identification information, determine whether the node is a common node of the rule identification information and other rule identification information or a node in a common node group;
[0028] If so, and if matching information of the common node or common node group with other rule identification information for the account feature data is currently saved, the matching information is directly used as matching information of the common node or common node group to which the node belongs for the account feature data; if matching information of the common node or common node group with other rule identification information for the account feature data is not currently saved, the node or the common node group to which the node belongs is matched with the corresponding third element and / or third logical relational word in the account feature data, and the matching information of the common node or the common node group to which the node belongs for the account feature data is determined and saved;
[0029] If not, matching the node with the corresponding third element or third logical relation word in the account feature data to determine matching information of the node to the account feature data;
[0030] Matching information of each node corresponding to the rule identification information to the account feature data is all matched rule identification information, and is determined as the target rule identification information.
[0031] In a possible implementation, determining the target rule identification information matching each third element and the third logical relationship word associated with the third element according to the correspondence between each rule identification information contained in the feature matching rule tree and the element and the logical relationship word includes:
[0032] According to the order of priority preset for each rule identification information contained in the feature matching rule tree, the target rule identification information that matches each third element and the third logical relationship word associated with the third element is determined according to the correspondence between each rule identification information and the element and the logical relationship word.
[0033] In a third aspect, the present application also provides a feature matching rule construction device, the device comprising:
[0034] A first determination module is used to determine, for each received sub-rule text string, each first element contained in the sub-rule text string and a first logical relationship word associated with the first element;
[0035] A construction module is used to determine, for any first element contained in the sub-rule text string, whether the first element is different from any element contained in the current feature matching rule tree; if so, establish a first node corresponding to the first element in the current feature matching rule tree; identify the target first logical relationship word associated with the first element in the sub-rule text string, establish a second node corresponding to the target first logical relationship word in the current feature matching rule tree, connect the first node and the second node, and save the correspondence between the rule identification information of the sub-rule text string and the first element and the target first logical relationship word.
[0036] In a possible implementation, the construction module is further used to determine whether the second logical relationship word connected to the second element in the current feature matching rule tree is the same as the target first logical relationship word associated with the first element in the sub-rule text string if the first element is the same as the second element of the target sub-rule text string contained in the current feature matching rule tree;
[0037] If so, the node group consisting of the node corresponding to the second element and the node corresponding to the second logical relationship word in the current feature matching rule tree is determined as the common node group of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; the correspondence between the rule identification information of the sub-rule text string and the second element and the second logical relationship word is saved;
[0038] If not, the node corresponding to the second element in the current feature matching rule tree is determined as the common node of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; a second node corresponding to the target first logical relationship word is established in the current feature matching rule tree, and the second node is connected to the node corresponding to the second element, and the correspondence between the rule identification information of the sub-rule text string and the second element and the target first logical relationship word is saved.
[0039] In a possible implementation manner, the first determination module is specifically configured to identify a preset separator contained in the sub-rule text string, and divide the sub-rule text string into a plurality of morphemes based on the separator;
[0040] For each morpheme, the target morpheme type corresponding to the morpheme is determined according to the pre-saved correspondence between morphemes and morpheme types; based on the target morpheme type, the morpheme is determined to be the first element or the first logical relationship word associated with the first element.
[0041] In a possible implementation, the construction module is also used to perform grammatical analysis on the sub-rule text string based on a context-free grammar and a recursive descent algorithm; if the grammatical analysis result of the sub-rule text string is qualified, the subsequent step of determining whether any first element contained in the sub-rule text string is different from any element contained in the current feature matching rule tree is performed.
[0042] In a possible implementation, the construction module is also used to use the first element as the first child node included in the sub-rule tree corresponding to the sub-rule text string, use the target first logical relationship word as the second child node included in the sub-rule tree, connect the first child node and the second child node that have an association relationship in the sub-rule text string, and establish a sub-rule tree corresponding to the sub-rule text string; based on the sub-rule tree, perform subsequent steps for the first child node corresponding to any first element included in the sub-rule tree corresponding to the sub-rule text string, and determine whether the first element of the first child node is different from the elements of any node included in the current feature matching rule tree.
[0043] In a possible implementation, the construction module is further used to sort the sub-nodes and the sorting order of the sub-nodes contained in the sub-rule tree based on a preset predicate deduction algorithm and sub-node sorting rules.
[0044] In a fourth aspect, the present application further provides a feature matching device, the device comprising:
[0045] A second determination module is used to receive the account characteristic data, and determine each third element contained in the account characteristic data and a third logical relationship word associated with the third element;
[0046] A third determination module is used to determine the target rule identification information matching each third element and the third logical relationship word associated with the third element according to the correspondence between each rule identification information and the element and the logical relationship word contained in the feature matching rule tree;
[0047] The fourth determination module is used to determine the target result value corresponding to the preset target rule identification information as the result value applicable to the account characteristic data.
[0048] In a possible implementation manner, the third determination module is specifically configured to determine, for each node corresponding to any rule identification information, whether the node is a common node or a node in a common node group of the rule identification information and other rule identification information;
[0049] If so, and if matching information of the common node or common node group with other rule identification information for the account feature data is currently saved, the matching information is directly used as matching information of the common node or common node group to which the node belongs for the account feature data; if matching information of the common node or common node group with other rule identification information for the account feature data is not currently saved, the node or the common node group to which the node belongs is matched with the corresponding third element and / or third logical relational word in the account feature data, and the matching information of the common node or the common node group to which the node belongs for the account feature data is determined and saved;
[0050] If not, matching the node with the corresponding third element or third logical relation word in the account feature data to determine matching information of the node to the account feature data;
[0051] Matching information of each node corresponding to the rule identification information to the account feature data is all matched rule identification information, and is determined as the target rule identification information.
[0052] In a possible implementation, the third determination module is specifically used to determine the target rule identification information that matches each third element and the third logical relationship word associated with the third element according to the order of priority preset for each rule identification information contained in the feature matching rule tree and in turn according to the correspondence between each rule identification information and the element and the logical relationship word.
[0053] In a fifth aspect, the present application also provides an electronic device, which includes at least a processor and a memory, and the processor is used to implement the steps of any of the feature matching rule construction methods described above when executing a computer program stored in the memory, or to implement the steps of any of the feature matching methods described above.
[0054] In a sixth aspect, the present application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the feature matching rule construction methods described above, or implements the steps of any of the feature matching methods described above.
[0055] In a seventh aspect, the present application provides a computer program product, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the steps of any of the feature matching rule construction methods described above, or to implement the steps of any of the feature matching methods described above.
[0056] In the embodiment of the present application, the rule identification information of each sub-rule text string contained in the feature matching rule tree can share the same node; when performing feature matching, the matching information of the account feature data can share the same node (common node or common node group), thereby avoiding repeated calculation (matching) and improving feature matching efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the implementation methods in the embodiments of the present application or the related technologies, the following is a brief introduction to the drawings required for use in the embodiments or the related technology descriptions. Obviously, the drawings described below are some embodiments of the present application, and a person skilled in the art can also obtain other drawings based on these drawings.
[0058] Figure 1 A schematic diagram of a first feature matching rule construction process provided by some embodiments is shown;
[0059] Figure 2 A schematic diagram of morpheme attribute information provided by some embodiments is shown;
[0060] Figure 3 A schematic diagram of a production model provided by some embodiments is shown;
[0061] Figure 4 A schematic diagram of a sub-rule tree provided by some embodiments is shown;
[0062] Figure 5a A schematic diagram of a sub-rule tree before arrangement provided by some embodiments is shown;
[0063] Figure 5b A schematic diagram of a sorted sub-rule tree provided by some embodiments is shown;
[0064] Figure 6a Another schematic diagram of a pre-arrangement sub-rule tree provided in some embodiments is shown;
[0065] Figure 6b Another schematic diagram of a rearranged sub-rule tree provided in some embodiments is shown;
[0066] Figure 7a A schematic diagram of a current feature matching rule tree provided by some embodiments is shown;
[0067] Figure 7b A schematic diagram of a sub-rule tree of a sub-rule string provided by some embodiments is shown;
[0068] Figure 7c A schematic diagram of an updated feature matching rule tree provided by some embodiments is shown;
[0069] Figure 8a A schematic diagram of a sub-rule tree of another sub-rule string provided in some embodiments is shown;
[0070] Figure 8b Another updated feature matching rule tree schematic diagram provided by some embodiments is shown;
[0071] Figure 9a A schematic diagram of a sub-rule tree of rule 1 and rule 2 before transposition provided in some embodiments is shown;
[0072] Figure 9b A schematic diagram of transposing the sub-rule trees of rule 1 and rule 2 provided in some embodiments is shown;
[0073] Fig.9c A schematic diagram of a feature matching rule tree formed by merging the sub-rule trees of rule 1 and rule 2 provided in some embodiments is shown;
[0074] Fig.10 A schematic diagram of a feature matching process provided by some embodiments is shown;
[0075] Fig.11 A schematic diagram of a feature matching rule construction device provided by some embodiments is shown;
[0076] Fig.12 A schematic diagram of a feature matching device provided by some embodiments is shown;
[0077] Fig.13 A schematic diagram of the structure of an electronic device provided by some embodiments is shown. DETAILED DESCRIPTION
[0078] In order to improve the efficiency of feature matching, the present application provides a feature matching rule construction, a feature matching method, an apparatus, a device and a medium.
[0079] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0080] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0081] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.
[0082] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0083] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0085] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.
[0086] Embodiment 1:
[0087] Figure 1 A schematic diagram of a first feature matching rule construction process provided by some embodiments is shown, and the process includes the following steps:
[0088] S101: For each received sub-rule text string, determine each first element contained in the sub-rule text string and a first logical relationship word associated with the first element.
[0089] The feature matching rule construction method provided in the embodiment of the present application is applied to an electronic device, which may be, for example, a PC, a mobile terminal or other device, or a server or other device.
[0090] In a possible implementation manner, developers or the like can configure each applicable rule (sub-rule) as a corresponding text string (for convenience of description, referred to as a sub-rule text string). Herein, the sub-rule text string can be flexibly set according to requirements, and the present application does not make specific limitations thereto. Exemplarily, the sub-rule text string can be "using a southern card in the north & issuing a card & business card > 840 - 2000 & B001 non-TE", etc. The electronic device can receive the sub-rule text strings configured by developers or the like, and for each received sub-rule text string, can determine each element included in the sub-rule text string (for convenience of description, referred to as a first element) and the logical relation words associated with the first element (for convenience of description, referred to as first logical relation words). Among them, the first elements and the first logical relation words included in the sub-rule text string can be flexibly set according to requirements, and the present application does not make specific limitations thereto. Exemplarily, the first element can be a singleton element, or a derivative element composed of a combination of multiple singleton elements, etc. The first logical relation words can include operators such as plus (+), minus (-), multiply (*), divide ( / ), greater than (>), greater than or equal to (≥), less than (<), less than or equal to (≤), belong to (in), etc., and can also include logical symbols such as AND (&), OR (|), NOT (!), parentheses, etc.
[0091] In a possible implementation manner, when determining each first element included in the sub-rule text string and the first logical relation words associated with the first element, the preset delimiter included in the sub-rule text string can be first identified, and based on this delimiter, the sub-rule text string can be split into multiple morphemes. Then, for each morpheme, according to the pre-stored corresponding relationship between the morpheme and the morpheme type, the morpheme type corresponding to the morpheme (for convenience of description, referred to as the target morpheme type) can be determined. Based on the target morpheme type, it can be determined whether the morpheme is a first element or a first logical relation word.
[0092] Exemplarily, still taking the above sub-rule text string "using a southern card in the north & issuing a card & business card > 840 - 2000 & B001 non-TE" as an example, if the preset delimiter is a space, then the above sub-rule text string can be divided into multiple morphemes such as using a southern card in the north, &, issuing a card, &, business card, &, gt840 - 2000, &, B001 non-TE, etc. After obtaining each morpheme included in the sub-rule text string, for each morpheme, according to the pre-stored corresponding relationship between the morpheme and the morpheme type, the target morpheme type corresponding to the morpheme can be determined. Figure 2 Shows a schematic diagram of morpheme attribute information provided by some embodiments, such as Figure 2As shown, exemplarily, if the correspondence between South Card and North Use and the morpheme type (referred to as type in the figure for convenience of description) as an element (singleton element) is pre-saved, South Card and North Use can be determined as the first element. If the correspondence between & and the morpheme type as a logical relationship word (and) is pre-saved, & can be determined as a logical relationship word (and). It can be understood that for card issuance, business card, gt840-2000, and B001 non-TE, if the correspondence between card issuance and morpheme type as an element (singleton element), the correspondence between business card and morpheme type as an element (singleton element), the correspondence between gt840-2000 and morpheme type as an element (singleton element), and the correspondence between B001 non-TE and morpheme type as an element (singleton element) are pre-saved respectively, then card issuance, business card, gt840-2000, and B001 non-TE can be determined as the first element respectively.
[0093] In a possible implementation, if the sub-rule text string contains extra spaces and line breaks, the extra spaces and line breaks in the sub-rule text string may be removed (cleaned), and then the sub-rule text string may be segmented into multiple morphemes based on a preset separator.
[0094] S102: For any first element included in the sub-rule text string, determine whether the first element is different from any element included in the current feature matching rule tree; if so, proceed to S103; if not, proceed to S104.
[0095] Considering that the sub-rule text string written by developers and the like needs to meet the set grammatical requirements (such as the left bracket and the right bracket contained in the sub-rule text string need to appear in pairs, that is, the number of the left bracket and the right bracket needs to be the same, etc.), accurate feature matching can be performed based on the sub-rule text string. In a possible implementation, after determining each first element contained in the sub-rule text string and the first logical relationship word associated with the first element, for any first element contained in the sub-rule text string, before judging whether the first element is different from any element contained in the current feature matching rule tree, the sub-rule text string can also be parsed based on a context-free grammar and a recursive descent algorithm (syntax analyzer). If the grammatical analysis result of the sub-rule text string is qualified, the subsequent step of judging whether any first element contained in the sub-rule text string is different from any element contained in the current feature matching rule tree (that is, integrating the sub-rule text string into the feature matching rule tree) can be performed.
[0096] It can be understood that if the grammatical analysis result of the sub-rule text string is unqualified, a set prompt message can be output to prompt the developer to correct the sub-rule text string.
[0097] For ease of understanding, the process of performing grammatical analysis on the sub-rule text string provided in the embodiment of the present application is illustrated below by way of a specific embodiment.
[0098] In a possible implementation, in addition to determining the morpheme type of each morpheme in the sub-rule text string, the expression, left operand, operator, right operand and other attribute parameters of each morpheme (such as an element) in the sub-rule text string can also be determined. For the convenience of description, the morpheme type, expression, left operand, operator, right operand and the like of the morpheme are referred to as morpheme attribute parameters. For each morpheme, the target morpheme attribute parameter corresponding to the morpheme can be determined based on the correspondence between the morpheme and the morpheme attribute parameter saved in advance, see also Figure 2 , each morpheme attribute parameter of the morpheme can be determined based on the target morpheme attribute parameter. The process of determining the morpheme attribute parameters such as the expression of the morpheme is the same as the process of determining the morpheme type of the morpheme, which will not be repeated here.
[0099] In a possible implementation, each morpheme can be sorted according to the order of each morpheme in the sub-rule text string. For the convenience of description, the sorted morphemes are called lexical unit sequences. In a possible implementation, the model created based on the context-free grammar can be called a production model G = (N, Σ, P, S). For example, Figure 3 Schematic diagrams of production models provided by some embodiments are shown, such as Figure 3 As shown, based on the production model created by the context-free grammar, the sub-rule text string can be parsed and the sub-rule tree corresponding to the sub-rule text string can be generated. Exemplarily, when the sub-rule text string is parsed based on the production model created by the context-free grammar, each morpheme in the lexical unit sequence corresponding to the sub-rule text string can be read in sequence, and a top-down recursive descent algorithm can be adopted, and a symbol is looked forward each time, and the look-ahead symbol is used to guide the selection of the grammar rule (analysis function) to determine an analysis function applicable to each morpheme. Exemplarily, there are 5 analysis functions, namely: expression analysis function expr(), or analysis function or(), and left analysis function andLeftCond(), and right analysis function andRightCond(), and non-analysis function notCond(). Each analysis function can be processed according to a conventional recursive descent algorithm.
[0100] In one possible implementation, in order to improve the efficiency of integrating the sub-rule text string with the feature matching rule tree, after the lexical unit sequence corresponding to the sub-rule text string is traversed, if the sub-rule text string meets the set grammatical requirements, that is, the grammatical analysis result is qualified, the rule tree corresponding to the sub-rule text string (for the convenience of description, referred to as the sub-rule tree) can be generated (established) based on the grammatical analyzer.
[0101] Specifically, the process of establishing a sub-rule tree corresponding to the sub-rule text string may include:
[0102] Each first element contained in the sub-rule text string is respectively taken as a node included in the sub-rule tree corresponding to the sub-rule text string (for the convenience of description, called the first sub-node), and the target first logical relationship word in the sub-rule text string is also respectively taken as a node included in the sub-rule tree (for the convenience of description, called the second sub-node), and the first sub-node and the second sub-node that have an association relationship in the sub-rule text string can be connected to establish the sub-rule tree corresponding to the sub-rule text string.
[0103] In a possible implementation, when establishing a sub-rule tree corresponding to a sub-rule text string, if the analysis function applicable to the morpheme in the lexical unit sequence of the sub-rule text string is or analysis function or(), and right analysis function andLeftCond(), non-analysis function notCond(), etc., newly added matching intermediate nodes or (or), and (and), or (or), etc. can be established in the sub-rule tree at the same time. If the morpheme (element) in the lexical unit sequence of the sub-rule text string is a terminal symbol (TOK_COND), a corresponding leaf node can be added in the lower layer of the associated intermediate node. Exemplary, Figure 4 A schematic diagram of a sub-rule tree provided by some embodiments is shown. Assuming that the sub-rule text string is: singleton element 1 | singleton element 2 (singleton element 3 & derived element 1 & derived element 2 &! (singleton element 4 & derived element 3) & (singleton element 5 | derived element 4)), the sub-rule tree corresponding to the sub-rule text string can be as follows Figure 4 The sub-rule tree shown. For the convenience of description, in the figure, singleton element 1 is called singleton 1, singleton element 2 is called singleton 2, singleton element 3 is called singleton 3, derived element 1 is called derived 1, derived element 2 is called derived 2, singleton element 4 is called singleton 4, derived element 3 is called derived 3, singleton element 5 is called singleton 5, and derived element 4 is called derived 4.
[0104] After the sub-rule tree corresponding to the sub-rule text string is established, the sub-rule text string (sub-rule tree) can be integrated into the feature matching rule tree based on the sub-rule tree. Specifically, each sub-rule text string (sub-rule tree) can be merged (integrated) into the same feature matching rule tree. In order to improve the matching efficiency and avoid repeated calculations (matching) when performing feature matching later, for each sub-rule text string (sub-rule tree), when any first element of the sub-rule text string (sub-rule tree) is merged into the feature matching rule tree, the first sub-node corresponding to any first element contained in the sub-rule tree corresponding to the sub-rule text string can be first determined to determine whether the first element of the first sub-node is different from the elements of any node contained in the current feature matching rule tree.
[0105] In a possible implementation, in order to improve the efficiency of integrating sub-rule text strings (sub-rule trees) into the feature matching rule tree, and in order to quickly and accurately identify common nodes and common node groups between sub-rule text strings, after establishing the sub-rule tree corresponding to the sub-rule text string, based on the sub-rule tree, before the subsequent step of determining whether the first element of the first sub-node is different from the elements of any node contained in the current feature matching rule tree for the first sub-node corresponding to any first element contained in the sub-rule tree corresponding to the sub-rule text string, the sub-nodes and the sorting order of the sub-nodes contained in the sub-rule tree can be sorted based on a preset predicate deduction algorithm and sub-node sorting rules.
[0106] Exemplarily, based on the preset predicate deduction algorithm and sub-node sorting rules, when sorting the sub-nodes contained in the sub-rule tree, the non-(!) operation nodes can be pushed down. Exemplarily, Figure 5a A schematic diagram of a pre-arrangement sub-rule tree provided in some embodiments is shown. Figure 5b A schematic diagram of a reorganized sub-rule tree provided by some embodiments is shown. Specifically, if there are multiple lower-level child nodes connected by a NOT (!) operation, the NOT (!) operation can be pushed down to the next-level child nodes, wherein the “AND operation” (&) and the “OR operation” (|) in the original next level are swapped and moved up one level.
[0107] In another exemplary embodiment, based on the preset predicate deduction algorithm and sub-node sorting rules, when the sub-nodes contained in the sub-rule tree are sorted, the nodes can also be moved up. Figure 6a Another schematic diagram of a pre-arrangement sub-rule tree provided in some embodiments is shown. Figure 6bAnother schematic diagram of a reorganized sub-rule tree provided by some embodiments is shown. Specifically, if the node where the current operator (logical relationship word) is located is consistent with the operator (logical relationship word) of the parent node, the child node of the current operator can be moved up and the node (child node) where the current operator is located can be deleted.
[0108] As another example, based on the preset predicate deduction algorithm and sub-node sorting rules, when sorting the sub-nodes contained in the sub-rule tree, the leaf nodes at the same level (see Figure 6a , for singleton 1, singleton 2, and this layer, singleton 1 and singleton 2 can be called leaf nodes), the unique attributes of the elements corresponding to each leaf node are sorted in ascending or descending order. In addition, non-leaf nodes in the same layer (see Figure 6a For singleton 1, singleton 2, and this layer, "and" can be called non-leaf nodes) and placed behind the leaf nodes. If there are multiple non-leaf nodes in the same layer, the multiple non-leaf nodes in the same layer can be sorted according to the unique attributes such as the field ID of the elements corresponding to the child nodes of the next layer of the non-leaf nodes.
[0109] S103: Establish a first node corresponding to the first element in the current feature matching rule tree; identify the target first logical relationship word associated with the first element in the sub-rule text string, establish a second node corresponding to the target first logical relationship word in the current feature matching rule tree, connect the first node and the second node, and save the correspondence between the rule identification information of the sub-rule text string and the first element and the target first logical relationship word.
[0110] In a possible implementation, if the first element is not the same as any element included in the current feature matching rule tree, it can be considered that the current feature matching rule tree does not yet contain the first element, and the first element can be added to the current feature matching rule tree. Specifically, a node corresponding to the first element can be established in the current feature matching rule tree (for the convenience of description, referred to as the first node), and the first logical relationship word associated with the first element in the sub-rule text string (for the convenience of description, referred to as the target first logical relationship word) is identified, and a node corresponding to the target first logical relationship word is established in the current feature matching rule tree (for the convenience of description, referred to as the second node), and the first node and the second node can be connected. In a possible implementation, in order to distinguish the elements and logical relationship words corresponding to each sub-rule text string and improve the matching accuracy, the identification information of the sub-rule text string (for the convenience of description, referred to as the rule identification information) and the corresponding relationship between the first element and the target first logical relationship word can also be saved. Among them, the rule identification information can be flexibly set according to demand, and this application does not make specific limitations.
[0111] S104: If the first element is the same as the second element of the target sub-rule text string contained in the current feature matching rule tree, determine whether the second logical relationship word connected to the second element in the current feature matching rule tree is the same as the target first logical relationship word associated with the first element in the sub-rule text string; if so, determine the node group composed of the node corresponding to the second element and the node corresponding to the second logical relationship word in the current feature matching rule tree as the common node group of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; save the correspondence between the rule identification information of the sub-rule text string and the second element and the second logical relationship word; if not, determine the node corresponding to the second element in the current feature matching rule tree as the common node of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; establish a second node corresponding to the target first logical relationship word in the current feature matching rule tree, and connect the second node with the node corresponding to the second element, and save the correspondence between the rule identification information of the sub-rule text string and the second element and the target first logical relationship word.
[0112] In a possible implementation, for each sub-rule text string, when any first element of the sub-rule text string is merged into the feature matching rule tree, if it is determined that the first element is the same as an element (for the convenience of description, referred to as the second element) in another sub-rule text string (for the convenience of description, referred to as the target sub-rule text string) contained in the current feature matching rule tree, it can be considered that the current feature matching rule tree already contains the first element, and the first element can no longer be added to the feature matching rule tree. In a possible implementation, it can then be determined whether the logical relationship word connected to the second element in the current feature matching rule tree (for the convenience of description, referred to as the second logical relationship word) is the same as the target first logical relationship word associated with the first element in the sub-rule text string.
[0113] If the second logical relationship word connected to the second element in the current feature matching rule tree is the same as the target first logical relationship word associated with the first element in the sub-rule text string, the node group composed of the nodes corresponding to the second element and the nodes corresponding to the second logical relationship word in the current feature matching rule tree can be determined as a common node group of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string, and the correspondence between the rule identification information of the sub-rule text string and the second element and the second logical relationship word is saved.
[0114] For ease of understanding, the feature matching rule construction process provided in this application is illustrated below by using a specific embodiment. Figure 7a A schematic diagram of a current feature matching rule tree provided by some embodiments is shown, such as Figure 7a As shown, the rule identification information of the sub-rule string contained in the current feature matching rule tree is "Rule 1". Figure 7b A schematic diagram of a sub-rule tree of a sub-rule string provided in some embodiments is shown. Assuming that the rule identification information of the sub-rule string is "Rule 2", the sub-rule tree of Rule 2 is as follows Figure 7b As shown in FIG. 1 , since both rule 1 and rule 2 contain the node “singleton element 3 & (and) derived element 1”, the node “singleton element 3 & (and) derived element 1” can be used as the common node group (completely overlapping fragment) of rule 1 and rule 2. Then, after the sub-rule tree of rule 2 is incorporated into the current feature matching rule tree containing rule 1, the current feature matching rule tree is changed to the following: Figure 7c The feature matching rule tree shown.
[0115] Another example, Figure 8a A schematic diagram of a sub-rule tree of another sub-rule string provided in some embodiments is shown. Assuming that the rule identification information of the sub-rule string is "Rule 3", the sub-rule tree of Rule 3 is as follows Figure 8a As shown, assuming that the current feature matching rule tree contains Figure 7a As shown in the sub-rule tree of rule 1, rule 1 and rule 3 contain some overlapping fragments, and the "singleton element 1 or singleton element 2 or singleton element 4" node can be used as a common node group of rule 1 and rule 3. For example, after the sub-rule tree of rule 3 is integrated into the current feature matching rule tree including rule 1, the current feature matching rule tree is changed to the following Figure 8b The feature matching rule tree shown.
[0116] For further illustration, see Figure 9a , Figure 9a A schematic diagram of a sub-rule tree of rule 1 and rule 2 before transposition provided by some embodiments is shown. Figure 9b A schematic diagram of transposing the sub-rule tree of rule 1 and rule 2 provided by some embodiments is shown, that is, the rule identification information is transposed to the bottom layer, and the elements are transposed to the top layer. For example, the use of the card in the south and the north belongs to a transaction mode, the issuance of the card belongs to an institutional role, the merchant card belongs to a card product, and the debit card and the credit card belong to a card nature respectively. Fig.9c A schematic diagram of a feature matching rule tree formed by merging the sub-rule trees of rule 1 and rule 2 provided in some embodiments is shown, such as Fig.9c As shown, "Southern Card, Northern Use & (and) Card Issuance & Merchant Card" can be used as the common node group (common fragment) of Rule 1 and Rule 2.
[0117] In a possible implementation, for any first element contained in a sub-rule text string, if the first element is the same as the second element of a target sub-rule text string contained in the current feature matching rule tree, but the second logical relationship word connected to the second element in the current feature matching rule tree is different from the target first logical relationship word associated with the first element in the sub-rule text string, then the node corresponding to the second element in the current feature matching rule tree can be determined as a common node of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; and a second node corresponding to the target first logical relationship word is established in the current feature matching rule tree, the second node is connected to the node corresponding to the second element, and the correspondence between the rule identification information of the sub-rule text string and the second element and the target first logical relationship word is saved.
[0118] In the embodiment of the present application, the rule identification information of each sub-rule text string contained in the feature matching rule tree can share the same node, that is, there are no repeated nodes in the feature matching rule tree. Therefore, when performing feature matching subsequently, the matching information of the account feature data can be shared by each rule identification information. The same node (common node or common node group) can be used to avoid repeated calculation (matching) and improve the feature matching efficiency.
[0119] Embodiment 2:
[0120] Based on the same technical concept, this application provides a feature matching method. Fig.10 A schematic diagram of a feature matching process provided by some embodiments is shown. Fig.10 As shown, the process includes the following steps:
[0121] S1001: Receive account characteristic data, and determine each third element contained in the account characteristic data and a third logical relationship word associated with the third element.
[0122] The feature matching method provided in the embodiment of the present application is applied to an electronic device, which may be, for example, a PC, a mobile terminal or other device, or may be a server or other device.
[0123] The electronic device may receive account feature data to be matched. In order to quickly and accurately match the features, the electronic device may determine each element (referred to as the third element for convenience of description) contained in the account feature data and the logical relationship word (referred to as the third logical relationship word for convenience of description) associated with the third element. The process of determining the elements and logical relationship words contained in the account feature data is the same as the process of determining the elements and logical relationship words contained in the sub-rule text string in the above embodiment, and will not be repeated here.
[0124] S1002: Determine target rule identification information that matches each third element and a third logical relationship word associated with the third element according to the correspondence between each rule identification information and the elements and logical relationship words contained in the feature matching rule tree.
[0125] In one possible implementation, when performing feature matching, for each rule identification information contained in the feature matching rule tree, feature matching can be performed on each element and logical relationship word corresponding to the rule identification information and each third element and third logical relationship word contained in the account feature data according to the correspondence between the rule identification information and the elements and logical relationship words in the feature matching rule tree (for the convenience of description, this is referred to as feature matching the rule identification information with the account feature data), and it is determined whether the rule identification information is rule identification information that matches the account feature data. If the rule identification information matches the account feature data, the rule identification information is determined as rule identification information that matches the account feature data (for the convenience of description, this is referred to as target rule identification information).
[0126] Optionally, in order to improve the matching efficiency, developers and the like may configure a corresponding priority for each rule identification information contained in the feature matching rule tree in advance, and the electronic device may perform feature matching on each rule identification information with the account feature data in turn according to the order of the priority preset for each rule identification information contained in the feature matching rule tree. Exemplarily, assuming that the feature matching rule tree contains two rule identification information, "Rule 1" and "Rule 2", and the priority of "Rule 1" is higher than that of "Rule 2", then "Rule 1" may be matched with the account feature data first to determine whether "Rule 1" is the target rule identification information that matches the account feature data; if "Rule 1" matches the account feature data, "Rule 1" is determined as the target rule identification information. If "Rule 1" does not match the account feature data, then "Rule 2" may be matched with the account feature data to determine whether "Rule 2" is the target rule identification information that matches the account feature data; if "Rule 2" matches the account feature data, "Rule 2" is determined as the target rule identification information.
[0127] In a possible implementation, when feature matching is performed between each element and logical relationship word corresponding to any rule identification information and each third element and third logical relationship word contained in the account feature data (feature matching is performed between the rule identification information and the account feature data), and it is determined whether the rule identification information is the target rule identification information that matches the account feature data, it can be determined for each node corresponding to any rule identification information whether the node is a common node or a node in a common node group between the rule identification information and other rule identification information. If the node is a common node or a node in a common node group between the rule identification information and other rule identification information, it can then be determined whether matching information of the common node or common node group of other rule identification information for the account feature data is currently stored.
[0128] If the common node or common node group that currently stores other rule identification information has matching information for the account feature data, it can be considered that the other rule identification information has been feature matched with the account feature data, and the matching information can be directly used as the matching information for the account feature data for the node or the common node group to which the node belongs.
[0129] If the matching information of the common node or common node group of other rule identification information on the account feature data is not currently saved, it can be considered that the other rule identification information has not yet been feature matched with the account feature data. For example, the node of the rule identification information or the common node group where the node is located can be matched with the third element and / or the third logical relationship word in the account feature data to determine the matching information of the node or the common node group where the node is located on the account feature data. In order to facilitate the subsequent feature matching of other rule identification information with the account feature data, the feature matching efficiency can be improved, and the matching information can be saved (cached). When other rule identification information is used for feature matching of the account feature data, the matching information can be directly used as the matching information of the node or the common node group where the node is located on the account feature data, without matching the node or the common node group where the node is located with the corresponding third element and / or third logical relationship word in the account feature data to determine the matching information of the node or the common node group where the node is located on the account feature data, thereby improving the feature matching efficiency.
[0130] It can be understood that for each node corresponding to any rule identification information, if the node is not a common node or a node in a common node group between the rule identification information and other rule identification information, the node is matched with the corresponding third element or third logical relationship word in the account feature data to determine the matching information of the node for the account feature data.
[0131] For example, see Fig.9cFor the card nature node, if the third element corresponding to the card nature in the account feature data is "credit card", it can be determined that the matching information between the card nature node (debit card) in rule 1 and the account feature data is not matched, while the matching information between the card nature node (credit card) in rule 2 and the account feature data is matched.
[0132] In a possible implementation, if each node corresponding to any rule identification information matches the matching information of the account feature data, the rule identification information may be determined as the target rule identification information matching the account feature data.
[0133] S1003: Determine the target result value corresponding to the preset target rule identification information as the result value applicable to the account feature data.
[0134] In a possible implementation, the correspondence between each rule identification information and the result value can be preset. After the target rule identification information is determined, the result value (target result value) corresponding to the preset target rule identification information can be determined as the result value applicable to the account feature data.
[0135] In the embodiment of the present application, the rule identification information of each sub-rule text string contained in the feature matching rule tree can share the same node; when performing feature matching, the matching information of the account feature data can share the same node (common node or common node group), thereby avoiding repeated calculation (matching) and improving feature matching efficiency.
[0136] In addition, compared with the related art, there are usually a large number of wildcard values in the row-column matrix structure used. When the Cartesian product configuration method is used for feature matching, the number of matches (parameter quantity) expands rapidly. If the account feature data needs to be matched with the wildcard value every time during the feature matching process, and the wildcard value usually has no effect on the matching result (result value), it will lead to many invalid operations (matches) in the feature matching process, thereby affecting the feature matching efficiency and system performance. In the embodiment of the present application, the feature matching rule tree usually does not contain wildcard values, thereby improving the feature matching efficiency.
[0137] In addition, the row-column matrix structure of the related art often contains fixed column fields, and there is often a fixed order between the column fields, resulting in low scalability of the row-column matrix structure, and it is difficult to flexibly derive new fields based on the basic column fields to generate new sub-rules. However, the present application can quickly and flexibly integrate the new sub-rule text strings configured by developers and the like into the feature matching rule tree, thereby quickly and flexibly improving the scalability of the sub-rules. In addition, the column field order of the row-column matrix structure in the related art is fixed, resulting in a fixed order between the sub-rules when performing feature matching, and the matching order cannot be flexibly adjusted according to actual conditions. The embodiment of the present application can flexibly adjust the priority order of each rule identification information contained in the feature matching rule tree, thereby achieving the purpose of flexibly adjusting the matching order.
[0138] In addition, the first element in the present application may be a derived element composed of a plurality of singleton elements, and the matching information of the derived element to the account feature data may be directly reused, thereby further improving the feature matching efficiency.
[0139] Embodiment 3:
[0140] Based on the same technical concept, the present application provides a feature matching rule construction device. Fig.11 A schematic diagram of a feature matching rule construction device provided by some embodiments is shown. Fig.11 As shown, the device comprises:
[0141] A first determination module 111 is used to determine, for each received sub-rule text string, each first element contained in the sub-rule text string and a first logical relation word associated with the first element;
[0142] Construction module 112 is used to determine, for any first element contained in the sub-rule text string, whether the first element is different from any element contained in the current feature matching rule tree; if so, establish a first node corresponding to the first element in the current feature matching rule tree; identify the target first logical relationship word associated with the first element in the sub-rule text string, establish a second node corresponding to the target first logical relationship word in the current feature matching rule tree, connect the first node and the second node, and save the correspondence between the rule identification information of the sub-rule text string and the first element and the target first logical relationship word.
[0143] In a possible implementation, the construction module 112 is further used to determine whether the second logical relationship word connected to the second element in the current feature matching rule tree is the same as the target first logical relationship word associated with the first element in the sub-rule text string if the first element is the same as the second element of the target sub-rule text string contained in the current feature matching rule tree;
[0144] If so, the node group consisting of the node corresponding to the second element and the node corresponding to the second logical relationship word in the current feature matching rule tree is determined as the common node group of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; the correspondence between the rule identification information of the sub-rule text string and the second element and the second logical relationship word is saved;
[0145] If not, the node corresponding to the second element in the current feature matching rule tree is determined as the common node of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; a second node corresponding to the target first logical relationship word is established in the current feature matching rule tree, and the second node is connected to the node corresponding to the second element, and the correspondence between the rule identification information of the sub-rule text string and the second element and the target first logical relationship word is saved.
[0146] In a possible implementation manner, the first determination module is specifically configured to identify a preset separator contained in the sub-rule text string, and divide the sub-rule text string into a plurality of morphemes based on the separator;
[0147] For each morpheme, the target morpheme type corresponding to the morpheme is determined according to the pre-saved correspondence between morphemes and morpheme types; based on the target morpheme type, the morpheme is determined to be the first element or the first logical relationship word associated with the first element.
[0148] In a possible implementation, the construction module 112 is also used to perform grammatical analysis on the sub-rule text string based on a context-free grammar and a recursive descent algorithm; if the grammatical analysis result of the sub-rule text string is qualified, the subsequent step of determining whether any first element contained in the sub-rule text string is different from any element contained in the current feature matching rule tree is performed.
[0149] In a possible implementation, the construction module 112 is also used to use the first element as the first child node included in the sub-rule tree corresponding to the sub-rule text string, use the target first logical relationship word as the second child node included in the sub-rule tree, connect the first child node and the second child node that have an association relationship in the sub-rule text string, and establish a sub-rule tree corresponding to the sub-rule text string; based on the sub-rule tree, perform subsequent steps for the first child node corresponding to any first element included in the sub-rule tree corresponding to the sub-rule text string, and determine whether the first element of the first child node is different from the elements of any node included in the current feature matching rule tree.
[0150] In a possible implementation, the construction module 112 is further configured to sort the sub-nodes and the order of the sub-nodes contained in the sub-rule tree based on a preset predicate deduction algorithm and sub-node sorting rules.
[0151] Embodiment 4:
[0152] Based on the same technical concept, the present application provides a feature matching device. Fig.12 A schematic diagram of a feature matching device provided in some embodiments is shown, such as Fig.12 As shown, the device comprises:
[0153] A second determination module 121 is used to receive the account characteristic data, and determine each third element contained in the account characteristic data and a third logical relationship word associated with the third element;
[0154] The third determination module 122 is used to determine the target rule identification information matching each third element and the third logical relationship word associated with the third element according to the correspondence between each rule identification information and the element and the logical relationship word contained in the feature matching rule tree;
[0155] The fourth determination module 123 is used to determine the target result value corresponding to the preset target rule identification information as the result value applicable to the account feature data.
[0156] In a possible implementation manner, the third determination module 122 is specifically configured to determine, for each node corresponding to any rule identification information, whether the node is a common node or a node in a common node group of the rule identification information and other rule identification information;
[0157] If so, and if matching information of the common node or common node group with other rule identification information for the account feature data is currently saved, the matching information is directly used as matching information of the common node or common node group to which the node belongs for the account feature data; if matching information of the common node or common node group with other rule identification information for the account feature data is not currently saved, the node or the common node group to which the node belongs is matched with the corresponding third element and / or third logical relational word in the account feature data, and the matching information of the common node or the common node group to which the node belongs for the account feature data is determined and saved;
[0158] If not, matching the node with the corresponding third element or third logical relation word in the account feature data to determine matching information of the node to the account feature data;
[0159] Matching information of each node corresponding to the rule identification information to the account feature data is all matched rule identification information, and is determined as the target rule identification information.
[0160] In a possible implementation, the third determination module 122 is specifically used to determine the target rule identification information that matches each third element and the third logical relationship word associated with the third element according to the order of priority preset for each rule identification information contained in the feature matching rule tree and according to the correspondence between each rule identification information and the element and the logical relationship word.
[0161] Embodiment 5:
[0162] Based on the same technical concept, the present application also provides an electronic device, Fig.13 A schematic diagram of the structure of an electronic device provided by some embodiments is shown. Fig.13 As shown, it includes: a processor 131, a communication interface 132, a memory 133 and a communication bus 134, wherein the processor 131, the communication interface 132, and the memory 133 communicate with each other through the communication bus 134;
[0163] The memory 133 stores a computer program, and when the program is executed by the processor 131, the processor 131 executes the steps of any of the above-mentioned feature matching rule construction methods, or implements the steps of any of the above-mentioned feature matching methods.
[0164] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0165] The communication interface 132 is used for communication between the above electronic device and other devices.
[0166] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0167] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0168] Embodiment 6:
[0169] Based on the same technical concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program that can be executed by an electronic device. When the program runs on the electronic device, the electronic device implements the steps of any of the feature matching rule construction methods described above, or implements the steps of any of the feature matching methods described above.
[0170] The above-mentioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in the electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., optical storage such as CD, DVD, BD, HVD, etc., and semiconductor storage such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD), etc.
[0171] Based on the same technical concept, the present application provides a computer program product, which includes: computer program code, when the computer program code runs on a computer, it enables the computer to execute the steps of any of the feature matching rule construction methods described above, or implement the steps of any of the feature matching methods described above.
[0172] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof, and all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions, and when the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated.
[0173] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0174] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0175] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0176] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0177] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for constructing feature matching rules, characterized in that: The method comprises: For each received sub-rule text string, determine each first element contained in the sub-rule text string and the first logical relationship word associated with the first element; for any first element contained in the sub-rule text string, determine whether the first element is different from any element contained in the current feature matching rule tree; if so, establish a first node corresponding to the first element in the current feature matching rule tree; identify the target first logical relationship word associated with the first element in the sub-rule text string, establish a second node corresponding to the target first logical relationship word in the current feature matching rule tree, connect the first node and the second node, and save the correspondence between the rule identification information of the sub-rule text string and the first element and the target first logical relationship word; If the first element is the same as the second element of the target sub-rule text string contained in the current feature matching rule tree, determine whether the second logical relationship word connected to the second element in the current feature matching rule tree is the same as the target first logical relationship word associated with the first element in the sub-rule text string; If so, the node group consisting of the node corresponding to the second element and the node corresponding to the second logical relationship word in the current feature matching rule tree is determined as the common node group of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; the correspondence between the rule identification information of the sub-rule text string and the second element and the second logical relationship word is saved; If not, the node corresponding to the second element in the current feature matching rule tree is determined as the common node of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; a second node corresponding to the target first logical relationship word is established in the current feature matching rule tree, and the second node is connected to the node corresponding to the second element, and the correspondence between the rule identification information of the sub-rule text string and the second element and the target first logical relationship word is saved.
2. The method according to claim 1, characterized in that The step of determining each first element contained in the sub-rule text string and the first logical relation word associated with the first element comprises: Identify a preset separator contained in the sub-rule text string, and divide the sub-rule text string into a plurality of morphemes based on the separator; For each morpheme, the target morpheme type corresponding to the morpheme is determined according to the pre-saved correspondence between morphemes and morpheme types; based on the target morpheme type, the morpheme is determined to be the first element or the first logical relationship word associated with the first element.
3. The method according to claim 1 or 2, characterized in that: After determining each first element contained in the sub-rule text string and the first logical relationship word associated with the first element, and before determining, for any first element contained in the sub-rule text string, whether the first element is different from any element contained in the current feature matching rule tree, the method further includes: Based on the context-free grammar and the recursive descent algorithm, the sub-rule text string is parsed; if the parsing result of the sub-rule text string is qualified, the subsequent steps are performed.
4. The method according to claim 3, characterized in that If the grammatical analysis result of the sub-rule text string is qualified, before determining whether any first element contained in the sub-rule text string is different from any element contained in the current feature matching rule tree, the method further includes: The first element is used as the first child node included in the sub-rule tree corresponding to the sub-rule text string, the target first logical relationship word is used as the second child node included in the sub-rule tree, and the first child node and the second child node that have an association relationship in the sub-rule text string are connected to establish a sub-rule tree corresponding to the sub-rule text string; based on the sub-rule tree, subsequent steps are performed for the first child node corresponding to any first element included in the sub-rule tree corresponding to the sub-rule text string, to determine whether the first element of the first child node is different from the elements of any node included in the current feature matching rule tree.
5. The method according to claim 4, characterized in that After the sub-rule tree corresponding to the sub-rule text string is established, before the subsequent step of determining, based on the sub-rule tree, whether the first element of the first sub-node corresponding to any first element contained in the sub-rule tree corresponding to the sub-rule text string is different from the elements of any node contained in the current feature matching rule tree, the method further includes: Based on the preset predicate deduction algorithm and sub-node sorting rules, the sub-nodes and the sorting order of the sub-nodes contained in the sub-rule tree are sorted.
6. The method according to claim 1, characterized in that The first element includes: a singleton element or a derived element.
7. A feature matching method, characterized in that: The method comprises: receiving account characteristic data, and determining each third element contained in the account characteristic data and a third logical relational word associated with the third element; According to the correspondence between each rule identification information and the elements and logical relationship words contained in the feature matching rule tree constructed based on any one of the methods of claims 1 to 6, determine the target rule identification information that matches each third element and the third logical relationship word associated with the third element; The target result value corresponding to the preset target rule identification information is determined as the result value applicable to the account characteristic data.
8. The method according to claim 7, characterized in that The determining, according to the correspondence between each rule identification information contained in the feature matching rule tree and the elements and the logical relationship words, of the target rule identification information matching each third element and the third logical relationship words associated with the third element comprises: For each node corresponding to any rule identification information, determine whether the node is a common node of the rule identification information and other rule identification information or a node in a common node group; If so, and if matching information of the common node or common node group with other rule identification information for the account feature data is currently saved, the matching information is directly used as matching information of the common node or common node group to which the node belongs for the account feature data; if matching information of the common node or common node group with other rule identification information for the account feature data is not currently saved, the node or the common node group to which the node belongs is matched with the corresponding third element and / or third logical relational word in the account feature data, and the matching information of the common node or the common node group to which the node belongs for the account feature data is determined and saved; If not, matching the node with the corresponding third element or third logical relation word in the account feature data to determine matching information of the node to the account feature data; Matching information of each node corresponding to the rule identification information to the account feature data is all matched rule identification information, and is determined as the target rule identification information.
9. The method according to claim 7, characterized in that: The determining, according to the correspondence between each rule identification information contained in the feature matching rule tree and the elements and the logical relationship words, of the target rule identification information matching each third element and the third logical relationship words associated with the third element comprises: According to the order of priority preset for each rule identification information contained in the feature matching rule tree, the target rule identification information that matches each third element and the third logical relationship word associated with the third element is determined according to the correspondence between each rule identification information and the element and the logical relationship word.
10. A feature matching rule construction device, characterized in that: The device comprises: A first determination module is used to determine, for each received sub-rule text string, each first element contained in the sub-rule text string and a first logical relationship word associated with the first element; A construction module is used to determine, for any first element contained in the sub-rule text string, whether the first element is different from any element contained in the current feature matching rule tree; if so, establish a first node corresponding to the first element in the current feature matching rule tree; identify a target first logical relationship word associated with the first element in the sub-rule text string, establish a second node corresponding to the target first logical relationship word in the current feature matching rule tree, connect the first node and the second node, and save the corresponding relationship between the rule identification information of the sub-rule text string and the first element and the target first logical relationship word; The construction module is further configured to determine, if the first element is the same as a second element of the target sub-rule text string included in the current feature matching rule tree, whether a second logical relationship word connected to the second element in the current feature matching rule tree is the same as a target first logical relationship word associated with the first element in the sub-rule text string; If so, the node group consisting of the node corresponding to the second element and the node corresponding to the second logical relationship word in the current feature matching rule tree is determined as the common node group of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; the correspondence between the rule identification information of the sub-rule text string and the second element and the second logical relationship word is saved; If not, the node corresponding to the second element in the current feature matching rule tree is determined as the common node of the rule identification information of the sub-rule text string and the rule identification information of the target sub-rule text string; a second node corresponding to the target first logical relationship word is established in the current feature matching rule tree, and the second node is connected to the node corresponding to the second element, and the correspondence between the rule identification information of the sub-rule text string and the second element and the target first logical relationship word is saved.
11. A feature matching device, characterized in that: The device comprises: A second determination module is used to receive the account characteristic data, and determine each third element contained in the account characteristic data and a third logical relationship word associated with the third element; A third determination module, for determining target rule identification information matching each third element and a third logical relationship word associated with the third element according to the correspondence between each rule identification information and the element and the logical relationship word contained in the feature matching rule tree constructed based on any one of the methods described in claims 1-6; The fourth determination module is used to determine the target result value corresponding to the preset target rule identification information as the result value applicable to the account characteristic data.
12. An electronic device, characterized in that: The electronic device comprises at least a processor and a memory, and the processor is used to implement the steps of the feature matching rule construction method as described in any one of claims 1 to 6 when executing the computer program stored in the memory, or to implement the steps of the feature matching method as described in any one of claims 7 to 9.
13. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the steps of the feature matching rule construction method as described in any one of claims 1 to 6, or implements the steps of the feature matching method as described in any one of claims 7 to 9.
