Data processing method, device and electronic equipment
Through the combination of neural network generation model and discriminant model, the table data conversion is optimized, and the problem of low text fluency and semantic consistency in the existing technology is solved, achieving high fluency and high consistency text conversion effect.
Patent Information
- Application Number
- CN202111045487.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-07
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2041-09-07
AI Technical Summary
When converting tabular data into text in the prior art, the fluency and semantic consistency of the text are low, making it difficult to meet the user's reading and comprehension needs.
The generated model based on neural network is used to convert the table data text, optimize the model parameters through multiple training samples and stimulus training data, and calculate the fluency and consistency stimulus values in combination with the discriminant model to ensure the converted text fluency and consistency properties. All reach the threshold.
The converted text fluency and semantic consistency are significantly improved, making the generated text more readable and semantic to the original tabular data.
Smart Images

Figure CN113761842B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device and electronic device. Background Art
[0002] Currently, Table-to-Text is an important research field in natural language processing (NLP), which aims to transform tabular data into text information that is easy for users to read and understand.
[0003] Currently, neural network models are mostly used to process tabular information into text information, but the fluency and semantic consistency of the text information are still low. Summary of the invention
[0004] In view of this, the present application provides a data processing method, device and electronic device as follows:
[0005] A data processing method, comprising:
[0006] Get the target table data;
[0007] Performing text conversion on the target table data to obtain target text data corresponding to the target table data;
[0008] Among them, the value of the fluency attribute of the target text data is greater than or equal to the fluency threshold, the value of the consistency attribute of the target text data is greater than or equal to the consistency threshold, the value of the fluency attribute represents the text fluency of the target text data, and the value of the consistency attribute represents the similarity between the target text data and the target table data.
[0009] The above method preferably performs text conversion on the target table data to obtain target text data corresponding to the target table data, including:
[0010] Using the generation model to perform text conversion on the target table data to obtain target text data corresponding to the target table data;
[0011] The generative model is constructed based on a neural network and trained using multiple training samples, wherein the training samples include table training data and text training data, and the generative model is also trained using excitation training data corresponding to the training samples, wherein the excitation training data characterizes the fluency attribute and consistency attribute of the generative model in converting the table training data into text.
[0012] In the above method, preferably, the incentive training data is obtained by:
[0013] Obtaining a plurality of candidate text data obtained by the generative model performing text conversion on the table training data;
[0014] Obtaining a fluency incentive value for each candidate text data, wherein the magnitude of the fluency incentive value represents the text fluency of the candidate text data;
[0015] Obtaining a consistency incentive value between each candidate text data and the corresponding text training data, wherein the size of the consistency incentive value represents the degree of similarity between the candidate text data and the text training data;
[0016] An overall incentive value is obtained according to the fluency incentive value and the consistency incentive value. The overall incentive value is used as the incentive training data to update the model parameters of the generation model.
[0017] In the above method, preferably, the fluency attribute of the target text data is obtained by a discriminant model;
[0018] The discriminant model is trained using the text training data and its corresponding text sample data, and the text sample data is sample data obtained by performing text conversion on the table training data using the generative model.
[0019] In the above method, preferably, the discriminant model is trained in the following manner:
[0020] Obtaining a loss function value of the discriminant model according to the text sample data and the text training data, wherein the magnitude of the loss function value represents the magnitude of an error in obtaining a fluency attribute by the discriminant model;
[0021] Using the loss function value, the model parameters of the discriminant model are updated.
[0022] The above method preferably obtains the loss function value of the discriminant model according to the text sample data and the text training data, including:
[0023] Using the discriminant model, obtaining a first incentive value of the text training data and a second incentive value of the text sample data;
[0024] A loss function value is obtained according to at least the first incentive value and the second incentive value.
[0025] The above method preferably obtains the loss function value at least according to the first incentive value and the second incentive value, including:
[0026] Taking an expected value of the logarithmic value of the first stimulus value corresponding to all the text training data to obtain a first expected value;
[0027] Subtracting the second stimulus value corresponding to each of the text sample data from 1 to obtain a new second stimulus value; taking an expected value of the logarithmic value of the new second stimulus value corresponding to all the text sample data to obtain a second expected value;
[0028] The loss function value is obtained according to the first expected value and the second expected value.
[0029] Preferably, the above method obtains the overall incentive value according to the fluency incentive value and the consistency incentive value, including:
[0030] Using an incentive weight parameter, weighted summing the fluency incentive value and the consistency incentive value to obtain an overall incentive value;
[0031] The incentive weight parameter is at least related to the text training data and the candidate text data.
[0032] A data processing device, comprising:
[0033] A target acquisition unit, used for acquiring target table data;
[0034] A text conversion unit, used for performing text conversion on the target table data to obtain target text data corresponding to the target table data;
[0035] Among them, the value of the fluency attribute of the target text data is greater than or equal to the fluency threshold, the value of the consistency attribute of the target text data is greater than or equal to the consistency threshold, the value of the fluency attribute represents the text fluency of the target text data, and the value of the consistency attribute represents the similarity between the target text data and the target table data.
[0036] An electronic device, comprising:
[0037] A memory, used to store applications and data generated by the operation of the applications;
[0038] A processor is used to execute the application to achieve: obtaining target table data; performing text conversion on the target table data to obtain target text data corresponding to the target table data; wherein the value of the fluency attribute of the target text data is greater than or equal to the fluency threshold, the value of the consistency attribute of the target text data is greater than or equal to the consistency threshold, the value of the fluency attribute represents the level of text fluency of the target text data, and the value of the consistency attribute represents the level of similarity between the target text data and the target table data.
[0039] From the above technical solution, it can be seen that in a data processing method, device and electronic device disclosed in the present application, after obtaining the target table data, the target table data is subjected to text conversion to obtain the target text data, and the text conversion in the present application can make the fluency attribute and consistency attribute of the target text data greater than or equal to their respective thresholds. It can be seen that the text conversion in the present application can make the fluency and semantic consistency of the obtained text higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 A flowchart of a data processing method provided in Example 1 of the present application;
[0042] Figure 2 This is a schematic diagram of table data in an embodiment of the present application;
[0043] Figure 3 This is an example diagram of training a generative model in an embodiment of the present application;
[0044] Figure 4 and Figure 5 They are respectively partial flow charts of a data processing method provided in Example 1 of the present application;
[0045] Figure 6 This is an example diagram of training a generative model and a discriminative model in an embodiment of the present application;
[0046] Figure 7 A schematic diagram of the structure of a data processing device provided in Embodiment 2 of the present application;
[0047] Figure 8 Another structural schematic diagram of a data processing device provided in Embodiment 2 of the present application;
[0048] Fig. 9 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present application;
[0049] Figure 10-12 They are respectively example diagrams of the server for performing text conversion on a table in embodiments of the present application. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0051] refer to Figure 1 As shown, it is a flowchart of a data processing method provided in the first embodiment of the present application, and the method can be applied to electronic devices capable of data processing, such as mobile phones, pads, notebooks, computers or servers, etc. The technical solution in this embodiment is mainly used to improve the fluency and consistency of the text converted from the table.
[0052] Specifically, the method in this embodiment may include the following steps:
[0053] Step 101: Obtain target table data.
[0054] The target table data refers to table data containing multiple cells and containing characters in the cells, such as Figure 2 As shown in . The target table data is the table data that needs to be converted into text statements.
[0055] Specifically, in this embodiment, the target table data at the designated storage location can be obtained by data reading or the like.
[0056] Step 102: Perform text conversion on the target table data to obtain target text data corresponding to the target table data.
[0057] Specifically, in this embodiment, the target table data may be firstly subjected to feature extraction to obtain a plurality of table features corresponding to at least one feature layer, and then the table features may be processed at least according to the feature weight parameters corresponding to the feature layer, thereby obtaining the target text data corresponding to the target table data. The obtained target text data has a fluency attribute and a consistency attribute, and through the text conversion in this embodiment, the value of the fluency attribute of the target text data is greater than or equal to the fluency threshold and the value of the consistency attribute is greater than or equal to the consistency threshold.
[0058] The value of the fluency attribute here represents the text fluency of the target text data. The larger the value of the fluency attribute, the higher the text fluency of the target text data, which is more convenient for users to read. The value of the consistency attribute represents the similarity between the target text data and the target table data, which can also represent the semantic consistency between the target text data and the target table data. The larger the value of the consistency attribute, the higher the phonetic consistency between the target text data and the target table data.
[0059] It can be seen from the above scheme that in a data processing method provided in the first embodiment of the present application, after obtaining the target table data, the target table data is subjected to text conversion to obtain the target text data, and the text conversion in the present application can make the fluency attribute and consistency attribute of the target text data greater than or equal to their respective thresholds. It can be seen that the text conversion in this embodiment can make the fluency and semantic consistency of the obtained text higher.
[0060] In one implementation, when text conversion is performed on the target table data in step 102, the target text data corresponding to the target table data may be obtained in the following manner:
[0061] The target table data is converted into text using the generative model to obtain target text data corresponding to the target table data.
[0062] The generative model is constructed based on a neural network, so that the generative model includes at least one feature layer. In addition, the generative model is trained using multiple training samples, and the training samples include table training data and text training data. The text training data is text data set by manual annotation or the like for the table training data, and the text training data is text data that satisfies the fluency attribute value greater than or equal to the fluency threshold and the consistency attribute value greater than or equal to the consistency threshold for the table training data.
[0063] It should be noted that, in addition to using the tabular training data and text training data in the training samples for learning and training, the generative model also uses the incentive training data corresponding to the training samples for training. The incentive training data here characterizes the fluency attribute and consistency attribute of the generative model's conversion of tabular training data into text. In other words, the generative model has two training directions. The first training direction is to use the tabular training data and text training data in the training samples for training. The second training direction is to obtain incentive training data that can characterize the text conversion performance of the trained generative model after training the generative model with the tabular training data and text training data, such as the overall incentive value that characterizes the fluency attribute and consistency attribute of the generative model's conversion of tabular training data into text, and then use the incentive training data to train the generative model again, such as Figure 3 As shown in , the value of the fluency attribute and the value of the consistency attribute of the target text data obtained by text conversion of the target table data by the trained generation model are greater than or equal to their respective corresponding thresholds.
[0064] First, in this embodiment, the generative model can be used to learn the table training data and the text training data so that the model parameters in the generative model are optimized. Specifically, in this embodiment, the table training data can be used as an input sample and the text training data can be used as an output sample to optimize the model parameters of the generative model. The model parameters of the generative model here can include feature weight parameters corresponding to each feature layer in the neural network structure, etc.
[0065] In addition, the motivational training data can be obtained through the following process, such as Figure 4 As shown in:
[0066] Step 401: obtaining a plurality of candidate text data obtained by performing text conversion on table training data by a generation model.
[0067] Specifically, when the generative model is used to perform text conversion on the table training data, the generative model predicts the candidate words used to form the candidate text data through the Monte Carlo search algorithm MC. For example, the first candidate word is first predicted, and there are multiple first candidate words. Then, the second candidate words are predicted based on the first candidate words, and each first candidate word corresponds to multiple second candidate words, and so on. Figure 5 As shown in , the first candidate word to the last candidate word constitute candidate text data, thereby obtaining a plurality of candidate text data.
[0068] Step 402: Obtain the fluency incentive value of each candidate text data.
[0069] The magnitude of the fluency incentive value represents the text fluency of the candidate text data.
[0070] Specifically, in this embodiment, the fluency attribute of each candidate text data can be obtained through a discriminant model. The discriminant model can be constructed based on a classification algorithm. Based on this, the discriminant model takes each candidate text data as input and can output a fluency incentive value for each candidate text, thereby characterizing the level of text fluency of the corresponding candidate text data.
[0071] For example, in this embodiment, the following formula (1) can be used to obtain the fluency incentive value of each candidate text data:
[0072]
[0073] Where t is the sequence number of the candidate word, Y is the sentence in the candidate text data, and the sentence consists of candidate words. T is the number of candidate words contained in Y, that is, the candidate word length of the candidate text data. n is the nth result of MC, that is, the nth candidate word, and N is the total number of search results of MC (Monte Carlo). For example, N can be 8, which means that there are 8 predictions for each candidate word. The value of N can be set according to needs. Φ is the discriminant model, G θ Generative model, a is the action of the generative model to predict the next word. β represents the model parameters of the generative model, and φ represents the model parameters of the discriminative model. Based on this, the obtained Q is the fluency incentive value of the candidate text data.
[0074] Step 403: Obtain a consistency incentive value between each candidate text data and the corresponding text training data.
[0075] Among them, the size of the consistency incentive value represents the degree of similarity between the candidate text data and the text training data, that is, the degree of semantic consistency.
[0076] Specifically, in this embodiment, a bleu-related algorithm can be used to calculate the semantic similarity between each candidate text data and the text training data, so as to obtain a consistency incentive value between each candidate text data and the text training data.
[0077] For example, in this embodiment, the following formula (2) can be used to obtain the consistency incentive value between each candidate text data and the text training data:
[0078]
[0079] Among them, B t It is the bleu_table algorithm, which is used to calculate the semantic consistency incentive value between text and table. The O obtained is the consistency incentive value between the candidate text data and the text training data.
[0080] It should be noted that the execution order of step 402 and step 403 may not be limited to the order shown in the accompanying drawings. Step 403 may be executed first, and then step 402, or step 403 and step 402 may be executed simultaneously. Different technical solutions formed by different execution orders of step 402 and step 403 are all within the protection scope of this application.
[0081] Step 404: Obtain an overall incentive value according to the fluency incentive value and the consistency incentive value.
[0082] The overall incentive value is used as incentive training data to update or optimize the model parameters of the generation model.
[0083] In one implementation, in this embodiment, the fluency incentive value and the consistency incentive value can be averaged to obtain the overall incentive value. For example, the fluency incentive value and the consistency incentive value are natural numbers greater than 0 and less than 1, and the overall incentive value can be obtained by averaging the two natural numbers.
[0084] In another implementation, the present embodiment may use an incentive weight parameter to perform a weighted summation of the fluency incentive value and the consistency incentive value to obtain an overall incentive value. The incentive weight parameter here includes a weight value of the fluency incentive value, and the weight value of the consistency incentive value can be obtained by subtracting the weight value from 1, or the incentive weight parameter here includes a weight value of the consistency incentive value, and the weight value of the fluency incentive value can be obtained by subtracting the weight value from 1.
[0085] In a specific implementation, the size of the incentive weight parameter is at least related to the text training data and the candidate text data. For example, in this embodiment, the following formula (3) can be used to obtain the weight value of the consistency incentive value:
[0086]
[0087] Among them, LCS (The longest common subsequence) is the longest common subsequence algorithm. is the kth text in the text training data, G i is the i-th result obtained by MC search, and λ is the weight value of the consistency incentive value.
[0088] Based on this, in this embodiment, the following formula (4) can be used to obtain the overall incentive value:
[0089] r=(1-λ)×r d +λ×r bleu-t (4)
[0090] Among them, r bleu-tRefers to the consistency incentive value between text training data and candidate text data, r d Refers to the fluency incentive value output by the discriminant model, based on which r is the overall incentive value.
[0091] Based on the above implementation, in this embodiment, after obtaining the overall incentive value, the model parameters of the generation model, such as the weight parameters of each layer in the neural network structure, can be updated through the policy gradient scheme, thereby obtaining a trained generation model. The generation model is used to perform text conversion on the target table data to obtain target text data with high values of fluency attribute and consistency attribute.
[0092] In one implementation, in this embodiment, the discriminant model can be used to obtain the fluency attribute of the target text data, and the bleu_talbe algorithm can be used to obtain the consistency attribute between the target text data and the target table data. The obtained fluency attribute value and the consistency attribute value are used to ensure the performance of the generated model in text conversion. Based on this, the discriminant model can be trained using text training data and its corresponding text sample data. The text sample data here is the sample data obtained by using the generated model to perform text conversion on the table training data, which can also be called negative sample data. Therefore, in this embodiment, the text training data is used as the positive sample data, and the text training data generated by the corresponding table training data is used as the negative sample data to train the discriminant model, so that the model parameters of the discriminant model are optimized.
[0093] Specifically, the discriminant model can be trained in the following ways, such as Figure 5 As shown in:
[0094] Step 501: Obtain the loss function value of the discriminant model according to the text sample data and the text training data.
[0095] Among them, the size of the loss function value represents the error size of the discriminant model in obtaining the fluency attribute.
[0096] Specifically, in this embodiment, a cross entropy loss function can be used to obtain a loss function value that characterizes the error between the text sample data and the text training data. For example, first, a discriminant model is used to obtain a first stimulus value of the text training data and a second stimulus value of the text sample data, and then a loss function value is obtained based on at least the first stimulus value and the second stimulus value.
[0097] For example, first, the discriminant model is used to obtain the fluency incentive value of the text training data and the text sample data respectively, so as to obtain the first incentive value and the second incentive value. Since the text training data and the text sample data are paired and there are multiple ones, the obtained first incentive value and the second incentive value are also multiple. Based on this, in this embodiment, the logarithmic value of the first incentive value corresponding to all text training data is taken as the expected value to obtain the first expected value, and the second incentive value corresponding to each text sample data is subtracted from 1 to obtain a new second incentive value. Thus, the logarithmic value of the new second incentive value corresponding to all text sample data is taken as the expected value to obtain the second expected value. Finally, the loss function value is obtained according to the first expected value and the second expected value. For example, the first expected value and the second expected value are summed and then negatively calculated to obtain the loss function value.
[0098] In a specific implementation, the following formula (5) can be used in this embodiment to obtain the loss function value:
[0099]
[0100] in, is the first expected value corresponding to the text training data, is the second expected value corresponding to the text sample data, and min(φ) is the loss function value.
[0101] Step 502: Use the loss function value to update the model parameters of the discriminant model.
[0102] Based on this, in this embodiment, the generative model and the discriminative model can be alternately trained multiple times using multiple sets of table training data and text training data according to the above training scheme until the overall incentive value and the loss function value meet the corresponding convergence conditions. For example, in the process of training the generative model and the discriminative model, until: the overall incentive value corresponding to the generative model approaches 1 or the change in each round of training is less than the corresponding threshold, and the loss function value of the discriminative model approaches 0 or the change in each round of training is less than the corresponding threshold.
[0103] For example, Figure 6 As shown in , the following training process is used to alternately train the generative model and the discriminative model using multiple sets of training samples consisting of tabular training data and text training data until the two models converge:
[0104] First, the generative model is trained using the table training data and text training data in the training samples to update the model parameters of the generative model;
[0105] Secondly, the trained generative model is used to perform text conversion on the table training data to obtain candidate text data in the text conversion process of the generative model. Based on this, the discriminant model is used to obtain the fluency incentive value of the candidate text data, and the bleu_table algorithm is used to obtain the consistency incentive value between the candidate text data and the text sample data. Then, the overall incentive value corresponding to the fluency incentive value and the consistency incentive value is used to update the model parameters of the generative model again to obtain the generative model that has been preliminarily trained.
[0106] Afterwards, the generative model that has completed preliminary training is used to perform text conversion on the table training data to obtain text sample data. The text sample data is used as a negative sample and the text training data is used as a positive sample to obtain the loss function value of the discriminant model, and the model parameters of the discriminant model are updated based on the loss function value.
[0107] refer to Figure 7 As shown, it is a structural schematic diagram of a data processing device provided in the second embodiment of the present application, and the device can be applied to electronic devices capable of data processing, such as mobile phones, pads, notebooks, computers or servers, etc. The technical solution in this embodiment is mainly used to improve the fluency and consistency of the text converted from the table.
[0108] Specifically, the device in this embodiment may include the following units:
[0109] The target obtaining unit 701 is used to obtain target table data;
[0110] A text conversion unit 702, configured to perform text conversion on the target table data to obtain target text data corresponding to the target table data;
[0111] Among them, the value of the fluency attribute of the target text data is greater than or equal to the fluency threshold, the value of the consistency attribute of the target text data is greater than or equal to the consistency threshold, the value of the fluency attribute represents the text fluency of the target text data, and the value of the consistency attribute represents the similarity between the target text data and the target table data.
[0112] From the above scheme, it can be seen that in a data processing device provided in the second embodiment of the present application, after obtaining the target table data, the target table data is subjected to text conversion to obtain the target text data, and the text conversion in the present application can make the fluency attribute and consistency attribute of the target text data greater than or equal to their respective thresholds. It can be seen that the text conversion in this embodiment can make the fluency and semantic consistency of the obtained text higher.
[0113] In one implementation, the text conversion unit 702 is specifically used to: perform text conversion on the target table data using a generation model to obtain target text data corresponding to the target table data;
[0114] Based on this, the following units can also be used in this embodiment, such as Figure 8 As shown in:
[0115] The model training unit 703 is used to train the generation model and the discrimination model.
[0116] The generative model is constructed based on a neural network and trained using multiple training samples, wherein the training samples include table training data and text training data, and the generative model is also trained using excitation training data corresponding to the training samples, wherein the excitation training data characterizes the fluency attribute and consistency attribute of the generative model in converting the table training data into text.
[0117] Optionally, the incentive training data is obtained in the following manner: obtaining multiple candidate text data obtained by the generation model performing text conversion on the table training data; obtaining a fluency incentive value for each of the candidate text data, the size of the fluency incentive value representing the level of text fluency of the candidate text data; obtaining a consistency incentive value between each of the candidate text data and the corresponding text training data, the size of the consistency incentive value representing the level of similarity between the candidate text data and the text training data; obtaining an overall incentive value based on the fluency incentive value and the consistency incentive value, and the overall incentive value is used as the incentive training data to update the model parameters of the generation model.
[0118] In one implementation, the fluency attribute of the target text data is obtained through a discriminant model; wherein the discriminant model is trained using the text training data and its corresponding text sample data, and the text sample data is sample data obtained by text conversion of the table training data using the generative model.
[0119] Optionally, the discriminant model is trained in the following manner: based on the text sample data and the text training data, a loss function value of the discriminant model is obtained, and the size of the loss function value represents the error size of the fluency attribute obtained by the discriminant model; using the loss function value, the model parameters of the discriminant model are updated.
[0120] Based on the above implementation, the loss function value is obtained in the following manner: using the discriminant model, obtaining the first stimulus value of the text training data and the second stimulus value of the text sample data; obtaining the loss function value at least according to the first stimulus value and the second stimulus value. For example, taking the expected value of the logarithmic value of the first stimulus value corresponding to all the text training data to obtain the first expected value; subtracting the second stimulus value corresponding to each of the text sample data from 1 to obtain a new second stimulus value; taking the expected value of the logarithmic value of the new second stimulus value corresponding to all the text sample data to obtain the second expected value; obtaining the loss function value according to the first expected value and the second expected value.
[0121] In one implementation, the overall incentive value is obtained by: using an incentive weight parameter to perform weighted summation on the fluency incentive value and the consistency incentive value to obtain an overall incentive value; wherein the incentive weight parameter is at least related to the text training data and the candidate text data.
[0122] It should be noted that the specific implementation of the above units can refer to the corresponding content in the previous text and will not be described in detail here.
[0123] refer to Fig. 9 , is a schematic diagram of the structure of an electronic device provided in the third embodiment of the present application, and the electronic device may be an electronic device capable of data processing, such as a mobile phone, pad, notebook, computer or server, etc. The technical solution in this embodiment is mainly used to improve the fluency and consistency of the text converted from the table.
[0124] Specifically, the electronic device in this embodiment may include the following structure:
[0125] The memory 901 is used to store the application program and the data generated by the operation of the application program;
[0126] Processor 902 is used to execute the application to achieve: obtaining target table data; performing text conversion on the target table data to obtain target text data corresponding to the target table data; wherein the value of the fluency attribute of the target text data is greater than or equal to the fluency threshold, the value of the consistency attribute of the target text data is greater than or equal to the consistency threshold, the value of the fluency attribute represents the level of text fluency of the target text data, and the value of the consistency attribute represents the level of similarity between the target text data and the target table data.
[0127] It can be seen from the above scheme that in an electronic device provided in the third embodiment of the present application, after obtaining the target table data, the target table data is subjected to text conversion to obtain the target text data, and the text conversion in the present application can make the fluency attribute and consistency attribute of the target text data greater than or equal to their respective thresholds. It can be seen that the text conversion in this embodiment can make the fluency and semantic consistency of the obtained text higher.
[0128] Specifically, taking the electronic device as a server as an example, the technical solution in this application is described in detail below:
[0129] First, the technical solution in this application is based on the GAN model, such as Fig.10 As shown in , by establishing an adversarial learning mechanism, the generator and discriminator are trained. The GAN model mainly includes two modules: generator G and discriminator D. Generator G is the generation model mentioned above, and discriminator D is the discriminator model mentioned above. Among them, the generator can generate corresponding text descriptions based on the input table data; the discriminator can evaluate whether the input text description is real data, that is, an accurate text description manually annotated, thereby obtaining a fluency incentive value, and at the same time, the bleu-related algorithm is used to compare the input text with the corresponding table, and the semantic information consistency incentive value is calculated, and the two are effectively integrated for updating the generator G. Based on this, the technical solution of the present application mainly has the following core points:
[0130] 1. Pre-train the generator G in the GAN model based on the training data set. The training data set here is the training sample mentioned above;
[0131] 2. Use G to generate negative samples and use them to pre-train the discriminator D in the GAN model;
[0132] 3. Use MC search to generate multiple candidate text descriptions (data) and calculate their total incentives, that is, the overall incentive value;
[0133] 4. Use policy gradient to update the generator G, and use the updated G to generate negative samples for updating the discriminator D;
[0134] 5. Continuously iterate and update G and D to train the entire GAN architecture;
[0135] 6. Use the trained generator to generate a text description of the input table.
[0136] Combination Fig.11In the training process shown in , formula (1) is used to calculate the fluency incentive of the generated text during the model training process, and formula (2) is used to calculate the semantic information consistency between the generated text and the corresponding table content. In order to effectively integrate the above two incentives, the final incentive value can be calculated using formulas (3) and (4), and the generator parameters are updated using the policy gradient method. After that, we use the updated G to generate negative samples and use the loss function such as formula (5) to train the discriminator.
[0137] The algorithm of the entire training process is as follows:
[0138] Input: table training data R and its corresponding text training data S;
[0139] Training goal: Jointly train the generator G and the discriminator D
[0140] 1. Use random parameters to initialize G and D, that is, initialize the model parameters β and φ of G and D respectively;
[0141] 2. Use R and S to pre-train the generator G;
[0142] 3. Save the model parameters of G to β;
[0143] 4. Input R to G, the generated text is used as a negative sample, and S is used as a positive sample;
[0144] 5. Use positive and negative samples to pre-train the discriminator D.
[0145] Among them, the algorithm for iterative training of the generator is as follows:
[0146] 1. When G generates each word, it uses the MC algorithm to obtain 8 candidates and forms an (incomplete) sentence with the previous text, that is, the candidate text data in the previous text;
[0147] 2. Use formula (1) to calculate the fluency incentive of each candidate text data;
[0148] 3. Use the BLEU-Table algorithm to calculate the information consistency incentives of each candidate text data and the original table data;
[0149] 4. Use formula (4) to combine the above two incentives to obtain the overall incentive;
[0150] 5. Use policy gradients to update the model parameters of the generator based on the overall incentive.
[0151] The algorithm for iterative training of the discriminator is as follows:
[0152] 1. Generate negative samples using the updated generator
[0153] 2. Combine positive samples such as S and negative samples to form training data;
[0154] 3. Use the cross entropy loss function to train the discriminator for k rounds, where k can be 3.
[0155] After that, the algorithm for iteratively training the generator and the algorithm for iteratively training the discriminator are repeatedly executed, thereby alternately training the generator and the discriminator until the entire GAN model converges.
[0156] In summary, this application can be applied to a variety of application scenarios. For example, in English composition writing, the GAN model in this application can generate a semantically complete and grammatically fluent model essay based on the keywords provided in the table to guide students in writing essays, such as Fig.12 As shown in . Therefore, the GAN model used in this application can simultaneously ensure the fluency and semantic information consistency of the generated text. In the specific implementation, an incentive fusion method is proposed to reasonably integrate the fluency incentive and the semantic consistency incentive to improve the performance of the model.
[0157] It should be noted that when using the technical solution of the present application, the distribution information of the text data generated on the test set can be statistically analyzed, such as the probability distribution of different levels of vocabulary (the level of vocabulary is determined by looking up the dictionary) and the probability distribution of different sentence structures (obtained by a syntactic parser), etc. In addition, the distribution information of the text data generated on the test set by other methods is statistically analyzed. If it is found that the statistical information obtained by other methods is consistent with the statistical information obtained in the technical solution of the present application, then the other methods are considered to belong to the same inventive concept as the technical solution of the present application.
[0158] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0159] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in 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 function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0160] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0161] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data processing method, comprising: Get the target table data; Performing text conversion on the target table data to obtain target text data corresponding to the target table data; Wherein, the value of the fluency attribute of the target text data is greater than or equal to the fluency threshold, the value of the consistency attribute of the target text data is greater than or equal to the consistency threshold, the value of the fluency attribute represents the text fluency of the target text data, and the value of the consistency attribute represents the similarity between the target text data and the target table data; Performing text conversion on the target table data to obtain target text data corresponding to the target table data includes: Using the generation model to perform text conversion on the target table data to obtain target text data corresponding to the target table data; Among them, the generative model is constructed based on a neural network and trained using multiple training samples, the training samples include table training data and text training data, and the training data of the generative model also includes incentive training data corresponding to the training samples, and the incentive training data characterizes the fluency attribute and consistency attribute of the text conversion of the table training data by the generative model; the training process of the generative model includes: first training using the table training data and text training data included in the training samples, and then training using the incentive training data corresponding to the training samples.
2. According to the method of claim 1, the incentive training data is obtained by: Obtaining a plurality of candidate text data obtained by the generative model performing text conversion on the table training data; Obtaining a fluency incentive value for each candidate text data, wherein the magnitude of the fluency incentive value represents the text fluency of the candidate text data; Obtaining a consistency incentive value between each candidate text data and the corresponding text training data, wherein the size of the consistency incentive value represents the degree of similarity between the candidate text data and the text training data; An overall incentive value is obtained according to the fluency incentive value and the consistency incentive value. The overall incentive value is used as the incentive training data to update the model parameters of the generation model.
3. The method according to claim 1 or 2, wherein the fluency attribute of the target text data is obtained by a discriminant model; in, The discriminant model is trained using the text training data and its corresponding text sample data, and the text sample data is sample data obtained by performing text conversion on the table training data using the generation model.
4. The method according to claim 3, wherein the discriminant model is trained by: Obtaining a loss function value of the discriminant model according to the text sample data and the text training data, wherein the magnitude of the loss function value represents the magnitude of an error in obtaining a fluency attribute by the discriminant model; Using the loss function value, the model parameters of the discriminant model are updated.
5. The method according to claim 4, obtaining the loss function value of the discriminant model according to the text sample data and the text training data, comprising: Using the discriminant model, obtaining a first incentive value of the text training data and a second incentive value of the text sample data; A loss function value is obtained according to at least the first incentive value and the second incentive value.
6. The method according to claim 5, obtaining a loss function value at least according to the first incentive value and the second incentive value, comprising: Taking an expected value of the logarithmic value of the first stimulus value corresponding to all the text training data to obtain a first expected value; Subtracting the second stimulus value corresponding to each of the text sample data from 1 to obtain a new second stimulus value; taking an expected value of the logarithmic value of the new second stimulus value corresponding to all the text sample data to obtain a second expected value; The loss function value is obtained according to the first expected value and the second expected value.
7. The method according to claim 2, obtaining an overall incentive value according to the fluency incentive value and the consistency incentive value, comprising: Using an incentive weight parameter, weighted summing the fluency incentive value and the consistency incentive value to obtain an overall incentive value; The incentive weight parameter is at least related to the text training data and the candidate text data.
8. A data processing device, comprising: A target acquisition unit, used for acquiring target table data; A text conversion unit, used for performing text conversion on the target table data to obtain target text data corresponding to the target table data; Wherein, the value of the fluency attribute of the target text data is greater than or equal to the fluency threshold, the value of the consistency attribute of the target text data is greater than or equal to the consistency threshold, the value of the fluency attribute represents the text fluency of the target text data, and the value of the consistency attribute represents the similarity between the target text data and the target table data; The text conversion unit is specifically used for: Using the generation model to perform text conversion on the target table data to obtain target text data corresponding to the target table data; Among them, the generative model is constructed based on a neural network and trained using multiple training samples, the training samples include table training data and text training data, and the training data of the generative model also includes incentive training data corresponding to the training samples, and the incentive training data characterizes the fluency attribute and consistency attribute of the text conversion of the table training data by the generative model; the training process of the generative model includes: first training using the table training data and text training data included in the training samples, and then training using the incentive training data corresponding to the training samples.
9. An electronic device, comprising: A memory, used to store applications and data generated by the operation of the applications; A processor is used to execute the application program to achieve: obtaining target table data; Performing text conversion on the target table data to obtain target text data corresponding to the target table data; wherein the value of the fluency attribute of the target text data is greater than or equal to the fluency threshold, the value of the consistency attribute of the target text data is greater than or equal to the consistency threshold, the value of the fluency attribute represents the text fluency of the target text data, and the value of the consistency attribute represents the similarity between the target text data and the target table data; Performing text conversion on the target table data to obtain target text data corresponding to the target table data includes: Using the generation model to perform text conversion on the target table data to obtain target text data corresponding to the target table data; Among them, the generative model is constructed based on a neural network and trained using multiple training samples, the training samples include table training data and text training data, and the training data of the generative model also includes incentive training data corresponding to the training samples, and the incentive training data characterizes the fluency attribute and consistency attribute of the text conversion of the table training data by the generative model; the training process of the generative model includes: first training using the table training data and text training data included in the training samples, and then training using the incentive training data corresponding to the training samples.
