Text generation method and device, storage medium and processor
By combining encoders and decoders, utilizing graph neural networks and dynamic pruning mechanisms, we solve the problem of low accuracy when converting tabular data into text, and achieve higher text generation accuracy.
Patent Information
- Application Number
- CN202210320783.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-29
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-03-29
AI Technical Summary
Existing table-to-text methods treat input information as an unordered sequence at the decoding end, losing the structural information in the structured data, resulting in low accuracy in converting tabular data to text.
A combination of encoder and decoder is adopted. The encoder is constructed by encoding module and graph neural network, and the decoder is constructed by decoding module, feedforward neural network adapter, dynamic pruning mechanism and structure-aware spanning attention layer. The target vector matrix is obtained through encoding processing, and the target text is generated through decoding processing.
The accuracy of converting tabular data into text has been improved, the data structure information has been fully retained, and the accuracy of the generated text has been improved.
Smart Images

Figure CN114781331B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a text generation method and device, a storage medium, and a processor. Background Art
[0002] Table-to-text refers to generating corresponding text descriptions from structured tabular data, helping people quickly access key information within the structured data. It has been widely used in scenarios such as biographical generation, weather forecasts, and news and event broadcasts. Existing table-to-text methods in the industry treat the input information as an unordered sequence at the decoding end, losing the structural information in the structured data and resulting in low accuracy in converting tabular data into text.
[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0004] Embodiments of the present invention provide a text generation method and device, a storage medium, and a processor to at least solve the technical problem of low accuracy in converting tabular data into text, caused by the decoding end treating the input data information as an unordered sequence and losing the structural information of the data information.
[0005] According to one aspect of an embodiment of the present invention, a method for generating text is provided, including: obtaining a target table and converting the data in the target table into a data structure graph; encoding the data structure graph through an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network; decoding the target vector matrix through a decoder to obtain a target text corresponding to the data structure graph, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware spanning attention layer.
[0006] Optionally, the data structure diagram is encoded by an encoder to obtain the target vector matrix, including: inputting the data structure diagram into the encoder; processing the data structure diagram by the encoding module to obtain a first vector matrix; and aggregating information of adjacent nodes of each node in the data structure diagram by the graph neural network to update the first vector matrix to obtain the target vector matrix.
[0007] Optionally, the first vector matrix is updated by aggregating information of adjacent nodes of each node in the data structure graph using the following formula through the graph neural network:
[0008]
[0009] in, g v , and e v,u is an intermediate variable, is the vector representation of node v, is the vector representation of node u, is the attention weight of the graph neural network, W q and W k is a learnable parameter, and m represents the hidden dimension of the graph neural network.
[0010] Optionally, the target vector matrix is decoded by a decoder to obtain a target text corresponding to the data structure diagram, including: calculating an initial decoding state vector through the data structure diagram; obtaining a representation of the first structured data based on the target vector matrix, the initial decoding state vector and the structure-aware spanning attention layer; performing modeling processing through the decoding module and the feedforward neural network adapter based on the representation of the first structured data to obtain a second vector matrix; decoding the second vector matrix through the decoding module to obtain the first text corresponding to the data structure diagram; obtaining the currently decoded decoding state vector from the second vector matrix, and obtaining all the text corresponding to the data structure diagram based on the second vector matrix, the decoding state vector and the structure-aware spanning attention layer; generating the target text based on all the obtained text.
[0011] Optionally, obtaining a representation of the first structured data based on the target vector matrix, the initial decoding state vector and the structure-aware cross-attention layer includes: constructing the initial decoding state vector and the data structure graph into a first evolutionary graph based on the target vector matrix; and perceiving the first evolutionary graph through the structure-aware cross-attention layer to obtain a representation of the first structured data.
[0012] Optionally, based on the second vector matrix, the decoding state vector and the structure-aware cross-attention layer, all the texts corresponding to the data structure diagram are obtained, including: S1, based on the second vector matrix, the decoding state vector and the first evolutionary graph are constructed into a second evolutionary graph; S2, the target nodes in the second evolutionary graph are pruned by the dynamic pruning mechanism to obtain the processed second evolutionary graph; S3, the processed second evolutionary graph is perceived by the structure-aware cross-attention layer to obtain a representation of the second structured data; S4, based on the representation of the second structured data, modeling is performed by the decoding module and the feedforward neural network adapter to obtain a third vector matrix; S5, the third vector matrix is decoded by the decoding module to obtain the second text corresponding to the data structure diagram; repeat steps S1-S5 until all the texts corresponding to the data structure diagram are obtained.
[0013] Optionally, pruning the target node in the second evolutionary graph by the dynamic pruning mechanism to obtain the processed second evolutionary graph includes: representing the gate of each node in the second evolutionary graph as: Among them, W g , W e and W d is a learnable parameter, h v and h t is an intermediate variable; a node whose gv is less than a preset value is used as the target node; and the target node is pruned by the dynamic pruning mechanism to obtain the processed second evolutionary graph.
[0014] According to another aspect of an embodiment of the present invention, a text generation method is also provided, including: receiving a target table sent by a client; converting the data in the target table into a data structure graph in a cloud server, encoding the data structure graph through an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network, decoding the target vector matrix through a decoder to obtain a target text corresponding to the data structure graph, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware spanning attention layer; returning the target text to the client.
[0015] According to another aspect of an embodiment of the present invention, a text generation device is also provided, including: a conversion unit, used to obtain a target table and convert the data in the target table into a data structure diagram; a first processing unit, used to encode the data structure diagram through an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network; a second processing unit, used to decode the target vector matrix through a decoder to obtain a target text corresponding to the data structure diagram, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware spanning attention layer.
[0016] Optionally, the first processing unit includes: an input subunit, used to input the data structure graph into the encoder; a first processing subunit, used to process the data structure graph through the encoding subunit to obtain a first vector matrix; an update subunit, used to aggregate information of adjacent nodes of each node in the data structure graph through the graph neural network to update the first vector matrix to obtain the target vector matrix.
[0017] Optionally, the first vector matrix is updated by aggregating information of adjacent nodes of each node in the data structure graph using the following formula through the graph neural network:
[0018] in, g v , and e v,u is an intermediate variable, is the vector representation of node v, is the vector representation of node u, is the attention weight of the graph neural network, W q and W k is a learnable parameter, and m represents the hidden dimension of the graph neural network.
[0019] Optionally, the second processing unit includes: a calculation subunit, used to calculate the initial decoding state vector through the data structure diagram; a second processing subunit, used to obtain the representation of the first structured data based on the target vector matrix, the initial decoding state vector and the structure-aware spanning attention layer; a third processing subunit, used to perform modeling processing through the decoding subunit and the feedforward neural network adapter based on the representation of the first structured data to obtain a second vector matrix; a fourth processing subunit, used to decode the second vector matrix through the decoding subunit to obtain the first text corresponding to the data structure diagram; an acquisition subunit, used to obtain the currently decoded decoding state vector from the second vector matrix, and obtain all the text corresponding to the data structure diagram based on the second vector matrix, the decoding state vector and the structure-aware spanning attention layer; a generation subunit, used to generate the target text based on all the obtained text.
[0020] Optionally, the second processing sub-unit includes: a first construction module, used to construct the initial decoding state vector and the data structure graph into a first evolutionary graph based on the target vector matrix; a first perception module, used to perceive the first evolutionary graph through the cross-attention layer of the structure perception to obtain a representation of the first structured data.
[0021] Optionally, the acquisition subunit includes: a second construction module, used to construct the decoding state vector and the first evolutionary graph into a second evolutionary graph based on the second vector matrix; a first processing module, used to prune the target nodes in the second evolutionary graph through the dynamic pruning mechanism to obtain a processed second evolutionary graph; a second perception module, used to perceive the processed second evolutionary graph through the cross-attention layer of the structure perception to obtain a representation of the second structured data; a second processing module, used to perform modeling processing through the decoding module and the feedforward neural network adapter based on the representation of the second structured data to obtain a third vector matrix; a third processing module, used to decode the third vector matrix through the decoding module to obtain the second text corresponding to the data structure diagram; repeat the second construction module, the first processing module, the second perception module, the second processing module and the third processing module until all the text corresponding to the data structure diagram are obtained.
[0022] Optionally, the first processing module includes: a first processing submodule, configured to represent the gate of each node of the second evolutionary graph as: Among them, W g , W e and W d is a learnable parameter, h v and h tis an intermediate variable; a determination submodule for taking a node whose gv is less than a preset value as the target node; a second processing submodule for pruning the target node through the dynamic pruning mechanism to obtain the processed second evolutionary graph.
[0023] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a program. When the program is executed, the device where the storage medium is located is controlled to execute any one of the above-mentioned methods for generating text.
[0024] According to another aspect of an embodiment of the present invention, a processor is further provided, wherein the processor is configured to run a program, wherein the program executes any one of the above-mentioned methods for generating text when running.
[0025] In an embodiment of the present invention, an encoder constructed by an encoding module and a graph neural network and a decoder constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware cross-attention layer are adopted. The data structure graph is encoded by the encoder to obtain a target vector matrix, and the target vector matrix is decoded by the decoder to obtain a target text corresponding to the data structure graph, thereby achieving the purpose of converting tabular data into text, thereby realizing the technical effect of improving the accuracy of converting tabular data into text, and further solving the technical problem of low accuracy of converting tabular data into text caused by the decoding end treating the input data information as an unordered sequence and losing the structural information of the data information. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0027] Figure 1 is a hardware structure block diagram of a computer terminal according to an embodiment of the present invention;
[0028] Figure 2 is a flowchart of a method for generating text according to an embodiment of the present invention;
[0029] Figure 3 This is a data structure diagram provided according to the first embodiment of the present invention;
[0030] Figure 4 is a schematic diagram of an encoder and a decoder provided according to embodiment 1 of the present invention;
[0031] Figure 5 is a schematic diagram of a graph neural network provided according to embodiment 1 of the present invention;
[0032] Figure 6 1 is a schematic diagram of pruning according to the dynamic pruning mechanism provided in the first embodiment of the present invention;
[0033] Figure 7 is a flowchart of a method for generating text according to a second embodiment of the present invention;
[0034] Figure 8 is a schematic diagram of a text generation device provided according to a third embodiment of the present invention;
[0035] Figure 9 This is a structural block diagram of an optional computer terminal according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0037] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0038] Example 1
[0039] According to an embodiment of the present invention, an embodiment of a method for generating text is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0040] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1FIG1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a text generation method. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (illustrated as 102a, 102b, ..., 102n) processors (the processor may include but is not limited to a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0041] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0042] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the text generation method in the embodiment of the present invention. The processor executes the software programs and modules stored in the memory 104 to perform various functional applications and data processing, thereby implementing the above-mentioned text generation method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0043] The transmission device 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the computer terminal 10. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.
[0044] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0045] Under the above operating environment, this application provides Figure 2 The method for generating the text shown. Figure 2 4 is a flowchart of a method for generating text according to embodiment 1 of the present invention.
[0046] Step S201: Obtain a target table and convert the data in the target table into a data structure diagram.
[0047] Specifically, the tabular data to be converted into text is first converted into a data structure graph, which consists of nodes and edges. For example, Figure 3 The data structure diagram shown.
[0048] Step S202: Encode the data structure graph through an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network.
[0049] Specifically, the encoder is constructed by the encoding module and the graph neural network, such as Figure 4 As shown in FIG, a schematic diagram of an encoder and a decoder according to an embodiment of the present invention is provided. The target vector matrix is obtained by encoding the encoder data structure diagram. FIG A schematic diagram of a graph neural network (Relational GraphAttention Network) is shown in FIG. Figure 5 As shown, the graph neural network can process and analyze the structural information in the data structure graph so that this structural information can be added to the above-mentioned target vector matrix.
[0050] In step S203, the target vector matrix is decoded by a decoder to obtain the target text corresponding to the data structure diagram, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism, and a structure-aware cross-attention layer.
[0051] Specifically, the decoder is constructed by a decoding module, a feedforward neural network adapter (FNNAdapter), a dynamic graph pruning mechanism (DynamicGraph Pruning DGP) and a structure-aware cross-attention layer (Structure-Aware Cross-Attention, SACA), as shown in Figure 4 FIG2 is a schematic diagram of an encoder and a decoder according to Embodiment 1 of the present invention. The decoder decodes the target vector matrix to obtain the target text corresponding to the data structure diagram.
[0052] In summary, the encoder constructed by the encoding module and the graph neural network and the decoder constructed by the decoding module, the feedforward neural network adapter, the dynamic pruning mechanism and the structure-aware spanning attention layer encode the data structure graph through the encoder to obtain the target vector matrix, and decode the target vector matrix through the decoder to obtain the target text corresponding to the data structure graph, thereby improving the accuracy of converting tabular data into text.
[0053] Optionally, in the text generation method provided in Example 1 of the present invention, the data structure graph is encoded by an encoder to obtain a target vector matrix, including: inputting the data structure graph into the encoder; processing the data structure graph by an encoding module to obtain a first vector matrix; and updating the first vector matrix by aggregating information of adjacent nodes of each node in the data structure graph by a graph neural network to obtain a target vector matrix.
[0054] Specifically, the obtained data structure diagram is first input into the encoder. The encoding module encodes each node in the data structure diagram to obtain a first vector matrix. Then, the graph neural network aggregates the information of the adjacent nodes of each node in the data structure diagram to update the first vector matrix and obtain the target vector matrix. This operation ensures that the target vector matrix contains the structural information of the data structure diagram. During subsequent decoding, the structural information in the data structure diagram can be fully combined with the data in the data structure diagram, thereby improving the accuracy of text acquisition.
[0055] Optionally, in the text generation method provided in the first embodiment of the present invention, the graph neural network uses the following formula to aggregate information of adjacent nodes of each node in the data structure graph to update the first vector matrix: in, g v , and e v,u is an intermediate variable, is the vector representation of node v, is the vector representation of node u, is the attention weight of the graph neural network, W q and W k is a learnable parameter and m represents the hidden dimension of the graph neural network.
[0056] Specifically, the graph neural network uses the following formula to update the first vector matrix: The above formula can accurately obtain the structural information in the data structure diagram.
[0057] Optionally, in the text generation method provided in Example 1 of the present invention, the target vector matrix is decoded by a decoder to obtain a target text corresponding to the data structure diagram, including: calculating an initial decoding state vector through the data structure diagram; obtaining a representation of the first structured data based on the target vector matrix, the initial decoding state vector and the structure-aware cross-attention layer; based on the representation of the first structured data, modeling processing is performed through a decoding module and a feedforward neural network adapter to obtain a second vector matrix; decoding the second vector matrix through a decoding module to obtain the first text corresponding to the data structure diagram; obtaining the currently decoded decoding state vector from the second vector matrix, obtaining all the text corresponding to the data structure diagram based on the second vector matrix, the decoding state vector and the structure-aware cross-attention layer, and generating the target text based on all the obtained text.
[0058] Specifically, at the decoder end, the initial decoding state vector is first calculated based on the structural data graph, and then a first evolutionary graph is constructed based on the target vector matrix and the initial decoding state vector, and the first evolutionary graph is perceived through the structure-aware cross-attention layer (SACA) to obtain a representation of the first structured data. In the prior art, the structural information of the data structure graph is ignored by the general cross-attention layer mechanism during decoding. This structural information plays a vital role in the representation of the node. Afterwards, based on the above-mentioned representation of the first structured data, modeling processing is performed through the decoding module and the feedforward neural network adapter to obtain a second vector matrix, where the second vector matrix contains the initial decoding state vector. The formula for the feedforward neural network adapter (FNN Adapter) to model the first evolutionary graph is: in, and is an intermediate variable, and is a learnable parameter. The decoding module decodes the second vector matrix to obtain the first text corresponding to the data structure graph. The above operation fully considers the structural information of the structured data graph, thereby improving the accuracy of converting tabular data into text.
[0059] Optionally, in the text generation method provided in Example 1 of the present invention, obtaining a representation of the first structured data based on the target vector matrix, the initial decoding state vector and the structure-aware cross-attention layer includes: constructing the initial decoding state vector and the data structure graph into a first evolution graph based on the target vector matrix; and perceiving the first evolution graph through the structure-aware cross-attention layer to obtain a representation of the first structured data.
[0060] Specifically, a first evolutionary graph is constructed based on the target vector matrix and the initial decoding state vector. This first evolutionary graph is perceived through a structure-aware spanning attention layer to obtain a representation of the first structured data. By accurately obtaining a representation of the structured data of the first evolutionary graph through the structure-aware spanning attention layer, the structural information of the first evolutionary graph can be fully considered during the decoding process, resulting in more accurate decoding.
[0061] Optionally, in the text generation method provided in Example 1 of the present invention, all the texts corresponding to the data structure diagram are obtained based on the second vector matrix, the decoding state vector and the structure-aware cross-attention layer, including: S1, based on the second vector matrix, the decoding state vector and the first evolutionary graph are constructed into a second evolutionary graph; S2, the target nodes in the second evolutionary graph are pruned by the dynamic pruning mechanism to obtain the processed second evolutionary graph; S3, the processed second evolutionary graph is perceived by the structure-aware cross-attention layer to obtain a representation of the second structured data; S4, based on the representation of the second structured data, modeling is performed by the decoding module and the feedforward neural network adapter to obtain a third vector matrix; S5, the third vector matrix is decoded by the decoding module to obtain the second text corresponding to the data structure diagram; steps S1-S5 are repeated until all the texts corresponding to the data structure diagram are obtained.
[0062] Specifically, as decoding proceeds, many nodes in the subsequent evolutionary graph may be irrelevant to subsequent generation. These irrelevant nodes may cause overfitting and even interfere with subsequent generation. Intuitively speaking, the decoder should dynamically prune the evolutionary graph in different decoding steps. To this end, the redundant nodes in the evolutionary graph (i.e., the target nodes mentioned above) are dynamically deleted during the decoding process through a dynamic graph pruning mechanism. For example, Figure 6As shown, a pruning schematic diagram of the dynamic pruning mechanism provided according to the first embodiment of the present invention. The dynamic graph pruning mechanism prunes the target node in the second evolutionary graph (i.e., the above-mentioned step S2). After obtaining the second text, the latest decoding state vector is obtained through the third vector matrix, and based on the third vector matrix and the latest decoding state vector, the above-mentioned steps S1 to S5 are repeated until all the texts corresponding to the data structure diagram are obtained. The above method processes redundant nodes through the dynamic graph pruning mechanism, which not only reduces the subsequent modeling and calculation work, but also improves the accuracy of decoding.
[0063] Optionally, in the text generation method provided in the first embodiment of the present invention, pruning the target node in the second evolutionary graph by a dynamic pruning mechanism to obtain the processed second evolutionary graph includes: representing the gate of each node in the second evolutionary graph as: Among them, W g , W e and W d is a learnable parameter, h v and h t is an intermediate variable; the node whose gv is less than the preset value is taken as the target node; the target node is pruned through the dynamic pruning mechanism to obtain the processed second evolutionary graph.
[0064] Specifically, Figure 2 The target node in the pruning process includes: expressing the gate of each node on the second evolutionary graph as: If g v If the correlation between node v and all its neighbors is close to 0, then the correlation between node v and all its neighbors is very weak. This means that node v is a redundant node (the target node mentioned above), and the dynamic pruning mechanism is then used to prune node v. The above formula accurately captures the correlation between each node and all its neighbors, improving the accuracy of the dynamic pruning mechanism.
[0065] In summary, in the text generation method provided in Example 1 of the present invention, an encoder constructed by an encoding module and a graph neural network and a decoder constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware cross-attention layer are adopted. The data structure graph is encoded by the encoder to obtain a target vector matrix, and the target vector matrix is decoded by the decoder to obtain the target text corresponding to the data structure graph, thereby achieving the purpose of converting tabular data into text, thereby realizing the technical effect of improving the accuracy of converting tabular data into text, and further solving the technical problem of low accuracy of converting tabular data into text caused by the decoding end treating the input data information as an unordered sequence and losing the structural information of the data information.
[0066] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0067] Through the description of the above implementation methods, those skilled in the art can clearly understand that the generation of text according to the above embodiments can be achieved by means of software plus the necessary general hardware platform, and of course it can also be achieved by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0068] Example 2
[0069] Under the above operating environment, this application provides Figure 7 The method for generating the text shown. Figure 7 4 is a flowchart of a method for generating text according to embodiment 2 of the present invention.
[0070] Step S701: receiving a target table sent by a client.
[0071] Specifically, the target table is sent to the cloud server, and the cloud server converts the data in the target table into text.
[0072] Step S702: In the cloud server, the data in the target table is converted into a data structure graph, and the data structure graph is encoded by an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network, and the decoder decodes the target vector matrix to obtain a target text corresponding to the data structure graph, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism, and a structure-aware cross-attention layer.
[0073] Specifically, in the cloud server, the data in the target table is converted into a data structure diagram, and then the encoder encodes each node of the data structure diagram to obtain a target vector matrix; then the target vector matrix is decoded by the decoder to obtain the target text corresponding to the data structure diagram.
[0074] Step S703: Return the target text to the client.
[0075] Performing table data conversion through cloud servers improves the efficiency of table data conversion and reduces the storage pressure of local terminals.
[0076] In the cloud server, the specific method of converting the table data into text is the same as that in Example 1 and will not be repeated here.
[0077] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0078] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0079] Example 3
[0080] According to an embodiment of the present invention, a device for generating the above text is also provided, such as Figure 8 As shown, the device includes: a conversion unit 801, a first processing unit 802 and a second processing unit 803.
[0081] The conversion unit 801 is used to obtain a target table and convert the data in the target table into a data structure diagram;
[0082] A first processing unit 802 is configured to encode the data structure graph through an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network;
[0083] The second processing unit 803 is used to decode the target vector matrix through a decoder to obtain the target text corresponding to the data structure diagram, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware cross-attention layer.
[0084] The text generation device provided in the third embodiment of the present invention is used to obtain a target table and convert the data in the target table into a data structure diagram through a conversion unit 801; a first processing unit 802 is used to encode the data structure diagram through an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network; a second processing unit 803 is used to decode the target vector matrix through a decoder to obtain a target text corresponding to the data structure diagram, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware cross-attention layer. In the related art, the decoding end treats the input data information as an unordered sequence, loses the structural information of the data information, and results in a low accuracy rate in converting tabular data into text. The encoder constructed by the encoding module and the graph neural network and the decoder constructed by the decoding module, the feedforward neural network adapter, the dynamic pruning mechanism and the structure-aware cross-attention layer improve the accuracy of converting tabular data into text.
[0085] Optionally, in the text generation device provided in Example 3 of the present invention, the first processing unit 802 includes: an input subunit, used to input the data structure diagram into the encoder; a first processing subunit, used to process the data structure diagram through the encoding subunit to obtain a first vector matrix; an update subunit, used to update the first vector matrix by aggregating information of adjacent nodes of each node in the data structure diagram through a graph neural network to obtain a target vector matrix.
[0086] Optionally, in the text generation device provided in the third embodiment of the present invention, the first vector matrix is updated by aggregating information of adjacent nodes of each node in the data structure graph using the following formula through a graph neural network: in, g v , and e v,u is an intermediate variable, is the vector representation of node v, is the vector representation of node u, is the attention weight of the graph neural network, W q and W k is a learnable parameter and m represents the hidden dimension of the graph neural network.
[0087] Optionally, in the text generation device provided in Example 3 of the present invention, the second processing unit 803 includes: a calculation subunit, which is used to calculate the initial decoding state vector through the data structure diagram; a second processing subunit, which is used to obtain the representation of the first structured data based on the target vector matrix, the initial decoding state vector and the structure-aware cross-attention layer; a third processing subunit, which is used to perform modeling processing through the decoding subunit and the feedforward neural network adapter based on the representation of the first structured data to obtain the second vector matrix; a fourth processing subunit, which is used to decode the second vector matrix through the decoding subunit to obtain the first text corresponding to the data structure diagram; an acquisition subunit, which is used to obtain the currently decoded decoding state vector from the second vector matrix, and obtain all the text corresponding to the data structure diagram based on the second vector matrix, the decoding state vector and the structure-aware cross-attention layer; and a generation subunit, which is used to generate the target text based on all the obtained text.
[0088] Optionally, in the text generation device provided in Example 3 of the present invention, the second processing sub-unit includes: a first construction module, used to construct the initial decoding state vector and the data structure graph into a first evolution graph based on the target vector matrix; a first perception module, used to perceive the first evolution graph through the cross-attention layer of structural perception to obtain a representation of the first structured data.
[0089] Optionally, in the text generation device provided in Example 3 of the present invention, the acquisition sub-unit includes: a second construction module, which is used to construct the decoding state vector and the first evolutionary graph into a second evolutionary graph based on the second vector matrix; a first processing module, which is used to prune the target nodes in the second evolutionary graph through a dynamic pruning mechanism to obtain a processed second evolutionary graph; a second perception module, which is used to perceive the processed second evolutionary graph through a cross-attention layer of structure perception to obtain a representation of the second structured data; a second processing module, which is used to perform modeling processing through a decoding module and a feedforward neural network adapter based on the representation of the second structured data to obtain a third vector matrix; a third processing module, which is used to decode the third vector matrix through the decoding module to obtain the second text corresponding to the data structure diagram; repeat the second construction module, the first processing module, the second perception module, the second processing module and the third processing module until all the text corresponding to the data structure diagram is obtained.
[0090] Optionally, in the text generation device provided in the third embodiment of the present invention, the first processing module includes: a first processing submodule, configured to represent the gate of each node of the second evolutionary graph as: Among them, W g , W e and W d is a learnable parameter, h v and h tis an intermediate variable; a determination submodule for taking a node whose gv is less than a preset value as a target node; a second processing submodule for pruning the target node through a dynamic pruning mechanism to obtain a processed second evolutionary graph.
[0091] It should be noted that the conversion unit 801, the first processing unit 802, and the second processing unit 803 correspond to steps S201 to S203 in Example 1. The examples and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.
[0092] Example 4
[0093] The embodiment of the present invention can provide a computer terminal, which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal can also be replaced by a terminal device such as a mobile terminal.
[0094] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of a computer network.
[0095] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the text generation method: obtaining a target table and converting the data in the target table into a data structure diagram; encoding the data structure diagram through an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network; decoding the target vector matrix through a decoder to obtain a target text corresponding to the data structure diagram, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware cross-attention layer.
[0096] The above-mentioned computer terminal can also execute the program code of the following steps in the text generation method: inputting the data structure diagram into the encoder; processing the data structure diagram through the encoding module to obtain a first vector matrix; aggregating the information of the adjacent nodes of each node in the data structure diagram through the graph neural network to update the first vector matrix and obtain the target vector matrix.
[0097] The computer terminal may further execute the program code of the following steps in the text generation method: updating the first vector matrix by aggregating information of adjacent nodes of each node in the data structure graph using the following formula through a graph neural network: in, g v , and e v,u is an intermediate variable, is the vector representation of node v, is the vector representation of node u, is the attention weight of the graph neural network, W q and W k is a learnable parameter and m represents the hidden dimension of the graph neural network.
[0098] The above-mentioned computer terminal can also execute the program code of the following steps in the text generation method: calculate the initial decoding state vector through the data structure diagram; obtain the representation of the first structured data based on the target vector matrix, the initial decoding state vector and the cross-attention layer of structure perception; based on the representation of the first structured data, perform modeling processing through the decoding module and the feedforward neural network adapter to obtain the second vector matrix; decode the second vector matrix through the decoding module to obtain the first text corresponding to the data structure diagram; obtain the current decoding state vector from the second vector matrix, and obtain all the text corresponding to the data structure diagram based on the second vector matrix, the decoding state vector and the cross-attention layer of structure perception; generate the target text based on all the obtained text.
[0099] The above-mentioned computer terminal can also execute the program code of the following steps in the text generation method: based on the target vector matrix, the initial decoding state vector and the data structure diagram are constructed into a first evolutionary graph; the first evolutionary graph is perceived through the cross-attention layer of structure perception to obtain a representation of the first structured data.
[0100] The above-mentioned computer terminal can also execute the program code of the following steps in the text generation method: S1, based on the second vector matrix, the decoding state vector and the first evolutionary graph are constructed into a second evolutionary graph; S2, the target nodes in the second evolutionary graph are pruned through the dynamic pruning mechanism to obtain the processed second evolutionary graph; S3, the processed second evolutionary graph is perceived through the structure-aware cross-attention layer to obtain the representation of the second structured data; S4, based on the representation of the second structured data, modeling is performed through the decoding module and the feedforward neural network adapter to obtain a third vector matrix; S5, the third vector matrix is decoded through the decoding module to obtain the second text corresponding to the data structure diagram; steps S1-S5 are repeated until all the texts corresponding to the data structure diagram are obtained.
[0101] The computer terminal can also execute the program code of the following steps in the text generation method: representing the gate of each node of the second evolutionary graph as: Among them, W g , W e and W d is a learnable parameter, h v and ht is an intermediate variable; the node whose gv is less than the preset value is taken as the target node; the target node is pruned through the dynamic pruning mechanism to obtain the processed second evolutionary graph.
[0102] Optionally, Figure 9 1 is a block diagram of a computer terminal according to an embodiment of the present invention. Figure 9 As shown, the computer terminal 10 may include: one or more (only one is shown in the figure) processors and a memory.
[0103] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the text generation method and device in the embodiments of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the above-mentioned text generation method. The memory may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include a memory remotely located relative to the processor, and these remote memories may be connected to the terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0104] The processor can call the information and applications stored in the memory through the transmission device to perform the following steps: obtain the target table and convert the data in the target table into a data structure diagram; encode the data structure diagram through the encoder to obtain the target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network; decode the target vector matrix through the decoder to obtain the target text corresponding to the data structure diagram, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware cross-attention layer.
[0105] Optionally, the above-mentioned processor can also execute the program code of the following steps: inputting the data structure diagram into the encoder; processing the data structure diagram through the encoding module to obtain a first vector matrix; aggregating the information of the adjacent nodes of each node in the data structure diagram through the graph neural network to update the first vector matrix to obtain the target vector matrix.
[0106] Optionally, the processor may further execute program code of the following steps: aggregating information of adjacent nodes of each node in the data structure graph by using the following formula through a graph neural network to update the first vector matrix: in, g v , and e v,uis an intermediate variable, is the vector representation of node v, is the vector representation of node u, is the attention weight of the graph neural network, W q and W k is a learnable parameter and m represents the hidden dimension of the graph neural network.
[0107] Optionally, the processor may also execute the following program code: calculating an initial decoding state vector through a data structure diagram; obtaining a representation of the first structured data based on the target vector matrix, the initial decoding state vector, and the structure-aware cross-attention layer; performing modeling processing through a decoding module and a feedforward neural network adapter based on the representation of the first structured data to obtain a second vector matrix; decoding the second vector matrix through a decoding module to obtain the first text corresponding to the data structure diagram; obtaining the currently decoded decoding state vector from the second vector matrix, obtaining all text corresponding to the data structure diagram based on the second vector matrix, the decoding state vector, and the structure-aware cross-attention layer, and generating a target text based on all the obtained text.
[0108] Optionally, the processor may also execute the program code of the following steps: constructing the initial decoding state vector and the data structure graph into a first evolution graph based on the target vector matrix; perceiving the first evolution graph through the structure-aware cross-attention layer to obtain a representation of the first structured data.
[0109] Optionally, the processor may also execute the following program code: S1, constructing the decoding state vector and the first evolutionary graph into a second evolutionary graph based on the second vector matrix; S2, pruning the target nodes in the second evolutionary graph through a dynamic pruning mechanism to obtain a processed second evolutionary graph; S3, perceiving the processed second evolutionary graph through a structure-aware cross-attention layer to obtain a representation of the second structured data; S4, based on the representation of the second structured data, performing modeling processing through a decoding module and a feedforward neural network adapter to obtain a third vector matrix; S5, decoding the third vector matrix through a decoding module to obtain a second text corresponding to the data structure diagram; repeating steps S1-S5 until all text corresponding to the data structure diagram are obtained.
[0110] Optionally, the processor may further execute a program code of the following steps: representing the gate of each node of the second evolutionary graph as: Among them, W g , W e and W d is a learnable parameter, h v and h tis an intermediate variable; the node whose gv is less than the preset value is taken as the target node; the target node is pruned through the dynamic pruning mechanism to obtain the processed second evolutionary graph.
[0111] According to an embodiment of the present invention, a target table is obtained and the data in the target table is converted into a data structure diagram; the data structure diagram is encoded by an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network; the target vector matrix is decoded by a decoder to obtain a target text corresponding to the data structure diagram, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism, and a structure-aware cross-attention layer. In related technologies, the decoding end treats the input data information as an unordered sequence, loses the structural information of the data information, and results in a low accuracy rate in converting tabular data into text. The encoder constructed by the encoding module and the graph neural network and the decoder constructed by the decoding module, the feedforward neural network adapter, the dynamic pruning mechanism, and the structure-aware cross-attention layer improve the accuracy of converting tabular data into text.
[0112] It can be understood by those skilled in the art that Figure 9 The structure shown is for illustration only, and the computer terminal may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 9 It does not limit the structure of the above electronic device. For example, the computer terminal 10 may also include Figure 9 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 9 Different configurations shown.
[0113] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0114] The embodiment of the present invention further provides a computer-readable storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the text generation method provided in the first embodiment.
[0115] Optionally, in this embodiment, the above-mentioned storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0116] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: obtaining a target table and converting the data in the target table into a data structure graph; encoding the data structure graph through an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network; decoding the target vector matrix through a decoder to obtain a target text corresponding to the data structure graph, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism, and a structure-aware spanning attention layer.
[0117] Optionally, the above-mentioned storage medium is also configured to store program code for executing the following steps: inputting the data structure diagram into the encoder; processing the data structure diagram through the encoding module to obtain a first vector matrix; updating the first vector matrix by aggregating information of adjacent nodes of each node in the data structure diagram through a graph neural network to obtain a target vector matrix.
[0118] Optionally, the storage medium is further configured to store program code for executing the following steps: updating the first vector matrix by aggregating information of adjacent nodes of each node in the data structure graph using the following formula through a graph neural network: in, g v , and e v,u is an intermediate variable, is the vector representation of node v, is the vector representation of node u, is the attention weight of the graph neural network, W q and W k is a learnable parameter and m represents the hidden dimension of the graph neural network.
[0119] Optionally, the storage medium is also configured to store program code for executing the following steps: calculating an initial decoding state vector through a data structure diagram; obtaining a representation of the first structured data based on the target vector matrix, the initial decoding state vector and the structure-aware cross-attention layer; performing modeling processing through a decoding module and a feedforward neural network adapter based on the representation of the first structured data to obtain a second vector matrix; decoding the second vector matrix through a decoding module to obtain the first text corresponding to the data structure diagram; obtaining the currently decoded decoding state vector from the second vector matrix, and obtaining all text corresponding to the data structure diagram based on the second vector matrix, the decoding state vector and the structure-aware cross-attention layer; generating a target text based on all the obtained text.
[0120] Optionally, the storage medium is also configured to store program code for executing the following steps: constructing the initial decoding state vector and the data structure graph into a first evolution graph based on the target vector matrix; perceiving the first evolution graph through the structure-aware cross-attention layer to obtain a representation of the first structured data.
[0121] Optionally, the storage medium is further configured to store program codes for executing the following steps: S1, constructing the decoding state vector and the first evolutionary graph into a second evolutionary graph based on the second vector matrix; S2, pruning the target nodes in the second evolutionary graph through a dynamic pruning mechanism to obtain a processed second evolutionary graph; S3, perceiving the processed second evolutionary graph through a structure-aware cross-attention layer to obtain a representation of the second structured data; S4, based on the representation of the second structured data, modeling is performed through a decoding module and a feedforward neural network adapter to obtain a third vector matrix; S5, decoding the third vector matrix through a decoding module to obtain a second text corresponding to the data structure diagram; repeating steps S1-S5 until all texts corresponding to the data structure diagram are obtained.
[0122] Optionally, the storage medium is further configured to store program code for executing the following steps: representing the gate of each node of the second evolutionary graph as: Among them, W g , W e and W d is a learnable parameter, h v and h t is an intermediate variable; the node whose gv is less than the preset value is taken as the target node; the target node is pruned through the dynamic pruning mechanism to obtain the processed second evolutionary graph.
[0123] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0124] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0125] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0126] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0127] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0128] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.
[0129] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A method for generating text, characterized in that: include: Acquire a target table, and convert the data in the target table into a data structure diagram; The data structure graph is encoded by an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network; the data structure graph is input into the encoder; the data structure graph is processed by the encoding module to obtain a first vector matrix; and the first vector matrix is updated by aggregating information of adjacent nodes of each node in the data structure graph by the graph neural network to obtain the target vector matrix; The target vector matrix is decoded by a decoder to obtain a target text corresponding to the data structure diagram, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware spanning attention layer; an initial decoding state vector is calculated through the data structure diagram; a representation of the first structured data is obtained based on the target vector matrix, the initial decoding state vector and the structure-aware spanning attention layer; a second vector matrix is obtained based on the representation of the first structured data by the decoding module and the feedforward neural network adapter; the second vector matrix is decoded by the decoding module to obtain the first text corresponding to the data structure diagram; a currently decoded decoding state vector is obtained from the second vector matrix, and all texts corresponding to the data structure diagram are obtained based on the second vector matrix, the decoding state vector and the structure-aware spanning attention layer; the target text is generated based on all the obtained texts.
2. The method according to claim 1, characterized in that Obtaining a representation of structured data based on the target vector matrix, the initial decoding state vector, and the structure-aware spanning attention layer includes: constructing the initial decoding state vector and the data structure graph into a first evolution graph according to the target vector matrix; The first evolutionary graph is perceived through the structure-aware spanning attention layer to obtain a representation of the first structured data.
3. The method according to claim 2, characterized in that According to the second vector matrix, the decoding state vector, and the structure-aware spanning attention layer, all the texts corresponding to the data structure diagram are obtained, including: S1, constructing a second evolutionary graph from the decoding state vector and the first evolutionary graph according to the second vector matrix; S2, pruning the target node in the second evolutionary graph by the dynamic pruning mechanism to obtain a processed second evolutionary graph; S3, perceiving the processed second evolution graph through the structure-perceived spanning attention layer to obtain a representation of second structured data; S4, performing modeling processing by the decoding module and the feedforward neural network adapter based on the representation of the second structured data to obtain a third vector matrix; S5, decoding the third vector matrix by the decoding module to obtain a second character corresponding to the data structure diagram; Repeat steps S1 to S5 until all the text corresponding to the data structure diagram is obtained.
4. The method according to claim 3, characterized in that Pruning the target node in the second evolutionary graph by the dynamic pruning mechanism to obtain the processed second evolutionary graph includes: The gate of each node of the second evolutionary graph is represented as: ,in, , and are learnable parameters, and is an intermediate variable; Will g v The node with a value smaller than the preset value is used as the target node; The target node is pruned by the dynamic pruning mechanism to obtain the processed second evolutionary graph.
5. A method for generating text, characterized in that: include: Receive the target table sent by the client; In a cloud server, the data in the target table is converted into a data structure graph, and the data structure graph is encoded by an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network, and the target vector matrix is decoded by a decoder to obtain a target text corresponding to the data structure graph, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism, and a structure-aware spanning attention layer; Returning the target text to the client; The step of encoding the data structure graph by an encoder to obtain a target vector matrix includes: inputting the data structure graph into the encoder; processing the data structure graph by the encoding module to obtain a first vector matrix; and aggregating information of adjacent nodes of each node in the data structure graph by the graph neural network to update the first vector matrix to obtain the target vector matrix. Among them, decoding the target vector matrix through the decoder to obtain the target text corresponding to the data structure diagram includes: calculating the initial decoding state vector through the data structure diagram; obtaining the representation of the first structured data based on the target vector matrix, the initial decoding state vector and the structure-aware spanning attention layer; based on the representation of the first structured data, modeling processing is performed through the decoding module and the feedforward neural network adapter to obtain a second vector matrix; decoding the second vector matrix through the decoding module to obtain the first text corresponding to the data structure diagram; obtaining the currently decoded decoding state vector from the second vector matrix, and obtaining all the texts corresponding to the data structure diagram based on the second vector matrix, the decoding state vector and the structure-aware spanning attention layer; generating the target text based on all the obtained texts.
6. A text generation device, characterized in that: include: A conversion unit, configured to obtain a target table and convert the data in the target table into a data structure diagram; a first processing unit, configured to encode the data structure graph through an encoder to obtain a target vector matrix, wherein the encoder is constructed by an encoding module and a graph neural network; input the data structure graph into the encoder; process the data structure graph through the encoding module to obtain a first vector matrix; and update the first vector matrix by aggregating information of adjacent nodes of each node in the data structure graph through the graph neural network to obtain the target vector matrix; The second processing unit is used to decode the target vector matrix through a decoder to obtain the target text corresponding to the data structure diagram, wherein the decoder is constructed by a decoding module, a feedforward neural network adapter, a dynamic pruning mechanism and a structure-aware spanning attention layer; an initial decoding state vector is calculated through the data structure diagram; a representation of the first structured data is obtained based on the target vector matrix, the initial decoding state vector and the structure-aware spanning attention layer; based on the representation of the first structured data, a modeling process is performed through the decoding module and the feedforward neural network adapter to obtain a second vector matrix; the second vector matrix is decoded through the decoding module to obtain the first text corresponding to the data structure diagram; a currently decoded decoding state vector is obtained from the second vector matrix, and all texts corresponding to the data structure diagram are obtained based on the second vector matrix, the decoding state vector and the structure-aware spanning attention layer; the target text is generated based on all the obtained texts.
7. A computer-readable storage medium, characterized in that The storage medium includes a stored program, wherein when the program is run, the device where the storage medium is located is controlled to execute the text generation method according to any one of claims 1 to 5.
8. A processor, characterized in that: The processor is configured to run a program, wherein the program, when running, executes the text generation method according to any one of claims 1 to 5.