Training method and device of text generation model based on text editing technology

By performing a training method based on text editing technology on the text generation model, using vocabulary and text editor to generate label sequences, the problem of high semantic text accuracy in specific fields is solved, and the effect of improving training efficiency and generation accuracy is achieved.

CN112257456BActive Publication Date: 2025-04-04PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011139506.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-22
Publication Date
2025-04-04
Estimated Expiration
2040-10-22

AI Technical Summary

Technical Problem

In the prior art, text generation models require a large amount of high-quality text data for training, resulting in low accuracy of high semantic text in specific fields.

Method used

By obtaining the preset source text set, editing the source text set using the preset text editor, building a vocabulary, and processing the source text through the vocabulary to obtain the first tag sequence. At the same time, input the source text into the text generation model to be trained to obtain the second tag sequence, and adjusting the parameters of the text generation model by calculating the similarity between the two.

Benefits of technology

The text model training can still be completed when there are fewer source text sets, which improves the training efficiency of text generation models and the accuracy of generating high semantic texts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112257456B_ABST
    Figure CN112257456B_ABST
Patent Text Reader

Abstract

The present invention discloses a training method and device for a text generation model based on text editing technology, the method comprising: obtaining a preset source text set; editing the source text set according to a preset text editor to obtain a target text set of the source text set; constructing a vocabulary according to the source text set and the target text set; processing each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first label sequence; inputting each source text into a text generation model to be trained to obtain a second label sequence; and adjusting configuration parameters of the text generation model according to the first label sequence and the second label sequence. The present invention is based on the field of machine learning technology, and by training a text generation model through this method, not only the training efficiency of the text generation model is greatly improved, but also the accuracy rate of the text generation model generating highly semantic text is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of text editing, and in particular relates to a training method and device for a text generation model based on text editing technology. Background Art

[0002] Text generation is an important task in the field of natural language processing and a major challenge facing artificial intelligence. Although text generation can assist professionals in professional writing, such as completing legal documents, automatically generating news, generating text summaries, and text retelling, the training of text generation models requires a large amount of data. In particular, high-quality text data in specific fields is relatively scarce, resulting in low accuracy of high-semantic text generated by text generation models. Summary of the invention

[0003] The embodiments of the present invention provide a method and device for training a text generation model based on text editing technology, which solves the problem in the prior art that the text generation model needs a large amount of high-quality text data for training in order to accurately obtain high-semantic text.

[0004] In a first aspect, an embodiment of the present invention provides a method for training a text generation model based on text editing technology, which includes:

[0005] Get a preset source text set;

[0006] Editing the source text set according to a preset text editor to obtain a target text set of the source text set;

[0007] Building a vocabulary based on the source text set and the target text set;

[0008] Processing each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first tag sequence;

[0009] Inputting each source text into a text generation model to be trained to obtain a second label sequence;

[0010] The configuration parameters of the text generation model are adjusted according to the first label sequence and the second label sequence.

[0011] In a second aspect, an embodiment of the present invention provides a training device for a text generation model based on text editing technology, comprising:

[0012] A first acquisition unit, used to acquire a preset source text set;

[0013] An editing unit, used for editing the source text set according to a preset text editor to obtain a target text set of the source text set;

[0014] A first construction unit, configured to construct a vocabulary according to the source text set and the target text set;

[0015] A processing unit, configured to process each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first tag sequence;

[0016] An input unit, used for inputting each source text into a text generation model to be trained to obtain a second label sequence;

[0017] The first adjustment unit is used to adjust the configuration parameters of the text generation model according to the first label sequence and the second label sequence.

[0018] In a third aspect, an embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the training method of a text generation model based on text editing technology as described in the first aspect above when executing the computer program.

[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the training method of a text generation model based on text editing technology described in the first aspect above.

[0020] The embodiment of the present invention provides a training method and device for a text generation model based on text editing technology. During the process of training the text generation model, after obtaining the source text set required for training the text generation model, each source text in the source text set is edited to obtain the target text of each source text, and then a vocabulary is constructed through the source text and the target text, and the source text is processed through the vocabulary and the target text to obtain a first label sequence, and the source text is input into the text generation model to be trained to obtain a second label sequence, and the configuration parameters of the text generation model to be trained are adjusted by calculating the similarity between the first label sequence and the second label sequence, wherein the first label sequence is a string obtained without the text generation model, and the second label sequence is a string obtained through the text generation model, the target text of the source text can be obtained through the first label sequence, and the target text similar to the source text can be obtained through the second label sequence. The training method of the text generation model based on the text editing technology of the present invention can complete the training of the text model when the source text set is small, greatly improve the training efficiency of the text generation model, and improve the accuracy of generating high semantic text. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the following will describe the required

[0022] The accompanying drawings are briefly introduced. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0023] Figure 1 A flowchart of a method for training a text generation model based on text editing technology provided in an embodiment of the present invention;

[0024] Figure 2 A schematic diagram of a sub-process of a method for training a text generation model based on text editing technology provided in an embodiment of the present invention;

[0025] Figure 3 A schematic diagram of another sub-process of the training method of the text generation model based on the text editing technology provided in an embodiment of the present invention;

[0026] Figure 4 A schematic diagram of another sub-process of the training method of the text generation model based on the text editing technology provided in an embodiment of the present invention;

[0027] Figure 5 A schematic diagram of another sub-process of the training method of the text generation model based on the text editing technology provided in an embodiment of the present invention;

[0028] Figure 6 A schematic diagram of another sub-process of the training method of the text generation model based on the text editing technology provided in an embodiment of the present invention;

[0029] Figure 7 A schematic block diagram of a training device for a text generation model based on text editing technology provided in an embodiment of the present invention;

[0030] Figure 8 A schematic block diagram of subunits of a training device for a text generation model based on text editing technology provided in an embodiment of the present invention;

[0031] Fig. 9 A schematic block diagram of another subunit of the training device for a text generation model based on text editing technology provided in an embodiment of the present invention;

[0032] Fig.10 A schematic block diagram of another subunit of the training device for a text generation model based on text editing technology provided in an embodiment of the present invention;

[0033] Fig.11A schematic block diagram of another subunit of the training device for a text generation model based on text editing technology provided in an embodiment of the present invention;

[0034] Fig.12 A schematic block diagram of another subunit of the training device for a text generation model based on text editing technology provided in an embodiment of the present invention;

[0035] Fig.13 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0037] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0038] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0039] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0040] See also Figure 1 , Figure 1A flow chart of a training method for a text generation model based on text editing technology provided by an embodiment of the present invention. The training method for a text generation model based on text editing technology is built and run in a server. When training the text generation model in the server, after obtaining the source text set required for training the text generation model, each source text in the source text set is edited to obtain the target text of each source text, and then the source text is processed by a preset vocabulary and the target text to obtain a first label sequence, and the source text is input into the text generation model to be trained to obtain a second label sequence, and the configuration parameters of the text generation model to be trained are adjusted by calculating the similarity between the first label sequence and the second label sequence, so that when the source text set is small, the text model can still be trained and the training efficiency of the text generation model is greatly improved, and the accuracy of generating high semantic text is improved.

[0041] like Figure 1 As shown, the method includes steps S110 to S150.

[0042] S110: Obtain a preset source text set.

[0043] Obtain a preset source text set. Specifically, the source text set is a data set that needs to be used to train the text generation model. The amount of text in the source text set can be configured according to user needs, and can be a large amount of text data or a small amount of text data. In an embodiment of the present invention, a source text set with a small amount of data is used to train the text generation model.

[0044] S120: Edit the source text set according to a preset text editor to obtain a target text set of the source text set.

[0045] The source text set is edited according to a preset text editor to obtain a target text set of the source text set. Specifically, the text editor is a text editing tool that can be used to edit each source text in the source text set to obtain a target text with high semantics, such as Notepad under Window, Text Editor under Mac OS X, vi, emacs, gedit under Linux, etc., which can be used to edit each source text in the source text set.

[0046] For example: when the source text is "Xiao Ming was born in 1993. Xiao Ming was born in Shanghai", the target text after editing with the text editor is "Xiao Ming was born in Shanghai in early 1993".

[0047] S130: Construct a vocabulary according to the source text set and the target text set.

[0048] A vocabulary is constructed according to the source text set and the target text set. Specifically, the words in each target text in the target text set that do not exist in the source text of the target text are taken as words in the vocabulary. In the process of constructing the vocabulary, in order to reduce the amount of calculation when the vocabulary is used later, the vocabulary needs to be optimized to make the vocabulary as small as possible, and the words in the vocabulary obtained from the source text set need to be screened according to the frequency of the words in the target text set. For example, the words in the vocabulary that appear less than ten times in the target text set are removed to obtain the optimized vocabulary. After the vocabulary in the embodiment of the present invention is constructed, it is stored in the blockchain, which ensures the security performance of vocabulary storage.

[0049] In one embodiment, if Figure 2 As shown, step S130 includes sub-steps S131 and S132.

[0050] S131 . Constructing the longest common subsequence of each source text and the target text of each source text according to each source text and the target text of each source text.

[0051] The longest common subsequence of each source text and the target text of each source text is constructed according to each source text and the target text of each source text. Specifically, the longest common subsequence of each source text and the target text of each source text is obtained by using the longest common subsequence technique. The longest common subsequence is defined as: a sequence S, if it is a subsequence of two or more known sequences respectively and is the longest among all sequences that meet this condition, then S is called the longest common subsequence of the known sequences.

[0052] In one embodiment, if Figure 3 As shown, step S131 includes sub-steps S1311 and S1312.

[0053] S1311 . Obtain a subsequence set of each source text and a subsequence set of a target text of each source text.

[0054] Obtain a subsequence set of each source text and a subsequence set of a target text of each source text. Specifically, the subsequences in the subsequence set of each source text are obtained by splitting each source text without changing the character order of each source text, and the subsequences after the splitting of each source text are combined into the subsequence set of each source text. Similarly, the subsequence set of the target text of each source text is obtained by referring to the method of obtaining the subsequence set of each source text.

[0055] S1312. Match each subsequence in the subsequence set of each source text with each subsequence in the subsequence set of the target text to obtain a common subsequence set of each source text and the target text of each source text, and use the longest common subsequence in the common subsequence set as the longest common subsequence.

[0056] Each subsequence in the subsequence set of each source text is matched with each subsequence in the subsequence set of the target text to obtain a common subsequence set of each source text and the target text of each source text, and the longest common subsequence in the common subsequence set is used as the longest common subsequence. Specifically, each common subsequence in the common subsequence set is a common subsequence of each source text and the target text of each source text, and the longest sequence in the common subsequence set is the longest common subsequence of each source text and the target text of each source text.

[0057] S132: Construct the vocabulary according to the target text of each source text and the longest common subsequence.

[0058] The vocabulary is constructed according to the target text of each source text and the longest common subsequence. Specifically, the longest common subsequence is the longest common subsequence between the target text of each source text and each source text, and words that do not exist in the longest common subsequence are obtained from the target text of each source text through the longest common subsequence and the words are used as words in the vocabulary, thereby completing the construction of the vocabulary.

[0059] In one embodiment, if Figure 4 As shown, step S132 includes sub-steps S1321 and S1322.

[0060] S1321 , performing word segmentation processing on the target text of each source text to obtain words of the target text of each source text.

[0061] The target text of each source text is segmented to obtain the words of the target text of each source text. Specifically, in this embodiment, the reverse maximum matching method in the string-based word segmentation method is used to segment the target text of each source text, and the word segmentation process is as follows: the number of Chinese characters contained in the longest entry in the preset dictionary is set to L, and the processing starts from the end of the string of the target text. At the beginning of each cycle, the last L characters of the string are taken as the processing object and the dictionary is searched. If there is such an L-character word in the dictionary, the match is successful, and the processing object is segmented as a word; if it is unsuccessful, the first Chinese character of the processing object is removed, and the remaining string is used as a new processing object, and matched again until the segmentation is successful, that is, a round of matching is completed, and a word is segmented. This cycle is repeated until all the words in the target text are segmented.

[0062] S1322: Match the words of the target text of each source text with the longest common subsequence to obtain words constituting the vocabulary from the words of the target text of each source text.

[0063] The words of the target text of each source text are matched with the longest common subsequence to obtain the words constituting the vocabulary from the words of the target text of each source text. Specifically, whether the words of the target text of each source text exist in the longest common subsequence is used as the result of whether the words of the target text and the longest common subsequence are successfully matched. If the match is successful, the word is not a word in the vocabulary; if the match is unsuccessful, it is used as a word in the vocabulary.

[0064] S140: Process each source text according to the vocabulary and the target text of each source text to obtain a first tag sequence.

[0065] Each source text is processed according to the vocabulary and the target text of each source text to obtain a first label sequence. Specifically, each source text does not contain the vocabulary in the vocabulary, and each source text is annotated by marking the longest common subsequence between each source text and the target text of each source text, and then each annotated source text is split to obtain characters of each annotated source text, and the characters are matched with words in the vocabulary to obtain new words, and then the matched words are spliced ​​to obtain the first label sequence.

[0066] In one embodiment, if Figure 5 As shown, step S140 includes sub-steps S141, S142, S143 and S144.

[0067] S141. Annotate each source text according to the longest common subsequence to obtain each annotated source text.

[0068] Each source text is labeled according to the longest common subsequence to obtain each labeled source text. Specifically, the characters in each source text that belong to the longest common subsequence are labeled with a first label, which is recorded as the symbol "keep"; the characters that do not belong to the longest common subsequence are labeled with a second label, which is recorded as the symbol "delete", so that each source text is labeled with the first label and the second label. For example, when the source text is "Xiao Ming was born in 1993. Xiao Ming was born in Shanghai", the order of the labels of the labeled source text is "keep keep delete deletekeep keep keep delete delete delete keep keep keep".

[0069] S142: Perform word segmentation processing on each of the annotated source texts to obtain a character set of each of the annotated source texts.

[0070] Each of the annotated source texts is segmented to obtain a character set of each of the annotated source texts. Specifically, the character set of each of the annotated source texts is a set of characters annotated with a first label, and the process of segmentation is: first, two adjacent words annotated with a first label and a second label in each source text are segmented, and then the sentence annotated with the first label is segmented separately to obtain a character set of each of the annotated source texts. For example, when the source text is "Xiao Ming was born in 1993. Xiao Ming was born in Shanghai", the order of the labels annotated in the source text annotated with labels is "keep keep delete delete keep keep keep delete delete deletekeep keep keep keep", and the final character set of each annotated source text is: [Xiao, Ming, in, 1993, year, born, in, Shanghai, Shanghai], wherein each character is annotated with the first label.

[0071] S143: Match the words in the vocabulary with the characters in the character set respectively to obtain a word set.

[0072] The words in the vocabulary are matched with the characters in the character set respectively to obtain a word set.

[0073] Specifically, each word in the vocabulary is matched with each character in the character set to form a new word, and then a search is performed in a preset dictionary to determine whether the newly formed word exists in the dictionary. If not, the newly formed word is ignored, and finally the new words selected form the word set.

[0074] S144: Concatenate the words in the word set to obtain the first label sequence.

[0075] The words in the word set are spliced ​​to obtain the first label sequence. Specifically, the words in the word set are spliced ​​in the order of the characters in each source text after the annotation to obtain the first label sequence. In the process of splicing all the words in the word set, the splicing needs to be carried out in the order of the source text character composition, and at least one text is obtained after the splicing is completed. Then, the spliced ​​text is subjected to syntactic analysis, and the sentence that best matches the source text is selected and used as the first label sequence. The target text of the source text can be predicted through the first label sequence. For example, when the source text is "Xiao Ming was born in 1993. Xiao Ming was born in Shanghai", the first label sequence is "keep keep delete delete keep keep keep 初 |delete delete delete 出 |keep keep keepkeep", where " 初 |" and " 出 |" are all labels marked according to the words in the vocabulary.

[0076] S150: Input each source text into a text generation model to be trained to obtain a second label sequence.

[0077] Each source text is input into the text generation model to be trained to obtain a second label sequence. Specifically, the text generation model to be trained is a model of an encoder-decoder model architecture, that is, the text generation model includes an encoder and a decoder. After the source text is input into the text generation model to be trained, the second label sequence can be obtained by encoding and decoding, and the target text of the source text can be predicted by the second label sequence. In an embodiment of the present invention, the encoder of the text generation model adopts a pre-trained RoBERTa Chinese model, that is, it is composed of 12 layers of transformers; the decoder adopts a single-layer transformer, which can take into account the inference speed of the model while ensuring accuracy.

[0078] S160: Adjust configuration parameters of the text generation model according to the first label sequence and the second label sequence.

[0079] The configuration parameters of the text generation model are adjusted according to the first label sequence and the second label sequence. Specifically, the target text of the source text can be obtained through the first label sequence and the second label sequence. The first label sequence is obtained on the basis of the target text of the source text, and the second label sequence text is generated by the text generation model to be trained, that is, the target text obtained according to the first label sequence is more accurate than the second label sequence. The first label sequence and the second label sequence are calculated to obtain the similarity between the first label sequence and the second label sequence, and finally the configuration parameters of the text generation model are adjusted accordingly according to the similarity, so that the second label sequence generated by the text generation model is closer to the first label sequence, thereby completing the training of the text generation model.

[0080] In one embodiment, if Figure 6 As shown, step S160 includes sub-steps S161 and S162.

[0081] S161. Obtain similarity between the second tag sequence and the first tag sequence.

[0082] Obtain the similarity between the second label sequence and the first label sequence. Specifically, when calculating the similarity between the first label sequence and the second label sequence, the first label sequence and the second label sequence need to be vectorized, and then the distance calculation is performed, and the calculated distance is used as the similarity between the second label sequence and the first label sequence. The longer the distance, the lower the similarity, and the shorter the distance, the higher the similarity. In an embodiment of the present invention, the Euclidean distance calculation method is used to obtain the similarity. The Euclidean distance is a commonly used distance definition, which refers to the true distance between two points in n-dimensional space, or the natural length of a vector. The Euclidean distance calculation formula between the second label sequence and the first label sequence is: Where n represents the dimension of the vector, x 1k is the vector of the first label sequence, x 2k is the vector of the second label sequence.

[0083] S162: If the similarity is lower than a preset threshold, adjust the configuration parameters of the text generation model according to the similarity.

[0084] If the similarity is lower than a preset threshold, the configuration parameters of the text generation model are adjusted according to the similarity. Specifically, the preset threshold is whether to adjust the parameters of the text generation model so that the text generation model can more accurately generate high-semantic text. The threshold can be set according to actual conditions and is not limited here.

[0085] The training method of the text generation model based on text editing technology described in the present invention is as follows: obtaining a preset source text set; editing the source text set according to a preset text editor to obtain a target text set of the source text set; constructing a vocabulary according to the source text set and the target text set; processing each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first label sequence; inputting each source text into the text generation model to be trained to obtain a second label sequence; and adjusting the configuration parameters of the text generation model according to the first label sequence and the second label sequence. The training method of the text generation model based on text editing technology described in the present invention not only greatly improves the training efficiency of the text generation model, but also improves the accuracy of the text generation model in generating highly semantic texts.

[0086] The embodiment of the present invention further provides a training device 100 for a text generation model based on text editing technology, which is used to execute any embodiment of the training method for a text generation model based on text editing technology. Figure 7 , Figure 7 It is a schematic block diagram of a training device 100 for a text generation model based on text editing technology provided in an embodiment of the present invention.

[0087] like Figure 7 As shown, the training device 100 of the text generation model based on text editing technology includes a first acquisition unit 110, an editing unit 120, a first construction unit 130, a processing unit 140, an input unit 150 and a first adjustment unit 160.

[0088] The first acquisition unit 110 is used to acquire a preset source text set.

[0089] The editing unit 120 is used to edit the source text set according to a preset text editor to obtain a target text set of the source text set.

[0090] The first construction unit 130 is configured to construct a vocabulary according to the source text set and the target text set.

[0091] In other inventive embodiments, Figure 8 As shown, the first building unit 130 includes: a second building unit 131 and a third building unit 132 .

[0092] The second construction unit 131 is configured to construct the longest common subsequence of each source text and the target text of each source text according to each source text and the target text of each source text.

[0093] In other inventive embodiments, Fig. 9As shown, the second construction unit 131 includes: a second acquisition unit 1311 and a first matching unit 1312 .

[0094] The second acquisition unit 1311 is configured to acquire a subsequence set of each source text and a subsequence set of a target text of each source text.

[0095] The first matching unit 1312 is used to match each subsequence in the subsequence set of each source text with each subsequence in the subsequence set of the target text to obtain a common subsequence set of each source text and the target text of each source text and use the longest common subsequence in the common subsequence set as the longest common subsequence.

[0096] The third construction unit 132 is configured to construct the vocabulary according to the target text of each source text and the longest common subsequence.

[0097] In other inventive embodiments, Fig.10 As shown, the third construction unit 132 includes: a first word segmentation unit 1321 and a second matching unit 1322 .

[0098] The first word segmentation unit 1321 is used to perform word segmentation processing on the target text of each source text to obtain words of the target text of each source text.

[0099] The second matching unit 1322 is configured to match the words of the target text of each source text with the longest common subsequence to obtain words constituting the vocabulary from the words of the target text of each source text.

[0100] The processing unit 140 is configured to process each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first tag sequence.

[0101] In other inventive embodiments, Fig.11 As shown, the processing unit 140 includes: a tagging unit 141 , a second word segmentation unit 142 , a third matching unit 143 and a splicing unit 144 .

[0102] The tagging unit 141 tags each source text according to the longest common subsequence to obtain each tagged source text.

[0103] The second word segmentation unit 142 is used to perform word segmentation processing on each of the annotated source texts to obtain a character set of each of the annotated source texts.

[0104] The third matching unit 143 is used to match the words in the vocabulary with the characters in the character set respectively to obtain a word set.

[0105] The concatenation unit 144 is configured to concatenate the words in the word set to obtain the first tag sequence.

[0106] The input unit 150 is used to input each source text into the text generation model to be trained to obtain a second label sequence.

[0107] The first adjustment unit 160 is configured to adjust configuration parameters of the text generation model according to the first label sequence and the second label sequence.

[0108] In other inventive embodiments, Fig.12 As shown, the first adjustment unit 160 includes: a third acquisition unit 161 and a second adjustment unit 162 .

[0109] The third acquiring unit 161 is configured to acquire the similarity between the second tag sequence and the first tag sequence.

[0110] The second adjusting unit 162 is configured to adjust the configuration parameters of the text generation model according to the similarity if the similarity is lower than a preset threshold.

[0111] The text generation model training device 100 based on text editing technology provided in the embodiment of the present invention is used to execute the above-mentioned steps of obtaining a preset source text set; editing the source text set according to a preset text editor to obtain a target text set of the source text set; building a vocabulary according to the source text set and the target text set; processing each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first label sequence; inputting each source text into the text generation model to be trained to obtain a second label sequence; and adjusting the configuration parameters of the text generation model according to the first label sequence and the second label sequence.

[0112] See also Fig.13 , Fig.13 It is a schematic block diagram of a computer device provided by an embodiment of the present invention.

[0113] See also Fig.13 The device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .

[0114] The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 may execute a training method for a text generation model based on text editing technology.

[0115] The processor 502 is used to provide computing and control capabilities to support the operation of the entire device 500.

[0116] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a training method for a text generation model based on text editing technology.

[0117] The network interface 505 is used for network communication, such as providing data information transmission, etc. Those skilled in the art will understand that Fig.13 The structure shown in the figure is merely a block diagram of a partial structure related to the solution of the present invention, and does not constitute a limitation on the device 500 to which the solution of the present invention is applied. The specific device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0118] The processor 502 is used to run a computer program 5032 stored in a memory to implement the following functions: obtaining a preset source text set; editing the source text set according to a preset text editor to obtain a target text set of the source text set; building a vocabulary according to the source text set and the target text set; processing each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first label sequence; inputting each source text into a text generation model to be trained to obtain a second label sequence; and adjusting configuration parameters of the text generation model according to the first label sequence and the second label sequence.

[0119] Those skilled in the art will understand that Fig.13 The embodiment of the device 500 shown in the figure does not constitute a limitation on the specific structure of the device 500. In other embodiments, the device 500 may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, in some embodiments, the device 500 may only include a memory and a processor 502. In such an embodiment, the structure and function of the memory and the processor 502 are the same as those of the embodiment of the present invention. Fig.13 The embodiments shown are consistent and will not be described again here.

[0120] It should be understood that in the embodiment of the present invention, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors 502, digital signal processors 502 (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor 502 may be a microprocessor 502 or the processor 502 may also be any conventional processor 502, etc. In another embodiment of the present invention, a computer storage medium is provided. The storage medium may be a non-volatile computer-readable storage medium. The storage medium stores a computer program 5032, wherein the computer program 5032 implements the following steps when executed by the processor 502: obtaining a preset source text set; editing the source text set according to a preset text editor to obtain a target text set of the source text set; constructing a vocabulary according to the source text set and the target text set; processing each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first label sequence; inputting each source text into a text generation model to be trained to obtain a second label sequence; and adjusting configuration parameters of the text generation model according to the first label sequence and the second label sequence.

[0121] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment, devices and units can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0122] In the several embodiments provided by the present invention, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. Units with the same function may also be combined into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.

[0123] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.

[0124] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0125] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a device 500 (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk.

[0126] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A training method for a text generation model based on text editing technology, characterized in that: The following steps are involved: Get a preset source text set; Editing the source text set according to a preset text editor to obtain a target text set of the source text set; Building a vocabulary based on the source text set and the target text set; Processing each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first tag sequence; Inputting each source text into a text generation model to be trained to obtain a second label sequence; Adjusting configuration parameters of the text generation model according to the first label sequence and the second label sequence; The step of constructing the vocabulary according to the source text set and the target text set includes: Constructing the longest common subsequence of each source text and the target text of each source text according to each source text and the target text of each source text; Building the vocabulary according to the target text of each source text and the longest common subsequence; The step of processing each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first tag sequence includes: Annotating each source text according to the longest common subsequence to obtain each annotated source text; Performing word segmentation processing on each of the annotated source texts to obtain a character set of each of the annotated source texts; Matching the words in the vocabulary with the characters in the character set respectively to obtain a word set; The words in the word set are concatenated to obtain the first tag sequence.

2. The training method of the text generation model based on text editing technology according to claim 1, characterized in that: The step of constructing the longest common subsequence of each source text and the target text of each source text according to each source text and the target text of each source text comprises: Acquire a subsequence set of each source text and a subsequence set of a target text of each source text; Each subsequence in the subsequence set of each source text is matched with each subsequence in the subsequence set of the target text to obtain a common subsequence set of each source text and the target text of each source text, and the longest common subsequence in the common subsequence set is used as the longest common subsequence.

3. The training method of the text generation model based on text editing technology according to claim 1 is characterized in that: The step of constructing the vocabulary according to the target text of each source text and the longest common subsequence comprises: Performing word segmentation processing on the target text of each source text to obtain words of the target text of each source text; The words of the target text of each source text are matched with the longest common subsequence to obtain words constituting the vocabulary from the words of the target text of each source text.

4. The training method of the text generation model based on text editing technology according to claim 1, characterized in that: The step of concatenating the words in the word set to obtain the first tag sequence includes: The words in the word set are concatenated in the order of the characters in each of the annotated source texts to obtain the first tag sequence.

5. The training method of the text generation model based on text editing technology according to claim 1, characterized in that: The adjusting of configuration parameters of the text generation model according to the first label sequence and the second label sequence includes: Obtaining a similarity between the second tag sequence and the first tag sequence; If the similarity is lower than a preset threshold, the configuration parameters of the text generation model are adjusted according to the similarity.

6. A training device for a text generation model based on text editing technology, characterized in that: include: A first acquisition unit, used to acquire a preset source text set; An editing unit, used for editing the source text set according to a preset text editor to obtain a target text set of the source text set; A first construction unit, configured to construct a vocabulary according to the source text set and the target text set; A processing unit, configured to process each source text according to the vocabulary and the target text of each source text in the source text set to obtain a first tag sequence; An input unit, used for inputting each source text into a text generation model to be trained to obtain a second label sequence; A first adjustment unit, configured to adjust configuration parameters of the text generation model according to the first label sequence and the second label sequence; The first building block includes: a second building block and a third building block; A second construction unit is used to construct the longest common subsequence of each source text and the target text of each source text according to each source text and the target text of each source text; A third construction unit, configured to construct the vocabulary according to the target text of each source text and the longest common subsequence; The processing unit includes: a marking unit, a second word segmentation unit, a third matching unit and a splicing unit; a labeling unit, configured to label each source text according to the longest common subsequence to obtain each labeled source text; A second word segmentation unit, configured to perform word segmentation processing on each of the annotated source texts to obtain a character set of each of the annotated source texts; A third matching unit, used for matching the words in the vocabulary with the characters in the character set respectively to obtain a word set; A concatenation unit is used to concatenate the words in the word set to obtain the first label sequence.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the training method for a text generation model based on text editing technology as described in any one of claims 1 to 5 is implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to execute the method for training a text generation model based on text editing technology as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Text translation model training method and text translation method and device

    CN110555213A

  • Artificial intelligence based method and apparatus for generating information

    US20180329886A1