Entity description text generation method, device and equipment

By jointly modeling the relationship and decoding state of entity attribute data during the decoding stage, using the structure-aware attention mechanism, the problem of low text accuracy caused by ignoring input graph structure information in the prior art is solved, and more efficient entity description text generation is achieved.

CN114579697BActive Publication Date: 2025-03-14ALIBABA (CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210130414.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-11
Publication Date
2025-03-14
Estimated Expiration
2042-02-11

AI Technical Summary

Technical Problem

When generating entity description text, the prior art ignores the structural information of the input diagram, resulting in a low accuracy of the generated text.

Method used

By jointly modeling the relationship and decoding state of entity attribute data during the decoding stage, using the structure-aware attention mechanism, retaining the structural information of the input graph, thereby generating more accurate entity description text.

Benefits of technology

It effectively improves the accuracy of entity description text, avoids the problem of treating all attribute data as disordered sequences, and realizes the attention mechanism of structure perception.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114579697B_ABST
    Figure CN114579697B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for generating entity description text. The method retains the original structural information of entity attribute data by jointly modeling the relationship and decoding status of entity attribute data in the decoding stage, avoids treating all attribute data as an unordered sequence in the decoding stage, and realizes a structure-aware attention mechanism, thereby effectively improving the accuracy of entity description text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of natural language processing, and in particular to a method and device for generating entity description text. Background Art

[0002] The table-to-text task aims to generate corresponding text descriptions from given structured table data, which can help people quickly obtain key information in structured data. It is widely used in scenarios such as biography generation, weather reports, and news and event reports.

[0003] A typical table-to-text method is based on the encoder-decoder framework, and uses the attention mechanism to model the context representation during decoding. Figure 5 As shown in the figure, in the existing encoder-decoder framework, the context representation of the input graph is obtained by a general attention mechanism (cross-attention mechanism). During decoding, the structural information of the input graph is ignored by the general cross-attention mechanism, and the input information is regarded as an unordered sequence.

[0004] However, in the process of implementing the present invention, the inventors found that the above technical solution has at least the following problems: the structural information of the input graph plays a vital role in the representation of the nodes, and it can also provide clues about which nodes are more relevant to the generated text context. The existing attention mechanism regards all input nodes as an unordered sequence in the decoding stage, which loses the original structural information of the data and affects the accuracy of text generation based on the table. Summary of the invention

[0005] The present application provides a method for generating entity description text to solve the problem of low accuracy in generating entity description text based on entity attribute data in the prior art. The present application also provides an entity description text generating device and an electronic device.

[0006] The present application provides a method for generating entity description text, comprising:

[0007] Acquire multiple attribute data of a target entity and the relationship between the multiple attribute data;

[0008] When generating a description text of the target entity according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the decoding state data at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment;

[0009] Generate a description text of the target entity according to the context vector representation related to the attribute relationship.

[0010] Optionally, also include:

[0011] The encoder models the relationship between the plurality of attribute data through a first structured adapter.

[0012] Optionally, the encoder obtains the vector representation of the plurality of attribute data through an encoding layer, and the encoder includes at least one encoding layer;

[0013] The encoder determines the vector representations of the plurality of attribute data related to the attribute relationship according to the relationship between the plurality of attribute data and the vector representations of the plurality of attribute data through a first structured adapter corresponding to the encoding layer.

[0014] Optionally, the decoding state data includes generated text, and the decoder jointly models the relationship between the plurality of attribute data and the decoding state data at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, including:

[0015] The decoder obtains the vector representation of the generated text through a decoding layer, and the decoder includes at least one decoding layer;

[0016] The decoder forms a relationship between the generated text and the undecoded attribute data through a dynamic graph interaction module;

[0017] The decoder obtains the context vector representation related to the attribute relationship based on the vector representation of the multiple attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through at least one attention module.

[0018] Optionally, the decoder obtains the context vector representation related to the attribute relationship according to the vector representations of the multiple attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through at least one attention module, including:

[0019] The decoder updates the vector representation of the generated text according to the vector representation of the multiple attribute data, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through at least one attention module, and uses the updated vector representation of the generated text as the context vector representation related to the attribute relationship.

[0020] Optionally, the decoder jointly models the relationship between the plurality of attribute data and the decoding state data at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, further comprising:

[0021] The decoder updates the vector representation of the generated text through a second structured adapter corresponding to the decoding layer.

[0022] The present application also provides a device for generating entity description text, comprising:

[0023] An attribute data and relationship acquisition unit, used to acquire multiple attribute data of a target entity and the relationship between the multiple attribute data;

[0024] A joint attribute relationship decoding unit, configured to jointly model the relationship between the plurality of attribute data and the decoding state data at each decoding moment when generating a description text of the target entity according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, so as to obtain a context vector representation related to the attribute relationship at the decoding moment;

[0025] A text determination unit is used to generate a description text of the target entity according to the context vector representation related to the attribute relationship.

[0026] The present application also provides an electronic device, including:

[0027] Processor and memory;

[0028] The memory is used to store a program for implementing the above-mentioned entity description text generation method. The device is powered on and runs the program of the method through the processor.

[0029] The present application also provides a method for generating entity description text, comprising:

[0030] Send a request to the server to obtain the description text of the target entity;

[0031] Receive the description text of the target entity sent back by the server;

[0032] The server generates the description text in the following manner:

[0033] Acquire multiple attribute data of a target entity and the relationship between the multiple attribute data;

[0034] When generating a description text of the target entity according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the decoding state data at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment;

[0035] Generate a description text of the target entity according to the context vector representation related to the attribute relationship.

[0036] The present application also provides a method for generating entity description text, comprising:

[0037] Receive a request for obtaining a description text of a target entity sent by a client;

[0038] Acquire multiple attribute data of a target entity and the relationship between the multiple attribute data;

[0039] When generating a description text of the target entity according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the decoding state data at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment;

[0040] Generate a description text of the target entity according to the context vector representation related to the attribute relationship;

[0041] The description text is sent back to the client.

[0042] The present application also provides a method for generating a biography, comprising:

[0043] Acquire multiple attribute data of a target user and the relationship between the multiple attribute data;

[0044] When generating a biography of the target user according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the decoding state data at each decoding moment to obtain a context vector representation at the decoding moment;

[0045] The biography of the target user is determined based on the context vector representation at the decoding moment.

[0046] The present application also provides a news event generation method, comprising:

[0047] Acquire multiple attribute data of a target event and the relationship between the multiple attribute data;

[0048] When generating news about the target event according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the decoding state data at each decoding moment to obtain a context vector representation at the decoding moment;

[0049] News about the target event is determined according to the context vector representation at the decoding moment.

[0050] The present application also provides a weather information generation method, comprising:

[0051] Acquire multiple weather attribute data at a target time and the relationship between multiple attribute data;

[0052] When weather information of a target time is generated according to the plurality of attribute data by a pre-trained language model based on an encoder-decoder structure, a relationship between the plurality of attribute data and decoding state data is jointly modeled at each decoding moment to obtain a context vector representation at the decoding moment;

[0053] The weather information at the target time is determined based on the context vector representation at the decoding time.

[0054] The present application also provides a method for generating product description information, comprising:

[0055] Acquire multiple attribute data of a target product and the relationship between the multiple attribute data;

[0056] When generating description information of the target product according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the decoding state data at each decoding moment to obtain a context vector representation at the decoding moment;

[0057] Determine the description information of the target product according to the context vector representation at the decoding moment.

[0058] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the computer-readable storage medium is run on a computer, the computer executes the above-mentioned various methods.

[0059] The present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the above-mentioned various methods.

[0060] Compared with the prior art, this application has the following advantages:

[0061] The entity description text generation method provided in the embodiment of the present application retains the original structure (relationship) information of the entity attribute data by jointly modeling the relationship and decoding status of the entity attribute data in the decoding stage, avoids treating all attribute data as an unordered sequence in the decoding stage, and realizes a structure-aware attention mechanism. Therefore, the accuracy of the entity description text can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 A schematic diagram of a flow chart of a method embodiment provided in this application;

[0063] Figure 2Schematic diagram of entity attributes and attribute relationships of the method embodiment provided by this application;

[0064] Figure 3 A schematic diagram of a model of a method embodiment provided in this application;

[0065] Figure 4 A schematic diagram of a first structured adapter of a method embodiment provided by the present application;

[0066] Figure 5 Schematic diagram of encoder-decoder architecture in the prior art;

[0067] Figure 6 Schematic diagram of the structure-aware attention mechanism of the method embodiment provided in this application. DETAILED DESCRIPTION

[0068] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0069] In the present application, a method and device for generating entity description text, and an electronic device are provided. In the following embodiments, various solutions are described in detail one by one.

[0070] First embodiment

[0071] Please refer to Figure 1 , which is a flow chart of the entity description text generation method of the present application. In this embodiment, the method may include the following steps:

[0072] Step S101: Acquire multiple attribute data of a target entity and the relationship between the multiple attribute data.

[0073] The target entity is an objectively existing and distinguishable thing, which can be a person, a movie, a commodity, a news event, a sports game, a day's weather, etc. The target entity has various information, which is referred to as the attribute data of the entity in this embodiment. Multiple attribute data of an entity are stored in a data table, which can be reflected as multiple field values ​​in the data table. For example, the target entity is a person "Andrew Lawrence", and the attribute data of the person may include "Andrew Lawrence" (name), "USA" (nationality), "actor, singer, voice actor" (occupation), "Matthew Lawrence" (collaborator), "BrotherlyLove, Recess" (participated in works), "January 12, 1988" (date of birth), etc. The multiple attribute data of the person are stored in a table, and the multiple attribute data of the person can be synthesized into a biography of the person through a table-based text generation task.

[0074] The multiple attribute data of the target entity may have certain relationships, and the relationships between the attribute data will affect the way of generating the description text of the target entity, that is, for the same attribute data set, different attribute data relationships will generate different description texts. The relationship between attributes may be related to the field names in the data table. For ease of understanding, this embodiment uses a diagram to represent the multiple attribute data of the target entity and the relationship between the multiple attribute data. Figure 2 As shown in the figure, the middle node is the target entity, representing the person Andrew Lawrence, and the other nodes are the attribute data of this person. Figure 2In the example, the node marked as actor (attribute data) has a relationship of r2 with the target entity "Andrew Lawrence", indicating that Andrew Lawrence's identity (occupation) is an actor. The node marked as singer also has a relationship of r2 with the target entity "Andrew Lawrence", indicating that Andrew Lawrence's identity is also a singer. The node marked as voiceactor still has a relationship of r2 with the target entity "Andrew Lawrence", indicating that Andrew Lawrence's identity is still a voice actor. The node marked as Matthew Lawrence has a relationship of r3 with the target entity, indicating that AndrewLawrence and Matthew Lawrence are collaborators or that there is a character relationship between the two. The relationship between the actor node and the MatthewLawrence node is also r2, indicating that Matthew Lawrence's occupation is also an actor. The relationship between the voiceactor node and the Matthew Lawrence node is also r2, indicating that Matthew Lawrence's occupation is also a voice actor. The node marked as Recess has a relationship of r4 with the target entity, indicating that Andrew Lawrence participated in the movie Recess. The relationship between the Recess node and the Matthew Lawrence node is also r4, indicating that Matthew Lawrence also participated in the movie Recess. The relationship between the node labeled BrotherlyLove and the target entity is also r4, indicating that Andrew Lawrence also participated in the movie BrotherlyLove. The relationship between the node labeled USA and the target entity is r1, indicating that Andrew Lawrence's nationality is the United States.

[0075] The target entity may be a product, and product description information may be generated for the product through a table-based text generation task. For example, an e-commerce platform generates product description information based on product attribute data recorded in a product information table and publishes the information on the e-commerce platform for users to view.

[0076] The target entity may be a sports event. A table-based text generation task may be used to generate news content for a sports event. For example, a TV station may report news about the event based on information such as the scores of each team in the game.

[0077] The target entity may be the weather at a certain time. The weather report content at a certain time may be generated through a table-based text generation task, such as a TV station broadcasting weather forecast information based on various attribute values ​​of the weather in various places.

[0078] Step S103: When generating a description text of the target entity according to the multiple attribute data through a pre-trained language model based on an encoder-decoder structure, the relationship between the multiple attribute data and the decoding state data are jointly modeled at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment. The decoding state data may include the generated text (a part of the complete description text of the target entity) and may also include the decoded attribute data.

[0079] The pre-trained language model is an abstract mathematical modeling of language based on objective facts of language, and is a corresponding relationship. The language model includes an encoder and a decoder. Among them, the input data of the encoder includes the attribute data of the target entity. The input data of the decoder at each decoding moment includes the output data of the encoder, and also includes the decoding state data of the current decoding moment. The input data of the decoder at each decoding moment may also include the relationship between multiple attribute data. The decoding state data at the current decoding moment may include the text generated at the previous decoding moment, and may also include decoded attribute data or undecoded attribute data. The text generated at the previous decoding moment is called generated text, and the generated text can be used as context data at the current decoding moment. For example, the text generated at the previous decoding moment is " <s>AndrewLawrence…known for his roles in'Recess'…”, this text is used as the context of the current decoding moment, and the decoded attribute data at this time include: name of the person, name of the movie he participated in, etc. The output data of the decoder can be the context vector representation of the current decoding moment, which is the vector representation related to the attribute relationship output by the decoder at the current decoding moment, and the vector representation is obtained based on the relationship between the text generated at the previous decoding moment and the attribute.

[0080] Step S105: Generate a description text of the target entity according to the context vector representation related to the attribute relationship.

[0081] The pre-trained language model may also include a prediction module, which may adopt a fully connected neural network structure or other network structures capable of realizing prediction functions. The input data of the prediction module is the context vector representation related to the attribute relationship output by the decoder at the current decoding moment. The prediction module calculates the generation probability of each word in the vocabulary according to the vector representation, and generates the description text of the target entity according to the words with high generation probability.

[0082] In one example, the input data of the encoder includes attribute data of the target entity and the relationship between the attribute data, which can be expressed as follows: Figure 2 The attribute relationship graph shown is called the input graph. In the input graph, different nodes correspond to different attributes, and the edges between nodes represent the relationship between two adjacent attributes. Each attribute data can be represented as a word vector through the word embedding layer. The output data of the encoder is the vector representation of each attribute data related to the attribute relationship, which can still be represented as an attribute relationship graph, called the output graph. In the output graph, the relationship between the attributes is retained, and each attribute data can be represented as a vector representation related to the attribute relationship.

[0083] In one example, the encoder may also model the relationship between multiple attribute data of the target entity through a first structured adapter to improve the accuracy of the encoder output data. The first structured adapter is a module that can retain attribute relationship information. The input data of the first structured adapter is a vector representation of each attribute data output by the corresponding encoding layer, and the output data is a vector representation of each attribute data related to the attribute relationship. The first structured adapter may use a Relational Graph Attention Network (RGAT) or other neural networks that can retain attribute relationship information.

[0084] In a specific implementation, the encoder models the relationship between multiple attribute data of the target entity through the first structured adapter, which may include the following sub-steps: 1) the encoder obtains the vector representation of the multiple attribute data through the encoding layer, and the encoder includes at least one encoding layer; 2) the encoder determines the vector representation of the multiple attribute data related to the attribute relationship based on the relationship between the multiple attribute data and the vector representation of the multiple attribute data through the first structured adapter corresponding to the encoding layer. Among them, the encoding layer can use a Transformer module or other neural network structure that can realize the encoding function.

[0085] like Figure 3 As shown, in this embodiment, the encoder includes N encoding layers, and a first structured adapter (such as an RGAT network) is added behind each encoding layer (such as a feedforward network sublayer of a Transformer module), and the first structured adapter is used to model the structure of the input data.

[0086] Figure 4 The first structured adapter using the RGAT network structure is shown. For each node (attribute data) v in the input graph, given its hidden representation from the lth layer of the encoder (i.e., the vector representation of the attribute data), each RGAT layer updates its representation (i.e., the vector representation of the attribute data related to the attribute relationship) by aggregating information from the adjacent attributes of the node v. The method provided by the embodiment of the present application can effectively improve the accuracy of the encoder output graph by using the first structured adapter of the RGAT network structure.

[0087] In specific implementation, for each node v in the input graph, the RGAT layer updates its hidden representation from the encoder layer l by aggregating information from the neighboring attributes of node v. The update formula can be described as follows:

[0088]

[0089]

[0090]

[0091]

[0092]

[0093] Among them, R represents the type of relationship in the input graph (such as Figure 2 In the relationship r1, r2, r3, r4), N^r_v represents the set of neighbor nodes with r relationship with node v, and [;] represents a splicing operation. Since the working principle of the relationship graph attention RGAT network belongs to the prior art, the meaning of the above formula is not repeated here. The method provided in the embodiment of the present application can model the structure (relationship R) of multiple attribute data of the target entity through the RGAT network.

[0094] In one example, the decoder jointly models the relationship between multiple attribute data and decoding status data of the target entity at each decoding moment, which may include the following steps: 1) the decoder obtains the vector representation of the generated text through a decoding layer, and the decoder includes at least one decoding layer; 2) the decoder updates the vector representation of the generated text through a second structured adapter corresponding to the decoding layer; 3) the decoder obtains undecoded attribute data based on the multiple attribute data and the decoded attribute data through a dynamic graph interaction module, and forms a relationship between the generated text and the undecoded attribute data; 4) the decoder obtains the context vector representation of the decoding moment based on the vector representation of the multiple attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through at least one attention module.

[0095] 1) The decoder obtains the vector representation of the generated text through the decoding layer.

[0096] The decoder includes at least one decoding layer, wherein the input data of the first decoding layer can be a vector representation obtained by word embedding processing of the generated text. The decoding layer can adopt a Transformer module or other neural network structure that can realize the encoding function.

[0097] 2) The decoder updates the vector representation of the generated text through a second structured adapter corresponding to the decoding layer.

[0098] The second structured adapter is used to make the language model better adaptable to the task of image-to-text, and the second structured adapter includes but is not limited to: a feedforward neural network FNN. Figure 3 As shown, in this embodiment, the decoder includes N decoding layers, and a second structured adapter (such as a feedforward neural network FNN) is added after each decoding layer before the last decoding layer (such as the feedforward network sublayer of the Transformer module). It should be noted that the second structured adapter is not a necessary module, and the accuracy of the entity description text can still be improved even without the second structured adapter.

[0099] In specific implementation, given the output of the Transformer module of the lth layer of the decoder, the formulation of the second structured adapter can be expressed as follows:

[0100]

[0101] As can be seen from the formula, since the Transformer module is mainly obtained based on pre-training of sequence data, there is a large gap between it and the structured input data. In order to solve this problem, the method provided in the embodiment of the present application can add a fully connected adapter after each Transformer layer to adapt the model to the input data of the graph structure. In specific implementation, the second structured adapter can also use other network structures besides the fully connected one, which can solve the above problem.

[0102] 3) The decoder forms a relationship between the generated text and the undecoded attribute data through a dynamic graph interaction module.

[0103] like Figure 5 As shown in the figure, in the existing encoder-decoder framework, the input graph context representation (IGcontext) obtained by the general attention mechanism (cross-attention mechanism) may not be accurate enough. There are two reasons for this inaccuracy. The first reason is that the vector representation output by the encoder itself may not be accurate enough. The second reason is that during decoding, the structural information of the input graph is ignored by the general cross-attention mechanism. This structural information plays a vital role in the representation of nodes, and it can also provide clues about which nodes are more relevant to the generated text context.

[0104] In order to solve the problems existing in general cross-attention, this application proposes a structure-aware (attribute relationship aware) cross-attention mechanism (Structure-Aware Cross-Attention, SACA). Figure 6 As shown in the figure, SACA introduces structural bias (attribute relationship of target entity) into the modeling of input graph context. Specifically, during decoding, an evolving graph framework can be constructed. In the evolving graph, the generated text context (GTcontext) and the input graph are explicitly connected. A new node GT is introduced to represent the generated text, and it is connected to each node in the input graph to form an evolving graph. At different decoding moments, the GT node (representing the generated text) in the evolving graph can have different vector representations, and the entity attribute nodes connected to the GT node at different decoding moments are also different. The entity attribute nodes connected to the GT node include undecoded attribute nodes.

[0105] In a specific implementation, the decoding status data may include decoded attribute data, and the decoder may obtain undecoded attribute data according to the plurality of attribute data and the decoded attribute data.

[0106] 4) The decoder obtains the context vector representation at the decoding moment according to the vector representation of the multiple attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through at least one attention module.

[0107] like Figure 3 As shown, in one example, an L-layer structure-aware attention module (such as an RGAT structure) can be used to summarize the representation of nodes in the evolutionary graph, including the relationship between the generated text and the undecoded attribute data and the relationship between the undecoded attribute data in the evolutionary graph. In this way, when decoding, the structural bias of the input graph is introduced into the context modeling of the input graph. In order to make the training more stable, a residual connection can be added between two RGAT layers.

[0108] In a specific implementation, the decoder can update the vector representation of the generated text according to the vector representation of the multiple attribute data (which can be the vector representation of the multiple attribute data related to the attribute relationship), the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through at least one attention module (a structure-aware attention module, such as a relationship graph attention network or other network structure that can retain structural information), and use the updated vector representation of the generated text as the context vector representation at the decoding moment. That is, the vector representation corresponding to the GT node is taken out as a structure-aware input graph context vector (i.e., the context vector representation related to the attribute relationship at the current decoding moment), and it is used to predict the output of the decoder at the current time step. In this way, the decoder can capture the input graph structure when modeling the context related to the generated text. In addition, even if the encoder loses some important information, SACA can still obtain the correct node representation through the dynamic graph interaction mechanism at the decoder stage. Figure 3 As shown, SACA can be added as the last layer of the decoder.

[0109] In this embodiment, for example Figure 2 The entity attribute and attribute relationship data shown in the figure can obtain the entity description text "Andrew Lawrence...is an American actor and singer.He is best known for his roles in "Recess" and... ". It can be seen that a more reasonable entity description text can be obtained by adopting the method provided in the embodiment of the present application.

[0110] It can be seen from the above embodiments that the entity description text generation method provided in the embodiments of the present application retains the original structural information of the entity attribute data by jointly modeling the relationship and decoding status of the entity attribute data in the decoding stage, avoids treating all attribute data as an unordered sequence in the decoding stage, and realizes a structure-aware attention mechanism. Therefore, the accuracy of the entity description text can be effectively improved.

[0111] Second embodiment

[0112] In the above-mentioned embodiment, a method for generating entity description text is provided. Correspondingly, the present application also provides an entity description text generating device. The device corresponds to the embodiment of the above-mentioned method. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple. For the relevant parts, please refer to the partial description of the method embodiment. The device embodiment described below is only illustrative.

[0113] The present application further provides an entity description text generation device, including: an attribute data and relationship acquisition unit, a joint attribute relationship decoding unit, and a text determination unit.

[0114] An attribute data and relationship acquisition unit, used to acquire multiple attribute data of a target entity and the relationship between the multiple attribute data; a joint attribute relationship decoding unit, used to generate a description text of the target entity according to the multiple attribute data through a pre-trained language model based on an encoder-decoder structure, and the decoder performs joint modeling on the relationship between the multiple attribute data and the decoding state data at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment; a text determination unit, used to generate a description text of the target entity according to the context vector representation related to the attribute relationship.

[0115] In one example, the apparatus may further include: a first structured adapter, used for the encoder to model the relationship between the plurality of attribute data. The first structured adapter includes but is not limited to: a relational graph attention network RGAT.

[0116] In one example, the device may also include: at least one encoding layer, for an encoder to obtain a vector representation of the multiple attribute data; the first structured adapter corresponds to the encoding layer, and is specifically used to determine the vector representation of the multiple attribute data related to the attribute relationship based on the relationship between the multiple attribute data and the vector representation of the multiple attribute data.

[0117] In one example, the decoding state data includes generated text, and the joint attribute relationship decoding unit includes: at least one decoding layer, a dynamic graph interaction module, and at least one attention module.

[0118] At least one decoding layer, used for the decoder to obtain the vector representation of the generated text; a dynamic graph interaction module, used for the decoder to form the relationship between the generated text and the undecoded attribute data; at least one attention module, used for the decoder to obtain the context vector representation related to the attribute relationship based on the vector representation of the multiple attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data.

[0119] In one example, the attention module is specifically used to update the vector representation of the generated text based on the vector representation of the multiple attribute data, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data, and use the updated vector representation of the generated text as the context vector representation related to the attribute relationship.

[0120] In one example, the joint attribute relationship decoding unit may further include: a second structured adapter corresponding to the decoding layer, used for the decoder to adjust the vector representation of the generated text. The second structured adapter includes but is not limited to: a feedforward neural network FNN.

[0121] Third embodiment

[0122] In the above-mentioned embodiment, a method for generating entity description text is provided, and correspondingly, the present application also provides an electronic device. The device corresponds to the embodiment of the above-mentioned method. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.

[0123] An electronic device of the present embodiment includes: a processor and a memory; the memory is used to store a program for implementing a method for generating entity description text. After the device is powered on and the program of the method is run through the processor, the following steps are performed: obtaining multiple attribute data of a target entity and the relationship between the multiple attribute data; when generating a description text of the target entity according to the multiple attribute data through a pre-trained language model based on an encoder-decoder structure, the decoder jointly models the relationship between the multiple attribute data and the decoding state data at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment; and generating a description text of the target entity according to the context vector representation related to the attribute relationship.

[0124] Fourth embodiment

[0125] In the above embodiment, a method for generating entity description text is provided. Correspondingly, the present application also provides a method for generating entity description text, which is used in a client, such as a personal computer, a smart phone, and other devices. This method corresponds to the above method embodiment 1, so the description is relatively simple. For relevant parts, please refer to the partial description of method embodiment 1. The method embodiment described below is only illustrative.

[0126] The entity description text generation method of this embodiment includes the following steps: 1) sending a description text acquisition request for the target entity to the server; 2) receiving the description text of the target entity sent back by the server. The server generates the description text in the following manner: obtaining multiple attribute data of the target entity and the relationship between the multiple attribute data; when generating the description text of the target entity according to the multiple attribute data through a pre-trained language model based on an encoder-decoder structure, the decoder jointly models the relationship between the multiple attribute data and the decoding state data at each decoding moment to obtain the context vector representation related to the attribute relationship at the decoding moment; and generating the description text of the target entity according to the context vector representation related to the attribute relationship.

[0127] Fifth embodiment

[0128] In the above embodiment, a method for generating entity description text is provided. Correspondingly, the present application also provides a method for generating entity description text, which is used on a server side, and the server side can be deployed on the server side or the cloud side. This method corresponds to the above method embodiment 1, so the description is relatively simple. For relevant parts, please refer to the partial description of method embodiment 1. The method embodiment described below is only illustrative.

[0129] The entity description text generation method of this embodiment includes the following steps: 1) receiving a description text acquisition request for a target entity sent by a client; 2) acquiring multiple attribute data of the target entity and the relationship between the multiple attribute data; 3) when generating the description text of the target entity according to the multiple attribute data through a pre-trained language model based on an encoder-decoder structure, the decoder jointly models the relationship between the multiple attribute data and the decoding state data at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment; 4) generating a description text of the target entity based on the context vector representation related to the attribute relationship; 5) sending the description text back to the client.

[0130] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.

[0131] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0132] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0133] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.

[0134] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.< / s>

Claims

1. A method for generating entity description text, characterized in that: include: Acquire multiple attribute data of a target entity and the relationship between the multiple attribute data; When generating a description text of a target entity according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the generated text at the decoding moment at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, including: The decoder obtains the vector representation of the generated text through the decoding layer; The decoder introduces a node representing the generated text and connects the node with an undecoded attribute node in the input graph to form a relationship between the generated text and the undecoded attribute data; The decoder obtains the context vector representation related to the attribute relationship according to the vector representation of the plurality of attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through the attention module; Generate a description text of the target entity according to the context vector representation related to the attribute relationship.

2. The method according to claim 1, characterized in that Also includes: The encoder models the relationship between the plurality of attribute data through a first structured adapter.

3. The method according to claim 2, characterized in that The encoder obtains the vector representation of the plurality of attribute data through the encoding layer, the encoder comprising at least one encoding layer; The encoder determines the vector representations of the plurality of attribute data related to the attribute relationship according to the relationship between the plurality of attribute data and the vector representations of the plurality of attribute data through a first structured adapter corresponding to the encoding layer.

4. The method according to claim 1, characterized in that: The decoder obtains the context vector representation related to the attribute relationship according to the vector representation of the plurality of attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through at least one attention module, including: The decoder updates the vector representation of the generated text according to the vector representation of the multiple attribute data, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through at least one attention module, and uses the updated vector representation of the generated text as the context vector representation related to the attribute relationship.

5. The method according to claim 1, characterized in that The decoder jointly models the relationship between the plurality of attribute data and the generated text at the decoding moment at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, and further includes: The decoder updates the vector representation of the generated text through a second structured adapter corresponding to the decoding layer.

6. A device for generating entity description text, characterized in that: include: An attribute data and relationship acquisition unit, used to acquire multiple attribute data of a target entity and the relationship between the multiple attribute data; A joint attribute relationship decoding unit is used to jointly model the relationship between the multiple attribute data and the generated text at the decoding moment when generating a description text of the target entity according to the multiple attribute data through a pre-trained language model based on an encoder-decoder structure, so as to obtain a context vector representation related to the attribute relationship at the decoding moment, including: The decoder obtains the vector representation of the generated text through the decoding layer; The decoder introduces a node representing the generated text and connects the node with an undecoded attribute node in the input graph to form a relationship between the generated text and the undecoded attribute data; The decoder obtains the context vector representation related to the attribute relationship according to the vector representation of the plurality of attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through the attention module; A text determination unit is used to generate a description text of the target entity according to the context vector representation related to the attribute relationship.

7. An electronic device, characterized in that: include: Processor and memory; A memory for storing a program for implementing the entity description text generation method according to any one of claims 1 to 5, the device is powered on and runs the program of the method through the processor.

8. A method for generating entity description text, characterized in that: include: Send a request to the server to obtain the description text of the target entity; Receive the description text of the target entity sent back by the server; The server generates the description text in the following manner: Acquire multiple attribute data of a target entity and the relationship between the multiple attribute data; When generating a description text of a target entity according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the generated text at the decoding moment at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, including: The decoder obtains the vector representation of the generated text through the decoding layer; The decoder introduces a node representing the generated text and connects the node with an undecoded attribute node in the input graph to form a relationship between the generated text and the undecoded attribute data; The decoder obtains the context vector representation related to the attribute relationship according to the vector representation of the plurality of attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through the attention module; Generate a description text of the target entity according to the context vector representation related to the attribute relationship.

9. A method for generating entity description text, characterized in that: include: Receive a request for obtaining a description text of a target entity sent by a client; Acquire multiple attribute data of a target entity and the relationship between the multiple attribute data; When generating a description text of a target entity according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the generated text at the decoding moment at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, including: The decoder obtains the vector representation of the generated text through the decoding layer; The decoder introduces a node representing the generated text and connects the node with an undecoded attribute node in the input graph to form a relationship between the generated text and the undecoded attribute data; The decoder obtains the context vector representation related to the attribute relationship according to the vector representation of the plurality of attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through the attention module; Generate a description text of the target entity according to the context vector representation related to the attribute relationship; The description text is sent back to the client.

10. A method for generating a biography, characterized in that: include: Acquire multiple attribute data of a target user and the relationship between the multiple attribute data; When a biography of a target user is generated according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, a relationship between the plurality of attribute data and the generated text at the decoding moment are jointly modeled at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, including: The decoder obtains the vector representation of the generated text through the decoding layer; The decoder introduces a node representing the generated text and connects the node with an undecoded attribute node in the input graph to form a relationship between the generated text and the undecoded attribute data; The decoder obtains the context vector representation related to the attribute relationship according to the vector representation of the plurality of attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through the attention module; The biography of the target user is determined based on the context vector representation related to the attribute relationship at the decoding moment.

11. A method for generating news events, characterized in that: include: Acquire multiple attribute data of a target event and the relationship between the multiple attribute data; When generating news about the target event according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, the relationship between the plurality of attribute data and the generated text at the decoding moment are jointly modeled at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, including: The decoder obtains the vector representation of the generated text through the decoding layer; The decoder introduces a node representing the generated text and connects the node with an undecoded attribute node in the input graph to form a relationship between the generated text and the undecoded attribute data; The decoder obtains the context vector representation related to the attribute relationship according to the vector representation of the plurality of attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through the attention module; The news of the target event is determined according to the context vector representation related to the attribute relationship at the decoding moment.

12. A method for generating weather information, characterized in that: include: Acquire multiple weather attribute data at a target time and the relationship between multiple attribute data; When weather information of a target time is generated according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, a relationship between the plurality of attribute data and the generated text at the decoding moment are jointly modeled at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, including: The decoder obtains the vector representation of the generated text through the decoding layer; The decoder introduces a node representing the generated text and connects the node with an undecoded attribute node in the input graph to form a relationship between the generated text and the undecoded attribute data; The decoder obtains the context vector representation related to the attribute relationship according to the vector representation of the plurality of attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through the attention module; The weather information at the target time is determined based on the context vector representation related to the attribute relationship at the decoding moment.

13. A method for generating product description information, characterized in that: include: Acquire multiple attribute data of a target product and the relationship between the multiple attribute data; When generating description information of the target product according to the plurality of attribute data by using a pre-trained language model based on an encoder-decoder structure, jointly modeling the relationship between the plurality of attribute data and the generated text at the decoding moment at each decoding moment to obtain a context vector representation related to the attribute relationship at the decoding moment, including: The decoder obtains the vector representation of the generated text through the decoding layer; The decoder introduces a node representing the generated text and connects the node with an undecoded attribute node in the input graph to form a relationship between the generated text and the undecoded attribute data; The decoder obtains the context vector representation related to the attribute relationship according to the vector representation of the plurality of attribute data, the vector representation of the generated text, the relationship between the generated text and the undecoded attribute data, and the relationship between the undecoded attribute data through the attention module; Describe the target product according to the context vector representation related to the attribute relationship at the decoding moment.

Citation Information

Patent Citations

  • Method for generating text based on pre-trained structured data

    CN110609986A