Data enhancement method and data enhancement device
By obtaining and processing entity words in the data set, generating sample statements that meet the constraints and annotating them, the problem of enhanced sample semantic inconsistency in the prior art is solved, and the effect of data enhancement and the performance of named entity recognition models is improved.
Patent Information
- Application Number
- CN202411215600.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-24
AI Technical Summary
In the data enhancement process of deep learning models, the generated enhancement samples have semantic incoherence problems, resulting in poor sample data enhancement effect.
By obtaining entity words in the initial statement in the data set, obtaining multiple extended entity words, and processing them based on preset constraints, multiple sample statements are generated to ensure the legality and context consistency of the inserted words, and finally, the final Sample statements are annotated to generate enhanced data sets that are both legitimacy, diversity and coherence.
It improves the semantic coherence of the enhancement samples and the diversity of the data sets, improves the data augmentation effect, and makes the enhanced data set perform more reasonably and accurately in the named entity recognition model.
Smart Images

Figure CN119179896A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data enhancement method and a data enhancement device. Background Art
[0002] In the field of deep learning, the training accuracy of deep learning models depends on the quality of the data set. In this case, it is particularly important to use data enhancement technology to expand the data set.
[0003] Taking the named entity recognition model as an example, in the related technology, when performing data enhancement on the data set of the named entity recognition model, the words in the sample are usually replaced and back-translated while keeping the sample labels in the data set unchanged to generate new enhanced samples, thereby expanding the data set.
[0004] However, there is a problem of semantic incoherence in generating new enhanced samples in related technologies, resulting in poor results in sample data enhancement. Summary of the invention
[0005] Based on this, it is necessary to provide a data enhancement method and a data enhancement device that can improve the semantic coherence of enhanced samples and thereby improve the sample data enhancement effect in response to the above technical problems.
[0006] In a first aspect, the present application provides a data enhancement method, comprising:
[0007] According to the entity words in each initial sentence in the data set, multiple extended entity words are obtained;
[0008] Based on preset constraints, entity word processing is performed on multiple extended entity words to obtain multiple sample sentences; the constraints are used to constrain the legitimacy of words inserted into the boundary positions of the extended entity words during the entity word processing process;
[0009] The extended entity words in multiple sample sentences are labeled to obtain an enhanced dataset of the dataset.
[0010] In the technical solution provided by the embodiment of the present application, multiple extended entity words are obtained according to the entity words in each initial sentence in the data set, and then entity word processing is performed on the multiple extended entity words based on the preset constraint conditions to obtain multiple sample sentences, and finally the entity words in the multiple sample sentences are annotated to obtain an enhanced data set of the data set. Among them, the constraint conditions are used to constrain the legitimacy of the words inserted in the boundary position of the extended entity words during the entity word processing process. In this method, based on the entity words in each initial sentence in the data set, multiple extended entity words are obtained, and the richness and diversity of the extended entity words are improved as much as possible while keeping the entity word type of the entity word unchanged; then, in the extended entity word processing process, the legitimacy of the words inserted in the boundary position of the extended entity words is guaranteed by the constraint conditions, and multiple sample sentences are obtained to ensure the coherence and legitimacy of the sample sentences; finally, the entity words in the multiple sample sentences are annotated to ensure the consistency of the entity words and labels in the enhanced sample sentences, and the consistency of the format of the enhanced sample sentences with the format of the initial sentences in the data set, and the enhanced data set of the data set is obtained, so that the enhanced words in the enhanced data set have the characteristics of both legitimacy, diversity and coherence, and improve the enhancement effect of the data set.
[0011] In one embodiment, entity word processing is performed on multiple extended entity words based on preset constraints to obtain multiple sample sentences, including:
[0012] Determining a preset number of target extended entity words from the plurality of extended entity words;
[0013] Each target extended entity word is input into a text generation model. In the text generation model, each target extended entity word is subjected to word insertion and filling processing according to constraint conditions to obtain a sample sentence matching each target extended entity word.
[0014] In the technical solution provided in the embodiment of the present application, a preset number of target extended entity words are input into a text generation model, and each target extended entity word is processed by insertion and filling according to constraints through the text generation model, and a sample sentence matching each target extended entity word is output. This is equivalent to integrating the constraints and insertion and filling logic into the text generation model, so that in different scenarios, the text generation model can be flexibly called to process the target extended entity words, thereby improving the generation speed of sample sentences.
[0015] In one embodiment, the constraint condition includes keeping the text content of each target extended entity word unchanged, and the context content of each target extended entity word after the word insertion belongs to the entity word in the specified entity word tag; performing the word insertion processing on each target extended entity word according to the constraint condition includes:
[0016] While keeping the text content of each target extended entity word unchanged, obtain the text information to be filled in the slots between each target extended entity word;
[0017] For any target extended entity word, if the context content formed by the target extended entity word and the text information of the front and back slots belongs to the entity word in the specified entity word tag, the text information of the front and back slots will be filled into the front and back slots of the target extended entity word accordingly.
[0018] In the technical solution provided in the embodiment of the present application, each target extended entity word is input into a text generation model, and the front and rear slots of each target extended entity word are filled in multiple stages according to the processing rules of keeping the text content of each target extended entity word unchanged and the context content of each target extended entity word belonging to the entity word in the specified entity word label after the insertion of the word. This is to improve the rationality of inserting text at the boundary position of the target extended entity word in the process of generating sample sentences by the text generation model, and to ensure the legitimacy of the enhanced data and the consistency of the labels.
[0019] In one embodiment, obtaining text information to be filled in the slots between target extended entity words includes:
[0020] For any slot, when the slot includes an insertion mark, obtaining the insertion probability of each candidate text information in the slot;
[0021] The candidate text information with the highest insertion probability is determined as the text information to be filled in the slot.
[0022] In the technical solution provided by the embodiment of the present application, when the slot of the target extended entity word includes an insertion mark, the candidate text information with the highest insertion probability is determined as the text information to be filled in the slot, so as to ensure the rationality of the context content formed by the text information filled in the slot and the target extended entity word, and the rationality of the context content in the sample sentence, thereby improving the quality of the sample sentences generated by the text generation model.
[0023] In one embodiment, the training process of the text generation model includes:
[0024] Get the quantitative importance value of each entity word in multiple corpora;
[0025] According to the quantified importance value of each entity word in each corpus, multiple corpus sequences of each corpus are obtained;
[0026] According to multiple corpus sequences of each corpus, a training data pair of each corpus is obtained;
[0027] Based on the training data pairs of each corpus, the initial text generation model is trained to obtain a text generation model.
[0028] In the technical solution provided by the embodiment of the present application, multiple corpus sequences of each corpus are obtained according to the quantified importance value of each entity word in each corpus, and then the training data pairs of each corpus are obtained. The training data pairs constructed in this way comprehensively consider the importance of the entity words and the dynamic filling planning path of the entity words, so that the initial text generation model can learn to fill the entity words to obtain the corpus sequence, and then obtain the sentence generation logic of the corpus by filling the words in the corpus sequence, so that the text generation model can fill the important words in the sample sentences earlier in the actual application process, reduce the number of iterations of the model reasoning, and speed up the reasoning speed of the initial text generation model.
[0029] In one embodiment, multiple corpus sequences of each corpus are obtained according to the importance quantification value of each entity word in each corpus, including:
[0030] For any corpus, according to the preset deletion rules, delete the entity words in the corpus to obtain multiple combined corpora;
[0031] The importance quantification values of each entity word in each combined corpus are superimposed to obtain the comprehensive quantification value of each combined corpus;
[0032] The combined corpus with the highest comprehensive quantization value is determined as the corpus sequence of the corpus; the process is executed in a loop until the number of entity words in the corpus sequence is reduced to a preset number threshold, thereby obtaining multiple corpus sequences of the corpus.
[0033] In the technical solution provided in the embodiment of the present application, according to the preset deletion rules, a variety of deletion methods are flexibly adopted to delete the entity words in the corpus, so as to obtain a plurality of combined corpora with rich content and different semantics. Then, based on the quantitative value of the importance of each entity word in each combined corpus, a quantitative evaluation is performed on each combined corpus to determine the combined corpus with the highest score as the corpus sequence, thereby ensuring the validity of the corpus sequence.
[0034] In one embodiment, the training data pair includes a corpus and a plurality of corpus sequence pairs of the corpus; and the training data pair of each corpus is obtained according to the plurality of corpus sequences of each corpus, including:
[0035] For multiple corpus sequences of any corpus, sort each corpus sequence according to the number of entity words in each corpus sequence, and combine every two adjacent corpus sequences to construct multiple groups of corpus sequence pairs;
[0036] The corpus and each group of corpus sequence pairs are combined to obtain the training data pairs of the corpus.
[0037] In the technical solution provided by the embodiment of the present application, each corpus sequence is sorted according to the number of entity words in each corpus sequence, and each two adjacent corpus sequences are combined to construct multiple groups of corpus sequence pairs, so that the entity words of the two corpus sequences in each group of corpus sequence pairs have the same change trend, and the entity words of adjacent groups of corpus sequence pairs have the same change trend. This is equivalent to characterizing the filling degree of the corpus sequence with the number of entity words, and combining the corpus sequences in pairs according to different filling degrees, providing the text generation model with corpus sequences of different filling degrees corresponding to the same corpus, so that the text generation model can fill the words in multiple slot positions in stages, thereby improving the efficiency of the text generation model in generating sample sentences and the accuracy of the sample sentences.
[0038] In one embodiment, the data set includes entity word labels of each entity word; according to the entity words in each initial sentence in the data set, a plurality of extended entity words are obtained, including:
[0039] According to the type of entity word label, the entity words in each initial sentence in the data set are classified to obtain multiple entity words corresponding to each entity word label;
[0040] According to the multiple entity words corresponding to each entity word label, determine the average text vector of each entity word label type;
[0041] According to each average text vector, the validity of each candidate entity word in the candidate entity word set is verified;
[0042] The candidate entity words that pass the validity verification are determined as extended entity words.
[0043] In the technical solution provided by the embodiment of the present application, the validity of each candidate entity word in the candidate entity word set is verified according to the average text vector corresponding to each entity word label, and the extended entity words that pass the verification are obtained, and the candidate entity words that fail the verification are discarded. Such verification is quantitative and intuitive, and the verification method is logically clear, and the extended entity words can be quickly screened out from the candidate entity word set. In addition, although the extended entity words correspond to the entity word labels of the entity words in the initial sentence, the extended entity words are not directly determined from the initial sentence, but are screened from the candidate entity word set, which can greatly enrich the semantic richness of the entity words, thereby improving the richness and diversity of the sample sentences obtained based on the extended entity words.
[0044] In one embodiment, the validity of each candidate entity word in the candidate entity word set is verified according to each average text vector, including:
[0045] For any candidate entity word, obtain the vector similarity between the candidate entity word and each average text vector;
[0046] If the maximum vector similarity among the vector similarities is greater than the preset vector similarity threshold, the entity word label corresponding to the maximum vector similarity is determined as the target entity word label of the candidate entity word;
[0047] According to the entity word corresponding to the target entity word label, the validity of the candidate entity word is verified.
[0048] In the technical solution provided in the embodiment of the present application, the validity of the candidate entity word is verified based on the vector similarity between the candidate entity word and each average text vector, and after the first validity verification of the candidate entity word is passed, the validity of the candidate entity word is verified again based on the entity word corresponding to the target entity word label of the candidate entity word, so as to ensure that the candidate entity word matches the entity word label in the data set, and the candidate entity word matches the entity word in the data set, thereby improving the reliability and accuracy of the validity verification results of the candidate entity word.
[0049] In one embodiment, validating the candidate entity words according to the entity words corresponding to the target entity word labels includes:
[0050] From the entity words corresponding to the target entity word label, obtain the target entity word with the highest occurrence frequency;
[0051] If the relevance information value between the candidate entity word and the target entity word is greater than a preset relevance threshold, it is determined that the validity verification of the candidate entity word has passed.
[0052] In the technical solution provided in the embodiment of the present application, the target entity word with the highest frequency of occurrence among the entity words corresponding to the target entity word label is used as the basis to calculate the correlation information value between the candidate entity word and the target entity word, so as to quantitatively evaluate the correlation between the candidate entity word and the target entity word, and when the correlation information value is greater than the preset correlation threshold, it is determined that the validity verification of the candidate entity word has passed, thereby effectively ensuring the reliability and accuracy of the validity verification results of the candidate entity word.
[0053] In one embodiment, the extended entity words in multiple sample sentences are annotated to obtain an enhanced dataset of the dataset, including:
[0054] Annotate the extended entity words in each sample sentence and generate a target enhanced sentence for each sample sentence;
[0055] The target enhanced sentences of each sample sentence are summarized to obtain the enhanced dataset.
[0056] In the technical solution provided by the embodiment of the present application, the extended entity words in each sample sentence are annotated, and a target enhanced sentence is generated for each sample sentence, and the format of the target enhanced sentence is kept consistent with that of each initial sentence in the data set. In addition, the extended entity words are determined based on the entity words of the initial sentence, so the entity word labels of the extended entity words also belong to the entity word labels of the entity words in the initial sentence, that is, the target enhanced sentence in the enhanced data set is a richer and more comprehensive sentence generated on the basis of keeping the entity word labels in the data set unchanged, which greatly improves the sample diversity of the data set.
[0057] In a second aspect, the present application also provides a data enhancement device, including:
[0058] An entity word acquisition module is used to acquire multiple extended entity words according to the entity words in each initial sentence in the data set;
[0059] A sentence generation module is used to perform entity word processing on multiple extended entity words based on preset constraints to obtain multiple sample sentences; the constraints are used to constrain the legality of words inserted into the boundary position of the extended entity words during the entity word processing process;
[0060] The sentence annotation module is used to annotate entity words in multiple sample sentences to obtain an enhanced dataset of the dataset.
[0061] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method in any one of the embodiments of the first aspect are implemented.
[0062] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect above.
[0063] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0065] FIG1 is a diagram of an internal structure of a computer device according to an embodiment of the present invention;
[0066] FIG2 is a schematic diagram of a flow chart of a data enhancement method in one embodiment;
[0067] FIG3 is a schematic diagram of the format of an initial statement in one embodiment;
[0068] FIG4 is a schematic flow chart of a sample sentence generation step in one embodiment;
[0069] FIG5 is a schematic flow chart of a word insertion step in one embodiment;
[0070] FIG6 is a schematic diagram of a flow chart of a filling information determination step in one embodiment;
[0071] FIG7 is a schematic diagram of a flow chart of a text generation model training step in one embodiment;
[0072] FIG8 is a schematic flow chart of a corpus sequence acquisition step in one embodiment;
[0073] FIG9 is a schematic flow chart of a step of acquiring training data pairs in one embodiment;
[0074] FIG10 is a flow chart of an extended entity word acquisition step in one embodiment;
[0075] FIG11 is a schematic diagram of a flow chart of a candidate entity word verification step in one embodiment;
[0076] FIG12 is a schematic flow chart of a candidate entity word verification step in another embodiment;
[0077] FIG13 is a schematic diagram of a flow chart of an enhanced data set acquisition step in one embodiment;
[0078] FIG14 is a schematic diagram of a flow chart of a data enhancement method in another embodiment;
[0079] FIG15 is a schematic diagram of a flow chart of a data enhancement method in another embodiment;
[0080] FIG16 is a structural block diagram of a data enhancement device in one embodiment. DETAILED DESCRIPTION
[0081] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0082] The data enhancement method provided in the embodiment of the present application can be applied to a computer device, which can be a server, and its internal structure diagram can be shown in Figure 1. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to data set enhancement, including but not limited to constraints, text generation models, etc. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data enhancement method is implemented. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0083] Those skilled in the art will understand that the structure shown in FIG. 1 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0084] In the field of deep learning, deep learning models need to be trained with a large number of annotated data sets before performing recognition tasks. However, in actual scenarios, the process of obtaining annotated data sets requires a lot of manpower and material resources, and the quality of the data sets cannot be guaranteed. Based on this, it is particularly important to use data augmentation methods to expand the data set. Data augmentation is a method of creating artificially synthesized data by adding existing data or extracting information from existing data, aiming to expand the data set.
[0085] Furthermore, in the field of natural language processing (NLP), taking deep learning as an example, the named entity recognition model is used to identify entity words in a sentence and determine the label of each entity word. In the related art, when enhancing the data set of the natural language processing model, common data enhancement methods include, for example, back translation, word replacement, random deletion, random insertion, and random exchange.
[0086] However, the enhanced data obtained by the above method is more suitable for executing sentence-level tasks, but not for named entity recognition models to perform token-level named entity recognition (NER) tasks. The specific reasons are as follows: First, the granularity of the NER task is finer and more sensitive to the noise generated during data enhancement. The enhanced text generated by the data enhancement method used in the related art may cause changes in the text that constitutes the named entity, undermine its legitimacy, and bring negative samples to the training of the named entity recognition model. Secondly, the data enhancement method used in the related art greatly reduces the semantic and grammatical fluency of the text in the original data set. Finally, the data enhancement method used in the related art is usually based on the modification of the text in the original data set, and the diversity of the constructed enhanced samples is low.
[0087] In summary, the enhanced samples generated in the related technology have problems such as semantic incoherence and low diversity, which leads to poor effect of the enhanced samples and is not suitable for performing word-level recognition tasks.
[0088] Based on this, an embodiment of the present application provides a data enhancement method, which obtains multiple extended entity words according to the entity words in each initial sentence in the data set to improve the diversity of the entity words, thereby improving the diversity of data enhancement; then, based on preset constraints, the legitimacy of the words inserted in the boundary position of the extended entity words during the entity word processing is constrained to obtain multiple sample sentences to ensure the coherence and legitimacy of the sample sentences; finally, the entity words in the multiple sample sentences are labeled to ensure the consistency of the entity words and labels in the enhanced sample sentences, and an enhanced data set of the data set is obtained, so that the enhancement in the enhanced data set has the characteristics of both legitimacy, diversity and coherence, thereby improving the enhancement effect of the data set.
[0089] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0090] In an exemplary embodiment, as shown in FIG2 , a data enhancement method is provided, comprising the following steps:
[0091] S201, obtaining a plurality of extended entity words according to the entity words in each initial sentence in the data set.
[0092] Among them, entity words are determined from the initial sentence according to the part of speech of each word, usually referring to nouns and pronouns. In the embodiment of the present application, the data set includes multiple initial sentences, each initial sentence includes multiple entity words, and each entity word in each initial sentence corresponds to an entity word label.
[0093] Please refer to Figure 3, which is a schematic diagram of the correspondence between an initial sentence and an entity word label; for example, the initial sentence includes the entity word "X month X day", and the entity word label of the entity word is time; the initial sentence includes the entity word "Y province", and the entity word label of the entity word is province; the initial sentence includes the entity word "Li Mou", and the entity word label of the entity word is the name of the person.
[0094] When obtaining entity words in each initial sentence, candidate entity words with the same entity word labels as those in the initial sentence can be screened from the candidate entity word set without annotated entity word labels as extended entity words. In this way, the entity word labels of the extended entity words match the entity word labels in the entity words in each initial sentence in the data set, which is equivalent to expanding the entity words under each entity word label in a richer and more diverse manner while keeping the original entity word labels of the data set unchanged.
[0095] Optionally, for each candidate entity word in the candidate entity word set, the semantic similarity between the candidate entity word and each entity word in the data set is calculated. If the maximum semantic similarity among multiple semantic similarities is greater than a preset semantic similarity threshold, the candidate entity word is determined as an extended entity word, and the entity word label of the entity word corresponding to the maximum semantic similarity is determined as the entity word label of the candidate entity word.
[0096] Optionally, based on the entity words in each initial sentence in the data set, the entity word label of each entity word is obtained, and then the candidate entity words in the candidate entity word set are classified and identified to obtain the candidate entity word label of each candidate entity word. If the candidate entity word label matches any entity word label, the candidate entity word corresponding to the candidate entity word label is determined as an extended entity word.
[0097] S202, performing entity word processing on a plurality of extended entity words based on preset constraint conditions to obtain a plurality of sample sentences; the constraint conditions are used to constrain the legality of words inserted into the boundary positions of the extended entity words during the entity word processing process.
[0098] The extended entity words are in discrete word form, while the samples in the data set are in continuous sentence form. Based on this, in order to obtain sample sentences in sentence form, when the extended entity words are obtained, the extended entity words are processed with multiple stages of word filling according to the preset processing logic to associate the extended entity words and obtain sample sentences. In addition, in the process of processing the extended entity words, the preset constraints can also be followed to ensure the rationality of the words at the boundary positions of the extended entity words in the sample sentences, thereby improving the fluency and legitimacy of the sample sentences.
[0099] In actual scenarios, several extended entity words can be randomly selected from multiple extended entity words to obtain multiple extended entity word combinations. Among them, the extended entity words in different extended entity word combinations can be the same or different, and this embodiment of the application does not limit this.
[0100] For any extended entity word combination, new words are filled at the boundary position of each extended entity word in the extended entity word combination according to the preset constraints. The filled sample sentences are continuously enriched in a multi-stage filling manner until the filling termination condition is met, and a sample sentence matching the extended entity word combination is obtained.
[0101] Exemplarily, the constraint condition may be that the text length of the words at two adjacent boundary positions of the extended prompt word is less than or equal to a preset text length. In each filling stage, if the text length of the words at one of the boundary positions of the extended prompt word reaches the preset text length, then in the next filling stage of the current filling stage, no new words will be filled into the boundary position.
[0102] Exemplarily, the constraint condition may be that the parts of speech of the words at two adjacent boundary positions of the extended prompt word are non-entity words, such as verbs or conjunctions. In each filling stage, one or more non-entity words are selected from the word set of non-entity words and inserted at the boundary position of the extended entity word.
[0103] S203: annotate the extended entity words in the multiple sample sentences to obtain an enhanced data set of the data set.
[0104] The extended entity words in each sample sentence are identified, the labels of each extended entity word in each sample sentence are determined, an enhanced sample sentence of each sample sentence is obtained, and the enhanced sample sentences of each sample sentence are summarized to obtain an enhanced data set of the data set.
[0105] It should be noted that the entity words in the sample sentences are extended entity words. Since the extended entity words are obtained based on the entity words in the dataset, the entity word labels of the extended entity words are one of the categories of entity word labels in the dataset. In other words, the type of entity word labels in the enhanced dataset is less than or equal to the entity word labels in the dataset.
[0106] In the embodiment of the present application, according to the entity words in each initial sentence in the data set, multiple extended entity words are obtained, and then based on the preset constraints, entity word processing is performed on the multiple extended entity words to obtain multiple sample sentences, and finally the entity words in the multiple sample sentences are annotated to obtain an enhanced data set of the data set. Among them, the constraints are used to constrain the legitimacy of the words inserted in the boundary position of the extended entity words during the entity word processing process. In this method, based on the entity words in each initial sentence in the data set, multiple extended entity words are obtained, and the richness and diversity of the extended entity words are improved as much as possible while keeping the entity word type of the entity word unchanged; then, in the process of extending the entity word processing, the legitimacy of the words inserted in the boundary position of the extended entity word is guaranteed by the constraints, and multiple sample sentences are obtained to ensure the coherence and legitimacy of the sample sentences; finally, the entity words in the multiple sample sentences are annotated to ensure the consistency of the entity words and labels in the enhanced sample sentences, and the consistency of the format of the enhanced sample sentences with the format of the initial sentences in the data set, and the enhanced data set of the data set is obtained, so that the enhanced position in the enhanced data set has the characteristics of both legitimacy, diversity and coherence, and the enhancement effect of the data set is improved.
[0107] From the above embodiments, it can be seen that the data enhancement process can be divided into three parts: expanding entity words, filling the expanded entity words to obtain sample sentences, and annotating the filled sample sentences. The following is a further description of the sample sentence generation step through an embodiment.
[0108] In an exemplary embodiment, as shown in FIG4 , entity word processing is performed on multiple extended entity words based on preset constraints to obtain multiple sample sentences, including:
[0109] S401, determining a preset number of target extended entity words from a plurality of extended entity words.
[0110] Exemplarily, a preset number of target extended entity words are randomly selected from a plurality of extended entity words as hard constraints of the sample sentence.
[0111] In another scenario, entity word labels of multiple extended entity words can also be obtained, and the multiple extended entity words can be classified according to the type of entity word labels. In this case, a preset number of target extended entity words can be randomly selected from multiple extended entity words corresponding to the same type of entity word labels, so that the entity word labels corresponding to the determined target extended entity words are the same; or an extended entity word can be selected from extended entity words corresponding to different types of entity word labels as a target extended entity word, so that the entity word labels corresponding to the multiple determined target extended entity words are different.
[0112] S402, input each target extended entity word into a text generation model, and perform word insertion and filling processing on each target extended entity word in the text generation model according to the constraint conditions to obtain a sample sentence matching each target extended entity word.
[0113] The text generation model can be a pre-trained deep learning model for performing multi-stage sentence generation tasks, such as a transformer model. The input of the text generation model is a discrete target extended entity word, and the output is a continuous sample sentence, and the sample sentence includes the input target extended entity word.
[0114] Optionally, the determined target extended entity words are input into a preset text generation model in parallel, and the boundary positions of the target extended entity words are cyclically filled according to the constraints by the text generation model: new text is inserted into the boundary positions of the target extended entity words for one filling, and then in the sentence obtained by the one filling, new text is continuously inserted into the boundary positions of the target extended entity words for a second filling, and the filling operation is cyclically performed until the filling termination condition is met, and a sample sentence is output. The termination condition may be that the length of the sentence obtained by the latest filling reaches the preset sentence length, or that the probability of inserting text into the boundary positions of the target extended entity words is 0.
[0115] It should be noted that the process of determining a preset number of target extended entity words and generating sample sentences corresponding to each target extended entity word through a text generation model can be executed in a loop, that is, first obtaining a first group of target extended entity words to obtain sample sentences matching the first group of target extended entity words, then obtaining a second group of target extended entity words to obtain sample sentences matching the second group of target extended entity words, ..., by executing the method steps shown in FIG. 4 in a loop, multiple sample sentences can be obtained.
[0116] In an embodiment of the present application, a preset number of target extended entity words are input into a text generation model, and each target extended entity word is processed by insertion and filling according to constraints through the text generation model, and a sample sentence matching each target extended entity word is output. This is equivalent to integrating the constraints and insertion and filling logic into the text generation model, so that in different scenarios, the text generation model can be flexibly called to process the target extended entity words, thereby improving the generation speed of sample sentences.
[0117] In the case of constraining the legitimacy of the words at the boundary position of the extended entity word, the content of the constraint condition is diverse, such as constraining the part of speech of the inserted word, the position of the inserted word, the text length of the inserted word, etc. Based on this, the content of the constraint condition is described below through an embodiment.
[0118] In an exemplary embodiment, as shown in FIG5 , the constraint condition includes keeping the text content of each target extended entity word unchanged, and the context content of each target extended entity word after the insertion filling belongs to the entity word in the specified entity word tag; performing the insertion filling process on each target extended entity word according to the constraint condition includes:
[0119] S501 , obtaining text information to be filled in the slots between the target extended entity words while keeping the text content of the target extended entity words unchanged.
[0120] Taking into account that inserting new words into the context of each word in the target extended entity word may cause the semantics of the target extended entity word to change and become incoherent after the inserted words, keeping the text content of the target extended entity word unchanged is used as a preset constraint condition.
[0121] Optionally, a "[NOI]" tag is added between two adjacent words in each target extended entity word so that the text recognition model can recognize the tag and not insert new words in the middle of the target extended entity word to prevent the legitimacy of the target extended entity word from being damaged.
[0122] Each target extended entity word corresponds to two boundary positions, that is, two slots. Based on this, while keeping the text content of each target extended entity word unchanged, the text recognition model is used to predict whether each slot needs to be filled with text information, and if text information needs to be filled, the text information matching each slot is further predicted.
[0123] S502, for any target extended entity word, if the context content formed by the target extended entity word and the text information of the front and back slots belongs to the entity word in the specified entity word tag, the text information of the front and back slots is filled into the front and back slots of the target extended entity word accordingly.
[0124] Considering that an entity word can be composed of multiple entity words, there will be a problem that after filling the front and back slots of the target extended entity word with words, a new entity word (context content) will be formed, resulting in a change in the semantics of the target extended entity word. The context content belongs to the entity word in the specified entity word label as a preset constraint condition. Among them, the text length of the context content is less than or equal to the maximum text length of each entity word corresponding to the specified entity word label.
[0125] Taking the entity word label of the specified entity word label as the target extended entity word as an example, among the extended entity words corresponding to the specified entity word label, the reference extended entity word with the largest entity word length is obtained, which is recorded as , and its length is recorded as , and then for each target extended entity word, compare the contextual content of the target extended entity word with the reference extended entity word:
[0126]
[0127] Among them, x is the target extended entity word, Expand the text information of the slots before and after the target entity word, is the reference extended entity word corresponding to the specified entity word label. When t=0, the target extended entity word is represented as the first word, that is, the front slot of the target extended entity word is not filled with text; when , the target extended entity word is represented as the last word, that is, the previous slot of the target extended entity word is not filled with text.
[0128] At each word insertion stage of the text generation model, the above-mentioned judgment is performed on each target extended entity word. If each target extended entity word in the sentence generated at the word insertion stage satisfies the above formula, the sentence generated by the text generation model at the word insertion stage is received, and the text generation model is continued to be instructed to perform filling processing for the next word insertion stage based on the sentence; otherwise, the generation result of the word insertion stage is rejected, and the text generation model is instructed to regenerate the sentence based on the sentence output by the previous word insertion stage according to the preset constraints.
[0129] In an embodiment of the present application, each target extended entity word is input into a text generation model, and the front and rear slots of each target extended entity word are filled in multiple stages according to the processing rules of keeping the text content of each target extended entity word unchanged and the context content of each target extended entity word belonging to the entity word in the specified entity word label after the insertion of the word. This is to improve the rationality of inserting text at the boundary position of the target extended entity word in the process of generating sample sentences by the text generation model, and to ensure the legitimacy of the enhanced data and the consistency of the labels.
[0130] In the process of generating sample sentences by the text generation model, the context content is formed by filling text information in the slots before and after the target extended entity word, and then the sample sentence is obtained. It can be seen that the text information in the slot and the target extended entity word are both components of the sample sentence, which is very important to the quality of the sample sentence. The following is an explanation of a feasible way to obtain the text information in the slot.
[0131] In an exemplary embodiment, as shown in FIG6 , obtaining text information to be filled in the slots between target extended entity words includes:
[0132] S601 , for any slot, when the slot includes an insertion mark, obtaining the insertion probability of each candidate text information in the slot.
[0133] During the text information filling stage, the text generation model predicts the insertion mark of each slot. When it is predicted that the slot includes an insertion mark, the text generation model further predicts the quantitative value of the matching degree between the slot and multiple candidate text information as the insertion probability of each candidate text information into the slot. Conversely, when it is predicted that the slot includes a non-insertion mark, such as the "[NOI]" mark, new text information will not be filled in the slot.
[0134] In one embodiment, if the tokens predicted for each slot are all "[NOI]" tokens, indicating that the filling process of the text generation model is completed, the sentence obtained in the last filling stage is determined as a sample sentence matching each target expanded entity word.
[0135] S602: Determine the candidate text information with the highest insertion probability as the text information to be filled in the slot.
[0136] For the same slot, the insertion probability of each candidate text information corresponding to the slot represents the matching degree between each candidate text information and the slot, which can be determined based on parameters such as coherence, fluency, and legality of the sample sentences generated by each candidate text information at the current stage.
[0137] In this case, the greater the insertion probability of each candidate text information corresponding to the slot, the more suitable the candidate text information is for insertion into the slot; the smaller the insertion probability is, the less suitable the candidate text information is for insertion into the slot. Based on this, in the embodiment of the present application, the candidate text information with the highest insertion probability is determined as the text information to be filled in the slot.
[0138] In an embodiment of the present application, when the slot of the target extended entity word includes an insertion mark, the candidate text information with the highest insertion probability is determined as the text information to be filled in the slot, so as to ensure the rationality of the context content formed by the text information filled in the slot and the target extended entity word, and the rationality of the context content in the sample sentence, thereby improving the quality of the sample sentences generated by the text generation model.
[0139] As can be seen from the above embodiments, the sample sentence generation process is generated by inserting and filling each target extended entity word according to the constraints by the text generation model. The above embodiments describe the constraints of the text generation model to generate sample sentences. The following describes the training process of the text generation model.
[0140] In an exemplary embodiment, as shown in FIG7 , the training process of the text generation model includes:
[0141] S701, obtaining the importance quantification value of each entity word in multiple corpora.
[0142] It should be emphasized that the corpus of the text generation model is stored in the form of sentences, which differs from the initial sentences in the dataset in at least the following two aspects:
[0143] (1) Different content: The corpus of the text generation model does not include entity word labels. It can be sentences obtained from various legal channels, such as news reports, novels, magazines, web page content, and other public databases. The initial sentence in the dataset includes the entity word labels in the initial sentence. Therefore, the corpus of the text generation model is richer and more multidimensional.
[0144] (2) Different functions: The corpus of the text generation model is used to train the text generation model. The input of the text generation model is entity words, and the output is sentences. The dataset is used for the named entity recognition model. The input of the named entity model is sentences, and the output is sentences with entity word labels.
[0145] For any entity word in any corpus, obtain the semantic richness quantification value, role importance quantification value and keyword quantification value of the entity word, and then obtain the importance quantification value of the entity word based on the semantic richness quantification value, role importance quantification value and keyword quantification value of each entity word.
[0146] Among them, the semantic richness quantification value is an indicator of the importance of the entity word in all corpora, which is used to characterize the uniqueness of the entity word and the richness of local semantics; the role importance quantification value is an indicator of the importance of the entity word in the corpus to which it belongs, and semantically characterizes the role of the entity word in the corpus; the keyword quantification value is a quantitative indicator that characterizes the frequency characteristics of the entity word in all corpora, which can be represented by 0 or 1.
[0147] Exemplarily, the product of the semantic richness quantification value and the role importance quantification value and the sum of the keyword quantification value can be used as the importance quantification value of the entity word.
[0148] For an entity word in the corpus For example, its importance quantification value The calculation formula is as follows:
[0149]
[0150] In the above formula, , and Respectively The semantic richness quantification value, role importance quantification value and keyword quantification value of The part of speech is the key word, Take 1, otherwise Take 0.
[0151] S702, obtaining multiple corpus sequences of each corpus according to the quantified importance value of each entity word in each corpus.
[0152] In a feasible scenario, for any corpus, the entity words in the corpus can be deleted in multiple stages in order of the importance quantification value of each entity word from high to low, until the deleted corpus does not include the entity words, and the corpus sequence of each stage is obtained.
[0153] In an exemplary embodiment, as shown in FIG8 , multiple corpus sequences of each corpus are obtained according to the importance quantification value of each entity word in each corpus, including:
[0154] S801, for any corpus, delete entity words in the corpus according to a preset deletion rule to obtain multiple combined corpora.
[0155] Among them, the deletion rule is not to delete two consecutive words in the corpus. Based on the deletion rule, there are multiple deletion methods to obtain the combined corpus obtained according to various deletion methods. Taking the corpus including 10 entity words as an example, the first entity word, the third entity word, the fifth entity word, the seventh entity word, and the ninth entity word can be deleted to obtain a combined corpus; the first entity word, the third entity word, the seventh entity word, and the ninth entity word can also be deleted to obtain a combined corpus; the non-entity words between the first entity word, the third entity word and the fifth entity word can also be deleted to obtain a combined corpus, and so on.
[0156] S802, superimposing the importance quantization value of each entity word in each combined corpus to obtain a comprehensive quantization value of each combined corpus.
[0157] For each combined corpus, a weighted sum of the importance quantization value of each entity word in each combined corpus and a preset weight value is calculated to obtain a comprehensive quantization value of the combined corpus.
[0158] S803, determining the combined corpus with the highest comprehensive quantization value as the corpus sequence of the corpus; executing in a loop until the number of entity words in the corpus sequence is reduced to a preset number threshold, and obtaining multiple corpus sequences of the corpus.
[0159] It should be noted that one deletion rule corresponds to multiple deletion methods, and each time the deletion rule is executed, a corpus sequence is obtained. In one embodiment, each time the deletion rule is applied, a combined corpus corresponding to multiple deletion methods is obtained, and then a corpus sequence is screened out from the multiple combined corpora. Then, the screened corpus sequence is applied with the deletion rule again to obtain a combined corpus corresponding to the corpus sequence under multiple deletion methods, and then a new corpus sequence is screened out from the multiple combined corpora. The above steps are executed repeatedly until the number of entity words in the latest corpus sequence reaches a preset number threshold, and multiple corpus sequences obtained by applying the deletion rule each time are obtained.
[0160] For the multiple combined corpora obtained by each deletion rule, the combined corpora obtained by different deletion methods are quantitatively evaluated according to the comprehensive quantitative value of each combined corpus, and the combined corpus with the highest comprehensive quantitative value is determined as the corpus sequence corresponding to this deletion rule.
[0161] In the embodiment of the present application, according to the preset deletion rules, a variety of deletion methods are flexibly adopted to delete the entity words in the corpus, so as to obtain a plurality of combined corpora with rich content and different semantics. Then, based on the quantitative value of the importance of each entity word in each combined corpus, a quantitative evaluation is performed on each combined corpus to determine the highest scoring combined corpus as the corpus sequence, thereby ensuring the validity of the corpus sequence.
[0162] S703, obtaining a training data pair for each corpus according to multiple corpus sequences of each corpus.
[0163] For any corpus, the comprehensive quantization value of each corpus sequence is obtained, and each corpus sequence is sorted in descending order of the comprehensive quantization value. Then, two adjacent corpus sequences are used as a set of training data pairs of the corpus to obtain multiple sets of training data pairs.
[0164] In an exemplary embodiment, as shown in FIG9 , the training data pair includes a corpus and multiple groups of corpus sequence pairs of the corpus; according to multiple corpus sequences of each corpus, the training data pair of each corpus is obtained, including:
[0165] S901, for multiple corpus sequences of any corpus, sort each corpus sequence according to the number of entity words in each corpus sequence, and combine every two adjacent corpus sequences to construct multiple groups of corpus sequence pairs.
[0166] Each corpus sequence is sorted in order of the number of entity words in each corpus sequence from small to large to obtain a sequence set of corpus sequences, and then every two adjacent corpus sequences in the sequence set are combined to obtain multiple groups of corpus sequence pairs.
[0167] S902, combining the corpus and each group of corpus sequence pairs to obtain training data pairs of the corpus.
[0168] One corpus corresponds to N corpus sequences (X 1 , X 2 , ..., X N-1 , X N ) as an example, the corpus corresponds to (N-1) groups of corpus sequence pairs, expressed as: (X 1 , X 2 )、......(X N-1 , X N ), the training data pair of the corpus can be expressed as: (X N , (X 1 , X 2 )、......(X N-1 , X N )).
[0169] In the embodiment of the present application, each corpus sequence is sorted according to the number of entity words in each corpus sequence, and each two adjacent corpus sequences are combined to construct multiple groups of corpus sequence pairs, so that the entity words of the two corpus sequences in each group of corpus sequence pairs have the same change trend, and the entity words of adjacent groups of corpus sequence pairs have the same change trend. This is equivalent to characterizing the filling degree of the corpus sequence with the number of entity words, and combining the corpus sequences in pairs according to different filling degrees, providing the text generation model with corpus sequences of different filling degrees corresponding to the same corpus, so that the text generation model can fill the words in multiple slot positions in stages, thereby improving the efficiency of the text generation model in generating sample sentences and the accuracy of the sample sentences.
[0170] S704: Based on the training data pairs of each corpus, the initial text generation model is trained to obtain a text generation model.
[0171] The training data pairs of each corpus are input into the initial text generation model, and each training data pair is parsed by the initial text generation model to obtain the predicted corpus. Then, according to the loss value between the predicted corpus and the real corpus, the model parameters of the initial text generation model are updated until the training accuracy requirements are met to obtain the text generation model.
[0172] In an embodiment of the present application, multiple corpus sequences of each corpus are obtained based on the quantified importance value of each entity word in each corpus, and then training data pairs of each corpus are obtained. The training data pairs constructed in this way comprehensively consider the importance of entity words and the dynamic filling planning path of entity words, so that the initial text generation model can learn to fill the entity words to obtain the corpus sequence, and then obtain the sentence generation logic of the corpus by filling the words in the corpus sequence. In the actual application process, the text generation model can fill in the important words in the sample sentence earlier, reduce the number of iterations of the model reasoning, and speed up the reasoning speed of the initial text generation model.
[0173] The above embodiment has described in detail the generation step of the sample sentence, that is, the implementation method of processing the extended entity words to obtain the sample sentence, which shows that the extended entity words are crucial to the generation quality of the sample sentence. Based on this, the following describes a feasible method for obtaining the extended entity words before the sample sentence is generated.
[0174] In an exemplary embodiment, as shown in FIG10 , the data set includes entity word labels of each entity word; according to the entity words in each initial sentence in the data set, a plurality of extended entity words are obtained, including:
[0175] S1001, classifying entity words in each initial sentence in the data set according to the type of entity word label, and obtaining multiple entity words corresponding to each entity word label.
[0176] The dataset includes multiple initial sentences, each of which includes multiple entity words, and each entity word in the initial sentence corresponds to an entity word label. Based on this, the entity words in each initial sentence and the entity word labels of each entity word are obtained, and the entity words under the same type of entity word labels are summed together to obtain multiple entity words corresponding to each entity word label.
[0177] S1002: Determine an average text vector of each entity word tag type according to multiple entity words corresponding to each entity word tag.
[0178] The multiple entity words corresponding to each entity word label are vectorized separately to obtain multiple entity word vectors under the same entity word label. Then the average entity word vector of each entity word vector is calculated as the average text vector of each entity word label type.
[0179] S1003: Verify the validity of each candidate entity word in the candidate entity word set according to each average text vector.
[0180] Among them, the candidate entity word set includes multiple candidate entity words, and does not include entity word labels corresponding to each candidate entity word. In this case, according to each average text vector, each candidate entity word in the candidate entity word set is vectorized, and the candidate entity words after vectorization are verified, and corresponding entity word labels are added to the candidate entity words that pass the verification. In this embodiment of the application, there is no restriction on the method of verifying the validity of the candidate entity words.
[0181] Exemplarily, for any candidate entity word, the candidate text vector corresponding to the candidate entity word is obtained, and then the similarity coefficient between the candidate text vector and each average text vector is calculated to obtain multiple similarity coefficients of the candidate entity word. If the maximum similarity coefficient is greater than or equal to a preset similarity coefficient threshold, it is determined that the validity verification of the candidate entity word has passed; otherwise, it is determined that the validity verification of the candidate entity word has failed, and the candidate entity word is discarded.
[0182] S1004: Determine the candidate entity words that have passed the validity verification as extended entity words.
[0183] If the validity verification of the candidate entity word passes, the candidate entity word is determined as an extended entity word, and the average text vector matching the candidate entity word is determined, and the entity word label to which the average text vector matching the candidate entity word belongs is determined as the entity word label of the candidate entity word.
[0184] In the embodiment of the present application, the validity of each candidate entity word in the candidate entity word set is verified according to the average text vector corresponding to each entity word label, and the extended entity words that pass the verification are obtained, and the candidate entity words that fail the verification are discarded. Such verification is quantitative and intuitive, and the verification method is logically clear, and the extended entity words can be quickly screened out from the candidate entity word set. In addition, although the extended entity words correspond to the entity word labels of the entity words in the initial sentence, the extended entity words are not directly determined from the initial sentence, but are screened from the candidate entity word set, which can greatly enrich the semantic richness of the entity words, thereby improving the richness and diversity of the sample sentences obtained according to the extended entity words.
[0185] Next, another verification method of "verifying the validity of each candidate entity word in the candidate entity word set according to each average text vector" in the above-mentioned embodiment S1003 is described, as shown in FIG11, including:
[0186] S1101, for any candidate entity word, obtain the vector similarity between the candidate entity word and each average text vector.
[0187] The vector similarity may be cosine similarity, Euclidean distance, Jaccard coefficient, etc., which is not limited in the embodiment of the present application.
[0188] Taking the case where the vector similarity is cosine similarity as an example, for any candidate entity word, the candidate entity word is vectorized, and then the cosine similarity between the vectorized candidate entity word and each average text vector is calculated:
[0189]
[0190] In the above formula, Represents the i-th candidate entity word after vectorization ( ), and, the j-th average text vector ( ), It means to calculate the 2-normal form of vector*, i.e. the length of the vector.
[0191] S1102: If the maximum vector similarity among the vector similarities is greater than a preset vector similarity threshold, the entity word label corresponding to the maximum vector similarity is determined as the target entity word label of the candidate entity word.
[0192] S1103, verifying the validity of the candidate entity words according to the entity words corresponding to the target entity word label.
[0193] From multiple vector similarities corresponding to a candidate entity word and each average text vector, the maximum vector similarity is determined, and the maximum vector similarity is compared with a preset vector similarity threshold to perform a first validity verification on the candidate entity word. If the maximum vector similarity is greater than the preset vector similarity threshold, the entity word label of the average text vector corresponding to the maximum vector similarity is further determined as the target entity word label of the candidate entity word, and based on multiple entity words corresponding to the target entity word label in the data set, the candidate entity word is again subjected to a second validity verification.
[0194] In one embodiment, if the maximum vector similarity is less than the vector similarity threshold, it is determined that the validity verification of the candidate entity word has failed, and the candidate entity word is discarded.
[0195] In an embodiment of the present application, the validity of the candidate entity word is verified based on the vector similarity between the candidate entity word and each average text vector, and after the candidate entity word passes the first validity verification, the validity of the candidate entity word is verified again based on the entity word corresponding to the target entity word label of the candidate entity word, so as to ensure that the candidate entity word matches the entity word label in the data set, and the candidate entity word matches the entity word in the data set, thereby improving the reliability and accuracy of the validity verification results of the candidate entity word.
[0196] When performing the first validity verification on the candidate entity words, it is based on multiple average text vectors. After the first validity verification is passed, the second validity verification is performed on the candidate entity words based on multiple entity words under the target entity word label corresponding to the candidate entity words.
[0197] In an exemplary embodiment, as shown in FIG12 , validating the candidate entity words according to the entity words corresponding to the target entity word labels includes:
[0198] S1201, obtaining the target entity word with the highest occurrence frequency from the entity words corresponding to the target entity word label.
[0199] The entity words in multiple initial sentences corresponding to the target entity word label are obtained from the dataset. Since the same entity word may appear repeatedly in different initial sentences, that is, the target entity word label corresponds to multiple identical entity words, based on this, the entity word with the highest frequency of occurrence in the target entity word label is determined as the target entity word.
[0200] S1202: If the correlation information value between the candidate entity word and the target entity word is greater than a preset correlation threshold, it is determined that the validity verification of the candidate entity word has passed.
[0201] The relevance information value represents the degree of semantic proximity between the candidate entity word and the target entity word. The larger the relevance information value, the closer their semantics are, and the smaller the relevance information value, the greater the semantic difference between them.
[0202] Among them, the candidate entity words ( ) and the target entity word ( The calculation formula of the correlation information value of ) is as follows:
[0203]
[0204] In the above formula, PMI represents the candidate entity word ( ) and the target entity word ( ), Represents the candidate entity words in the dataset ( ) and the target entity word ( ) appears in an initial sentence at the same time, ALL represents the number of entity words in the target entity word label to which the candidate entity word belongs, Indicates that the candidate entity word appears in the target entity word label to which the candidate entity word belongs ( ) times, Indicates that the target entity word appears in the target entity word label to which the candidate entity word belongs ( ) times.
[0205] After obtaining the relevance information value between the candidate entity word and the target entity word, the relevance information value is compared with a preset relevance threshold, and when the relevance information value is greater than the preset relevance threshold, it is determined that the validity verification of the candidate entity word has passed.
[0206] In an embodiment of the present application, the target entity word with the highest frequency of occurrence among the entity words corresponding to the target entity word label is used as a basis to calculate the correlation information value between the candidate entity word and the target entity word to quantitatively evaluate the correlation between the candidate entity word and the target entity word, and when the correlation information value is greater than a preset correlation threshold, it is determined that the candidate entity word validity verification has passed, thereby effectively ensuring the reliability and accuracy of the candidate entity word validity verification results.
[0207] It should be noted that in the process of obtaining the target extended entity word, the label of the target extended entity word is determined. However, in the process of obtaining sample sentences according to the target extended entity, the application of entity word labels is not involved. Therefore, the sample sentences have not been labeled with entity word labels. Based on this, in order to ensure the format consistency of the enhanced sentences and the initial sample sentences in the data set, it is also necessary to label the entity words in the sample sentences to obtain enhanced sentences with entity word labels. In an exemplary embodiment, as shown in Figure 13, the extended entity words in multiple sample sentences are labeled to obtain an enhanced data set of the data set, including:
[0208] S1301, marking the extended entity words in each sample sentence to generate a target enhanced sentence for each sample sentence.
[0209] For each sample sentence, the sample sentence is input into the named entity recognition model, the extended entity words in the sample sentence are recognized by the named entity recognition model, and the entity word label of each extended entity word in each sample sentence is added, and the target enhanced sample sentence corresponding to each sample sentence is output.
[0210] S1302 , summarizing target enhanced sentences of each sample sentence to obtain an enhanced data set.
[0211] The target enhanced sample sentences of each sample sentence are summarized to obtain an enhanced data set; the target enhanced sentences in the enhanced data set have the same format as the initial sentences in the data set, and both include sentences and entity word labels of each entity word in the sentences.
[0212] In the embodiment of the present application, the extended entity words in each sample sentence are annotated, and a target enhanced sentence is generated for each sample sentence, and the format of the target enhanced sentence is kept consistent with that of each initial sentence in the data set. In addition, the extended entity words are determined based on the entity words of the initial sentence, so the entity word labels of the extended entity words also belong to the entity word labels of the entity words in the initial sentence, that is, the target enhanced sentence in the enhanced data set is a richer and more comprehensive sentence generated on the basis of keeping the entity word labels in the data set unchanged, which greatly improves the sample diversity of the data set.
[0213] In an exemplary embodiment, taking data augmentation of a dataset of a named entity model as an example, a data augmentation method is provided. As shown in FIG14 , the data augmentation method can be divided into three stages: expanding entity words, filling the expanded entity words to obtain sample sentences, and annotating the filled sample sentences, and applying the named entity model. Each stage includes the following steps:
[0214] In the first stage, candidate entity words are verified based on the annotated entity words in the data, including:
[0215] S1401, verifying the validity of unlabeled candidate entity words based on the average text vector of labeled entity words in the data set.
[0216] The candidate entity words and the marked entity words are vectorized respectively, and then the validity of the candidate entity words is verified using a cosine similarity-based method. If the maximum cosine similarity is greater than the preset similarity threshold, the candidate entity word validity verification is determined to have passed, otherwise, the candidate entity word validity verification is determined to have failed.
[0217] S1402, for the candidate entity words that have passed the validity verification, obtain the target entity word label of the average text vector that matches the candidate entity word in the data set, and perform relevance verification on the candidate entity word with the target entity word label that appears most frequently in the data set to obtain the extended entity word.
[0218] The target entity words are vectorized, and the point mutual information value is used as the evaluation indicator to verify the relevance of the candidate entity words and determine the extended entity words.
[0219] Next, the steps of the first stage are repeated to determine multiple extended entity words from the candidate entity word set.
[0220] In the second stage, based on the extended entity words generated in the first stage, an insert text generation model is used to generate sample sentences to obtain enhanced sentences.
[0221] Among them, the text generation model is a non-autoregressive generation model. It starts from the initial constraints in an iterative manner, continuously uses the output of the previous stage as the input of the next stage, and continuously inserts new words between two adjacent words using the masked language model prediction method to finally generate the final text.
[0222] S1403, constructing training data pairs of the corpus based on the importance quantification value of the entity word and dynamic programming.
[0223] The goals of the inserted text generation model are twofold: the more important words should be generated earlier, and more words should be generated at each generation stage, resulting in lower losses. Based on this, the present application constructs training data pairs in a unified format to simplify the training process of the subsequent initial text generation model.
[0224] Each corpus X is divided into a series of continuous corpus sequence pairs: (X 0 , X 1 ), (X 1 , X 2 ),...(X K-1 , X K ), where K is the number of corpus sequence pairs. In this way, in each iteration of constructing corpus sequence pairs, X K A mask operation is performed on a portion of the existing words in to generate X K A subsequence of , thereby constructing a corpus sequence pair (X K-1 , X K ). This process will continue to iterate until the final corpus sequence X 0 Only a preset number of tokens remain in the .
[0225] The word units are masked by predicting the probability of words between two words and the probability of inserting words in the slot. Exemplarily, a special tag "[NOI]" is added to the vocabulary to indicate that no new words will be inserted in a specific slot at the current stage. In this way, at each stage, the same insertion text generation model is used to predict the tags that will be inserted into each slot, so that the model learns to insert different words at different stages, and predicts what words to insert at each stage from the degree of context discontinuity of the current context sequence.
[0226] At the same time, considering the requirements for the generation logic of the text generation model: (1) important words should be generated earlier; (2) as few generation stages as possible should be used to reduce the number of iterations generated by the model during reasoning and speed up the model reasoning. The word importance scoring and dynamic programming-based approach are used to construct the training data pairs of the corpus.
[0227] Specifically, a constraint is added to the masking process: no consecutive tags can be masked at the same stage, so predicting the masked word is equivalent to insertion-based generation. Under such conditions, the embodiment of the present application scores each tag and selects a subset of tags with the highest total score (because the corresponding scores for any word are greater than zero), and then uses its complement as the words that need to be masked at this stage, so that the words with the highest degree of importance can be adaptively retained at each stage. The generation process of the masking pattern constructed in this way will first generate the most important words.
[0228] The masking process can be viewed as a linear programming problem, the goal of which is to find the optimal masking solution. ,in ,when Indicates that the corresponding words Mask, Represents the corresponding words For a given corpus sequence, the least important words in the corpus sequence are masked.
[0229] S1404, training the initial text generation model according to the training data pairs of the corpus to obtain a text generation model.
[0230] After constructing the sample training data, for the corpus sequence pair (X K-1 , X K ), the initial text generation model is trained using the following loss function:
[0231]
[0232] In the formula, , Represents the indicator vector of the kth stage, indicating whether a new word is inserted in the slot.
[0233] In order to enable the model to be used in a variety of different fields, the English and Chinese language models can be pre-trained using two large-scale public datasets that cover a wide range of domain-specific texts. The training samples of the pre-training dataset are also constructed according to the method described above. After completing the large-scale pre-training, the text generation model can generate relatively fluent sentences. Next, the model is fine-tuned according to the dataset of the downstream task, and the model can generate text containing the domain knowledge of the downstream task.
[0234] S1405, input the extended entity words into the text generation model, combine the constraints, output sample sentences, and annotate the entity words in the sample sentences to obtain enhanced sentences.
[0235] During the reasoning process, if at a certain stage, the tag predicted for each slot is "[NOI]", it means that the generation process is completed and is the final output sequence. In particular, in order to provide the model with samples at the end of the prediction during the training process, the present invention adds a data pair to the training sample of each sentence construction in the training set, which represents a "[NOI]" sequence with the same length as . At the same time, in order to enable the model to insert words at the beginning and end of a text sequence, the final training instance adds a "[SOS]" tag representing the beginning of the sentence and a "[EOS]" tag representing the end of the sentence at the beginning and end of each sentence, respectively.
[0236] Starting from the given keyword constraints, the text is gradually generated by greedy search or top-K sampling, and the insertion text generation model is repeatedly used until no new words are generated. If the [NOI] tag is generated, it will be deleted in the next round.
[0237] According to the above loss function, the model will generate all the tokens to be inserted at the same time in each reasoning stage based on the word constraints given in the previous stage. This method has the problem of conditional independence. Each predicted word is generated conditionally independently and is unknown to each other. This will result in repeated or inconsistent words in each round of reasoning. In order to solve this problem, the beam search method is used in the model decoding stage to select the generated results. For example, in the kth stage, the keyword constraint is ,in for length, then for the next stage The prediction is that there will be slots are available.
[0238] Furthermore, when faced with named entity recognition tasks, the text generated based on the insertion text generation model may undermine the legitimacy of the entity. This problem mainly exists in two situations: (1) the original entity word plus the words in the context form a new entity; (2) the original entity is composed of multiple words, and words are inserted in the middle of the entity text, causing the legitimacy of the entity to be destroyed. When these two situations occur, noise will be introduced into the named entity recognition model, resulting in a decrease in the performance of the model. Therefore, the embodiment of the present application sets up two mechanisms to prevent these two situations from occurring when the model generates text.
[0239] For situation (1), take out the entity word set corresponding to each type of entity word label The longest entity in Chinese text, record its length as , and then for each stage of each text generation, the context of the original entity constraint word x will be judged by the following formula:
[0240]
[0241] in, The text information of the slots before and after x. When t=0, it means x is the first word; When , it means x is the last word. When the above formula is satisfied, the model will accept the generation result of this stage, otherwise it will reject the generation result and regenerate with the original constraints.
[0242] For situation (2), the present invention performs special processing on the model input before model generation, and adds a "[NOI]" tag between each text that makes up the entity word, so that the model cannot insert new words in the middle of the entity word to prevent the legitimacy of the entity from being damaged.
[0243] In the third stage, the text generation model is applied.
[0244] S1406, training a text generation model based on the enhanced data set constructed using the enhanced sentences.
[0245] S1407, input the text to be recognized into the trained text generation model to obtain the entity word label of the text to be recognized.
[0246] In the embodiment of the present application, in the process of obtaining extended entity words, the importance of words and the semantic diversity of the unlabeled data set in the target field are considered to optimize the quality and application effect of the extended entity words. Compared with the conventional simple replacement and back translation method, the extended entity words obtained in the embodiment of the present application are more abundant and diverse, ensuring the semantic consistency and diversity of the sample sentences generated by the subsequent text generation model. Then, in the process of generating sample sentences, by inputting the hard constraint of the target extended entity word and the two preset constraints, the text information to be filled in the entity word slot is obtained in a standardized manner, ensuring the rationality of inserting words at the boundary position of the entity word during the generation process, and improving the fluency of the sample sentences. Finally, the extended entity words in each sample sentence are annotated, and the target enhanced sentence of each sample sentence is generated, and the format consistency of the target enhanced sentence and each initial sentence in the data set is maintained to improve the data enhancement effect.
[0247] In an exemplary embodiment, continuing to take data enhancement of a dataset of a named entity model as an example, a data enhancement method is provided, as shown in FIG15 , including:
[0248] S1501, classify the entity words in each initial sentence in the data set to obtain multiple entity words corresponding to each entity word label.
[0249] S1502: Determine an average text vector of each entity word tag type according to multiple entity words corresponding to each entity word tag.
[0250] S1503: For any candidate entity word, obtain the vector similarity between the candidate entity word and each average text vector.
[0251] S1504: If the maximum vector similarity among the vector similarities is greater than a preset vector similarity threshold, the entity word label corresponding to the maximum vector similarity is determined as the target entity word label of the candidate entity word.
[0252] S1505, obtaining the target entity word with the highest occurrence frequency from the entity words corresponding to the target entity word label.
[0253] S1506: If the correlation information value between the candidate entity word and the target entity word is greater than a preset correlation threshold, it is determined that the candidate entity word has passed the validity verification, and the candidate entity word that has passed the validity verification is determined as an extended entity word.
[0254] S1507: Determine a preset number of target extended entity words from the multiple extended entity words.
[0255] S1508, obtaining training data pairs of multiple corpora, and training the initial text generation model according to the training data pairs of each corpus to obtain a text generation model.
[0256] S1509, input each target extended entity word into a text generation model, and in the text generation model, perform word insertion and filling processing on each target extended entity word according to the constraint conditions to obtain a sample sentence matching each target extended entity word.
[0257] The constraints include keeping the text content of each target extended entity word unchanged, and the context content of each target extended entity word after the insertion belongs to the entity word in the specified entity word label.
[0258] S1510, marking the extended entity words in each sample sentence to generate a target enhanced sentence for each sample sentence.
[0259] S1511, summarizing the target enhanced sentences of each sample sentence to obtain an enhanced data set.
[0260] In the embodiment of the present application, in the process of obtaining extended entity words, the importance of words and the semantic diversity of the unlabeled data set in the target field are considered to optimize the quality and application effect of the extended entity words. Compared with the conventional simple replacement and back translation method, the extended entity words obtained in the embodiment of the present application are more abundant and diverse, ensuring the semantic consistency and diversity of the sample sentences generated by the subsequent text generation model. Then, in the process of generating sample sentences, by inputting the hard constraint of the target extended entity word and the two preset constraints, the text information to be filled in the entity word slot is obtained in a standardized manner, ensuring the rationality of inserting words at the boundary position of the entity word during the generation process, and improving the fluency of the sample sentences. Finally, the extended entity words in each sample sentence are annotated, and the target enhanced sentence of each sample sentence is generated, and the format consistency of the target enhanced sentence and each initial sentence in the data set is maintained to improve the data enhancement effect.
[0261] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0262] Based on the same inventive concept, the embodiment of the present application also provides a data enhancement device for implementing the data enhancement method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more data enhancement device embodiments provided below can refer to the limitations on the data enhancement method above, and will not be repeated here.
[0263] In an exemplary embodiment, as shown in FIG16 , a data enhancement device is provided, including: an entity word expansion module 1601, a sentence generation module 1602 and a sentence annotation module 1603, wherein:
[0264] The entity word expansion module 1601 is used to obtain multiple expanded entity words according to the entity words in each initial sentence in the data set;
[0265] The sentence generation module 1602 is used to perform entity word processing on multiple extended entity words based on preset constraints to obtain multiple sample sentences; the constraint conditions are used to constrain the legality of words inserted into the boundary positions of the extended entity words during the entity word processing process;
[0266] The sentence annotation module 1603 is used to annotate the extended entity words in the multiple sample sentences to obtain an enhanced data set of the data set.
[0267] In an exemplary embodiment, the sentence generation module 1602 includes: an extended entity word determination unit and a model filling unit, wherein:
[0268] An extended entity word determination unit, used to determine a preset number of target extended entity words from a plurality of extended entity words;
[0269] The model filling unit is used to input each target extended entity word into the text generation model, and in the text generation model, each target extended entity word is inserted and filled according to the constraint conditions to obtain a sample sentence matching each target extended entity word.
[0270] In an exemplary embodiment, the model filling unit includes: an information acquisition subunit and an information filling subunit, wherein:
[0271] The information acquisition subunit is used to acquire the text information to be filled in the slots between the target extended entity words while keeping the text content of each target extended entity word unchanged;
[0272] The information filling subunit is used to fill the text information of the front and back slots into the front and back slots of the target extended entity word for any target extended entity word. If the context content formed by the target extended entity word and the text information of the front and back slots belongs to the entity word in the specified entity word tag, the text information of the front and back slots will be filled into the front and back slots of the target extended entity word accordingly.
[0273] In an exemplary embodiment, the information acquisition subunit is also used to obtain the insertion probability of each candidate text information in any slot when the slot includes an insertion mark; and determine the candidate text information with the highest insertion probability as the text information to be filled in the slot.
[0274] In an exemplary embodiment, the model filling unit includes: a quantization value acquisition subunit, a sequence acquisition subunit, a data pair acquisition subunit and a model training subunit, wherein:
[0275] A quantitative value acquisition subunit is used to obtain the importance quantitative value of each entity word in multiple corpora;
[0276] The sequence acquisition subunit is used to obtain multiple corpus sequences of each corpus according to the importance quantification value of each entity word in each corpus;
[0277] A data pair acquisition subunit, used for obtaining a training data pair of each corpus according to multiple corpus sequences of each corpus;
[0278] The model training subunit is used to train the initial text generation model based on the training data pairs of each corpus to obtain a text generation model.
[0279] In an exemplary embodiment, the sequence acquisition subunit is also used to delete entity words in any corpus according to a preset deletion rule to obtain multiple combined corpora; superimpose the importance quantization values of each entity word in each combined corpus to obtain a comprehensive quantization value of each combined corpus; determine the combined corpus with the highest comprehensive quantization value as the corpus sequence of the corpus; and execute in a loop until the number of entity words in the corpus sequence is reduced to a preset number threshold, thereby obtaining multiple corpus sequences of the corpus.
[0280] In an exemplary embodiment, the data pair acquisition subunit is also used to sort the multiple corpus sequences of any corpus according to the number of entity words in each corpus sequence, and combine every two adjacent corpus sequences to construct multiple groups of corpus sequence pairs; combine the corpus and each group of corpus sequence pairs to obtain the training data pairs of the corpus.
[0281] In an exemplary embodiment, the entity word expansion module 1601 includes: an entity word classification unit, a text vector acquisition unit, an entity word verification subunit and an expanded entity word determination unit, wherein:
[0282] An entity word classification unit is used to classify the entity words in each initial sentence in the data set according to the type of the entity word label, and obtain multiple entity words corresponding to each entity word label;
[0283] A text vector acquisition unit, used to determine an average text vector of each entity word label type according to multiple entity words corresponding to each entity word label;
[0284] An entity word verification subunit, used to verify the validity of each candidate entity word in the candidate entity word set according to each average text vector;
[0285] The extended entity word determination unit is used to determine the candidate entity words that have passed the validity verification as extended entity words.
[0286] In an exemplary embodiment, the entity word verification subunit is also used to obtain the vector similarity between any candidate entity word and each average text vector for any candidate entity word; when the maximum vector similarity among the vector similarities is greater than a preset vector similarity threshold, the entity word label corresponding to the maximum vector similarity is determined as the target entity word label of the candidate entity word, and the validity of the candidate entity word is verified based on the entity word corresponding to the target entity word label.
[0287] In an exemplary embodiment, the entity word verification subunit is also used to obtain the target entity word with the highest occurrence frequency from the entity words corresponding to the target entity word label; when the correlation information value between the candidate entity word and the target entity word is greater than a preset correlation threshold, it is determined that the validity verification of the candidate entity word has passed.
[0288] In an exemplary embodiment, the sentence annotation module 1603 includes: an entity word annotation unit and a sentence summary unit, wherein:
[0289] An entity word tagging unit, used to tag the extended entity words in each sample sentence and generate a target enhanced sentence for each sample sentence;
[0290] The sentence summarizing unit is used to summarize the target enhanced sentences of each sample sentence to obtain an enhanced data set.
[0291] Each module in the above data enhancement device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0292] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0293] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0294] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0295] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0296] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0297] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0298] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data enhancement method, characterized in that: The method comprises: According to the entity words in each initial sentence in the data set, multiple extended entity words are obtained; Based on preset constraints, entity word processing is performed on the multiple extended entity words to obtain multiple sample sentences; the constraint conditions are used to constrain the legitimacy of words inserted into the boundary positions of the extended entity words during the entity word processing; The extended entity words in the multiple sample sentences are labeled to obtain an enhanced data set of the data set.
2. The method according to claim 1, characterized in that Based on the preset constraint conditions, entity word processing is performed on the multiple extended entity words to obtain multiple sample sentences, including: Determining a preset number of target extended entity words from the multiple extended entity words; Each of the target extended entity words is input into a text generation model, and in the text generation model, each of the target extended entity words is subjected to word insertion and filling processing according to the constraint conditions to obtain a sample sentence matching each of the target extended entity words.
3. The method according to claim 2, characterized in that The constraint condition includes keeping the text content of each target extended entity word unchanged, and the context content of each target extended entity word after the word insertion belongs to the entity word in the specified entity word tag; the word insertion and filling processing of each target extended entity word according to the constraint condition includes: While keeping the text content of each of the target extended entity words unchanged, obtaining the text information to be filled in the slots between each of the target extended entity words; For any target extended entity word, if the context content formed by the target extended entity word and the text information of the front and rear slots belongs to the entity word in the specified entity word tag, the text information of the front and rear slots will be filled into the front and rear slots of the target extended entity word accordingly.
4. The method according to claim 3, characterized in that The step of obtaining text information to be filled in the slots between the target extended entity words includes: For any slot, when the slot includes an insertion mark, obtaining the insertion probability of each candidate text information in the slot; The candidate text information with the highest insertion probability is determined as the text information to be filled in the slot.
5. The method according to any one of claims 2 to 4, characterized in that: The training process of the text generation model includes: Get the quantitative importance value of each entity word in multiple corpora; According to the quantified importance value of each entity word in each of the corpora, a plurality of corpus sequences of each of the corpora are obtained; According to the plurality of corpus sequences of the corpus, a training data pair of each corpus is obtained; Based on the training data pairs of each of the corpora, the initial text generation model is trained to obtain the text generation model.
6. The method according to claim 5, characterized in that The step of obtaining a plurality of corpus sequences of each corpus according to the importance quantification value of each entity word in each corpus includes: For any corpus, according to a preset deletion rule, the entity words in the corpus are deleted to obtain multiple combined corpora; Superimposing the importance quantified values of each entity word in each of the combined corpora to obtain a comprehensive quantified value of each of the combined corpora; The combined corpus with the highest comprehensive quantization value is determined as the corpus sequence of the corpus; the process is executed in a loop until the number of entity words in the corpus sequence decreases to a preset number threshold, thereby obtaining multiple corpus sequences of the corpus.
7. The method according to claim 5, characterized in that The training data pair includes a corpus and a plurality of corpus sequence pairs of the corpus; the training data pair of each corpus is obtained according to the plurality of corpus sequences of each corpus, including: For multiple corpus sequences of any corpus, sort the corpus sequences according to the number of entity words in each corpus sequence, and combine every two adjacent corpus sequences to construct multiple groups of corpus sequence pairs; The corpus and each group of corpus sequence pairs are combined to obtain training data pairs of the corpus.
8. The method according to any one of claims 1 to 4, characterized in that: The data set includes entity word labels of each entity word; and obtaining multiple extended entity words according to the entity words in each initial sentence in the data set includes: Classifying the entity words in each of the initial sentences in the data set according to the type of the entity word label to obtain a plurality of entity words corresponding to each of the entity word labels; Determine an average text vector of each entity word label type according to multiple entity words corresponding to each entity word label; According to each of the average text vectors, verify the validity of each candidate entity word in the candidate entity word set; The candidate entity words that pass the validity verification are determined as the extended entity words.
9. The method according to claim 8, characterized in that The step of verifying the validity of each candidate entity word in the candidate entity word set according to each of the average text vectors includes: For any candidate entity word, obtaining the vector similarity between the candidate entity word and each of the average text vectors; If the maximum vector similarity among the vector similarities is greater than a preset vector similarity threshold, the entity word label corresponding to the maximum vector similarity is determined as the target entity word label of the candidate entity word; The validity of the candidate entity word is verified according to the entity word corresponding to the target entity word label.
10. The method according to claim 9, characterized in that The validating the candidate entity word according to the entity word corresponding to the target entity word label includes: From the entity words corresponding to the target entity word label, obtain the target entity word with the highest occurrence frequency; If the relevance information value between the candidate entity word and the target entity word is greater than a preset relevance threshold, it is determined that the validity verification of the candidate entity word has passed.
11. The method according to any one of claims 1 to 4, characterized in that: The extended entity words in the plurality of sample sentences are annotated to obtain an enhanced data set of the data set, including: Annotating the extended entity words in each of the sample sentences to generate a target enhanced sentence for each of the sample sentences; The target enhanced sentences of the sample sentences are summarized to obtain the enhanced data set.
12. A data enhancement device, characterized in that: The device comprises: An entity word acquisition module is used to acquire multiple extended entity words according to the entity words in each initial sentence in the data set; A sentence generation module, used to perform entity word processing on the multiple extended entity words based on preset constraints to obtain multiple sample sentences; the constraints are used to constrain the legality of words inserted into the boundary positions of the extended entity words during the entity word processing process; The sentence annotation module is used to annotate the extended entity words in the plurality of sample sentences to obtain an enhanced data set of the data set.
Citation Information
Patent Citations
Data enhancement method and system applied to electric power text
CN114003733A
Data enhancement method and device, electronic equipment and storage medium
CN114595327A
Relational data enhancement method and device, equipment and storage medium
CN114881034A
Social text enhancement method and system based on multi-modal retrieval and keyword extraction
CN115408495A
Data enhancement method and device based on large language model
CN118277645A
