De-identification method, device and equipment
By training the target model and using IOB marking method and regular expressions for entity tagging, combined with grouping training of multiple pretrained sub-models, the problem of low accuracy of existing de-identification techniques is solved, and high accuracy and high efficiency de-identification is achieved.
Patent Information
- Application Number
- CN202510045592.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-01-10
AI Technical Summary
The existing de-identification technology has low accuracy when processing unstructured data and is prone to false positives or detection errors.
By training the target model, the data set is entity-labeled using IOB notation and regular expressions, and trained in groups through multiple pretrained sub-models until the accuracy threshold is reached, and high accuracy de-identification is achieved.
The accuracy and efficiency of target entity recognition are improved, and the high accuracy and efficiency of deidentified data sets are achieved.
Smart Images

Figure CN119903554A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a de-identification method, device and equipment. Background Art
[0002] In the healthcare-related field, electronic health records (EHR) are usually used to update patient health information in real time and digitally track patient health status, so as to share patient information between different institutions and ensure the continuity of patient treatment. Therefore, structured data has been widely used in EHR, but unstructured data (such as medical history, physical examination records and pathology reports) contains richer patient information. In order to effectively use these unstructured data in cutting-edge research, it is urgent to adopt some scalable de-identification technologies.
[0003] However, the de-identification technology in the prior art identifies entities through the pre-defined rules of the pattern matching system and then replaces the entities. Since the rules of the pattern matching system are fixed, if the text format does not completely comply with the pre-defined rules, the system may have false positives or detection errors. Therefore, how to achieve high-accuracy and high-efficiency de-identification technology has become a technical problem that needs to be solved. Summary of the invention
[0004] The present invention provides a de-identification method, device and equipment to solve the problem of low accuracy of existing de-identification technologies.
[0005] In a first aspect, the present application provides a de-identification method, the method comprising:
[0006] After the acquired data set to be processed is input into the target model, a data set with the target entity marked is obtained;
[0007] The target entity is replaced based on a preset alternative text to obtain a de-identified data set;
[0008] The target model is trained in the following way:
[0009] Performing a first entity tagging on the target data set based on the IOB tagging method to obtain a first labeled data set;
[0010] Based on the regular expression and the first entity tag, perform a second entity tag on the first tag data set to obtain a second tag data set, and use the second tag data set as a training set;
[0011] Based on the training set, multiple pre-trained sub-models are trained. When the accuracy of the trained sub-model is less than the accuracy threshold, return to the step of performing second entity labeling on the first labeled data set based on the regular expression and the first entity labeling, until the accuracy of the trained sub-model is greater than or equal to the accuracy threshold; when the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, determine that the sub-model has passed the training, and use the model composed of the multiple sub-models that have passed the training as the target model.
[0012] In a possible implementation, the step of performing a first entity tagging on the target data set based on the IOB tagging method to obtain a first tagged data set includes:
[0013] Performing word segmentation processing on the target data set to obtain multiple words of the target data set;
[0014] Based on the IOB tagging method, for each word, when it is determined that the word is an entity, the entity start part of the word is marked as the first tag, and the entity internal part of the word is marked as the second tag; when it is determined that the word is not an entity, the word is marked as the third tag;
[0015] The labeled target dataset is used as the first labeled dataset
[0016] In a possible implementation manner, before performing the second entity tag on the tag data set based on the regular expression and the first entity tag, the method further includes:
[0017] Counting the repetition rate of the first target text in the first labeled data set;
[0018] When it is determined that the repetition rate of the first target text is greater than or equal to a repetition rate threshold, adding the first target text to a target set;
[0019] The first target text in the first labeled data set is deleted based on the target set.
[0020] In a possible implementation, the regular expression is determined by the following method:
[0021] Determine a target vocabulary of the first tag data set based on a pattern matching method, and update a first entity tag of the target vocabulary to a first replacement word based on a preset first corresponding relationship;
[0022] Determining an entity category corresponding to the target vocabulary based on a first entity tag in the first tag data set;
[0023] Based on the entity category and a preset second correspondence, the first replacement word is updated to a second replacement word, and a third correspondence between the first entity tag of the target vocabulary and the second replacement word is used as the regular expression.
[0024] In a possible implementation, the training of multiple pre-trained sub-models based on the training set includes:
[0025] Assigning a pre-trained sub-model to each pre-trained entity category of the training set;
[0026] Determining a target entity category of a training set in the pre-trained sub-model, wherein the target entity category is the entity category corresponding to the highest confidence during the training process;
[0027] When the target entity category is consistent with the pre-trained entity category, it is determined that the pre-trained sub-model has completed training; when the target entity category is inconsistent with the pre-trained entity category, the pre-trained sub-model continues to be trained.
[0028] In a possible implementation, when the accuracy of the trained sub-model is less than the accuracy threshold, returning to the step of performing a second entity tag on the tagged data set based on the regular expression and the first entity tag, before that, the method further includes:
[0029] Determine that a second target text marked with a second entity does not exist in the second marked data set, and add the second target text to the target set;
[0030] The second target text in the labeled data set is deleted based on the target set.
[0031] In a possible implementation, replacing the target entity based on a preset alternative text to obtain a de-identified data set includes:
[0032] determining an entity category and a location of the target entity;
[0033] Marking target entities with consistent entity categories and consistent entity instances with preset labels;
[0034] Based on a fourth correspondence between the preset label and the alternative text, the target entity is replaced with the alternative text to obtain a de-identified data set, wherein the fourth correspondence is preset.
[0035] In a second aspect, an embodiment of the present application further provides a de-identification device, the device comprising:
[0036] A labeling unit, used to input the acquired data set to be processed into the target model to obtain a data set for labeling the target entity;
[0037] A replacement unit, used to replace the target entity based on a preset alternative text to obtain a de-identified data set;
[0038] A training unit is used to perform a first entity tagging on a target data set based on an IOB tagging method to obtain a first tagging data set; perform a second entity tagging on the tagging data set based on a regular expression and the first entity tagging to obtain a second tagging data set, and use the second tagging data set as a training set; train multiple pre-trained sub-models based on the training set, and when the accuracy of the trained sub-model is less than an accuracy threshold, return to the step of performing a second entity tagging on the tagging data set based on a regular expression and the first entity tagging until the accuracy of the trained sub-model is greater than or equal to the accuracy threshold; when the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, determine that the sub-model has passed the training, and use the model composed of the trained multiple sub-models as the target model
[0039] In a possible implementation manner, the training unit is specifically used to:
[0040] Performing word segmentation processing on the target data set to obtain multiple words of the target data set;
[0041] Based on the IOB tagging method, for each word, when it is determined that the word is an entity, the entity start part of the word is marked as the first tag, and the entity internal part of the word is marked as the second tag; when it is determined that the word is not an entity, the word is marked as the third tag;
[0042] The labeled target data set is used as the first labeled data set.
[0043] In a possible implementation manner, the training unit is specifically used to:
[0044] Counting the repetition rate of the first target text in the first labeled data set;
[0045] When it is determined that the repetition rate of the first target text is greater than or equal to a repetition rate threshold, adding the first target text to a target set;
[0046] The first target text in the first labeled data set is deleted based on the target set.
[0047] In a possible implementation manner, the training unit is specifically used for:
[0048] Determine a target vocabulary of the first tag data set based on a pattern matching method, and update a first entity tag of the target vocabulary to a first replacement word based on a preset first corresponding relationship;
[0049] Determining an entity category corresponding to the target vocabulary based on a first entity tag in the first tag data set;
[0050] Based on the entity category and a preset second correspondence, the first replacement word is updated to a second replacement word, and a third correspondence between the first entity tag of the target vocabulary and the second replacement word is used as the regular expression.
[0051] In a possible implementation manner, the training unit is specifically used for:
[0052] Assigning a pre-trained sub-model to each pre-trained entity category of the training set;
[0053] Determining a target entity category of a training set in the pre-trained sub-model, wherein the target entity category is the entity category corresponding to the highest confidence during the training process;
[0054] When the target entity category is consistent with the pre-trained entity category, it is determined that the pre-trained sub-model has completed training; when the target entity category is inconsistent with the pre-trained entity category, the pre-trained sub-model continues to be trained.
[0055] In a possible implementation manner, the training unit is further used for:
[0056] Determine that a second target text marked with a second entity does not exist in the second marked data set, and add the second target text to the target set;
[0057] The second target text in the labeled data set is deleted based on the target set.
[0058] In a possible implementation manner, the replacement unit is specifically used to:
[0059] determining an entity category and a location of the target entity;
[0060] Marking target entities with consistent entity categories and consistent entity instances with preset labels;
[0061] Based on a fourth correspondence between the preset label and the alternative text, the target entity is replaced with the alternative text to obtain a de-identified data set, wherein the fourth correspondence is preset.
[0062] In the third aspect, an embodiment of the present application also provides a de-identification device, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any method described in the first aspect.
[0063] The beneficial effects of the present invention are as follows:
[0064] The present application provides a de-identification method, device and equipment. The present application inputs the acquired data set to be processed into the target model to obtain a data set for marking the target entity; replaces the target entity based on the preset alternative text to obtain a de-identified data set; wherein the target model is trained in the following manner: based on the IOB tagging method, the target data set is firstly marked as a first marked data set; based on the regular expression and the first entity tag, the marked data set is secondly marked as a second marked data set, and the second marked data set is used as a training set; based on the training set, multiple pre-trained sub-models are trained, and when the accuracy of the trained sub-model is less than the accuracy threshold, the step of performing the second entity tagging on the marked data set based on the regular expression and the first entity tag is returned until the accuracy of the trained sub-model is greater than or equal to the accuracy threshold; when the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, it is determined that the sub-model has passed the training, and the model composed of the trained multiple sub-models is used as the target model. The present application obtains the target model by training multiple pre-trained sub-models in groups, thereby achieving high accuracy and high efficiency of target entity recognition, and thus achieving high accuracy and high efficiency of de-identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0066] Figure 1 A flowchart of a de-identification method provided in an embodiment of the present application;
[0067] FIG2( a) is a schematic diagram of a de-identification method provided in an embodiment of the present application;
[0068] FIG2( b ) is a schematic diagram of another de-identification method provided in an embodiment of the present application;
[0069] Figure 3A flowchart of a method for training a target model provided in an embodiment of the present application;
[0070] Figure 4 A flowchart of another target model training method provided in an embodiment of the present application;
[0071] Figure 5 A flowchart of another target model training method provided in an embodiment of the present application;
[0072] FIG6( a) is a schematic diagram of another de-identification method provided in an embodiment of the present application;
[0073] FIG6( b ) is a schematic diagram of another de-identification method provided in an embodiment of the present application;
[0074] Figure 7 A flowchart of another target model training method provided in an embodiment of the present application;
[0075] Figure 8 A flowchart of another target model training method provided in an embodiment of the present application;
[0076] Fig. 9 A schematic diagram of a de-identification device provided in an embodiment of the present application;
[0077] Fig.10 A schematic diagram of a de-identification device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0078] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0079] Some technical terms involved in this application are explained below.
[0080] (1) Entity: refers to an object or thing that has a unique identity and can be distinguished from other objects. It usually refers to a specific information unit in a text, such as a person's name, a place name, an organization name, etc. In other words, an entity is a part of a text that has a specific meaning.
[0081] (2) De-identification: In order to reduce the leakage of personal information in fields such as medicine, finance, and scientific research, de-identification refers to the removal or modification of information that may reveal personal identity from data, so that personal identity cannot be directly traced when the data is used or shared.
[0082] (3) Electronic Health Record (EHR): It is a digital patient health information record system that includes the patient's detailed health information, treatment history, diagnosis, test results, medication records, etc. Compared with traditional paper medical records, EHR enables information to be shared among different medical institutions and doctors.
[0083] It should be noted that the terms "including" and "having" and their variations involved in the documents of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0084] The terms "first" and "second" in this document are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "multiple" means two or more.
[0085] The word “exemplary” is used hereinafter to mean “serving as an example, example, or illustration.” Any embodiment described as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0086] The following is an introduction to the application scenarios of the technical solutions in the embodiments of the present application.
[0087] In the healthcare-related field, electronic health records (EHR) are usually used to update patient health information in real time and digitally track patient health status, so as to share patient information between different institutions and ensure the continuity of patient treatment. Therefore, structured data has been widely used in EHR, but unstructured data (such as medical history, physical examination records and pathology reports) contains richer patient information. Traditional manual de-identification methods are prone to negligence or errors when processing large amounts of data. In order to effectively use these unstructured data in cutting-edge research, it is urgent to adopt some scalable de-identification technologies.
[0088] However, the de-identification technology implemented by the pattern matching system in the related art is to identify entities through the rules pre-defined by the system and then replace the entities. Since the rules of the pattern matching system are fixed, if the text format in the data set does not completely comply with the pre-defined rules, the pattern matching system may have false positives or detection errors.
[0089] The de-identification technology implemented by the machine learning system in the related technology is to convert the input data set into the form of a numerical vector through the feature vector transformation technology, so as to facilitate computer recognition and processing. However, when a large amount of data needs to be processed, it takes a long time and has low efficiency.
[0090] The deep learning system in the related technology relies on a large amount of labeled data sets. For some professional fields, the application of deep learning systems is limited because labeled data sets are difficult to obtain, and the accuracy of deep learning systems is low when processing complex sentences.
[0091] From the above content, it can be seen that there is no high-accuracy and high-efficiency de-identification technology in the relevant technology. Therefore, how to achieve high-accuracy and high-efficiency de-identification technology has become a technical problem that needs to be solved.
[0092] To solve this problem, the embodiment of the present application provides a de-identification method, device and apparatus, which obtains a target model by training multiple pre-trained sub-models in groups, and then inputs the data set to be processed into the target model to obtain a data set that marks the target entity, and replaces the target entity based on the preset alternative text to obtain a de-identified data set. This achieves high accuracy and efficiency in target entity recognition, and further achieves high accuracy and efficiency in de-identification.
[0093] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0094] Figure 1 A schematic diagram of a de-identification method provided in an embodiment of the present application is shown as an example. Figure 1 As shown, a de-identification method provided in an embodiment of the present application specifically includes the following processes:
[0095] S101, after inputting the acquired data set to be processed into the target model, a data set with the target entity marked is obtained;
[0096] As an example, after the data set to be processed is input into the target model, the target model marks the position of the category of the target entity of the data set to be processed, so that the target entity can be de-identified based on the position of the category of the target entity.
[0097] S102, replacing the target entity based on a preset alternative text to obtain a de-identified data set;
[0098] As an example, the present application first determines the entity category and position of the target entity; then marks the target entity with a consistent entity category and entity instance with a preset label; finally, based on the fourth correspondence between the preset label and the alternative text, the target entity is replaced with the alternative text to obtain a de-identified data set, wherein the fourth correspondence is pre-set.
[0099] Exemplarily, as shown in Figures 2(a) and 2(b), it is a schematic diagram of a de-identification method provided in an embodiment of the present application, wherein Figure 2(a) represents a data set for obtaining a marked target entity, and Figure 2(b) represents a de-identified data set.
[0100] As shown in Figure 2(a), the target entity-labeled dataset includes labeling of the location of the target entity category. Among them, the target entity categories of "2020-02-01", "15Jan 2020" and "1Feb 2020" are dates, the target entity categories of "123456" and "92" are numbers, the target entity categories of "John" and "Doe" are names, and the target entity category of "New York" is a place name. In order to reduce the leakage of personal information and avoid tracing back to personal identity during data use, it is necessary to modify and replace the information in the data that may reveal personal identity.
[0101] The present application first determines the entity category and position of the target entity based on the data set for marking the target entity, and then presets the target entity tags with consistent entity categories and consistent entity instances. For example, the "Doe" tag that appears twice in Figure 2(a) can be marked with the same preset tag A1, "John" is marked with preset tag A2, "2020-02-01" is marked with preset tag A3, "15Jan 2020" is marked with preset tag A4, "1Feb 2020" is marked with preset tag A5, "123456" is marked with preset tag A6, "92" is marked with preset tag A7, and "New York" is marked with preset tag A8.
[0102] It should be noted that the preset labels A1, A2, A3, A4, A5, A6, A7 and A8 can be a string of English characters, a string of numbers, a string of English characters and numbers, or other forms, which are not limited here.
[0103] According to the fourth correspondence between the preset preset labels and the alternative texts, the target entity is replaced with the alternative text. For example, in the fourth correspondence preset in the present application, the preset label A1 corresponds to the alternative text "Martin", the preset label A2 corresponds to the alternative text "Tom", the preset label A3 corresponds to the alternative text "2020-03-04", the preset label A4 corresponds to the alternative text "13Jan2020", the preset label A5 corresponds to the alternative text "18Feb 2020", the preset label A6 corresponds to the alternative text "HKLMU9B", the preset label A7 corresponds to the alternative text "90+", and the preset label A8 corresponds to the alternative text "London", thereby replacing the target entity with the alternative text to obtain a de-identified data set.
[0104] In the embodiment of the present application, the data set to be processed is input into the target model to obtain a data set of marked target entities, and the target entities are replaced based on the preset alternative text to obtain a de-identified data set. High accuracy and high efficiency of target entity recognition are achieved, and then high accuracy and high efficiency of de-identification are achieved.
[0105] Specifically, the target model is trained in the following ways: Figure 3 As shown, a flow chart of a method for training a target model provided in an embodiment of the present application includes the following steps:
[0106] S301, performing a first entity tagging on a target data set based on an IOB tagging method to obtain a first tagging data set;
[0107] It should be noted that before performing the first entity tagging on the target data set based on the IOB tagging method, the target data set needs to be cleaned to delete invalid data, erroneous data and incomplete data in the target data set.
[0108] As an example, Figure 4 As shown, a flow chart of another target model training method provided in an embodiment of the present application is provided, and the first labeled data set is obtained in the following manner.
[0109] S401, performing word segmentation processing on the target data set to obtain multiple words of the target data set;
[0110] In a possible implementation, word segmentation is used to convert text in the target data set into smaller text units, which may be words or characters. For example, if the text in the target data set is "John Smith livesin New York.", after word segmentation, "John", "Smith", "lives", "in", "New", "York", and "." are obtained.
[0111] S402, based on the IOB tagging method, for each word, when it is determined that the word is an entity, the entity start part of the word is marked as a first tag, and the entity inner part of the word is marked as a second tag; when it is determined that the word is not an entity, the word is marked as a third tag;
[0112] Exemplarily, the IOB tagging method marks the beginning of a vocabulary entity as a first tag B, marks the internal part of the vocabulary entity as a second tag I, and marks non-entity vocabulary as a third tag O. In addition, since entities include multiple categories, such as person names (PER), place names (LOC, location), etc., the beginning of an entity whose entity category is a person name can be marked as a first tag B-PER, and the internal part of an entity whose entity category is a person name can be marked as a second tag I-PER. Similarly, the beginning of an entity whose entity category is a place name can be marked as a first tag B-LOC, and the internal part of an entity whose entity category is a place name can be marked as a second tag I-LOC.
[0113] For example, multiple words of the target data set are obtained through word segmentation processing: "John", "Smith", "lives", "in", "New", "York" and ".". "John Smith" is a person's name, where "John" is the beginning part of the person's name entity, marked with the first tag B-PER, and "Smith" is the internal part of the person's name entity, marked with the second tag I-PER; the entity category of "New York" is a place name, where "New" is the beginning part of the place name entity, marked with the first tag B-LOC, and "York" is the internal part of the place name entity, marked with the second tag I-LOC; "lives", "in" and "." are non-entity words, marked with the third tag O.
[0114] S403, using the marked target data set as the first marked data set;
[0115] Exemplarily, taking the text in the target data set as "John Smith lives in New York." as an example, the data set with the first tags B-PER and B-LOC, the second tags I-PER and I-LOC, and the third tag O is used as the first labeled data set.
[0116] It should be noted that the entity category can be a person's name, a place name, an organization name, a date, a time, a quantity, etc., which are not limited here. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application, and the embodiments and features in the embodiments in the present application can be combined with each other if there is no conflict.
[0117] As an example, Figure 5 As shown, it is a flow chart of another target model training method provided in an embodiment of the present application, after obtaining the first labeled data set and before performing the second entity labeling on the first labeled data set, it also includes:
[0118] S501, counting the repetition rate of the first target text in the first labeled data set;
[0119] S502: when it is determined that the repetition rate of the first target text is greater than or equal to the repetition rate threshold, add the first target text to the target set;
[0120] S503: Delete the first target text in the first labeled data set based on the target set.
[0121] Exemplarily, the first target text in the target set is used to exclude repetitive and meaningless text and reduce noise in subsequent model training, such as chapter titles in clinical records, repeated usage of doctors, etc.
[0122] For example, Figure 6(a) and 6(b) As shown, it is a schematic diagram of another de-identification method provided by an embodiment of the present application, wherein FIG6(a) represents an exemplary text in the first labeled data set, and FIG6(b) represents an exemplary text in which the first target text is deleted from the first labeled data. Since "DATE" and "NUMBER" appear multiple times in the first labeled data set, when it is determined that the repetition rate of "DATE" and "NUMBER" is greater than or equal to the repetition rate threshold, "DATE" and "NUMBER" are added to the target set as the first target text; based on the target set, the first target text "DATE" and "NUMBER" in the first labeled data set are deleted. Among them, the gray marked part in FIG6(b) is the first target text deleted from the first labeled data.
[0123] S302: Based on the regular expression and the first entity tag, perform a second entity tag on the first tag data set to obtain a second tag data set, and use the second tag data set as a training set;
[0124] As an example, Figure 7 As shown, it is a flow chart of another method for training a target model provided in an embodiment of the present application, and the regular expression is determined by the following method:
[0125] S701, determining a target vocabulary of a first tag data set based on a pattern matching method, and updating a first entity tag of the target vocabulary to a first replacement word based on a preset first corresponding relationship;
[0126] S702, determining an entity category corresponding to a target vocabulary based on a first entity tag in a first tag data set;
[0127] S703: Based on the entity category and the preset second correspondence, update the first replacement word to a second replacement word, and use the third correspondence between the first entity tag of the target vocabulary and the second replacement word as a regular expression.
[0128] Exemplarily, the present application updates the first entity marker of the target vocabulary to a first replacement word based on a pattern matching method and a preset first correspondence relationship, wherein the first correspondence relationship is predetermined based on a named entity recognition (NER) template. For example, when the entity is composed of numbers, the first entity marker is updated to N; when the entity is composed of letters, the first entity marker is updated to L; and when the entity is composed of numbers and letters, the first entity marker is updated to M.
[0129] The pre-set second correspondence is the correspondence between the first replacement word and the second replacement word. The first replacement word "L" corresponds to the second replacement word "[A-Za-z]+", and the entity represented by L corresponds to one or more letters. The first replacement word "N" corresponds to the second replacement word "\d+", and the entity represented by N corresponds to one or more numbers. The first replacement word "M" corresponds to the second replacement word "\w", and the entity represented by M corresponds to letters or numbers.
[0130] For example, taking the date "12 / 25 / 2024" appearing in the first labeled data set as an example, based on the preset first correspondence relationship, the first entity tag of the entity "12 / 25 / 2024" is updated to the first replacement word N / N / N, and based on the entity category and the preset second correspondence relationship, the first replacement word N / N / N is updated to the second replacement word \d+ / \d+ / \d+, so that based on the regular expression, the first entity tag of the entity that satisfies the date format of 12 / 25 / 2024 is updated to d+ / \d+ / \d+, thereby realizing the second entity tagging of the labeled data set and obtaining the second labeled data set.
[0131] For example, taking the time "3:45PM" appearing in the first labeled data set as an example, based on the preset first correspondence, the first entity tag of the entity "3:45PM" is updated to the first replacement word N:NM, and based on the entity category and the preset second correspondence, the first replacement word N / N / N is updated to the second replacement word \d+:\d+\w, so that based on the regular expression, the first entity tag of the entity that meets the 3:45PM time format is updated to \d+:\d+\w, thereby realizing the second entity tagging of the labeled data set and obtaining the second labeled data set.
[0132] The embodiment of the present application performs second entity labeling on the first labeling data set based on the regular expression and the first entity labeling to obtain the second labeling data set. The entity labeling in the first labeling data set is strengthened by the regular expression, thereby enhancing the accuracy of the target model.
[0133] S303, training multiple pre-trained sub-models based on the training set, and when the accuracy of the trained sub-model is less than the accuracy threshold, returning to the step of performing second entity labeling on the labeled data set based on the regular expression and the first entity labeling, until the accuracy of the trained sub-model is greater than or equal to the accuracy threshold; when the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, determining that the sub-model has passed the training, and using the model composed of the trained multiple sub-models as the target model.
[0134] As an example, Figure 8 As shown, it is a flowchart of another target model training method provided in an embodiment of the present application.
[0135] S801, assigning a pre-trained sub-model to each pre-trained entity category in the training set;
[0136] S802, determining a target entity category of a training set in a pre-trained sub-model, wherein the target entity category is an entity category corresponding to the highest confidence in the training process;
[0137] S803. When the target entity category is consistent with the pre-trained entity category, determine that the pre-trained sub-model has completed training; when the target entity category is inconsistent with the pre-trained entity category, continue to train the pre-trained sub-model.
[0138] Exemplarily, a pretrained sub-model is assigned to each pre-trained entity category in the training set. For example, if the pre-trained entity categories in the training set are person names, place names, and dates, the first pre-trained sub-model is assigned to train entities in the training set whose entity category is person names, the second pre-trained sub-model is assigned to train entities in the training set whose entity category is place names, and the third pre-trained sub-model is assigned to train entities in the training set whose entity category is dates.
[0139] Taking the example of assigning the first pre-trained sub-model to train entities whose entity categories are human names in the training set, during the training process, when the target entity category determined by the first pre-trained sub-model is consistent with the entity category of the first pre-trained sub-model, that is, when the target entity category is a human name, the first pre-trained sub-model is determined to have completed training; when the target entity category determined by the first pre-trained sub-model is inconsistent, that is, when the target entity category is not a human name, the first pre-trained sub-model continues to be trained.
[0140] This application trains multiple pre-trained sub-models based on the group training method to achieve high accuracy and efficiency in target entity recognition, thereby achieving high accuracy and efficiency in de-identification. In addition, this application reduces the reliance on a large number of identification data sets through the model training method, thereby improving the generalization ability of the model.
[0141] It should be noted that each pre-trained sub-model includes a case-sensitive XL-NET model and a case-insensitive XL-NET model. Training both the case-sensitive and case-insensitive XL-NET models during the pre-trained sub-model training process can improve the flexibility and accuracy of the model in identifying entities.
[0142] As an example, when the accuracy of the trained sub-model is less than the accuracy threshold, before returning to the step of performing the second entity tagging on the tagged data set based on the regular expression and the first entity tag, the method further includes:
[0143] Determine that the second target text marked by the second entity does not exist in the second marked data set, add the second target text to the target set; and delete the second target text in the marked data set based on the target set. In other words, in the iterative fine-tuning process of the sub-model, the second target text is added to the target set and the second target text in the training set is deleted, thereby improving the accuracy of the sub-model.
[0144] For example, during the iterative fine-tuning of the sub-model, public data sets, such as data sets including cities and addresses, can be added to improve the training effect of the sub-model and further improve the accuracy of the sub-model.
[0145] It should be noted that after the pre-trained sub-model is trained based on the training set, the precision of the trained sub-model is determined based on the test set to verify the performance of the sub-model. When the precision of the trained sub-model is less than the precision threshold, the process returns to the step of performing the second entity tagging on the first tagged data set based on the regular expression and the first entity tag, and continues to train the sub-model until the precision of the trained sub-model is greater than or equal to the precision threshold;
[0146] When the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, the sub-model is determined to have passed the training, and the model composed of the trained multiple sub-models is used as the target model. For example, taking three pre-trained sub-models as an example, when the accuracy of the three pre-trained sub-models is greater than or equal to the accuracy threshold, the model composed of the three pre-trained sub-models is used as the target model.
[0147] Based on the same inventive concept, the embodiment of the present application further provides a de-identification device, the principle of which is similar to that of the above-mentioned de-identification method, and the repetitive parts will not be repeated. Fig. 9 FIG. 1 is a schematic diagram of a de-identification device provided in an embodiment of the present application, comprising:
[0148] The marking unit 901 is used to input the acquired data set to be processed into the target model to obtain a data set marking the target entity;
[0149] A replacement unit 902, configured to replace the target entity based on a preset replacement text to obtain a de-identified data set;
[0150] The training unit 903 is used to perform a first entity tagging on the target data set based on the IOB tagging method to obtain a first tagging data set; perform a second entity tagging on the first tagging data set based on a regular expression and the first entity tagging to obtain a second tagging data set, and use the second tagging data set as a training set; train multiple pre-trained sub-models based on the training set, and when the accuracy of the trained sub-model is less than the accuracy threshold, return to the step of performing a second entity tagging on the first tagging data set based on the regular expression and the first entity tagging until the accuracy of the trained sub-model is greater than or equal to the accuracy threshold; when the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, determine that the sub-model has passed the training, and use the model composed of the multiple sub-models that have passed the training as the target model.
[0151] The present application provides a de-identification method and device. The present application inputs the acquired data set to be processed into the target model to obtain a data set for marking the target entity; replaces the target entity based on the preset alternative text to obtain a de-identified data set; wherein the target model is trained in the following manner: based on the IOB tagging method, the target data set is firstly marked as a first marked data set; based on the regular expression and the first entity tag, the marked data set is secondly marked as a second marked data set, and the second marked data set is used as a training set; based on the training set, multiple pre-trained sub-models are trained, and when the accuracy of the trained sub-model is less than the accuracy threshold, the step of performing the second entity tagging on the marked data set based on the regular expression and the first entity tag is returned until the accuracy of the trained sub-model is greater than or equal to the accuracy threshold; when the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, it is determined that the sub-model has passed the training, and the model composed of the trained multiple sub-models is used as the target model. The present application obtains the target model by training multiple pre-trained sub-models in groups, thereby achieving high accuracy and high efficiency of target entity recognition, and thus achieving high accuracy and high efficiency of de-identification.
[0152] In a possible implementation manner, the training unit 903 is specifically configured to:
[0153] Perform word segmentation on the target data set to obtain multiple words of the target data set;
[0154] Based on the IOB tagging method, for each word, if the word is determined to be an entity, the entity start part of the word is marked as the first tag, and the entity internal part of the word is marked as the second tag; if the word is determined to be a non-entity, the word is marked as the third tag;
[0155] The labeled target dataset is used as the first labeled dataset.
[0156] In a possible implementation manner, the training unit 903 is specifically configured to:
[0157] Counting the repetition rate of the first target text in the first labeled data set;
[0158] When it is determined that the repetition rate of the first target text is greater than or equal to the repetition rate threshold, the first target text is added to the target set;
[0159] The first target text in the first labeled data set is deleted based on the target set.
[0160] In a possible implementation manner, the training unit 903 is specifically configured to:
[0161] Determine a target vocabulary of the first labeled data set based on a pattern matching method, and update a first entity tag of the target vocabulary to a first replacement word based on a preset first corresponding relationship;
[0162] Determining an entity category corresponding to a target vocabulary based on a first entity tag in a first tag dataset;
[0163] Based on the entity category and the preset second correspondence, the first replacement word is updated to a second replacement word, and the third correspondence between the first entity tag of the target vocabulary and the second replacement word is used as a regular expression.
[0164] In a possible implementation manner, the training unit 903 is specifically configured to:
[0165] Assigning a pre-trained sub-model to each pre-trained entity category of the training set;
[0166] Determine the target entity category of the training set in the pre-trained sub-model, where the target entity category is the entity category corresponding to the highest confidence during the training process;
[0167] When the target entity category is consistent with the pre-trained entity category, it is determined that the pre-trained sub-model has completed training; when the target entity category is inconsistent with the pre-trained entity category, the pre-trained sub-model continues to be trained.
[0168] In a possible implementation manner, the training unit 903 is further configured to:
[0169] Determine that a second target text marked with a second entity does not exist in the second marked data set, and add the second target text to the target set;
[0170] The second target text in the labeled dataset is deleted based on the target set.
[0171] In a possible implementation manner, the replacement unit 902 is specifically configured to:
[0172] Determine the entity category and location of the target entity;
[0173] Marking target entities with consistent entity categories and consistent entity instances with preset labels;
[0174] Based on a fourth correspondence between a preset label and an alternative text, the target entity is replaced with the alternative text to obtain a de-identified data set, wherein the fourth correspondence is preset.
[0175] Based on the same inventive concept, the embodiment of the present application further provides a de-identification device, the principle of which is similar to that of the above-mentioned de-identification method and apparatus, and the repetitive parts will not be repeated. Fig.10As shown, it is a schematic diagram of a de-identification device provided in an embodiment of the present application, comprising at least one processor 1001; and a memory 1002 communicatively connected to the at least one processor 1001; wherein the memory 1002 stores instructions executable by the at least one processor 1001, and the instructions are executed by the at least one processor 1001 so that the at least one processor 1001 can execute any one of the methods in the first aspect.
[0176] The present application provides a de-identification method, device and equipment. The present application inputs the acquired data set to be processed into the target model to obtain a data set for marking the target entity; replaces the target entity based on the preset alternative text to obtain a de-identified data set; wherein the target model is trained in the following manner: based on the IOB tagging method, the target data set is firstly marked as a first marked data set; based on the regular expression and the first entity tag, the marked data set is secondly marked as a second marked data set, and the second marked data set is used as a training set; based on the training set, multiple pre-trained sub-models are trained, and when the accuracy of the trained sub-model is less than the accuracy threshold, the step of performing the second entity tagging on the marked data set based on the regular expression and the first entity tag is returned until the accuracy of the trained sub-model is greater than or equal to the accuracy threshold; when the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, it is determined that the sub-model has passed the training, and the model composed of the trained multiple sub-models is used as the target model. The present application obtains the target model by training multiple pre-trained sub-models in groups, thereby achieving high accuracy and high efficiency of target entity recognition, and thus achieving high accuracy and high efficiency of de-identification.
[0177] The present application is described above with reference to the block diagrams and / or flow charts showing the methods, devices (systems) and / or computer program products according to the embodiments of the present application. It should be understood that a block of the block diagram and / or flow chart diagram and a combination of blocks of the block diagram and / or flow chart diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer and / or other programmable data processing device to produce a machine, so that the instructions executed by the computer processor and / or other programmable data processing device create a method for implementing the functions / actions specified in the block diagram and / or flow chart block.
[0178] Accordingly, the present application may also be implemented with hardware and / or software (including firmware, resident software, microcode, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium, which has a computer-usable or computer-readable program code implemented in the medium, for use by an instruction execution system or in conjunction with an instruction execution system. In the context of the present application, a computer-usable or computer-readable medium may be any medium that may contain, store, communicate, transmit, or convey a program for use by an instruction execution system, device, or apparatus, or in conjunction with an instruction execution system, device, or apparatus.
[0179] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A de-identification method, characterized in that: The method comprises: After the acquired data set to be processed is input into the target model, a data set with the target entity marked is obtained; The target entity is replaced based on a preset alternative text to obtain a de-identified data set; The target model is trained in the following way: Performing a first entity tagging on the target data set based on the IOB tagging method to obtain a first labeled data set; Based on the regular expression and the first entity tag, perform a second entity tag on the first tag data set to obtain a second tag data set, and use the second tag data set as a training set; Based on the training set, multiple pre-trained sub-models are trained. When the accuracy of the trained sub-model is less than the accuracy threshold, return to the step of performing second entity labeling on the first labeled data set based on the regular expression and the first entity labeling, until the accuracy of the trained sub-model is greater than or equal to the accuracy threshold; when the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, determine that the sub-model has passed the training, and use the model composed of the multiple sub-models that have passed the training as the target model.
2. The method according to claim 1, characterized in that The step of performing a first entity tagging on the target data set based on the IOB tagging method to obtain a first tagged data set includes: Performing word segmentation processing on the target data set to obtain multiple words of the target data set; Based on the IOB tagging method, for each word, when it is determined that the word is an entity, the entity start part of the word is marked as the first tag, and the entity internal part of the word is marked as the second tag; when it is determined that the word is not an entity, the word is marked as the third tag; The labeled target data set is used as the first labeled data set.
3. The method according to claim 1, characterized in that Before performing the second entity tag on the first tag data set based on the regular expression and the first entity tag, the method further includes: Counting the repetition rate of the first target text in the first labeled data set; When it is determined that the repetition rate of the first target text is greater than or equal to a repetition rate threshold, adding the first target text to a target set; The first target text in the first labeled data set is deleted based on the target set.
4. The method according to claim 1, characterized in that The regular expression is determined by the following method: Determine a target vocabulary of the first tag data set based on a pattern matching method, and update a first entity tag of the target vocabulary to a first replacement word based on a preset first corresponding relationship; Determining an entity category corresponding to the target vocabulary based on a first entity tag in the first tag data set; Based on the entity category and a preset second correspondence, the first replacement word is updated to a second replacement word, and a third correspondence between the first entity tag of the target vocabulary and the second replacement word is used as the regular expression.
5. The method according to claim 1, characterized in that The training of multiple pre-trained sub-models based on the training set includes: Assigning a pre-trained sub-model to each pre-trained entity category of the training set; Determining a target entity category of a training set in the pre-trained sub-model, wherein the target entity category is the entity category corresponding to the highest confidence during the training process; When the target entity category is consistent with the pre-trained entity category, it is determined that the pre-trained sub-model has completed training; when the target entity category is inconsistent with the pre-trained entity category, the pre-trained sub-model continues to be trained.
6. The method according to claim 3, characterized in that When the accuracy of the trained sub-model is less than the accuracy threshold, before returning to the step of performing a second entity tag on the first tagged data set based on the regular expression and the first entity tag, the method further includes: Determine that a second target text marked with a second entity does not exist in the second marked data set, and add the second target text to the target set; The second target text in the labeled data set is deleted based on the target set.
7. The method according to any one of claims 1 to 6, characterized in that: The step of replacing the target entity based on the preset alternative text to obtain a de-identified data set includes: determining an entity category and a location of the target entity; Marking target entities with consistent entity categories and consistent entity instances with preset labels; Based on a fourth correspondence between the preset label and the alternative text, the target entity is replaced with the alternative text to obtain a de-identified data set, wherein the fourth correspondence is preset.
8. A de-identification device, characterized in that: The device comprises: A labeling unit, used to input the acquired data set to be processed into the target model to obtain a data set for labeling the target entity; A replacement unit, used to replace the target entity based on a preset alternative text to obtain a de-identified data set; A training unit is used to perform a first entity tagging on a target data set based on an IOB tagging method to obtain a first tagging data set; perform a second entity tagging on the first tagging data set based on a regular expression and the first entity tagging to obtain a second tagging data set, and use the second tagging data set as a training set; train multiple pre-trained sub-models based on the training set, and when the accuracy of the trained sub-model is less than an accuracy threshold, return to the step of performing a second entity tagging on the first tagging data set based on a regular expression and the first entity tagging until the accuracy of the trained sub-model is greater than or equal to the accuracy threshold; when the accuracy of the trained sub-model is greater than or equal to the accuracy threshold, determine that the sub-model has passed the training, and use the model composed of the trained multiple sub-models as the target model.
9. The device according to claim 8, characterized in that The training unit is specifically used for: Performing word segmentation processing on the target data set to obtain multiple words of the target data set; Based on the IOB tagging method, for each word, when it is determined that the word is an entity, the entity start part of the word is marked as a first tag, and the entity internal part of the word is marked as a second tag; In the case where it is determined that the word is a non-entity, marking the word as a third tag; The labeled target data set is used as the first labeled data set.
10. A de-identification device, characterized in that: The invention comprises at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
User information privacy removal processing method and system and medium
CN115357935A
Neural network model-based appeal classification method and device and storage medium
CN117252196A
Privacy compliance method for unstructured text data
CN118094634A
Business data processing method and device, computer equipment, readable storage medium and program product
CN119128986A