Sensitive data labeling method and device based on natural language processing and storage medium
By using multiple label classification models and attribute information evaluation methods, the problem that regular expressions cannot cover all business situations is solved, and high-precision and low-cost sensitive data labeling is achieved.
Patent Information
- Application Number
- CN202410818751.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-06-24
AI Technical Summary
In existing technologies, regular expressions are difficult to cover complex and diverse data types and rapidly changing business scenarios, resulting in low accuracy of sensitive data annotation and high maintenance costs.
At least two label classification models are used to classify sensitive data, and the accuracy of the label classification results is evaluated based on the attribute information of the sensitive data in the database. Labeling is only performed when the preset standard is met.
It improves the accuracy of sensitive data labeling, adapts to complex and diverse data types and rapidly changing business scenarios, and reduces maintenance costs.
Smart Images

Figure CN119150340B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data security, and in particular to a sensitive data labeling method and device based on natural language processing and a storage medium. BACKGROUND
[0002] In today's digital age, data security has become an important issue for enterprises and organizations. With the continuous expansion of data size and the diversification of data types, classifying and labeling sensitive data has become increasingly critical. The leakage of sensitive data can lead to serious legal liability, reputation loss, and financial loss. In the face of massive data, how to quickly and accurately label sensitive data is a technical problem that needs to be solved.
[0003] Currently, regular expression matching is usually used to label sensitive data. However, in this approach, the definition of regular expressions is mainly based on rules developed based on human experience and prior knowledge. In the face of complex and diverse data types and rapidly changing business scenarios, this rule is difficult to cover all cases, which affects the labeling accuracy of sensitive data. SUMMARY
[0004] Therefore, the present application provides a sensitive data labeling method and device based on natural language processing and a storage medium, which can improve the labeling accuracy of sensitive data.
[0005] According to a first aspect of the present application, a sensitive data labeling method based on natural language processing is provided, which comprises:
[0006] Obtaining sensitive data to be labeled and attribute information of the sensitive data in a database;
[0007] Using at least two label classification models to classify the labels of the sensitive data respectively, to obtain label classification results corresponding to the at least two label classification models;
[0008] According to the label classification results, the number of labels of the sensitive data belonging to a target label is counted;
[0009] According to the attribute information and the number of labels of the target label, the accuracy of the label classification results is evaluated;
[0010] If the accuracy of the label classification results reaches a preset standard, the labeling label corresponding to the sensitive data is determined according to the number of labels of the target label, and the sensitive data is labeled.
[0011] According to a second aspect of the present application, a sensitive data labeling device based on natural language processing is provided, which comprises:
[0012] The acquisition unit is configured to acquire sensitive data to be labeled and attribute information of the sensitive data in a database.
[0013] The classification unit is configured to respectively perform label classification on the sensitive data by using at least two label classification models to obtain label classification results corresponding to the at least two label classification models.
[0014] The statistical unit is configured to count a label quantity of the sensitive data belonging to a target label according to the label classification results.
[0015] The evaluation unit is configured to evaluate accuracy of the label classification results according to the attribute information and the label quantity of the target label.
[0016] The labeling unit is configured to determine a labeling label corresponding to the sensitive data according to the label quantity of the target label and label the sensitive data if the accuracy of the label classification results reaches a preset standard.
[0017] According to a third aspect of the present application, a storage medium having a computer program stored thereon is provided, and the program is executed by a processor to implement the above-mentioned sensitive data labeling method based on natural language processing.
[0018] According to a fourth aspect of the present application, an electronic device is provided, which includes a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, and the processor implements the above-mentioned sensitive data labeling method based on natural language processing when executing the program.
[0019] According to the above technical solutions, the present application provides a sensitive data labeling method, device and storage medium based on natural language processing. Firstly, at least two label classification models are used to respectively perform label classification on the sensitive data. Then, the accuracy of the label classification results is evaluated according to the attribute information of the sensitive data in the database. Finally, the sensitive data is automatically labeled according to the label classification results when the accuracy of the label classification results meets the requirements. As can be seen, the present application can adapt to complex and diverse data types and rapidly changing business scenarios by using label classification models to label sensitive data, thereby effectively solving the problem that regular expressions cannot cover all business situations and the maintenance cost is high, and further ensuring the labeling accuracy of sensitive data. In addition, the present application can further improve the labeling accuracy of sensitive data by using at least two label classification models to perform label classification on the sensitive data and evaluating the label classification results according to the attribute information of the sensitive data in the database.
[0020] The above description is only a summary of the technical solutions of the present application. In order to enable the technical means of the present application to be more clearly understood, and to be implemented according to the content of the description, and in order to enable the above and other purposes, characteristics and advantages of the present application to be more apparent and easy to understand, the following specific embodiments of the present application are described. BRIEF DESCRIPTION OF DRAWINGS
[0021] The accompanying drawings described herein are used to provide further understanding of the present application, and form a part of the present application. The schematic embodiments of the present application and the description thereof are used to explain the present application, and do not constitute an improper limitation on the present application. In the drawings:
[0022] Figure 1 A flowchart of a sensitive data labeling method based on natural language processing provided by an embodiment of the present application is shown;
[0023] Figure 2 A flowchart of another sensitive data labeling method based on natural language processing provided by an embodiment of the present application is shown;
[0024] Figure 3 A structural diagram of a sensitive data labeling device based on natural language processing provided by an embodiment of the present application is shown;
[0025] Figure 4 A structural diagram of another sensitive data labeling device based on natural language processing provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0026] In the following, the present application will be described in detail with reference to the drawings and in combination with the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0027] The definition of the regular expression is mainly based on the rules formulated based on artificial experience and prior knowledge. When facing complex and various data types and rapidly changing business scenarios, the rules are difficult to cover all cases, thereby affecting the labeling accuracy of sensitive data.
[0028] In order to solve the above problems, an embodiment of the present application provides a sensitive data labeling method based on natural language processing, as shown in the figure, the method comprises: Figure 1 as shown in the figure, the method comprises:
[0029] Step 101, obtaining sensitive data to be labeled and attribute information of the sensitive data in a database.
[0030] Among them, the sensitive data to be labeled includes personal identity information, financial data, medical record data, etc. The attribute information is the attribute name of the column or row where the sensitive data is located in the database, such as user name, ID number, etc.
[0031] The embodiment of the present application is mainly applicable to the scene of automatically labeling sensitive data. The execution subject of the embodiment of the present application is a device or equipment capable of automatically labeling sensitive data, which can be specifically arranged on the server side.
[0032] For the embodiment of the present application, the sensitive data to be labeled can be obtained from the database, and the attribute information of the corresponding row or column in the data table of the sensitive data can be obtained through the database query statement.
[0033] Step 102, using at least two label classification models to respectively label the sensitive data to obtain the label classification results corresponding to the at least two label classification models.
[0034] Among them, the at least two label classification models can include different types of label classification models, can include models trained by different training sets for the same type of classification model, and can also include combinations of different types of label classification models and models trained by different training sets. For example, A label classification model and B label classification model are two different types of label classification models, A1, A2 and A3 are three models of A label classification model trained by different training sets, and B1, B2 and B3 are three models of B label classification model trained by different training sets. The at least two label classification models include A1, A2 and A3, and B1, B2 and B3. In addition, the type of label classification model can be a logistic regression model, a decision tree model, a support vector machine model, a neural network model, a Bayesian classification model and a BERT model, etc. It should be noted that the type of label classification model in the embodiment of the present application is not limited to the above-mentioned model types, but can also be other model types. In addition, the label classification results output by each model include labels such as personal information, financial data and medical data, and the number and type of labels can be set according to actual business needs, which is not limited in the embodiment of the present application.
[0035] For example, the sensitive data is respectively input into A1, A2 and A3, and B1, B2 and B3 label classification models for label classification, and each label classification model can obtain a label classification result. The label classification results output by each label classification model can be the same or different.
[0036] Step 103, according to the label classification results, the number of labels of the sensitive data belonging to the target label is counted.
[0037] The target label is a label in the label library involved in the label classification result. For example, the labels in the label library include personal information, financial data, medical data, business secrets, and government secrets, the labels involved in the label classification result output by the label classification model include personal information, financial data, and medical data, and the personal information, financial data, and medical data are the target labels. In addition, the types of the target labels involved in the label classification result can be one, two, or more.
[0038] For example, the label classification results output by the label classification models A1, A2, A3, B1, B2, and B3 are personal information, financial data, medical data, medical data, personal information, and personal information, respectively. Therefore, it can be counted that the number of labels of sensitive data belonging to personal information is 3, the number of labels of sensitive data belonging to medical data is 2, and the number of labels of sensitive data belonging to financial data is 1.
[0039] Step 104: According to the attribute information and the number of labels of the target label, the accuracy of the label classification result is evaluated.
[0040] In addition, the types of the target labels involved in the label classification result can be one, two, or more.
[0041] For the embodiment of the present application, when the label classification result involves only one target label, the accuracy of the label classification result does not need to be evaluated, and the only target label is directly determined as the labeling label of the sensitive data; when the label classification result involves at least two target labels, the accuracy of the label classification result needs to be evaluated. When evaluating, the attribute information of the column or row where the sensitive data is located in the database and the number of labels of each target label can be combined to evaluate the accuracy of the label classification result. The closer each target label is to the attribute information, the better the label classification result of the model is, and vice versa. In addition, according to the number of labels of each target label, the number difference of any two target labels can be calculated. The larger the number difference is, the better the label classification result of the model is, and vice versa.
[0042] Step 105: If the accuracy of the label classification result reaches a preset standard, the labeling label corresponding to the sensitive data is determined according to the number of labels of the target label, and the sensitive data is labeled.
[0043] The preset standard can be set according to actual business needs.
[0044] For the embodiment of the application, if the accuracy of the label classification result does not reach the preset standard, the label classification result output by the model is not used; if the accuracy of the label classification result reaches the preset standard, the target label corresponding to the maximum label quantity can be selected as the labeling label of the sensitive data according to the label quantity of each target label, and finally the sensitive data is automatically annotated based on the labeling label.
[0045] The sensitive data labeling method based on natural language processing provided by the embodiment of the application can adapt to complex and diverse data types and rapidly changing business scenarios, thereby effectively solving the problem that a regular expression is difficult to cover all business cases and the maintenance cost is high, and further ensuring the labeling accuracy of sensitive data. In addition, the application can further improve the labeling accuracy of sensitive data by using at least two label classification models to classify the labels of the sensitive data and evaluating the label classification results according to the attribute information of the sensitive data in the database.
[0046] Further, as a refinement and expansion of the above embodiment, in order to fully describe the embodiment, the embodiment also provides another sensitive data labeling method based on natural language processing, as shown in Figure 2 The method comprises:
[0047] Step 201, obtaining sensitive data to be labeled and attribute information of the sensitive data in a database.
[0048] For the embodiment of the application, the sensitive data to be labeled can be obtained from the database, and the attribute information of the corresponding row or column in the data table where the sensitive data is located can be obtained through a database query statement.
[0049] Step 202, using at least two label classification models to respectively classify the labels of the sensitive data, obtaining label classification results corresponding to the at least two label classification models, and according to the label classification results, counting the label quantity of the target label to which the sensitive data belongs.
[0050] For example, the label classification results output by the label classification models A1, A2, A3, B1, B2 and B3 are personal information, financial data, medical data, medical data, personal information and personal information respectively, so that it can be counted that the label quantity of the sensitive data belonging to personal information is 3, the label quantity of the sensitive data belonging to medical data is 2, and the label quantity of the sensitive data belonging to financial data is 1.
[0051] The embodiment of the application can ensure the accuracy of the label classification result by using multiple label classification models when labeling the sensitive data, thereby improving the labeling accuracy of the sensitive data.
[0052] Step 203, when the label classification result involves at least two target labels, then according to the label quantity of each target label, the maximum label quantity is determined.
[0053] For example, the label quantity of sensitive data belonging to personal information is 3, the label quantity of sensitive data belonging to medical data is 2, and the label quantity of sensitive data belonging to financial data is 1. At this time, it can be determined that the maximum label quantity is 3, and the target label corresponding to the maximum label quantity is personal information.
[0054] Step 204, if the maximum label quantity is greater than the preset label quantity, the target label corresponding to the maximum label quantity is determined as the labeling label corresponding to the sensitive data.
[0055] The preset label quantity is usually related to the number of label classification models. The preset label quantity can be set to half of the number of label classification models, or other setting methods can be used according to actual business needs, and the embodiments of the present application do not make specific limitations.
[0056] For example, the maximum label quantity is 6, and the preset label quantity is 5. Since the maximum label quantity 6 is greater than the preset label quantity 5, the target label corresponding to the maximum label quantity can be directly determined as the labeling label corresponding to the sensitive data. At this time, it is not necessary to evaluate the accuracy of the label classification result.
[0057] Step 205, if the maximum label quantity is less than or equal to the preset label quantity, the embedding vector corresponding to the attribute information and the embedding vector corresponding to each target label are determined.
[0058] For the embodiments of the present application, if the maximum label quantity is less than or equal to the preset label quantity, the accuracy of the label classification result needs to be evaluated at this time. When evaluating, the embedding vector corresponding to the attribute information and the embedding vector corresponding to each target label need to be determined first. For the determination method of the embedding vector, TF-IDF can be used to compare the frequency of the words (or word groups) appearing in the attribute information and each target label with the frequency in the corpus, to determine the importance of each word in the attribute information and each target label, and convert it into a vector representation. Word2Vec can also be used to determine the embedding vector of the words in the attribute information and each target label, thereby determining the embedding vector of the entire attribute information and the embedding vector of each target label.
[0059] Step 206, based on the embedding vector corresponding to the attribute information and the embedding vector corresponding to each target label, the average distance between the attribute information and each target label is calculated.
[0060] For the embodiment of the present application, in order to evaluate the accuracy of the label classification result, it is necessary to calculate the average distance between the attribute information and each target label. For the calculation process of the average distance, as an optional implementation, step 206 specifically comprises: based on the embedding vector corresponding to the attribute information, the embedding vector corresponding to each target label, and the label quantity of each target label, respectively calculating the first distance between the attribute information and each target label; according to the first distance corresponding to each target label, calculating the average distance between the attribute information and each target label. Wherein, the specific calculation formula of the first distance is as follows:
[0061]
[0062] Wherein, A i represents the embedding vector corresponding to the attribute information, B i represents the embedding vector corresponding to any kind of target label, k is the number of occurrences of any kind of target label, and d(A, B) is the first distance between the attribute information and any kind of target label. After calculating the first distance between the attribute information and each target label, the average distance of each first distance is calculated. The greater the average distance, the lower the accuracy of the label classification result, and vice versa. The smaller the average distance, the higher the accuracy of the label classification result.
[0063] In the embodiment of the present application, when calculating the first distance between the attribute information and the target label, the influence factor of the label quantity is fully considered, so as to ensure the accuracy of the distance calculation.
[0064] Step 207, based on the label quantity of each target label, calculating the average quantity difference between any two target labels.
[0065] For the embodiment of the present application, in order to evaluate the accuracy of the label classification result, it is necessary to calculate the average quantity difference between any two target labels. For the calculation process of the average quantity difference, as an optional implementation, step 207 specifically comprises: based on the label quantity of each target label, calculating the quantity difference between any two target labels; according to the quantity difference between the two target labels, calculating the average quantity difference.
[0066] For example, the target labels involved in the label classification result include personal information, financial data and medical data. The label quantity corresponding to the personal information is 5, the label quantity corresponding to the financial data is 3, and the label quantity corresponding to the medical data is 2. The quantity difference between the personal information and the financial data is calculated as 2, the quantity difference between the financial data and the medical data is calculated as 1, and the quantity difference between the personal information and the medical data is calculated as 3. Finally, the average value of each quantity difference is calculated to obtain the average quantity difference (2+1+3) / 3=2.
[0067] Step 208: evaluating the accuracy of the label classification result according to the average distance and the average quantity difference.
[0068] The embodiment of the present application adopts the scoring mode to evaluate the accuracy of the label classification result, and for this process, as an optional implementation, step 208 specifically comprises: determining a first score corresponding to the label classification result based on the average distance; determining a second score corresponding to the label classification result based on the average quantity difference; adding the first score and the second score to obtain a total score; and evaluating the accuracy of the label classification result based on the total score.
[0069] Specifically, the embodiment of the present application can pre-divide the average distance into multiple distance intervals, and the first score corresponding to different distance intervals is different, that is, the smaller the average distance, the higher the first score, and vice versa. Similarly, the average quantity difference can be divided into multiple quantity difference intervals, and the second score corresponding to different quantity difference intervals is different, that is, the greater the average quantity difference, the higher the second score, and vice versa.
[0070] The embodiment of the present application considers both the distance between the attribute information and each target label and the quantity difference between each target label when evaluating the label classification result of the model, so as to ensure the accuracy of the evaluation result and further ensure the accuracy of the sensitive data labeling.
[0071] Step 209: if the accuracy of the label classification result reaches a preset standard, determining the labeling label corresponding to the sensitive data according to the label quantity of the target label, and labeling the sensitive data.
[0072] For the embodiment of the present application, if the total score is greater than a preset total score, it is determined that the accuracy of the label classification result reaches the preset standard; if there is only one kind of target label corresponding to the maximum label quantity, the target label corresponding to the maximum label quantity is determined as the labeling label corresponding to the sensitive data; if there are at least two kinds of target labels corresponding to the maximum label quantity, a first minimum distance is determined from the first distance corresponding to each target label, and the target label corresponding to the first minimum distance is determined as the labeling label corresponding to the sensitive data. The preset total score can be set according to actual business requirements, and the embodiment of the present application does not make specific limitation thereto.
[0073] Specifically, if the preset total score is greater than the preset total score, it indicates that the accuracy of the label classification result obtained by using the label classification model is high, and the label classification result can be used for labeling. When specifically labeling, the target label corresponding to the maximum label quantity can be selected as the labeling label, and the sensitive data is labeled. If the target label corresponding to the maximum label quantity is only one kind, it is directly used as the labeling label; if the target label corresponding to the maximum label quantity is more than one kind, the first distance between the target label and the attribute information is further combined to specifically analyze, so as to determine the final labeling label. For example, the label quantity of the financial data and the financial data is 4, and 4 is the maximum label quantity. Since the target label corresponding to the maximum label quantity has two kinds, the first distance between the financial data and the attribute information is considered if the first distance between the medical data and the attribute information is less than the first distance between the financial data and the attribute information, and the financial data is selected as the labeling label; if the first distance between the medical data and the attribute information is less than the first distance between the financial data and the attribute information, the medical data is selected as the labeling label.
[0074] The score evaluation method adopted in the embodiment of the application can accurately evaluate the accuracy of the label classification result, so as to ensure the accuracy of the labeling result. At the same time, when there are at least two kinds of target labels corresponding to the maximum label quantity, the first distance between the attribute information and the target label is combined to specifically analyze, the labeling label is accurately selected, and the labeling accuracy of the sensitive data is further improved.
[0075] Further, if the total score is less than or equal to the preset total score, the embedding vectors corresponding to each label in the label library are determined; the second distance between the attribute information and each label is calculated based on the embedding vector corresponding to the attribute information and the embedding vector corresponding to each label; the second minimum distance is determined from the second distance corresponding to each label, and the label corresponding to the second minimum distance is determined as the labeling label corresponding to the sensitive data.
[0076] Specifically, if the preset total score is less than or equal to the preset total score, it indicates that the accuracy of the label classification result obtained by using the label classification model is low, and the label classification result cannot be used for labeling. At this time, the second distance between the attribute information and each label in the label library is calculated, and the corresponding labeling label is selected from the label library based on the second distance.
[0077] For example, the labels in the label library include personal information, financial data, medical data, business secrets and government secrets, the second distance between the attribute information of the sensitive data and the above-mentioned labels is calculated respectively, if the second distance between the financial data and the attribute information is the smallest, the financial data is determined as the labeling label, and the sensitive data is labeled.
[0078] Another sensitive data labeling method based on natural language processing provided by the embodiment of the present application can adapt to complex and diverse data types and rapidly changing business scenarios by using a label classification model for sensitive data labeling, thereby effectively solving the problem that a regular expression is difficult to cover all business cases and has high maintenance cost, and further ensuring the labeling accuracy of sensitive data. In addition, by using at least two label classification models to classify the labels of the sensitive data and evaluating the label classification results according to the attribute information of the sensitive data in the database, the labeling accuracy of the sensitive data can be further improved.
[0079] Further, as a specific implementation of the method shown in Figure 1 and Figure 2 , the embodiment provides a sensitive data labeling device based on natural language processing, which, as shown in Figure 3 , includes an acquisition unit 31, a classification unit 32, a statistics unit 33, an evaluation unit 34, and a labeling unit 35.
[0080] The acquisition unit 31 can be used to acquire sensitive data to be labeled and attribute information of the sensitive data in a database.
[0081] The classification unit 32 can be used to use at least two label classification models to classify the labels of the sensitive data respectively, to obtain label classification results corresponding to the at least two label classification models.
[0082] The statistics unit 33 can be used to count the number of labels of a target label to which the sensitive data belongs according to the label classification results.
[0083] The evaluation unit 34 can be used to evaluate the accuracy of the label classification results according to the attribute information and the number of labels of the target label.
[0084] The labeling unit 35 can be used to determine a labeling label corresponding to the sensitive data according to the number of labels of the target label, and label the sensitive data, if the accuracy of the label classification results reaches a preset standard.
[0085] In some embodiments, the device further includes a determination unit 36.
[0086] The determination unit 36 can be used to determine a maximum number of labels according to the number of labels of each target label, if the label classification results involve at least two target labels, and determine a target label corresponding to the maximum number of labels as a labeling label corresponding to the sensitive data, if the maximum number of labels is greater than a preset number of labels.
[0087] In some embodiments, the evaluation unit 34 is configured toFigure 4 The apparatus 300 can further include a determining module 341, a calculating module 342, and an evaluating module 343.
[0088] The determining module 341 can be configured to determine, if the maximum number of labels is less than or equal to a preset number of labels, an embedding vector corresponding to the attribute information and embedding vectors corresponding to the target labels, respectively.
[0089] The calculating module 342 can be configured to calculate, based on the embedding vector corresponding to the attribute information and the embedding vectors corresponding to the target labels, an average distance between the attribute information and the target labels.
[0090] The calculating module 342 can be further configured to calculate, based on the number of labels of the target labels, an average number difference between any two target labels.
[0091] The evaluating module 343 can be configured to evaluate, according to the average distance and the average number difference, an accuracy of the label classification result.
[0092] In some embodiments, the calculating module 342 can be specifically configured to calculate, based on the embedding vector corresponding to the attribute information, the embedding vectors corresponding to the target labels, and the number of labels of the target labels, a first distance between the attribute information and the target labels, respectively; and calculate, according to the first distances corresponding to the target labels, the average distance between the attribute information and the target labels.
[0093] In some embodiments, the calculating module 342 can be further specifically configured to calculate, based on the number of labels of the target labels, a number difference between any two target labels; and calculate, according to the number difference between the any two target labels, the average number difference.
[0094] In some embodiments, the evaluating module 343 can be specifically configured to determine, based on the average distance, a first score corresponding to the label classification result; determine, based on the average number difference, a second score corresponding to the label classification result; add the first score and the second score to obtain a total score; and evaluate, based on the total score, the accuracy of the label classification result.
[0095] In some embodiments, the marking unit 35 can be specifically configured to: if the total score is greater than a preset total score, determine that the accuracy of the label classification result reaches a preset standard; if the target label corresponding to the maximum label quantity only exists in one kind, determine the target label corresponding to the maximum label quantity as the marking label corresponding to the sensitive data; and if the target label corresponding to the maximum label quantity exists in at least two kinds, determine a first minimum distance from the first distances corresponding to the target labels, and determine the target label corresponding to the first minimum distance as the marking label corresponding to the sensitive data.
[0096] In some embodiments, the marking unit 35 can be further configured to: if the total score is less than or equal to the preset total score, determine the embedding vectors corresponding to the labels in the label library; calculate second distances between the attribute information and the labels based on the embedding vector corresponding to the attribute information and the embedding vectors corresponding to the labels; determine a second minimum distance from the second distances corresponding to the labels, and determine the label corresponding to the second minimum distance as the marking label corresponding to the sensitive data.
[0097] It should be noted that other corresponding descriptions of the various functional units involved in the sensitive data marking device based on natural language processing provided in this embodiment can be referred to the corresponding descriptions in Figure 1 and Figure 2 , which will not be described here in detail.
[0098] Based on the above methods as shown in Figure 1 and Figure 2 , correspondingly, the present embodiment also provides a storage medium having a computer program stored thereon, which is executed by a processor to implement the above-mentioned sensitive data marking method based on natural language processing as shown in Figure 1 and Figure 2 .
[0099] Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.), and includes a plurality of instructions for causing an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of various implementation scenarios of the present application.
[0100] Based on the above methods as shown in Figure 1 and Figure 2 , and Figure 3 and Figure 4In order to achieve the above-mentioned purposes, the electronic device provided by the embodiment of the present application can be a personal computer, a tablet computer, a server, or other network devices, etc., which comprises a storage medium and a processor; the storage medium is used for storing a computer program; and the processor is used for executing the computer program to realize the above-mentioned natural language processing-based sensitive data labeling method. Figure 1 and Figure 2 the natural language processing-based sensitive data labeling method.
[0101] Optionally, the entity device can further comprise a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface can comprise a display, an input unit such as a keyboard, etc. The optional user interface can further comprise a USB interface, a card reader interface, etc. The network interface can optionally comprise a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0102] Those skilled in the art can understand that the above-mentioned entity device structure provided by the embodiment does not constitute a limitation on the entity device, and can comprise more or fewer components, or combine certain components, or different component arrangements.
[0103] The storage medium can further comprise an operating system and a network communication module. The operating system is a program for managing hardware and software resources of the entity device, and supports the running of information processing programs and other software and / or programs. The network communication module is used for realizing the communication between the components in the storage medium, and the communication with other hardware and software in the information processing entity device.
[0104] From the above description of the embodiments, those skilled in the art can clearly understand that the present application can be realized by means of software and necessary general hardware platforms, or by hardware.
[0105] By adopting the label classification model for sensitive data labeling, the embodiment of the present application can adapt to complex and diverse data types and rapidly changing business scenarios, thereby effectively solving the problem that the regular expression is difficult to cover all business situations and the maintenance cost is high, and further ensuring the labeling accuracy of sensitive data. In addition, by adopting at least two label classification models to classify the labels of the sensitive data, and evaluating the label classification results according to the attribute information of the sensitive data in the database, the labeling accuracy of the sensitive data can be further improved.
[0106] Those skilled in the art can understand that the modules or flows in the drawings are not necessarily required for implementing the present application. Those skilled in the art can understand that the modules in the devices in the implementation scenarios can be distributed in the devices in the implementation scenarios according to the description of the implementation scenarios, or can be changed to be located in one or more devices different from the implementation scenarios. The modules in the above implementation scenarios can be combined into one module, or can be further split into multiple sub-modules.
[0107] The above application numbers are only for description, and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only some specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be thought of by those skilled in the art should fall within the protection scope of the present application.
Claims
1. A natural language processing-based sensitive data labeling method, characterized in that, The method comprises the following steps: obtaining sensitive data to be labeled and attribute information of the sensitive data in a database; using at least two label classification models to respectively perform label classification on the sensitive data, to obtain label classification results corresponding to the at least two label classification models; according to the label classification results, counting the number of labels of the sensitive data belonging to a target label; according to the attribute information and the number of labels of the target label, evaluating the accuracy of the label classification results; if the accuracy of the label classification results reaches a preset standard, determining a labeling label corresponding to the sensitive data according to the number of labels of the target label, and labeling the sensitive data; after the step of according to the label classification results, counting the number of labels of the sensitive data belonging to a target label, the method further comprises the following steps: when the label classification results involve at least two target labels, determining the maximum number of labels according to the number of labels of each target label; if the maximum number of labels is greater than a preset number of labels, determining the target label corresponding to the maximum number of labels as the labeling label corresponding to the sensitive data; according to the attribute information and the number of labels of the target label, evaluating the accuracy of the label classification results, comprises the following steps: if the maximum number of labels is less than or equal to a preset number of labels, respectively determining an embedding vector corresponding to the attribute information and embedding vectors corresponding to the target labels; based on the embedding vector corresponding to the attribute information and the embedding vectors corresponding to the target labels, calculating the average distance between the attribute information and the target labels; based on the number of labels of the target labels, calculating the average number difference between any two target labels; according to the average distance and the average number difference, evaluating the accuracy of the label classification results.
2. The method of claim 1, wherein, the step of based on the embedding vector corresponding to the attribute information and the embedding vectors corresponding to the target labels, calculating the average distance between the attribute information and the target labels, comprises the following steps: based on the embedding vector corresponding to the attribute information, the embedding vectors corresponding to the target labels, and the number of labels of the target labels, respectively calculating the first distance between the attribute information and the target labels; according to the first distance corresponding to the target labels, calculating the average distance between the attribute information and the target labels; and / or the step of based on the number of labels of the target labels, calculating the average number difference between any two target labels, comprises the following steps: based on the number of labels of the target labels, calculating the number difference between any two target labels; according to the number difference between any two target labels, calculating the average number difference.
3. The method of claim 2, wherein, the step of according to the average distance and the average number difference, evaluating the accuracy of the label classification results, comprises the following steps: based on the average distance, determining a first score corresponding to the label classification results; based on the average number difference, determining a second score corresponding to the label classification results; adding the first score and the second score to obtain a total score; based on the total score, evaluating the accuracy of the label classification results.
4. The method of claim 3, wherein, If the accuracy of the label classification result reaches a preset standard, the labeling label corresponding to the sensitive data is determined according to the label quantity of the target label, including: If the total score is greater than a preset total score, it is determined that the accuracy of the label classification result reaches a preset standard; If the target label corresponding to the maximum label quantity only exists in one kind, the target label corresponding to the maximum label quantity is determined as the labeling label corresponding to the sensitive data; If the target label corresponding to the maximum label quantity exists in at least two kinds, a first minimum distance is determined from the first distance corresponding to each target label, and the target label corresponding to the first minimum distance is determined as the labeling label corresponding to the sensitive data.
5. The method of claim 4, wherein, The method further includes: If the total score is less than or equal to the preset total score, the embedding vectors corresponding to each label in the label library are determined; Based on the embedding vectors corresponding to the attribute information and the embedding vectors corresponding to each label, a second distance between the attribute information and each label is calculated; A second minimum distance is determined from the second distance corresponding to each label, and the label corresponding to the second minimum distance is determined as the labeling label corresponding to the sensitive data.
6. A natural language processing-based sensitive data labeling apparatus, characterized by, Including: An acquisition unit is configured to acquire sensitive data to be labeled and attribute information of the sensitive data in a database; A classification unit is configured to use at least two label classification models to respectively perform label classification on the sensitive data, and obtain label classification results corresponding to the at least two label classification models; A statistical unit is configured to statistically determine a label quantity of a target label to which the sensitive data belongs according to the label classification results; An evaluation unit is configured to evaluate the accuracy of the label classification results according to the attribute information and the label quantity of the target label; A labeling unit is configured to, if the accuracy of the label classification result reaches a preset standard, determine the labeling label corresponding to the sensitive data according to the label quantity of the target label, and label the sensitive data; The device further includes a determination unit; The determination unit is configured to, when the label classification result involves at least two target labels, determine a maximum label quantity according to the label quantity of each target label, and determine the target label corresponding to the maximum label quantity as the labeling label corresponding to the sensitive data if the maximum label quantity is greater than a preset label quantity; The evaluation unit includes a determination module, a calculation module, and an evaluation module; The determination module is configured to, if the maximum label quantity is less than or equal to a preset label quantity, respectively determine an embedding vector corresponding to the attribute information and embedding vectors corresponding to each target label; The calculation module is configured to calculate an average distance between the attribute information and each target label based on the embedding vector corresponding to the attribute information and the embedding vectors corresponding to each target label; The calculation module is further configured to calculate an average quantity difference between any two target labels based on the label quantity of each target label; The evaluation module is configured to evaluate the accuracy of the label classification result according to the average distance and the average quantity difference.
7. A storage medium having stored thereon a computer program, characterized in that The computer program, which is executed by a processor, implements the method of any one of claims 1 to 5.
8. An electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, The processor, when executing the computer program, implements the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Data labeling method and device, electronic equipment and storage medium
CN113159133A