Classification label identification method and device, computer equipment and storage medium
By combining the configuration rule library and the tag identification model, label identification of the original data of classification is solved, and the problem of insufficient generalization ability of rule-based identification methods in the prior art is achieved, more efficient classification tag identification is achieved, and identification costs are reduced.
Patent Information
- Application Number
- CN202411762870.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-04-11
AI Technical Summary
In the existing natural language processing technology, the rule-based classification label recognition method lacks generalization ability when facing complex and changeable text data, and relies on a large amount of labeled data and appropriate feature representation, resulting in high recognition cost.
By combining the configuration rule base and the tag identification model, the original data to be classified is obtained and tag identification is performed. The specific steps include: initial label identification of the original data according to the configuration rule base to obtain the configuration hit tag set; input the original data into the tag to identify the model to obtain the model hit tag set; calculate the configuration result weight and model result weight of each tag; and finally select the target classification tag from the configuration hit tag set and model hit tag set.
On the premise of ensuring that the recognition cost is not high, the generalization ability of classification label recognition is improved, the dependence on a large amount of labeled data is reduced, and the advantages of rule recognition and model recognition are combined.
Smart Images

Figure CN119807647A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a classification label recognition method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] Currently, in the process of natural language processing, it is usually necessary to identify the labels of the data to be processed and then perform classification processing based on the identified labels.
[0003] In related technologies, classification labels are usually identified based on preset rules. Rule-based recognition methods rely on a set of manually defined rules. These rules may be based on specific patterns, vocabulary or grammatical structures of the text. Through pre-defined rules, labels in the text are identified based on the results of rule matching.
[0004] However, rule-based recognition methods may face challenges in rule writing and maintenance, especially when faced with complex and changeable text data, which requires constant updating and adjustment of rule sets. This makes such methods less generalizable. If a recognition model is used to identify classification labels, the recognition capability depends on a large amount of annotated data and appropriate feature representation, which will greatly increase the cost of label recognition. Summary of the invention
[0005] Based on this, it is necessary to provide a classification label recognition method, device, computer equipment, computer-readable storage medium and computer program product to improve the generalization ability of classification label recognition while ensuring that the recognition cost of classification labels is not too high, in response to the above technical problems.
[0006] In a first aspect, the present application provides a classification label recognition method, comprising:
[0007] Obtaining the original data to be classified and the preset configuration rule library;
[0008] Performing label recognition on the raw data to be classified according to the configuration rule base to obtain a configuration hit label set;
[0009] Inputting the raw data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels;
[0010] According to the configuration hit tag set and the model hit tag set, calculating the configuration result weight and the model result weight corresponding to each tag;
[0011] According to the configuration result weight and the model result weight, a target classification label is selected from the configuration hit label set and the model hit label set.
[0012] In one embodiment, the configuration rule base includes a plurality of regular expressions and classification labels corresponding to the regular expressions; the label recognition of the raw data to be classified according to the configuration rule base to obtain a configuration hit label set includes:
[0013] Matching the original data to be classified with each of the regular expressions one by one, and using the hit classification label as the configuration hit label;
[0014] Counting the number of hits of each configuration hit tag;
[0015] A configuration hit tag set is constructed according to the configuration hit tags and the corresponding hit times.
[0016] In one embodiment, the step of inputting the raw data to be classified into a label recognition model to obtain a model hit label set includes:
[0017] Inputting the raw data to be classified into a label recognition model to obtain at least one model hit label;
[0018] Counting the number of hits of each model hit label;
[0019] A model hit label set is constructed according to the model hit labels and the corresponding hit counts.
[0020] In one embodiment, the step of calculating the configuration result weight and the model result weight corresponding to each tag according to the configuration hit tag set and the model hit tag set includes:
[0021] For each of the configuration hit tags, calculate the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set to obtain a configuration result weight;
[0022] For each of the model hit tags, the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set is calculated to obtain the model result weight.
[0023] In one embodiment, selecting a target classification label from the configuration hit label set and the model hit label set according to the configuration result weight and the model result weight includes:
[0024] Respectively obtaining classification recognition coefficients of the configuration hit label set and the model hit label set;
[0025] For the tags in the configuration hit tag set, calculating the candidate tag weight according to the corresponding classification recognition coefficient and the configuration result weight;
[0026] For the labels in the model hit label set, calculating the candidate label weights according to the corresponding classification recognition coefficients and the model result weights;
[0027] A target classification label is selected according to the candidate label weights of each label in the configuration hit label set and the model hit label set.
[0028] In one embodiment, selecting a target classification label according to the candidate label weights of each label in the configuration hit label set and the model hit label set includes:
[0029] Sorting the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set to obtain a weight sorting result;
[0030] Selecting a preset number of labels as target classification labels according to the weight sorting result;
[0031] The method further comprises:
[0032] The classification result of the original data to be classified is determined according to the target classification label.
[0033] In a second aspect, the present application also provides a classification label recognition device, comprising:
[0034] A data acquisition module is used to acquire the original data to be classified and a preset configuration rule library;
[0035] A label recognition module is used to perform label recognition on the raw data to be classified according to the configuration rule base to obtain a configuration hit label set; input the raw data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels;
[0036] A weight determination module, used to calculate the configuration result weight and the model result weight corresponding to each tag according to the configuration hit tag set and the model hit tag set;
[0037] The label selection module is used to select a target classification label from the configuration hit label set and the model hit label set according to the configuration result weight and the model result weight.
[0038] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0039] Obtaining the original data to be classified and the preset configuration rule library;
[0040] Performing label recognition on the raw data to be classified according to the configuration rule base to obtain a configuration hit label set;
[0041] Inputting the raw data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels;
[0042] According to the configuration hit tag set and the model hit tag set, calculating the configuration result weight and the model result weight corresponding to each tag;
[0043] According to the configuration result weight and the model result weight, a target classification label is selected from the configuration hit label set and the model hit label set.
[0044] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0045] Obtaining the original data to be classified and the preset configuration rule library;
[0046] Performing label recognition on the raw data to be classified according to the configuration rule base to obtain a configuration hit label set;
[0047] Inputting the raw data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels;
[0048] According to the configuration hit tag set and the model hit tag set, calculating the configuration result weight and the model result weight corresponding to each tag;
[0049] According to the configuration result weight and the model result weight, a target classification label is selected from the configuration hit label set and the model hit label set.
[0050] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0051] Obtaining the original data to be classified and the preset configuration rule library;
[0052] Performing label recognition on the raw data to be classified according to the configuration rule base to obtain a configuration hit label set;
[0053] Inputting the raw data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels;
[0054] According to the configuration hit tag set and the model hit tag set, calculating the configuration result weight and the model result weight corresponding to each tag;
[0055] According to the configuration result weight and the model result weight, a target classification label is selected from the configuration hit label set and the model hit label set.
[0056] The above-mentioned classification label recognition method, device, computer equipment, storage medium and computer program product can perform label recognition on the original data to be classified according to the configuration rule library by acquiring the original data to be classified and the preset configuration rule library, obtain a configuration hit label set, and then input the original data to be classified into the label recognition model to obtain a model hit label set. The configuration rule recognition method and the model recognition method are combined, which can not only improve the generalization ability of label recognition through the label recognition model, but also retain the advantages of the configuration rule recognition method, reduce the recognition process The dependence on a large amount of labeled data, calculate the configuration result weight and model result weight corresponding to each label according to the configuration hit label set and the model hit label set, calculate the weights of the two through the recognition results, and then select the target classification label from the configuration hit label set and the model hit label set according to the configuration result weight and the model result weight, which can improve the generalization ability of classification label recognition while ensuring that the recognition cost of the classification label is not too high. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0058] Figure 1 A diagram of an application environment of a classification label recognition method in an embodiment;
[0059] Figure 2 A schematic diagram of a flow chart of a classification label recognition method in one embodiment;
[0060] Figure 3 This is a flow chart of step S208 of the classification label identification method in one embodiment;
[0061] Figure 4 It is a structural block diagram of a classification label recognition device in one embodiment;
[0062] Figure 5 is an internal structure diagram of a computer device in one embodiment;
[0063] Figure 6FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0065] The classification label recognition method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network, and the terminal 102 can be used to obtain the configuration rule base data preset by the administrator, and send the configuration rule base to the server 104 for storage. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The data storage system can be used to store raw data to be classified, as well as data such as the preset configuration rule base. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0066] In an exemplary embodiment, Figure 2 As shown, a classification label recognition method is provided, which can be used for classification label recognition in multimedia data fields such as text data, image data, video data, etc., and can also be used for classification label recognition in weather data and climate fields. Figure 1 The server 104 in the example is used as an example to illustrate the method, which includes the following steps S202 to S208. Among them:
[0067] Step S202, obtaining the original data to be classified and a preset configuration rule library.
[0068] The configuration rule base may include multiple regular expressions and classification labels corresponding to the regular expressions.
[0069] For example, in the process of text classification, the server 104 may first need to prepare the raw data to be classified, which may be unprocessed natural language text, such as comments, articles or conversations input by users. Prior to this, the server 104 may pre-set a configuration rule library, which includes multiple regular expressions and classification labels corresponding to each regular expression, and its function is to match the manually defined rules with the text to be classified. By combining these preset rules with the raw data, the server 104 can preliminarily determine the classification label of the text according to the matching results for subsequent classification tasks.
[0070] Step S204, performing label recognition on the raw data to be classified according to the configuration rule library to obtain a configuration hit label set; inputting the raw data to be classified into a label recognition model to obtain a model hit label set.
[0071] Among them, the label recognition model is trained based on historical classification data and historical classification labels.
[0072] Exemplarily, the server 104 may match the original data to be classified with each regular expression one by one, and use the hit classification label as the configuration hit label; count the hit times of each configuration hit label; and construct a configuration hit label set according to the configuration hit labels and the corresponding hit times.
[0073] Furthermore, when processing the raw data to be classified, the server 104 can match these data with the regular expressions in the configuration rule base in turn. For example, there is a regular expression "weather" in the configuration rule base, and its corresponding classification label is "meteorology", and another regular expression "traffic" corresponds to the classification label "travel". If the raw data contains "today's weather is very good", then the server 104 can match the regular expression "weather" and record "meteorology" as a hit classification label. Subsequently, the server 104 can count the number of occurrences of each hit label, for example, the "meteorology" label hits 2 times, and the "travel" label hits 1 time. Based on these statistical results, the server 104 will construct a set containing all hit labels and their hit times, such as: {"meteorology": 2, "travel": 1}. This set is the configuration hit label set, which provides a basis for subsequent classification decisions.
[0074] Exemplarily, the server 104 may input the raw data to be classified into a label recognition model to obtain at least one model hit label; count the number of hits of each model hit label; and construct a model hit label set according to the model hit labels and the corresponding number of hits.
[0075] Furthermore, the server 104 can input the raw data to be classified into a pre-trained label recognition model, and the model will analyze the input data and identify at least one label related to the text. For example, assuming that the input data is "the wind speed is very strong on the mountain", the model identifies two labels: "geography" and "meteorology". Subsequently, the server 104 can count the number of hits of these labels. For example, the "geography" label is judged by the model to be more likely to be related to the input data, and is hit 2 times, while the "meteorology" label has a slightly weaker correlation and is hit 1 time. Based on these statistical results, the server 104 constructs a model hit label set, for example: {"geography": 2, "meteorology": 1}. This label set reflects the model's classification results of the raw data and the degree of correlation between each label, providing a basis for subsequent classification weight fusion.
[0076] Step S206, calculating the configuration result weight and the model result weight corresponding to each tag according to the configuration hit tag set and the model hit tag set.
[0077] Exemplarily, server 104 can calculate, for each configuration hit tag, the ratio of the number of hits to the sum of the number of hits of all tags in the configuration hit tag set and the model hit tag set to obtain the configuration result weight; for each model hit tag, calculate the ratio of the number of hits to the sum of the number of hits of all tags in the configuration hit tag set and the model hit tag set to obtain the model result weight.
[0078] Furthermore, the server 104 may perform weight calculation on each configuration hit tag, and similarly, the server 104 may also calculate weight on each model hit tag. For example, assuming that the configuration hit tag set is {"geography": 3, "weather": 2}, the total number of hits in the configuration hit tag set is 5; the model hit tag set is {"geography": 3, "animals and plants": 7}, and the total number of hits in the model hit tag set is 10.
[0079] For the "geography" tag, the number of hits of its configuration rules is 3, and the number of hits of model recognition is 3, so the calculated weight of its configuration result is 60%, and the weight of the model result is 30%; for the "weather" tag, the number of hits of the configuration rules is 2, so the calculated weight of its configuration result is 40%; for the "animals and plants" tag, the number of hits of its model recognition is 7, so the calculated weight of its model result is 70%.
[0080] Step S208, selecting a target classification label from the configuration hit label set and the model hit label set according to the configuration result weight and the model result weight.
[0081] Exemplarily, the server 104 may sort the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set to obtain a weight sorting result, and select a preset number of tags as target classification tags according to the weight sorting result.
[0082] Furthermore, the server 104 may also determine the classification result of the original data to be classified according to the target classification label.
[0083] In the above classification label recognition method, by obtaining the original data to be classified and the preset configuration rule library, the label recognition can be performed on the original data to be classified according to the configuration rule library to obtain the configuration hit label set, and then the original data to be classified is input into the label recognition model to obtain the model hit label set. The configuration rule recognition method and the model recognition method are combined, which can not only improve the generalization ability of label recognition through the label recognition model, but also retain the advantages of the configuration rule recognition method, reduce the recognition process The dependence on a large amount of labeled data, calculate the configuration result weight and model result weight corresponding to each label according to the configuration hit label set and the model hit label set, calculate the weights of the two through the recognition result, and then select the target classification label from the configuration hit label set and the model hit label set according to the configuration result weight and the model result weight, which can improve the generalization ability of classification label recognition while ensuring that the recognition cost of the classification label is not too high.
[0084] In an exemplary embodiment, Figure 3 As shown, step S208 includes steps S302 to S308. Among them:
[0085] Step S302, respectively obtain the classification recognition coefficients of the configuration hit label set and the model hit label set.
[0086] Exemplarily, the server 104 can obtain the preset classification recognition coefficients corresponding to the configuration rule recognition and the model recognition respectively at the beginning of the tag recognition task. The server 104 can directly obtain the classification recognition coefficient input by the user or administrator from the terminal 102, or obtain the classification recognition coefficient from other servers. The other servers can calculate the classification recognition coefficient based on historical recognition data.
[0087] Step S304, for the labels in the configuration hit label set, the candidate label weights are calculated according to the corresponding classification recognition coefficients and the configuration result weights; for the labels in the model hit label set, the candidate label weights are calculated according to the corresponding classification recognition coefficients and the model result weights.
[0088] Among them, the classification recognition coefficient may vary according to different labels in addition to varying according to the recognition method. In this embodiment, the classification recognition coefficient varies according to the recognition method as an example. It is assumed that the classification recognition coefficient of the configuration rule recognition method is 70% and the classification recognition coefficient of the model recognition method is 30%.
[0089] Exemplarily, the server 104 can further calculate the final weight of each tag based on the tags in the configuration hit tag set and the model hit tag set, combined with the corresponding classification recognition coefficient and the respective result weights. For the tags in the configuration hit tag set, the server 104 can calculate the weight of the candidate tag based on the classification recognition coefficient of each tag and the configuration result weight. For example, assuming that the configuration result weight of the tag "geography" in rule identification is 60%, and its corresponding classification recognition coefficient is 70%, the server 104 can multiply these two values to obtain a candidate tag weight of 60%*70%=42% for the tag "geography". Similarly, for the tag "meteorology", if its classification recognition coefficient is 70% and the configuration result weight is 40%, the candidate tag weight is 70%*40% = 28%.
[0090] Step S306, for the labels in the model hit label set, the candidate label weights are calculated according to the corresponding classification recognition coefficients and the model result weights.
[0091] Exemplarily, server 104 can perform similar calculations on the tags in the model hit tag set. Assuming that the result weight of the tag "animals and plants" in the model recognition is 70%, and its corresponding classification recognition coefficient is 30%, server 104 can calculate that the candidate tag weight of "animals and plants" is 70%*30%=21%. For the tag "geography", the model result weight is 30%, and its corresponding classification recognition coefficient is 30%, then the candidate tag weight is 30%*30%=9%. In this way, server 104 calculates the final candidate tag weights based on rule and model recognition for each tag. These weights combine the classification recognition coefficient, rule recognition results, and model recognition results, thereby more accurately reflecting the importance of each tag in the final classification decision.
[0092] Step S308, selecting a target classification label according to the candidate label weights of each label in the configuration hit label set and the model hit label set.
[0093] For example, according to the above example, the server 104 can calculate the sum of the weights of the candidate tags in the configuration hit tag set and the model hit tag set for each tag, and thus select the target classification tag according to the sum of the weights. For example, if the candidate tag weight of the tag "geography" in the configuration hit tag set is 42%, and the candidate tag weight in the model hit tag set is 9%, then the sum of their weights can be calculated to be 51%.
[0094] Finally, the server 104 may calculate the sum of the weights of all the tags respectively, and select the tag with the highest weight as the target classification tag, thereby obtaining the text classification result.
[0095] In another exemplary embodiment, service 104 obtains the original data to be classified and a preset configuration rule library, matches the original data to be classified with each regular expression one by one, uses the hit classification label as the configuration hit label, counts the hit times of each configuration hit label, and constructs a configuration hit label set according to the configuration hit labels and the corresponding hit times.
[0096] Correspondingly, server 104 inputs the original data to be classified into the label recognition model trained according to the historical classification data and historical classification labels, obtains at least one model hit label, counts the number of hits of each model hit label, and constructs a model hit label set according to the model hit labels and the corresponding number of hits.
[0097] Subsequently, the server 104 calculates the ratio of the number of hits to the sum of the number of hits of all labels in the configuration hit label set and the model hit label set for each configuration hit label, and obtains the configuration result weight, and calculates the ratio of the number of hits to the sum of the number of hits of all labels in the configuration hit label set and the model hit label set for each model hit label, and obtains the model result weight. Next, the server 104 obtains the classification recognition coefficients of the configuration hit label set and the model hit label set respectively; for the labels in the configuration hit label set, the candidate label weights are calculated according to the corresponding classification recognition coefficients and the configuration result weights; for the labels in the model hit label set, the candidate label weights are calculated according to the corresponding classification recognition coefficients and the model result weights, and finally the target classification label is selected according to the candidate label weights of each label in the configuration hit label set and the model hit label set.
[0098] Finally, server 104 sorts the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set to obtain a weight sorting result, and then selects a preset number of tags as target classification tags based on the weight sorting result, and finally determines the classification result of the original data to be classified based on the target classification tags.
[0099] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0100] Based on the same inventive concept, the embodiment of the present application also provides a classification label recognition device for implementing the classification label recognition method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more classification label recognition device embodiments provided below can refer to the limitations of the classification label recognition method above, and will not be repeated here.
[0101] In an exemplary embodiment, Figure 4 As shown, a classification label recognition device is provided, including: a data acquisition module 402, a label recognition module 404, a weight determination module 406 and a label selection module 408, wherein:
[0102] The data acquisition module 402 is used to acquire the original data to be classified and the preset configuration rule library;
[0103] The label recognition module 404 is used to perform label recognition on the raw data to be classified according to the configuration rule library to obtain a configuration hit label set; input the raw data to be classified into the label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels;
[0104] The weight determination module 406 is used to calculate the configuration result weight and the model result weight corresponding to each tag according to the configuration hit tag set and the model hit tag set;
[0105] The label selection module 408 is used to select a target classification label from the configuration hit label set and the model hit label set according to the configuration result weight and the model result weight.
[0106] In one embodiment, the configuration rule base includes a plurality of regular expressions and classification labels corresponding to the regular expressions; the label identification module 404 includes:
[0107] The first recognition unit is used to match the original data to be classified with each regular expression one by one, and use the hit classification label as the configuration hit label; count the hit times of each configuration hit label; and construct a configuration hit label set according to the configuration hit label and the corresponding hit times.
[0108] In one embodiment, the tag identification module 404 further includes:
[0109] The second recognition unit is used to input the original data to be classified into the label recognition model to obtain at least one model hit label; count the number of hits of each model hit label; and construct a model hit label set according to the model hit labels and the corresponding number of hits.
[0110] In one of the embodiments, the weight determination module 406 is specifically used to: for each configuration hit tag, calculate the ratio of the number of hits to the sum of the number of hits of all tags in the configuration hit tag set and the model hit tag set to obtain the configuration result weight; for each model hit tag, calculate the ratio of the number of hits to the sum of the number of hits of all tags in the configuration hit tag set and the model hit tag set to obtain the model result weight.
[0111] In one of the embodiments, the label selection module 408 is specifically used to: obtain the classification recognition coefficients of the configuration hit label set and the model hit label set respectively; for the labels in the configuration hit label set, calculate the candidate label weights according to the corresponding classification recognition coefficients and the configuration result weights; for the labels in the model hit label set, calculate the candidate label weights according to the corresponding classification recognition coefficients and the model result weights; select the target classification label according to the candidate label weights of each label in the configuration hit label set and the model hit label set.
[0112] In one of the embodiments, the label selection module 408 is also used to: sort the candidate label weights of each label in the configuration hit label set and the model hit label set to obtain a weight sorting result; select a preset number of labels as target classification labels according to the weight sorting result; and determine the classification results of the original data to be classified according to the target classification labels.
[0113] Each module in the above classification label recognition device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0114] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 5As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store raw data to be classified, as well as data such as a preset configuration rule base. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a classification label recognition method is implemented.
[0115] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a classification label recognition method is realized. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0116] Those skilled in the art will understand that Figure 6The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0117] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining original data to be classified and a preset configuration rule library; performing label recognition on the original data to be classified according to the configuration rule library to obtain a configuration hit label set; inputting the original data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels; calculating the configuration result weight and the model result weight corresponding to each label based on the configuration hit label set and the model hit label set; and selecting a target classification label from the configuration hit label set and the model hit label set based on the configuration result weight and the model result weight.
[0118] In one embodiment, when the processor executes the computer program, the following steps are also implemented: matching the original data to be classified with each regular expression one by one, and using the hit classification label as the configuration hit label; counting the number of hits of each configuration hit label; and constructing a configuration hit label set according to the configuration hit label and the corresponding number of hits.
[0119] In one embodiment, when the processor executes the computer program, the following steps are also implemented: inputting the original data to be classified into the label recognition model to obtain at least one model hit label; counting the number of hits of each model hit label; and constructing a model hit label set based on the model hit labels and the corresponding number of hits.
[0120] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each configuration hit tag, the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set is calculated to obtain the configuration result weight; for each model hit tag, the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set is calculated to obtain the model result weight.
[0121] In one embodiment, when the processor executes the computer program, the following steps are also implemented: respectively obtaining the classification recognition coefficients of the configuration hit tag set and the model hit tag set; for the tags in the configuration hit tag set, calculating the candidate tag weights according to the corresponding classification recognition coefficients and the configuration result weights; for the tags in the model hit tag set, calculating the candidate tag weights according to the corresponding classification recognition coefficients and the model result weights; and selecting the target classification tag according to the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set.
[0122] In one embodiment, when the processor executes the computer program, the following steps are also implemented: sorting the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set to obtain a weight sorting result; selecting a preset number of tags as target classification tags according to the weight sorting result; and determining the classification result of the original data to be classified according to the target classification tag.
[0123] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining raw data to be classified and a preset configuration rule library; performing label recognition on the raw data to be classified according to the configuration rule library to obtain a configuration hit label set; inputting the raw data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels; calculating the configuration result weight and the model result weight corresponding to each label based on the configuration hit label set and the model hit label set; and selecting a target classification label from the configuration hit label set and the model hit label set based on the configuration result weight and the model result weight.
[0124] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: matching the original data to be classified with each regular expression one by one, and using the hit classification label as the configuration hit label; counting the number of hits of each configuration hit label; and constructing a configuration hit label set based on the configuration hit labels and the corresponding number of hits.
[0125] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: inputting the original data to be classified into the label recognition model to obtain at least one model hit label; counting the number of hits of each model hit label; and constructing a model hit label set based on the model hit labels and the corresponding number of hits.
[0126] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each configuration hit tag, the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set is calculated to obtain the configuration result weight; for each model hit tag, the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set is calculated to obtain the model result weight.
[0127] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: respectively obtaining the classification recognition coefficients of the configuration hit tag set and the model hit tag set; for the tags in the configuration hit tag set, calculating the candidate tag weights according to the corresponding classification recognition coefficients and the configuration result weights; for the tags in the model hit tag set, calculating the candidate tag weights according to the corresponding classification recognition coefficients and the model result weights; and selecting the target classification tag according to the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set.
[0128] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: sorting the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set to obtain a weight sorting result; selecting a preset number of tags as target classification tags based on the weight sorting result; and determining the classification results of the original data to be classified based on the target classification tags.
[0129] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: obtaining raw data to be classified and a preset configuration rule library; performing label recognition on the raw data to be classified according to the configuration rule library to obtain a configuration hit label set; inputting the raw data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels; calculating the configuration result weight and model result weight corresponding to each label based on the configuration hit label set and the model hit label set; and selecting a target classification label from the configuration hit label set and the model hit label set based on the configuration result weight and the model result weight.
[0130] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: matching the original data to be classified with each regular expression one by one, and using the hit classification label as the configuration hit label; counting the number of hits of each configuration hit label; and constructing a configuration hit label set based on the configuration hit labels and the corresponding number of hits.
[0131] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: inputting the original data to be classified into the label recognition model to obtain at least one model hit label; counting the number of hits of each model hit label; and constructing a model hit label set based on the model hit labels and the corresponding number of hits.
[0132] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each configuration hit tag, the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set is calculated to obtain the configuration result weight; for each model hit tag, the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set is calculated to obtain the model result weight.
[0133] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: respectively obtaining the classification recognition coefficients of the configuration hit tag set and the model hit tag set; for the tags in the configuration hit tag set, calculating the candidate tag weights according to the corresponding classification recognition coefficients and the configuration result weights; for the tags in the model hit tag set, calculating the candidate tag weights according to the corresponding classification recognition coefficients and the model result weights; and selecting the target classification tag according to the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set.
[0134] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: sorting the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set to obtain a weight sorting result; selecting a preset number of tags as target classification tags based on the weight sorting result; and determining the classification results of the original data to be classified based on the target classification tags.
[0135] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0136] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0137] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0138] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A classification label recognition method, characterized in that: The method comprises: Obtaining the original data to be classified and the preset configuration rule library; Performing label recognition on the raw data to be classified according to the configuration rule base to obtain a configuration hit label set; Inputting the raw data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels; According to the configuration hit tag set and the model hit tag set, calculating the configuration result weight and the model result weight corresponding to each tag; According to the configuration result weight and the model result weight, a target classification label is selected from the configuration hit label set and the model hit label set.
2. The method according to claim 1, characterized in that The configuration rule base includes a plurality of regular expressions and classification labels corresponding to the regular expressions; The step of performing label recognition on the raw data to be classified according to the configuration rule base to obtain a configuration hit label set includes: Matching the original data to be classified with each of the regular expressions one by one, and using the hit classification label as the configuration hit label; Counting the number of hits of each configuration hit tag; A configuration hit tag set is constructed according to the configuration hit tags and the corresponding hit times.
3. The method according to claim 2, characterized in that The step of inputting the raw data to be classified into a label recognition model to obtain a model hit label set includes: Inputting the raw data to be classified into a label recognition model to obtain at least one model hit label; Counting the number of hits of each model hit label; A model hit label set is constructed according to the model hit labels and the corresponding hit counts.
4. The method according to claim 3, characterized in that The calculating, according to the configuration hit tag set and the model hit tag set, the configuration result weight and the model result weight corresponding to each tag includes: For each of the configuration hit tags, calculate the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set to obtain a configuration result weight; For each of the model hit tags, the ratio of the hit count to the sum of the hit counts of all tags in the configuration hit tag set and the model hit tag set is calculated to obtain the model result weight.
5. The method according to any one of claims 1 to 4, characterized in that: The selecting a target classification label from the configuration hit label set and the model hit label set according to the configuration result weight and the model result weight includes: Respectively obtaining classification recognition coefficients of the configuration hit label set and the model hit label set; For the tags in the configuration hit tag set, calculating the candidate tag weight according to the corresponding classification recognition coefficient and the configuration result weight; For the labels in the model hit label set, calculating the candidate label weights according to the corresponding classification recognition coefficients and the model result weights; A target classification label is selected according to the candidate label weights of each label in the configuration hit label set and the model hit label set.
6. The method according to claim 5, characterized in that The selecting a target classification label according to the candidate label weights of each label in the configuration hit label set and the model hit label set includes: Sorting the candidate tag weights of each tag in the configuration hit tag set and the model hit tag set to obtain a weight sorting result; Selecting a preset number of labels as target classification labels according to the weight sorting result; The method further comprises: The classification result of the original data to be classified is determined according to the target classification label.
7. A classification label recognition device, characterized in that: The device comprises: A data acquisition module is used to acquire the original data to be classified and a preset configuration rule library; A label recognition module is used to perform label recognition on the raw data to be classified according to the configuration rule base to obtain a configuration hit label set; input the raw data to be classified into a label recognition model to obtain a model hit label set; wherein the label recognition model is trained based on historical classification data and historical classification labels; A weight determination module, used to calculate the configuration result weight and the model result weight corresponding to each tag according to the configuration hit tag set and the model hit tag set; The label selection module is used to select a target classification label from the configuration hit label set and the model hit label set according to the configuration result weight and the model result weight.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.