Data-to-text generation method and device based on dynamic partitioning and electronic equipment

By using a dynamically partitioned data-to-text generation method, and leveraging the planner and generator of the encoder and decoder networks, combined with unsupervised training, the problem of static planning being unable to be adjusted is solved, achieving the effect of efficiently generating coherent text.

CN115730567BActive Publication Date: 2026-06-02NAT UNIV OF DEFENSE TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NAT UNIV OF DEFENSE TECH
Filing Date
2021-08-25
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing data-to-text generation methods, the planning process is usually static, making it impossible to adjust the data partitioning in a timely manner based on the generated text, and requiring a large amount of supervised training corpus.

Method used

A data-to-text generation method based on dynamic partitioning is adopted, which uses encoder and decoder networks, including planner and generator, to dynamically adjust the data partitioning through unsupervised training strategy and policy gradient algorithm to generate coherent text.

Benefits of technology

It reduces reliance on standard data partitioning, lowers data annotation costs, and improves the coherence and accuracy of generated text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115730567B_ABST
    Figure CN115730567B_ABST
Patent Text Reader

Abstract

The application relates to a data-to-text generation method and device based on dynamic division and electronic equipment. The method comprises the following steps: obtaining structured data, constructing a data-to-text generation network based on dynamic division, the network comprising an encoder and a decoder; the encoder is used for encoding the input to obtain a context-sensitive vector space; in the decoder, a planner and a generator are used alternately to perform data division and text generation, so that the planner can dynamically adjust the data division according to the generated content; an unsupervised training strategy is used to train the network to obtain a data-to-text generation model; the to-be-tested structured data is obtained and input into the model to obtain the text generated by the data. In the method, the planner can adjust the data division in a timely manner according to the generated text, and the unsupervised training network method can eliminate the dependence of the model on standard data division, thereby reducing the data labeling cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, and electronic device for generating data to text based on dynamic partitioning. Background Technology

[0002] Data-to-text generation is a classic task in the field of natural language generation, and it has already played a role in many applications, including weather forecast generation, sports report generation, and biography generation. In recent years, neural network models with attention, especially encoder-decoder structures, have achieved successful applications in data-to-text generation thanks to their powerful representation capabilities. However, aside from these successful applications of neural network models, there are still unresolved problems in data-to-text generation, namely, the difficulty in accurately generating coherent long texts. Therefore, recent work has attempted to introduce processes such as content selection and text planning into data-to-text generation to overcome these problems. These methods extract the alignment or order relationship between the input content and the target sequence, and perform supervised training based on this information.

[0003] Current planning processes are typically static, making it impossible for planners to adjust data partitioning in a timely manner based on the generated text. Supervised training requires a large amount of supervised corpus. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, and electronic device for generating data to text based on dynamic partitioning to address the aforementioned technical problems.

[0005] A method for generating text from dynamically partitioned data, the method comprising:

[0006] Obtain structured data, which is a set of records including multiple records, and use the discrete records as training samples.

[0007] A data-to-text generation network based on dynamic partitioning is constructed. This network includes an encoder and a decoder. The encoder preprocesses the input records and performs word insertion to obtain embedded representations of the records, mapping these representations to a context-sensitive vector space. The decoder includes a planner and a generator. The planner predicts the record group of the next sentence based on the generated sentences, obtaining data partitioning. The generator generates sentences word-by-word according to the data partitioning using an autoregressive approach. When the generator generates a delimiter, the current sentence generation process terminates, and the planner begins partitioning the next sentence. When the generator generates a terminator, the sentence generation process ends, and the post-processing stage begins, deleting the delimiter and terminator to obtain the generated text.

[0008] Based on the training samples, the data-to-text generation network is trained using an unsupervised training strategy to obtain a trained data-to-text generation model.

[0009] Obtain the structured data to be tested, and input the structured data to be tested into the data-to-text generation model to obtain the text generated from the data.

[0010] In one embodiment, the encoder includes a preprocessing module, a word embedding module, and an encoding module.

[0011] The preprocessing module is used to sort the input discrete records according to alphabetical order.

[0012] The word embedding module is used to perform embedding operations on the discrete records to obtain the embedded representation of the records.

[0013] The encoding module is used to map the embedded representation of the record to a context-sensitive vector space.

[0014] In one embodiment, the data-to-text generation network is trained using an unsupervised training strategy based on the training samples to obtain a trained data-to-text generation model, including:

[0015] The training samples are input into the encoder to obtain the encoded vector.

[0016] The encoded vector is input into the decoder to obtain the predicted text generated from the data.

[0017] Based on the training samples and the predicted text, the data-to-text generation network is trained using an unsupervised training strategy to obtain a trained data-to-text generation model.

[0018] In one embodiment, the encoder's encoding module includes a bidirectional LSTM network;

[0019] The training samples are input into the encoder to obtain the encoded vector, including:

[0020] The training samples are input into the preprocessing module to obtain ordered records.

[0021] The ordered records are input into the word embedding module to obtain the embedded representation of the records.

[0022] The embedded representation is input into the bidirectional LSTM network to obtain the encoded vector.

[0023] In one embodiment, both the planner and the generator comprise a unidirectional LSTM network.

[0024] The encoded vector is input into the decoder to obtain the predicted text generated from the data, including:

[0025] The generator's state and the records that have not yet been selected are input into the planner to obtain the probability of each record being selected given the generated sentence and data partitioning. Records with a probability greater than 0.5 are taken as the predicted record group for the next sentence. The records that have not yet been selected are those that have not yet been assigned to a sentence by the planner.

[0026] The predicted record group is input into the generator to obtain the generated sentence. If it is the first sentence, a start symbol is generated at the beginning of the sentence. When the generator generates a separator, the generation process of the current sentence terminates, and the planner begins to determine the data partitioning of the next sentence. When the generator generates a terminator, the sentence generation process ends and enters the post-processing stage, where the separator and terminator are deleted to obtain the predicted text generated from the data. The process of the generator generating the sentence includes: generating the words corresponding to the record and generating a separator at the end of the sentence. If it is the first sentence, a start symbol is generated at the beginning of the sentence.

[0027] Based on the training samples and the predicted text, the data-to-text generation network is trained in a directional manner using an unsupervised training strategy and a policy gradient algorithm to obtain a trained data-to-text generation model.

[0028] In one embodiment, the probability of each record being selected given the generated sentence and data partitioning is calculated using the following formula:

[0029]

[0030]

[0031] Where h' -1 h″ represents the latest state vector of the generator. k This indicates that the planner is working with sentence s. k The state vector during planning; This represents the set of records that have not yet been selected in the first k-1 sentences; This is a conditional indicator function that returns 1 if a given condition is true, and 0 otherwise; d h x represents the dimension of the state vector; i This represents the i-th record; n is the number of records; g k P(x) represents the k-th record group; i ∈g k |g <k ,s <k ) represents record x i Selected to enter the current record group g kThe conditional probability.

[0032] In one embodiment, the embedded representation is input into the bidirectional LSTM network to obtain an encoded vector, including:

[0033] The embedded representation is input into the bidirectional LSTM network, encoded by forward LSTM to obtain a forward encoded vector, and encoded by backward LSTM to obtain a backward encoded vector.

[0034] The positive and negative encoding vectors are concatenated to obtain the encoding vector.

[0035] In one embodiment, the data-to-text generation network includes an encoder and a decoder employing a neural network structure or a Transformer network structure.

[0036] A data-to-text generation apparatus based on dynamic partitioning, the apparatus comprising:

[0037] The training sample acquisition module is used to acquire structured data, which is a set of records including multiple records, and to use the discrete records as training samples.

[0038] A module for constructing a data-to-text generation model based on dynamic partitioning is used to build a data-to-text generation network based on dynamic partitioning. The data-to-text generation network includes an encoder and a decoder. The encoder is used to preprocess the input records and perform word insertion processing to obtain the embedded representation of the records, and maps the inserted representation to a context-sensitive vector space. The decoder includes a planner and a generator. The planner is used to predict the record group of the next sentence based on the generated sentences, obtaining data partitioning. The generator is used to generate sentences word by word according to the data partitioning using an autoregressive formula. When the generator generates a delimiter, the current sentence generation process terminates, and the planner begins to partition the data for the next sentence. When the generator generates a terminator, the sentence generation process ends, and the post-processing stage begins, where the delimiter and terminator are deleted to obtain the generated text.

[0039] The training module for the data-to-text generation model based on dynamic partitioning is used to train the data-to-text generation network using an unsupervised training strategy based on the training samples, so as to obtain a trained data-to-text generation model.

[0040] The data-generated text determination module is used to acquire the structured data to be tested and input the structured data to be tested into the data-to-text generation model to obtain the text generated from the data.

[0041] The aforementioned method, apparatus, and electronic device for generating data to text based on dynamic partitioning include: acquiring structured data; constructing a data-to-text generation network based on dynamic partitioning, the network including an encoder and a decoder; the encoder encoding the input to obtain a context-sensitive vector space; in the decoder, a planner and a generator alternately perform data partitioning and text generation, allowing the planner to dynamically adjust the data partitioning based on the generated content; training the network using an unsupervised training strategy to obtain a data-to-text generation model; acquiring the structured data to be tested and inputting it into the model to obtain the text generated from the data. In this method, the planner can adjust the data partitioning in a timely manner according to the generated text, and the unsupervised training method can eliminate the model's dependence on standard data partitioning, thereby reducing data annotation costs. Attached Figure Description

[0042] Figure 1 This is a flowchart illustrating a data-to-text generation method based on dynamic partitioning in one embodiment;

[0043] Figure 2 This is a model structure for generating text from dynamically partitioned data in one embodiment;

[0044] Figure 3 This is a structural block diagram of a data-to-text generation device based on dynamic partitioning in one embodiment;

[0045] Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0047] Given structured input data X and an output text sequence Y, the goal of a data-to-text task is to generate a coherent and correct Y from X. Where Y = y1, y2, ..., y... i …,y m Represents the target sequence, y i Each represents a word or symbol, and m represents the number of words or symbols. When Y contains multiple sentences, it can also be represented as Y = s1, s2, ..., s i ,…,s k , where s i =y i1 ,y i2 ,…,y il il represents a sentence, and s represents a sentence.i The length of X = x1, x2, ..., x i ,…,x n Let x be a set of records, where n represents the number of records. i Each record is a single record. Each record is an N-tuple containing multiple attributes and their specific values, where the number and type of attributes depend on the specific dataset. For example, in the E2E dataset, each record x i It is a triple (attribute, index, value), where attribute represents the attribute type, index represents the word index, and value represents the word with index index among the attribute values ​​of that type. In the EPW dataset, since no attribute value contains multiple words, each record is a tuple containing only the attribute type and the specific value.

[0048] In one embodiment, such as Figure 1 As shown, a method for generating text from dynamically partitioned data is provided, which includes the following steps:

[0049] Step 100: Obtain structured data. Structured data is a collection of records, including multiple records, and uses discrete records as training samples.

[0050] Data-to-text generation is a task that transforms structured data into corresponding coherent and semantically consistent text.

[0051] Structured data comes in many forms, including tables and concepts. Most of this structured data can be converted into records, each of which is an N-tuple containing one or more attributes and their corresponding values.

[0052] Step 102: Construct a data-to-text generative network based on dynamic partitioning.

[0053] Data-to-text generation networks consist of encoders and decoders.

[0054] The encoder is used to preprocess the input records and perform word insertion to obtain the embedded representation of the records, and then maps the inserted representation to a context-sensitive vector space.

[0055] The decoder includes a planner and a generator. The planner is used to predict the record group of the next sentence based on the generated sentences, thus obtaining data partitioning. The generator is used to generate sentences in words according to autoregression, referring to the data partitioning. When the generator generates a delimiter, the current sentence generation process terminates, and the planner begins to partition the data for the next sentence. When the generator generates a terminator, the sentence generation process ends and enters the post-processing stage, where the delimiter and terminator are deleted to obtain the generated text.

[0056] This network model includes a planner and a generator in the decoder. The planner is responsible for dividing the given records into groups, with each group corresponding to a sentence to be generated. The generator then generates sentences based on the planner's results. A key difference between this network model and generation methods using static programming is that it couples the decoupled "planning" and "generation" processes found in static programming. In this network model, "planning" and "generation" are no longer completely separate processes but are performed alternately on a sentence-by-sentence basis.

[0057] The planner can sense the content that has been generated, and thus can dynamically adjust itself based on its own state and the state of the generator when the generation process deviates from the predetermined plan.

[0058] The generation of text sequences based on dynamically partitioned data-to-text generative network models is decomposed into the generation of multiple consecutive sentences.

[0059] Step 104: Based on the training samples, train the data-to-text generation network using an unsupervised training strategy to obtain a trained data-to-text generation model.

[0060] In unsupervised training based on reinforcement learning, the planner's output is used as the agent's action, the likelihood probability of the target sentence in the generator is used as the reward, and the gradient is backpropagated using the policy gradient algorithm.

[0061] Step 106: Obtain the structured data to be tested and input it into the data-to-text generation model to obtain the text generated from the data.

[0062] The aforementioned data-to-text generation method based on dynamic partitioning includes: acquiring structured data; constructing a data-to-text generation network based on dynamic partitioning, the network including an encoder and a decoder; the encoder is used to encode the input to obtain a context-sensitive vector space; in the decoder, a planner and a generator alternately perform data partitioning and text generation, thereby enabling the planner to dynamically adjust the data partitioning based on the generated content; training the network using an unsupervised training strategy to obtain a data-to-text generation model; acquiring the structured data to be tested and inputting it into the model to obtain the text generated from the data. In this method, the planner can adjust the data partitioning in a timely manner according to the generated text, and the use of unsupervised network training can eliminate the model's dependence on standard data partitioning, thereby reducing data annotation costs.

[0063] In one embodiment, in step 102, the encoder includes a preprocessing module, a word embedding module, and an encoding module; the preprocessing module is used to sort the input discrete records according to alphabetical order; the word embedding module is used to perform embedding operations on the discrete records to obtain the embedded representation of the records; and the encoding module is used to map the embedded representation of the records to a context-sensitive vector space.

[0064] The embedding representation of a record is the sum of the embeddings of all elements within its tuple. In a record, the last element typically corresponds to some word in the target sequence and is therefore considered to contain more information than the other elements in the tuple. To highlight the last element, this chapter uses the square root of the embedding representation dimension to scale the word embedding of the last element. For example, in the E2E dataset, the embedding representation of a record x is:

[0065]

[0066] Where d represents the dimension of word embedding.

[0067] In one embodiment, step 104 further includes: inputting training samples into an encoder to obtain an encoding vector; inputting the encoding vector into a decoder to obtain predicted text generated from the data; and training the data-to-text generation network using an unsupervised training strategy based on the training samples and the predicted text to obtain a trained data-to-text generation model.

[0068] In one embodiment, the encoder's encoding module includes a bidirectional Long Short-Term Memory (LSTM) network. Step 104 further includes: inputting training samples into a preprocessing module to obtain ordered records; inputting the ordered records into a word embedding module to obtain embedded representations of the records; and inputting the embedded representations into the bidirectional LSTM network to obtain encoding vectors.

[0069] In one embodiment, both the planner and the generator include a unidirectional LSTM network. Step 104 further includes: inputting the generator's state and unselected records into the planner to obtain the probability of each record being selected given the generated sentence and data partitioning; taking records with a probability greater than 0.5 as the predicted record group for the next sentence; unselected records are those not yet assigned to a sentence by the planner; inputting the predicted record group into the generator to obtain the generated sentence; if it is the first sentence, generating a start symbol at the beginning of the sentence; when the generator generates a separator, the generation process of the current sentence terminates, and the planner begins to determine the data partitioning for the next sentence; when the generator generates a terminator, the sentence generation process ends, entering the post-processing stage, deleting the separator and terminator to obtain the predicted text generated from the data; the process of the generator generating the sentence includes: generating the words corresponding to the records and generating separators at the end of the sentence; if it is the first sentence, generating start symbols at the beginning of the sentence; and training the data-to-text generation network in the direction of training based on the training samples and the predicted text using an unsupervised training strategy and a policy gradient algorithm to obtain a trained data-to-text generation model.

[0070] In one embodiment, in step 104, the probability of each record being selected given the generated sentence and data partitioning is calculated using the following formula:

[0071]

[0072]

[0073] Where h' -1 h″ represents the latest state vector of the generator. k This indicates that the planner is working with sentence s. k The state vector during planning; This represents the set of records that have not yet been selected in the first k-1 sentences; This is a conditional indicator function that returns 1 if a given condition is true, and 0 otherwise; d h x represents the dimension of the state vector; i This represents the i-th record; n is the number of records; g k P(x) represents the k-th record group; i ∈g k |g <k ,s <k ) represents record x i Selected to enter the current record group g k The conditional probability.

[0074] In one embodiment, step 104 further includes: inputting the embedded representation into a bidirectional LSTM network, encoding it through a forward LSTM to obtain a forward encoded vector, encoding it through a backward LSTM to obtain a backward encoded vector, and concatenating the forward encoded vector and the backward encoded vector to obtain an encoded vector.

[0075] In one embodiment, in step 104, the data-to-text generation network includes an encoder and a decoder employing a neural network structure or a Transformer network structure.

[0076] In another embodiment, such as Figure 2 As shown, a data-to-text generation network based on dynamic partitioning is presented. The network employs an encoder-decoder structure, where the encoder is a bidirectional LSTM network responsible for mapping discrete input records to a context-sensitive vector space. The decoder comprises two modules: a planner and a generator. These two modules, like the encoder, also use LSTM networks, but only a unidirectional LSTM. The generation of text sequences using this network model is decomposed into the generation of multiple consecutive sentences.

[0077] Specifically, in the generation process (i.e., the decoding process), the planner divides the data into sentences. Before generating a sentence, the planner predicts the record group for the next sentence based on the already divided data and the sentences already generated. The symbol g is used. i ={x i1 ,x i2 ,…,x il′ Let} represent a set of il′ records, i.e., a record group, where il′ represents the size of the i-th record group. After the planner determines the record group corresponding to a sentence, the generator begins to generate a new sentence. Unlike the planner, the generator performs autoregressive generation on a word-by-word basis, but it refers to the data partitioning output by the planner before starting to generate a sentence. Figure 2 It also includes three special characters: <bos> 、 <sep>and <eos>These characters represent the beginning of a sentence, the separator between sentences, and the end of a sentence, respectively. The generator producing this separator signifies the completion of sentence generation, at which point the planner begins determining the record group for the next sentence. The planner and generator work alternately until the generator produces the end character. <eos>This means that the model has completed the generation of the entire sequence.

[0078] This embodiment utilizes a bidirectional LSTM network to encode the embedded representation of records, enabling each record to perceive other records. Because a bidirectional LSTM is used, a record x... i We can obtain two vectors encoded in different directions:

[0079]

[0080]

[0081] in, and These represent LSTM encoding from left to right and LSTM encoding from right to left, respectively. The encoded value h is recorded after encoder processing. i This indicates that it is formed by concatenating encoded vectors from two directions, that is:

[0082]

[0083] in: This represents the encoding result from left to right, i.e., forward encoding. This indicates the encoding result from right to left, i.e., reverse encoding.

[0084] like Figure 2 The generator's state is fed into the planner, enabling it to support dynamic data partitioning. For a record, if the planner has already assigned it to a sentence, it is said to be selected; otherwise, it is said to be unselected. In addition to taking the generator's state as input, the planner also takes the records that have not yet been selected as input, making it more sensitive to these records.

[0085] The planner's output at each step is the probability that each record will be selected given the generated sentences and data partitions, where record x i Selected to enter the current record group g k The formula for calculating the conditional probability is shown in equation (2).

[0086] During the inference process, a record x i Should it be assigned to record group g? k The following conditions must be met: Record x i Selected to enter the current record group g k The conditional probability is greater than or equal to 0.5.

[0087]

[0088]

[0089] Where, h′ t This refers to the state of the generator when generating the t-th word. This invention uses vector dot product as the specific scoring function, Score. After calculating the context vector, the generator calculates the probability distribution of the target word on this word list, i.e.:

[0090] P(y t |x <t ,g k ) = Softmax(W(h' t ||c t ))

[0091] At each step of the planner, a potential reward is defined for those records that are not selected, which is the potential improvement space for the likelihood average of the word probabilities in the target sentence:

[0092] p(X-∪g <k |g <k s <k )=1-r(g k |g <k s <k )

[0093] The potential reward p makes it possible for records outside the record group to be selected again.

[0094] The generator's objective remains maximizing the likelihood probability of the target sequence, while the planner's objective is to maximize the cumulative reward, which is backpropagated through the policy gradient algorithm. The final training objective of the model is transformed into:

[0095]

[0096] in: Represents X-∪g <k v1 and v2 are two hyperparameters in the policy gradient algorithm.

[0097] It should be understood that, although Figure 1 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0098] In one embodiment, such as Figure 3 As shown, a data-to-text generation device based on dynamic partitioning is provided, including: a training sample acquisition module, a data-to-text generation model construction module based on dynamic partitioning, a data-to-text generation model training module based on dynamic partitioning, and a data-generated text determination module, wherein:

[0099] The training sample acquisition module is used to acquire structured data, which is a collection of records, including multiple records, and uses discrete records as training samples.

[0100] The module for building a data-to-text generation model based on dynamic partitioning is used to construct a data-to-text generation network based on dynamic partitioning. The data-to-text generation network includes an encoder and a decoder. The encoder is used to preprocess the input records and perform word insertion processing to obtain the embedded representation of the records, and maps the inserted representation to a context-sensitive vector space. The decoder includes a planner and a generator. The planner is used to predict the record group of the next sentence based on the generated sentences, obtaining the data partition. The generator is used to generate sentences word by word according to an autoregressive formula, referring to the data partition. When the generator generates a delimiter, the current sentence generation process terminates, and the planner begins to partition the data for the next sentence. When the generator generates a terminator, the sentence generation process ends and enters the post-processing stage, where the delimiter and terminator are deleted to obtain the generated text.

[0101] The training module for the data-to-text generation model based on dynamic partitioning is used to train the data-to-text generation network using an unsupervised training strategy based on training samples, so as to obtain a trained data-to-text generation model.

[0102] The data-generated text determination module is used to acquire the structured data to be tested and input the structured data to be tested into the data-to-text generation model to obtain the text generated from the data.

[0103] In one embodiment, the encoder in the data-to-text generation model building module based on dynamic partitioning includes a preprocessing module, a word embedding module, and an encoding module; the preprocessing module is used to sort the input discrete records according to alphabetical order; the word embedding module is used to perform embedding operations on the discrete records to obtain the embedded representation of the records; and the encoding module is used to map the embedded representation of the records to a context-sensitive vector space.

[0104] In one embodiment, the data-to-text generation model training module based on dynamic partitioning is further used to input training samples into the encoder to obtain an encoding vector; input the encoding vector into the decoder to obtain predicted text generated from the data; and train the data-to-text generation network using an unsupervised training strategy based on the training samples and the predicted text to obtain a trained data-to-text generation model.

[0105] In one embodiment, the encoder's encoding module includes a bidirectional LSTM network. The data-to-text generation model training module based on dynamically partitioned data is further configured to input training samples into a preprocessing module to obtain ordered records; input the ordered records into a word embedding module to obtain embedded representations of the records; and input the embedded representations into the bidirectional LSTM network to obtain encoded vectors.

[0106] In one embodiment, both the planner and the generator comprise a unidirectional LSTM network. The training module for the data-to-text generation model based on dynamic partitioning is also used to input the generator's state and unselected records into the planner, obtaining the probability of each record being selected given the generated sentences and data partitioning conditions. Records with a probability greater than 0.5 are used as the predicted record group for the next sentence. Unselected records are those not yet assigned to a sentence by the planner. The predicted record group is input into the generator to obtain the generated sentence. If it is the first sentence, a start symbol is generated at the beginning of the sentence. When the generator generates a separator, the generation process of the current sentence terminates, and the planner begins to determine the data partitioning of the next sentence. When the generator generates a terminator, the sentence generation process ends and enters the post-processing stage, where the separator and terminator are deleted to obtain the predicted text generated from the data. The process of the generator generating a sentence includes: generating the words corresponding to the records and generating separators at the end of the sentence. If it is the first sentence, a start symbol is generated at the beginning of the sentence. Based on the training samples and the predicted text, the data-to-text generation network is trained in a directional manner using an unsupervised training strategy and a policy gradient algorithm to obtain the trained data-to-text generation model.

[0107] In one embodiment, in the data-to-text generation model training module based on dynamic partitioning, the probability of each record being selected given the generated sentence and data partitioning is calculated using the following formula:

[0108]

[0109]

[0110] Where h' -1 h″ represents the latest state vector of the generator. k This indicates that the planner is working with sentence s. k The state vector during planning; This represents the set of records that have not yet been selected in the first k-1 sentences; This is a conditional indicator function that returns 1 if a given condition is true, and 0 otherwise; d h x represents the dimension of the state vector; i This represents the i-th record; n is the number of records; g k P(x) represents the k-th record group; i ∈g k |g <k ,s <k ) represents record x i Selected to enter the current record group g k The conditional probability.

[0111] In one embodiment, the data-to-text generation model training module based on dynamic partitioning is also used to input the embedded representation into a bidirectional LSTM network, encode it through a forward LSTM to obtain a forward encoded vector, encode it through a backward LSTM to obtain a backward encoded vector, and concatenate the forward encoded vector and the backward encoded vector to obtain an encoded vector.

[0112] In one embodiment, in the data-to-text generation model training module based on dynamic partitioning, the data-to-text generation network includes an encoder and a decoder that employ a neural network structure or a Transformer network structure.

[0113] Specific limitations regarding the data-to-text generation device based on dynamic partitioning can be found in the limitations of the data-to-text generation method based on dynamic partitioning described above, and will not be repeated here. Each module in the aforementioned data-to-text generation device based on dynamic partitioning can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0114] In one embodiment, an electronic device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, the electronic device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a data-to-text generation method based on dynamic partitioning. The display screen can be a liquid crystal display (LCD) or an e-ink display. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer casing, or an external keyboard, touchpad, or mouse.

[0115] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific electronic devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0116] In one embodiment, an electronic device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the method described in the above embodiments.

[0117] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0118] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.< / eos> < / eos> < / sep> < / bos>

Claims

1. A method for generating text from data based on dynamic partitioning, characterized in that, The method includes: Obtain structured data, which is a set of records including multiple records, and use the records as training samples; A data-to-text generation network based on dynamic partitioning is constructed, comprising an encoder and a decoder. The encoder preprocesses the input records and performs word insertion to obtain embedded representations of the records, and maps these embedded representations to a context-sensitive vector space. The decoder includes a planner and a generator. The planner predicts the record group of the next sentence based on the generated sentences, obtaining data partitioning. The generator generates sentences word by word according to the data partitioning using an autoregressive approach. When the generator generates a delimiter, the current sentence generation process terminates, and the planner begins data partitioning for the next sentence. When the generator generates a terminator, the sentence generation process ends, and the post-processing stage begins, where delimiters and terminators are deleted to obtain the generated text. The encoder's encoding module includes a bidirectional LSTM network. The bidirectional LSTM network encodes the embedded representations using a forward LSTM to obtain a forward encoded vector, and then encodes them using a backward LSTM to obtain a backward encoded vector. The forward and backward encoded vectors are concatenated to obtain the encoded vector h. i ; Based on the training samples, the data-to-text generation network is trained using an unsupervised training strategy to obtain a trained data-to-text generation model. Obtain the structured data to be tested, and input the structured data to be tested into the data-to-text generation model to obtain the text generated from the data; Both the planner and the generator include a unidirectional LSTM network. The encoded vector is input into the decoder to obtain the predicted text generated from the data, including: The generator's state and unselected records are input into the planner to obtain the probability of each record being selected given the generated sentences and data partitioning. Records with a probability greater than 0.5 are designated as the prediction record group for the next sentence. The unselected records are those not yet assigned to a sentence by the planner. The formula for calculating the probability of each record being selected given the generated sentences and data partitioning is as follows: in This represents the latest state vector of the generator; This indicates that the planner is working with the sentence. The state vector during planning; Indicates preceding A set of records in each sentence that have not yet been selected; It is a conditional indicator function that returns 1 if the given condition is true, and 0 otherwise. Represents the dimension of the state vector; Indicates the first 1 record; It is the number of records; Indicates the first One record group; Representing records Selected to enter the current recording group The conditional probability; The predicted record group is input into the generator to obtain the generated sentence. If it is the first sentence, a start symbol is generated at the beginning of the sentence. When the generator generates a separator, the generation process of the current sentence terminates, and the planner begins to determine the data partitioning of the next sentence. When the generator generates a terminator, the sentence generation process ends and enters the post-processing stage, where the separator and terminator are deleted to obtain the predicted text generated from the data. The process of the generator generating the sentence includes: generating the words corresponding to the record and generating a separator at the end of the sentence; if it is the first sentence, a start symbol is generated at the beginning of the sentence. Based on the training samples and the predicted text, the data-to-text generation network is trained in a directional manner using an unsupervised training strategy and a policy gradient algorithm to obtain a trained data-to-text generation model.

2. The method according to claim 1, characterized in that, The encoder includes a preprocessing module, a word embedding module, and an encoding module; The preprocessing module is used to sort the input discrete records according to alphabetical order; The word embedding module is used to perform embedding operations on the discrete records to obtain the embedded representation of the records; The encoding module is used to map the embedded representation of the record to a context-sensitive vector space.

3. The method according to claim 2, wherein the data-to-text generation network is trained using an unsupervised training strategy based on the training samples to obtain a trained data-to-text generation model, comprising: The training samples are input into the encoder to obtain the encoded vector; The encoded vector is input into the decoder to obtain the predicted text generated from the data; Based on the training samples and the predicted text, the data-to-text generation network is trained using an unsupervised training strategy to obtain a trained data-to-text generation model.

4. The method according to claim 3, characterized in that, The training samples are input into the encoder to obtain the encoded vector, including: The training samples are input into the preprocessing module to obtain ordered records; The ordered records are input into the word embedding module to obtain the embedded representation of the records; The embedded representation is input into the bidirectional LSTM network to obtain the encoded vector.

5. The method according to claim 1, characterized in that, The data-to-text generation network includes an encoder and a decoder, employing a neural network structure or a Transformer network structure.

6. A data-to-text generation apparatus based on dynamic partitioning, according to the data-to-text generation method based on dynamic partitioning as described in claim 1, characterized in that, The device includes: The training sample acquisition module is used to acquire structured data, which is a set of records including multiple records, and to use the records as training samples. A data-to-text generation model construction module based on dynamic partitioning is used to construct a data-to-text generation network based on dynamic partitioning. The data-to-text generation network includes an encoder and a decoder. The encoder is used to preprocess the input records and perform word insertion processing to obtain the embedded representation of the records, and maps the embedded representation to a context-sensitive vector space. The decoder includes a planner and a generator. The planner is used to predict the record group of the next sentence based on the generated sentences, obtaining data partitioning. The generator is used to generate sentences word by word according to the autoregressive formula, referring to the data partitioning. When the generator generates a delimiter, the current sentence generation process terminates, and the planner begins to partition the data for the next sentence. When the generator generates a terminator, the sentence generation process ends, and the post-processing stage begins, where the delimiter and terminator are deleted to obtain the generated text. The training module for the data-to-text generation model based on dynamic partitioning is used to train the data-to-text generation network using an unsupervised training strategy based on the training samples, so as to obtain a trained data-to-text generation model. The data-generated text determination module is used to acquire the structured data to be tested and input the structured data to be tested into the data-to-text generation model to obtain the text generated from the data.

7. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.