Text generation method and apparatus

By acquiring user characteristics and utilizing a text generation model that integrates knowledge graphs, target text that meets user needs is generated, solving the user filtering problem caused by excessive data volume in knowledge graphs and improving information hit rate and user experience.

CN115757808BActive Publication Date: 2026-05-12ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ALIBABA (CHINA) CO LTD
Filing Date
2022-10-20
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In knowledge graphs, due to the large amount of data, users need to further select the information they expect to obtain from the feedback information, resulting in a poor user experience.

Method used

By acquiring the user characteristics of the target user, determining the text generation information associated with the target object, and using a text generation model that integrates the encoding and decoding units of a knowledge graph, target text that meets the user's needs is generated.

Benefits of technology

This reduces redundant operations for users in filtering feedback information, improving information hit rate and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115757808B_ABST
    Figure CN115757808B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a text generation method and device, wherein the text generation method comprises: obtaining user characteristics of a target user, and determining text generation information associated with a target object according to the user characteristics, wherein the text generation information comprises first entity information of the target object and text control information; inputting the text generation information into a text generation model, performing encoding processing on the text generation information through an encoding unit of the text generation model that fuses a knowledge graph, and obtaining an encoding vector containing second entity information; and performing decoding processing on the encoding vector through a decoding unit of the text generation model, and outputting a target text containing the text control information. The text generation model based on the encoding unit that fuses the knowledge graph processes the text generation information containing the text control information, and outputs a target text that is more in line with user demand, thereby realizing controllability from the knowledge graph to text generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of natural language processing, and in particular to a text generation method. One or more embodiments of this specification also relate to a text generation apparatus, a computing device, and a computer-readable storage medium. Background Technology

[0002] With the rapid development of technologies such as computers and artificial intelligence, the application of knowledge graphs is becoming increasingly widespread. Knowledge graphs are one of the important carriers for storing large amounts of data and knowledge, describing the relationships between entities. Because knowledge graphs contain a large amount of structured data, they are widely used in fields such as search engines, question-answering systems, and recommendation systems. However, when users retrieve relevant information based on knowledge graphs, the sheer volume of data stored within them results in a large amount of feedback information. This forces users to further select the information they want from the feedback, causing unnecessary trouble and a poor user experience. Therefore, how to accurately provide users with the feedback information they want is a problem that urgently needs to be solved. Summary of the Invention

[0003] In view of this, embodiments of this specification provide a text generation method. One or more embodiments of this specification also relate to a text generation apparatus, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.

[0004] According to a first aspect of the embodiments of this specification, a text generation method is provided, comprising:

[0005] Obtain the user characteristics of the target user, and determine the text generation information associated with the target object based on the user characteristics, wherein the text generation information includes the first entity information and text control information of the target object;

[0006] The text generation information is input into the text generation model, and the text generation information is encoded by the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing the second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information;

[0007] The encoding vector is decoded by the decoding unit in the text generation model to output the target text containing the text control information.

[0008] According to a second aspect of the embodiments of this specification, a text generation method is provided, comprising:

[0009] Receive text generation instructions submitted by the target user for the target object in the recommendation business;

[0010] In response to the text generation instruction, the user characteristics of the target user are obtained, and text generation information associated with the target object is determined based on the user characteristics;

[0011] The text generation information is input into a text generation model for processing to obtain the target text output by the text generation model, wherein the text generation model includes an encoding unit and a decoding unit that integrates a knowledge graph;

[0012] Recommendation information is generated based on the target text and the object resources of the target object, and the recommendation information is fed back to the target user.

[0013] According to a third aspect of the embodiments of this specification, a text generation apparatus is provided, comprising:

[0014] The determination module is configured to acquire user characteristics of the target user and determine text generation information associated with the target object based on the user characteristics, wherein the text generation information includes first entity information and text control information of the target object;

[0015] The encoding module is configured to input the text generation information into the text generation model, and encode the text generation information through the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information;

[0016] The decoding module is configured to decode the encoded vector through the decoding unit in the text generation model and output target text containing the text control information.

[0017] According to a fourth aspect of the embodiments of this specification, a text generation apparatus is provided, comprising:

[0018] The receiving module is configured to receive text generation instructions submitted by the target user for the target object in the recommendation service;

[0019] The determination module is configured to, in response to the text generation instruction, acquire the user characteristics of the target user and determine the text generation information associated with the target object based on the user characteristics;

[0020] The processing module is configured to input the text generation information into the text generation model for processing, and obtain the target text output by the text generation model, wherein the text generation model includes an encoding unit and a decoding unit that integrates a knowledge graph;

[0021] The feedback module is configured to generate recommendation information based on the target text and the object resources of the target object, and to feed back the recommendation information to the target user.

[0022] According to a fifth aspect of the embodiments of this specification, a text generation method is provided, applied on a server, including:

[0023] Receive text generation instructions submitted by the target user through the client;

[0024] In response to the text generation instruction, the user characteristics of the target user are obtained, and text generation information associated with the target object is determined based on the user characteristics, wherein the text generation information includes the first entity information and text control information of the target object;

[0025] The text generation information is input into the text generation model, and the text generation information is encoded by the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing the second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information;

[0026] The encoding vector is decoded by the decoding unit in the text generation model to output the target text containing the text control information, and the target text is fed back to the client.

[0027] According to a sixth aspect of the embodiments of this specification, a computing device is provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor executes the computer instructions to implement the steps of the text generation method.

[0028] According to a seventh aspect of an embodiment of this specification, a computer-readable storage medium is provided that stores computer instructions which, when executed by a processor, implement the steps of the text generation method.

[0029] According to an eighth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described text generation method.

[0030] The text generation method provided in this specification obtains user characteristics of a target user, determines text generation information associated with a target object based on the user characteristics, wherein the text generation information includes first entity information and text control information of the target object; the text generation information is input into a text generation model, and the text generation information is encoded by an encoding unit that integrates a knowledge graph in the text generation model to obtain an encoding vector containing second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information; the encoding vector is decoded by a decoding unit in the text generation model to output target text containing the text control information.

[0031] One embodiment of this specification implements the determination of text generation information based on user characteristics. The text generation information is processed by a text generation model incorporating coding units that integrate a knowledge graph to obtain target text containing text control information. This achieves control over the generation of target text through text generation information, enabling the generation of target text that meets user needs based on a knowledge graph, reducing the generation of invalid information, thereby achieving controllable text generation and improving text generation efficiency and hit rate. Attached Figure Description

[0032] Figure 1 This is a schematic diagram illustrating a scenario of a text generation method provided in one embodiment of this specification;

[0033] Figure 2 This is a flowchart illustrating a text generation method provided in one embodiment of this specification;

[0034] Figure 3 This is a flowchart of a text generation method provided in another embodiment of this specification;

[0035] Figure 4 This is a flowchart illustrating the processing steps of a text generation method provided in one embodiment of this specification.

[0036] Figure 5 This is a schematic diagram of the structure of a text generation device provided in one embodiment of this specification;

[0037] Figure 6 This is a schematic diagram of the structure of a text generation device provided in another embodiment of this specification;

[0038] Figure 7 This is a flowchart of a text generation method provided in another embodiment of this specification;

[0039] Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0040] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0041] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to any or all possible combinations including one or more of the associated listed items.

[0042] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0043] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0044] Knowledge graphs: The primary goal of knowledge graphs is to describe various entities and concepts existing in the real world, as well as the relationships between them; therefore, they can be considered a semantic network. Knowledge graphs can be used to query complex relational information, understand user intent at the semantic level, and improve search quality. A knowledge graph stores multiple pieces of knowledge, represented in the form of triples. A triple consists of nodes and edges. Nodes represent entities or attributes, and edges represent relationships between entities or between entities and attributes.

[0045] In real-life and commercial applications, it's often necessary to describe structured data using natural language so users can quickly understand its meaning. With the development of knowledge graph technology, knowledge graphs store vast amounts of data. When users need information, this data can be converted into natural language descriptions and presented to them. However, when data conversion is based on language models, the models tend to select a large amount of relevant data for conversion, resulting in an overwhelming amount of content presented to the user, requiring them to filter it manually. For example, if user A wants to know the price of a certain mobile phone, and user B wants to know its dimensions, the feedback for both users would be the same: all data about that phone from the knowledge graph would be converted into text, such as model number, specifications, and manufacturer. This creates unnecessary hassle for users, requiring them to manually search for the information they want, leading to a poor user experience.

[0046] Based on this, this specification provides a text generation method for controlling text generation, selecting data content that the user wants to know from a knowledge graph, and generating descriptive text that meets the user's needs to provide feedback to the user, thereby improving the user experience. This specification also relates to a text generation device, a computing device, a computer-readable storage medium, and a computer program, which will be described in detail in the following embodiments.

[0047] Figure 1 This is a schematic diagram illustrating a scenario of a text generation method provided according to an embodiment of this specification, taking the text generation method in the scenario of a user purchasing goods as an example. Figure 1 Users purchase goods through their terminals. After entering the product name, the service recommends various products to the user, such as... Figure 1 The system displays products A, B, etc., to the user via their terminal. When a user clicks on a product to learn more about it, a text generation command is sent to the server to generate introductory information about that product. For example, if the product is a mobile phone and the user wants to know about its camera capabilities, clicking on the phone on their terminal only sends a command to the server to view specific phone information, without specifying which aspect. This could result in all information about the phone being pushed to the user, forcing them to search for details about the camera within the pushed information, leading to a poor user experience.

[0048] However, based on the text generation method provided in this specification, in one possible implementation, the user terminal sends a text generation instruction to the service provider's backend server. Upon receiving the text generation instruction, the backend server obtains the user's relevant user characteristics and analyzes these characteristics to determine the information the user wants to know about the product, such as... Figure 1 In this application, if a user wants to know about the phone's camera performance, descriptive text about the phone's camera information is generated for the user. Based on user characteristics, text control information about the phone is determined. This text control information controls the specific content of subsequent text generation. In the subsequent text generation process, the text control information influences the data obtained from the knowledge graph, ensuring that the obtained data is transformed into text that meets the user's needs. This increases the relevance of the generated text to the user, reduces redundant operations for the user to further filter from feedback information, and improves the user experience. It should be noted that the user characteristic information or user data involved in this application are all information and data authorized by the user or fully authorized by all parties. User characteristic information includes, but is not limited to, user personal information and user preference information. User data includes, but is not limited to, data used for analysis, data stored, and data displayed. Furthermore, the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0049] Figure 2 A flowchart of a text generation method according to an embodiment of this specification is shown, including steps 202 to 206.

[0050] Step 202: Obtain the user characteristics of the target user, and determine the text generation information associated with the target object based on the user characteristics, wherein the text generation information includes the first entity information and text control information of the target object.

[0051] In this context, target users can be understood as users who need to obtain information text. In the business scenario of purchasing goods, target users can be understood as users who want to know specific information about the product. Target user characteristics can be understood as user tags. User characteristics can be determined based on a user's historical behavior and user attribute information. For example, if a user frequently checks user experiences related to a product before purchasing it, then one of their user characteristics is "likes to read reviews"; if a user frequently buys snacks, then one of their user characteristics is "snack enthusiast". Each user will have user characteristics in various business areas, therefore, the selected user characteristics will differ depending on the specific business scenario. In a recommendation scenario, when a user clicks to view nearby restaurants, their identified user characteristics might be "loves spicy food and Sichuan cuisine," leading to recommendations of Sichuan restaurants. Similarly, in a purchase scenario, when a user searches for snacks, their previous purchasing behavior might indicate a user characteristic like "likes chocolate," resulting in search results for different brands of chocolate. When the user clicks on a chocolate product, since they consistently buy chocolates from different countries, a description of the product's origin can be generated based on their "product's place of origin," allowing the user to directly understand the product's origin and reducing the time spent browsing information, thus providing a better shopping experience.

[0052] In practical applications, text generation information related to the target object is determined based on user characteristics. The target object is what the user wants to know, such as a product in a purchase scenario or a restaurant in a recommendation scenario. The text generation information can be understood as the information needed to generate the target object. The text generation information includes the first entity information of the target object and text control information. The first entity information is the entity information of the target object in the corresponding knowledge graph. For example, the entity information of a mobile phone in an e-commerce knowledge graph is "mobile phone". Based on this entity information, the second entity information of the entity information can be determined based on different relationships. For example, in the triple "mobile phone A - manufacturer - company A", mobile phone A is the first entity information, company A is the second entity information, and the relationship between mobile phone A and company A is "manufacturer". When a user wants to know about the manufacturer of a mobile phone, the text control information included in the text generation information can be used to control the selection and generation of text content related to the manufacturer of the mobile phone.

[0053] In summary, by analyzing user characteristics to determine the text generation information associated with the target object during the text generation process, we can generate text content that better meets user needs in subsequent text generation, improve the information hit rate, generate specific text information based on the user characteristics of different users, meet the needs of all users, and improve the user experience.

[0054] Furthermore, since each user has many user characteristics, it is necessary to obtain the user characteristics of the target object from the user's many user characteristics. Specifically, obtaining the user characteristics of the target user includes: receiving the text generation instruction of the target user; determining the identity information of the target user and the object information of the target object carried in the text generation instruction; obtaining the user characteristic set of the target user based on the identity information, and selecting the user characteristics associated with the target object from the user characteristic set based on the object information.

[0055] The target user's identity information can be understood as unique identifiers of the user, such as account ID and URL. Based on this identity information, all user characteristics related to that target user can be found in the database, forming a user feature set. While all user characteristics in this set are specific to the target user, many are not suitable for generating text information about the target object. Therefore, it's necessary to select user characteristics relevant to the target object from the user feature set. For example, if user A's user feature set includes "student, loves playing games, male...", and the target object is a mobile phone, then "male, loves playing games" can be selected from the user feature set. This allows for the generation of text tailored to the phone's specifications and gaming performance.

[0056] In one embodiment of this specification, a text generation instruction from target user A is received. The identity information of the target user and the object information of the target object carried in the text generation instruction are determined. The identity information is the account ID of the target user A's login account, and the object information of the target object is an air conditioner. Based on the identity information, a set of user features of target user A is obtained. Based on the object information, user features associated with the air conditioner are selected from the set of user features. The selected user features are "frugal and minimalist". Then, energy consumption information and style information of the air conditioner can be generated according to the user features.

[0057] By filtering user feature sets based on object information, user features associated with target objects can be identified, thereby generating text that meets user needs and improves user satisfaction.

[0058] Furthermore, since target objects express different meanings in different domains, in order to provide users with accurate text information, it is necessary to determine the business domain of the target object and perform knowledge lookup from the knowledge graph corresponding to that business domain. Specifically, determining the text generation information associated with the target object based on the user characteristics includes: determining the business domain to which the target object belongs, and determining the first entity information of the target object in the knowledge graph corresponding to the business domain; determining the text control information of the target object based on the user characteristics, and generating the text generation information associated with the target object based on the text control information and the first entity information.

[0059] In this context, the business domain can be understood as the industry sector to which the target object belongs. For example, a business domain could be finance, healthcare, or e-commerce. In certain special cases, the same target object may represent different meanings in different industry sectors. Therefore, in generating text associated with the target object, it is necessary to search for corresponding knowledge from the knowledge graph of the target object's business domain to avoid problems such as failing to obtain correct results. For instance, in the technology business domain, information about Apple mobile phones can be retrieved, while in the daily business domain, information about apples as a fruit can be retrieved.

[0060] In practical applications, there are also general knowledge graphs (regardless of business domain). However, in order to improve the accuracy of text generation, we can further determine the business domain to which the target object belongs, improve the vertical retrieval effect, and thus generate more accurate information for users.

[0061] In one embodiment of this specification, following the previous example, the business domain of "Brand A air conditioner" is determined to be the e-commerce business domain. In the e-commerce knowledge graph corresponding to the business domain, the first entity information is determined to be "Brand A air conditioner". The text control information is determined to be "energy consumption" based on user characteristics. Based on the text control information and the first entity information, text generation information of the associated target object is generated. The text generation information can be "Brand A air conditioner - energy consumption". Thus, energy consumption information about "Brand A air conditioner" can be generated in a targeted manner based on the text control information.

[0062] In summary, the first entity information of the target object is determined based on the knowledge graph of the business domain to which the target business belongs. Then, text generation information associated with the target object is generated based on the first entity information and text control information. This enables the text generation model to provide targeted text or resources that meet the user's needs.

[0063] Step 204: Input the text generation information into the text generation model, and encode the text generation information through the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing the second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information.

[0064] The text generation model can be understood as a pre-trained language model. Based on the input text information, it generates descriptive text about the target object. The text control information controls the text generation model to generate content that conforms to the control information.

[0065] In practical applications, the text generation model adopts an encoder-decoder structure. The encoding part transforms the input sequence into a vector, and the decoding part transforms this vector into an output sequence, thereby generating the target text. In one feasible approach, knowledge graphs are fused into the encoding units of the text generation model, enabling the model to perform knowledge retrieval. This allows it to find knowledge about a first entity in the input information; this knowledge becomes the second entity information. Furthermore, based on text control information, the model can precisely retrieve the knowledge about the first entity information that the user needs. Therefore, the encoding units of the text generation model in this specification need to be integrated with knowledge graphs to endow the model with knowledge retrieval capabilities.

[0066] In practical applications, to enable the text generation model to retrieve relevant knowledge about the target object, a knowledge graph can be integrated into the encoding unit of the text generation model. Specifically, before inputting the text generation information into the text generation model, the process includes: obtaining an initial text generation model and a knowledge graph corresponding to the target object; linearizing the knowledge graph to obtain a linearized knowledge graph; integrating the linearized knowledge graph with the initial encoding unit of the initial text generation model; and determining the text generation model containing the encoding unit based on the integration result.

[0067] The initial text generation model can be understood as a model without fused knowledge graphs. The knowledge graph corresponding to the target object is the knowledge graph to which the target object belongs. In order to fuse the knowledge graph with the model's encoding unit, the knowledge graph first needs to be linearized, and then the linearized knowledge graph is fused with the encoding unit.

[0068] In practical applications, knowledge graphs are represented graphically. To integrate knowledge graphs with coding units, they need to be linearized first. A knowledge graph consists of multiple triples; for example, (Beijing, is capital of, China) can be linearized into "...". <h>Beijing <r>is capital of <t>China, among which <h> , <r> , <t>These represent the separators for the head entity, relation, and tail entity, respectively. Linearizing all triples in the knowledge graph according to the above template completes the linearization of the knowledge graph.

[0069] In one embodiment of this specification, a knowledge graph corresponding to the target object predicted by the initial text generation model is obtained. This knowledge graph is an e-commerce knowledge graph. The e-commerce knowledge graph is linearized by linearizing all triples within it, resulting in a linearized knowledge graph. This linearized knowledge graph is then fused with the initial encoding units in the initial text generation model to obtain a text generation model containing the encoding units. In summary, by linearizing the knowledge graph, it is possible to fuse the knowledge graph with the encoding units in the model, thereby endowing the text generation model with knowledge retrieval capabilities.

[0070] Furthermore, to enable the text generation model to perform knowledge retrieval in the knowledge graph based on text control information, a preset parameter template can be added to the initial encoding unit of the fused knowledge graph. Specifically, determining the text generation model containing the encoding unit based on the fusion result includes: determining the initial encoding unit of the fused knowledge graph based on the fusion result; determining the preset parameter template corresponding to the initial text generation model, wherein the preset parameter template is used to provide preset parameter input function for the encoding unit; concatenating the preset parameter template with the initial encoding unit of the fused knowledge graph, and generating a text generation model containing the encoding unit of the fused knowledge graph based on the concatenation result.

[0071] The preset parameter template provides the encoding unit with preset parameter input functionality, i.e., the ability to input text control information. The preset parameter template includes preset text control information parameters and prefix parameters. The content of the preset parameter template can be "A, B", where A is the global prefix and B is the preset text control information parameter. The global prefix helps maintain fixed parameters during text generation model training, requiring only a small number of parameter optimizations to achieve good training results with limited training data. Therefore, adding a global prefix token to the preset parameter template reduces the need for model parameter optimization, ensuring good training results even with less training data. The preset text control information parameter can be understood as basic text control information. When subsequent text control information is input to the text generation model, it can replace the preset text control information parameter, enabling the encoding unit to input text control information.

[0072] In one embodiment of this specification, an initial encoding unit of the fused knowledge graph is determined based on the fusion result of the knowledge graph and the encoding unit, and a preset parameter template is determined. The preset parameter template is "A, B", where A is the fixed global prefix (prefix token) corresponding to the text generation model, and B is a preset text control information parameter that is empty. The purpose is that when there is subsequent text control information input, the text control information can be added to this position so that the global prefix can be combined with the text control information, which is convenient for subsequent input into the encoding unit. Based on this, the encoding unit of the fused knowledge graph can be obtained, thereby obtaining a text generation model containing the encoding unit of the knowledge graph.

[0073] Furthermore, after determining the encoding unit structure of the text generation model, when inputting text generation information, the text generation model is encoded based on the encoding unit that integrates the knowledge graph. Specifically, the text generation information is encoded by the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing second entity information, including: updating the preset parameters in the preset parameter template according to the text control information; generating target input information based on the updated preset parameters and the first entity information; and encoding the target input information by the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing second entity information.

[0074] Specifically, after inputting text generation information into the text generation model, the text control information in the text generation model updates the preset parameters in the preset parameter template. The preset parameters can be understood as the basic text control information and global prefix in the preset parameter model. That is, it can be understood as putting the text control information into the preset parameter template and combining it with the global prefix to generate the updated preset parameters. Based on the updated preset parameters and the first entity information in the text generation information, the target input information can be generated. The target input information can be understood as the information that needs to be encoded, which may include the global prefix, text control information, and first entity information.

[0075] In practical applications, after encoding the target input information using the knowledge graph's encoding units, an encoded vector containing the second entity information can be obtained. This second entity information can be retrieved from the knowledge graph based on the first entity information and text control information. For example, if the first entity information is "mobile phone" and the text control information is "manufacturer," then the second entity information identified in the knowledge graph is Company A. By integrating the knowledge graph's encoding units and a preset parameter template structure, the text control information and the first entity information in the generated text information can be encoded to retrieve the second entity information. The text control information, global prefix, first entity information, and second entity information are then encoded to obtain an encoded vector containing the second entity information.

[0076] In specific implementation, the second entity information can be determined in the knowledge graph based on the first entity information and the text control information, and then encoding processing can be performed. Specifically, the text generation information is encoded by the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing the second entity information. This includes: determining the second entity information in the knowledge graph based on the first entity information and the text control information; encoding the first entity information, the text control information, and the second entity information based on the encoding unit that integrates the knowledge graph in the text generation model to obtain a first entity vector corresponding to the first entity information, a text control vector corresponding to the text control information, and a second entity vector corresponding to the second entity vector; and generating an encoding vector containing the second entity information based on the first entity vector, the text control vector, and the second entity vector.

[0077] The second entity information is obtained by encoding the first entity information, text control information and second entity information in the knowledge graph based on the retrieval results of the first entity information and text control information in the knowledge graph. After determining the second entity information, the encoding unit of the knowledge graph is used to encode the first entity information, text control information and second entity information to obtain an encoding vector containing the second entity information.

[0078] In practical applications, encoding the first entity information can yield a vector representation of the corresponding first entity information, i.e., the first entity vector. Similarly, the text control vector corresponding to the text control information and the second entity vector corresponding to the second entity information can be obtained.

[0079] In another feasible approach, the first entity information and text control information can be encoded first using an encoding unit that integrates a knowledge graph to obtain a first entity vector and a text control vector. Then, based on the first entity vector and the text control vector, the second entity vector corresponding to the second entity information can be directly searched in the knowledge graph, thereby generating an encoded vector containing the second entity information. Specifically, encoding the text generation information using an encoding unit that integrates a knowledge graph in the text generation model to obtain an encoded vector containing the second entity information includes: encoding the first entity information and the text control information using an encoding unit that integrates a knowledge graph in the text generation model to obtain a first entity vector corresponding to the first entity information and a text control vector corresponding to the text control information; determining the second entity vector corresponding to the second entity information in the knowledge graph based on the first entity vector and the text control vector; and generating an encoded vector containing the second entity information based on the first entity vector, the text control vector, and the second entity vector.

[0080] Since the knowledge graph integrated into the encoding unit has already undergone linearization, the second entity vector corresponding to the second entity information can be directly determined from the linearized knowledge graph based on the first entity vector and the text control vector. Then, an encoding vector containing the second entity information is generated based on the first entity vector, the text control vector, and the second entity vector.

[0081] In summary, by encoding the text control information, an encoded vector containing the second entity information can be obtained. Subsequently, decoding can be performed based on the encoded vector containing the second entity information to obtain a text sequence that meets the user's needs, thereby providing the user with more accurate descriptive text information.

[0082] Step 206: The encoding vector is decoded by the decoding unit in the text generation model to output the target text containing the text control information.

[0083] The target text containing text control information can be understood as text containing user requirements. Since the text control information is determined based on user characteristics, it can also be represented as information that reflects user requirements. Therefore, the target text fed back to the user needs to contain text control information.

[0084] In one embodiment of this specification, the encoded vector is decoded by the decoding unit in the text generation model, and the input is target text containing text control information, the target text being "The manufacturer of mobile phone A is Company A".

[0085] Based on this, by decoding the encoded vector containing the second entity information, the target text containing text control information output by the text generation model is obtained, thereby achieving controllability of text generation and ensuring that the generated target text meets user needs.

[0086] Furthermore, the decoding process involves converting the encoded vector into a text sequence, which can then be used to generate text. Specifically, the encoded vector is decoded by the decoding unit in the text generation model to output target text containing the text control information. This includes: decoding the encoded vector by the decoding unit in the text generation model to obtain a target text sequence containing the text control information; and determining the target text containing the text control information based on the target text sequence.

[0087] The target text sequence can be understood as the sequence obtained after decoding the encoded vector. Based on this sequence, target text that meets the user's needs can be generated. Since the encoded vector includes a first entity vector, a text control vector, and a second entity vector, the target text generated from the target text sequence contains text control information, reflecting the content the user wants to know. In specific implementation, this specification does not impose specific restrictions on the process of generating target text from the target text sequence; the implementation method can be determined according to specific circumstances.

[0088] In summary, this specification provides a text generation method that includes: acquiring user characteristics of a target user; determining text generation information associated with a target object based on the user characteristics, wherein the text generation information includes first entity information and text control information of the target object; inputting the text generation information into a text generation model; encoding the text generation information through an encoding unit that integrates a knowledge graph in the text generation model to obtain an encoding vector containing second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information; decoding the encoding vector through a decoding unit in the text generation model to output target text containing the text control information. By analyzing user characteristics to determine text control information and generating text generation information containing text control information, and processing the text generation model based on the encoding unit that integrates a knowledge graph, the method can output target text that meets user needs. It achieves controllability of the knowledge graph-to-text generation process, enabling the generation of more accurate target text, generating content from specific angles for users with different user characteristics, meeting the needs of different users, and improving the user experience.

[0089] Figure 3 A flowchart of a text generation method according to another embodiment of this specification is shown, including steps 302 to 308.

[0090] Step 302: Receive the text generation instruction submitted by the target user for the target object in the recommendation business.

[0091] The recommendation service can be understood as the business of recommending product information to users, enabling them to take subsequent actions based on the recommendations. For example, the recommendation service might send product recommendations to users, and if a user becomes interested in the product based on the recommendations, they can then proceed with the purchase. The text generation instruction can be understood as the instruction to generate product recommendation text information.

[0092] In one specific embodiment of this specification, a text generation instruction submitted by a target user for a product purchase transaction involving a brand A mobile phone is received, indicating that the target user wants to obtain relevant information about the brand A mobile phone.

[0093] Step 304: In response to the text generation instruction, obtain the user characteristics of the target user, and determine the text generation information associated with the target object based on the user characteristics.

[0094] In a specific embodiment of this specification, the user characteristics are "game enthusiast, social networking enthusiast". Based on the user characteristics, the text generation information associated with the A brand mobile phone is determined. The text generation information includes the first entity information of the A brand mobile phone and text control information. The text control information includes "mobile phone performance, mobile phone configuration".

[0095] Step 306: Input the text generation information into the text generation model for processing to obtain the target text output by the text generation model, wherein the text generation model includes an encoding unit and a decoding unit that integrates a knowledge graph.

[0096] In a specific embodiment of this specification, text generation information is input into a text generation model for processing to obtain the target text output by the model. The target text includes relevant configuration information of Brand A mobile phone and information introducing the advantages of Brand A mobile phone when playing games.

[0097] Step 308: Generate recommendation information based on the target text and the object resources of the target object, and feed the recommendation information back to the target user.

[0098] Among them, the object resources of the target object can be understood as the multimedia data resources of the target object, such as images, videos and other resources about the target object.

[0099] In a specific embodiment of this specification, recommendation information is generated based on the target text and images and videos of the A-brand mobile phone, and the recommendation information is displayed to the user so that the user can understand the configuration information of the A-brand mobile phone and the performance data of the A-brand mobile phone when playing games.

[0100] This specification provides a text generation method, comprising: receiving a text generation instruction submitted by a target user for a target object in a recommendation service; responding to the text generation instruction, acquiring the user characteristics of the target user, and determining text generation information associated with the target object based on the user characteristics; inputting the text generation information into a text generation model for processing to obtain target text output by the text generation model, wherein the text generation model includes an encoding unit and a decoding unit that integrates a knowledge graph; generating recommendation information based on the target text and the object resources of the target object, and feeding back the recommendation information to the target user. This method achieves the determination of text generation information based on user characteristics, and processes the text generation information through a text generation model that integrates an encoding unit that integrates a knowledge graph to obtain target text containing text control information. It enables control over the generation of target text through text generation information, allowing the generation of target text that meets user needs based on a knowledge graph, reducing the generation of invalid information, thereby achieving controllable text generation and improving text generation efficiency and hit rate.

[0101] The following is in conjunction with the appendix Figure 4 Taking the text generation method provided in this specification as an example of its application in user food search, the method for user food search will be further explained. Figure 4 A flowchart of a text generation method according to an embodiment of this specification is shown, with specific steps including steps 402 to 418.

[0102] Step 402: Receive the text generation instruction from the target user, and determine the identity information of the target user and the object information of the target object carried in the text generation instruction.

[0103] In one feasible approach, when a target user searches for nearby restaurants via a terminal and views detailed information about restaurant A based on the search results, the server receives a text generation instruction from the target user. This text generation instruction is used to generate descriptive information about restaurant A, and it carries the target user's identity information and the object information of restaurant A, so that the subsequent text generation model can generate text information about which aspects of restaurant A the user wants to know based on the text generation instruction.

[0104] Step 404: Obtain the user feature set of the target user based on the identity information, and select the user features associated with the target object from the user feature set based on the object information.

[0105] In one feasible approach, the user's user feature set is obtained based on the target user's account information, and the user features associated with restaurant A are selected from the user feature set, with the user features being "Sichuanese, loves spicy food".

[0106] Step 406: Determine the business domain to which the target object belongs, and determine the first entity information of the target object in the knowledge graph corresponding to the business domain.

[0107] In one feasible approach, the business domain of Restaurant A is determined to be the catering industry, and the first entity information of the target object is determined in the knowledge graph corresponding to the catering industry.

[0108] Step 408: Determine the text control information of the target object based on user characteristics, and generate text generation information associated with the target object based on the text control information and the first entity information.

[0109] In one feasible approach, the text control information of restaurant A is determined to be "cuisine, flavor" based on user characteristics, and text generation information "restaurant A-cuisine, restaurant A-flavor" is generated based on the text control information and the first entity information.

[0110] Step 410: Obtain the initial text generation model and the knowledge graph corresponding to the target object, and perform linearization on the knowledge graph to obtain a linearized knowledge graph.

[0111] In one feasible approach, an initial text generation model, i.e. a pre-trained language model, and a catering knowledge graph corresponding to restaurant A are obtained. This knowledge graph is then linearized to obtain a linearized knowledge graph.

[0112] Step 412: Fuse the linearized knowledge graph with the initial encoding unit of the initial text generation model, and determine the initial encoding unit of the fused knowledge graph based on the fusion result.

[0113] In one feasible approach, a preset parameter template corresponding to the initial text generation model is determined, wherein the preset parameter template is used to provide preset parameter input functions for the encoding unit, the preset parameter template is concatenated with the initial encoding unit of the fused knowledge graph, and a text generation model containing the encoding unit of the fused knowledge graph is generated based on the concatenation result.

[0114] Step 414: Input the text generation information into the text generation model, update the preset parameters in the preset parameter template according to the text control information, and generate the target input information based on the updated preset parameters and the first entity information.

[0115] In one feasible approach, "Restaurant A - Cuisine, Restaurant A - Flavor" is input into a text generation model. The preset parameters in the preset parameter template of the text generation model are updated based on the text control information in the text generation information. The preset parameters include prefix information and preset text control information. The target input information is generated based on the updated preset parameters and the first entity information. The target input information is "prefix information - text control information - first entity information".

[0116] Step 416: Encode the text generation information using the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing the second entity information.

[0117] Specifically, this includes determining the second entity information in the knowledge graph based on the first entity information and text control information, encoding the first entity information, text control information, and second entity information based on the encoding unit that integrates the knowledge graph in the text generation model, obtaining the first entity vector corresponding to the first entity information, the text control vector corresponding to the text control information, and the second entity vector corresponding to the second entity vector, and generating an encoded vector containing the second entity information based on the first entity vector, the text control vector, and the second entity vector.

[0118] In one feasible approach, second entity information is determined in a knowledge graph based on first entity information and text control information. The second entity information is the menu of restaurant A. The second entity information may also include corresponding attribute information, including the ingredients, flavor, and cuisine of each dish in the menu. The first entity information, text control information, and second entity information are encoded to obtain first entity vector, text control vector, and second entity vector, respectively, and an encoded vector containing the second entity information is generated.

[0119] Step 418: Decode the encoded vector using the decoding unit in the text generation model to obtain the target text sequence containing text control information, and determine the target text containing text control information based on the target text sequence.

[0120] In one feasible approach, the encoded vector is decoded by the decoding unit of the text generation model to obtain target text containing "cuisine and flavor". The target text could be "Restaurant A's cuisine is Sichuan cuisine, including spicy chicken, boiled fish, etc."

[0121] This specification provides a text generation method for users searching for food. It determines text generation information based on user characteristics, processes this information using a text generation model incorporating coding units that integrate a knowledge graph, and obtains target text containing text control information. This method enables control over target text generation through text generation information, generating target text that meets user needs based on a knowledge graph, reducing the generation of invalid information, thus achieving controllable text generation, improving efficiency and hit rate, and enhancing the user experience.

[0122] Corresponding to the above method embodiments, this specification also provides embodiments of a text generation apparatus. Figure 5 A schematic diagram of a text generation apparatus according to an embodiment of this specification is shown. Figure 5 As shown, the device includes:

[0123] The determination module 502 is configured to acquire user characteristics of the target user and determine text generation information associated with the target object based on the user characteristics, wherein the text generation information includes first entity information and text control information of the target object;

[0124] The encoding module 504 is configured to input the text generation information into the text generation model, and encode the text generation information through the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information.

[0125] The decoding module 506 is configured to decode the encoded vector through the decoding unit in the text generation model and output target text containing the text control information.

[0126] Optionally, the determining module 502 is further configured to:

[0127] Receive text generation instructions from the target user;

[0128] Determine the identity information of the target user and the object information of the target object carried in the text generation instruction;

[0129] Based on the identity information, obtain the user feature set of the target user, and based on the object information, select the user features associated with the target object from the user feature set.

[0130] Optionally, the determining module 502 is further configured to:

[0131] Determine the business domain to which the target object belongs, and determine the first entity information of the target object in the knowledge graph corresponding to the business domain;

[0132] Based on the user characteristics, the text control information of the target object is determined, and text generation information associated with the target object is generated based on the text control information and the first entity information.

[0133] Optionally, the device further includes a linearization module configured to:

[0134] Obtain the initial text generation model and the knowledge graph corresponding to the target object;

[0135] The knowledge graph is linearized to obtain a linearized knowledge graph;

[0136] The linearized knowledge graph is fused with the initial encoding unit of the initial text generation model;

[0137] The text generation model containing coding units is determined based on the fusion results.

[0138] Optionally, the linearization module is further configured to:

[0139] The initial encoding units of the fused knowledge graph are determined based on the fusion results;

[0140] Determine the preset parameter template corresponding to the initial text generation model, wherein the preset parameter template is used to provide preset parameter input function for the encoding unit;

[0141] The preset parameter template is concatenated with the initial encoding unit of the fused knowledge graph, and a text generation model containing the encoding unit of the fused knowledge graph is generated based on the concatenation result.

[0142] Optionally, the encoding module 504 is further configured to:

[0143] Update the preset parameters in the preset parameter template according to the text control information;

[0144] Target input information is generated based on the updated preset parameters and the first entity information;

[0145] The target input information is encoded by the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing the second entity information.

[0146] Optionally, the encoding module 504 is further configured to:

[0147] The second entity information is determined in the knowledge graph based on the first entity information and the text control information;

[0148] Based on the encoding unit that integrates knowledge graph in the text generation model, the first entity information, the text control information, and the second entity information are encoded to obtain the first entity vector corresponding to the first entity information, the text control vector corresponding to the text control information, and the second entity vector corresponding to the second entity vector.

[0149] Generate an encoded vector containing the second entity information based on the first entity vector, the text control vector, and the second entity vector.

[0150] Optionally, the decoding module 506 is further configured to:

[0151] The encoding vector is decoded by the decoding unit in the text generation model to obtain a target text sequence containing the text control information;

[0152] The target text containing the text control information is determined based on the target text sequence.

[0153] This specification provides a text generation device, comprising: a determination module configured to acquire user characteristics of a target user and determine text generation information associated with a target object based on the user characteristics, wherein the text generation information includes first entity information and text control information of the target object; an encoding module configured to input the text generation information into a text generation model and encode the text generation information through an encoding unit in the text generation model that integrates a knowledge graph to obtain an encoding vector containing second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information; and a decoding module configured to decode the encoding vector through a decoding unit in the text generation model and output target text containing the text control information. By determining text generation information based on user characteristics and processing the text generation information through a text generation model that integrates an encoding unit that integrates a knowledge graph, target text containing text control information is obtained. This achieves control over the generation of target text through text generation information, enabling the generation of target text that meets user needs based on a knowledge graph, reducing the generation of invalid information, thereby achieving controllable text generation and improving text generation efficiency and hit rate.

[0154] The above is an illustrative scheme of a text generation device according to this embodiment. It should be noted that the technical solution of this text generation device and the technical solution of the above-described text generation method belong to the same concept. For details not described in detail in the technical solution of the text generation device, please refer to the description of the technical solution of the above-described text generation method.

[0155] Corresponding to the above method embodiments, this specification also provides another embodiment of a text generation apparatus. Figure 6 A schematic diagram of a text generation apparatus according to another embodiment of this specification is shown. Figure 6 As shown, the device includes:

[0156] The receiving module 602 is configured to receive text generation instructions submitted by the target user for the target object in the recommendation service;

[0157] The determination module 604 is configured to, in response to the text generation instruction, acquire the user characteristics of the target user and determine the text generation information associated with the target object based on the user characteristics;

[0158] The processing module 606 is configured to input the text generation information into a text generation model for processing, and obtain the target text output by the text generation model, wherein the text generation model includes an encoding unit and a decoding unit that integrates a knowledge graph.

[0159] Feedback module 608 is configured to generate recommendation information based on the target text and the object resources of the target object, and to feed back the recommendation information to the target user.

[0160] This specification provides a text generation device that determines text generation information containing text control information based on user characteristics. The device processes this text generation information using a text generation model incorporating encoding units that integrate a knowledge graph to obtain target text containing the text control information. Based on the target text and relevant resources, it generates recommended information, enabling control over the generation of target text through text generation information. This allows for the generation of target text based on a knowledge graph that meets user needs, reducing the generation of invalid information and thus achieving controllable text generation. Furthermore, it improves text generation efficiency and hit rate, and combines the target text and target object resources to generate recommended information that users are more interested in about the target object.

[0161] The above is an illustrative scheme of a text generation device according to this embodiment. It should be noted that the technical solution of this text generation device and the technical solution of the above-described text generation method belong to the same concept. For details not described in detail in the technical solution of the text generation device, please refer to the description of the technical solution of the above-described text generation method.

[0162] Figure 7 A flowchart of a text generation method according to another embodiment of this specification is shown, including steps 702 to 708.

[0163] Step 702: Receive the text generation instruction submitted by the target user through the client.

[0164] Step 704: In response to the text generation instruction, obtain the user characteristics of the target user, and determine the text generation information associated with the target object based on the user characteristics, wherein the text generation information includes the first entity information and text control information of the target object.

[0165] Step 706: Input the text generation information into the text generation model, and encode the text generation information through the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing the second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information.

[0166] Step 708: The encoding vector is decoded by the decoding unit in the text generation model to output the target text containing the text control information, and the target text is fed back to the client.

[0167] Optionally, the method further includes:

[0168] Receive text generation instructions from the target user;

[0169] Determine the identity information of the target user and the object information of the target object carried in the text generation instruction;

[0170] Based on the identity information, obtain the user feature set of the target user, and based on the object information, select the user features associated with the target object from the user feature set.

[0171] Optionally, the method further includes:

[0172] Determine the business domain to which the target object belongs, and determine the first entity information of the target object in the knowledge graph corresponding to the business domain;

[0173] Based on the user characteristics, the text control information of the target object is determined, and text generation information associated with the target object is generated based on the text control information and the first entity information.

[0174] Optionally, the method further includes:

[0175] Obtain the initial text generation model and the knowledge graph corresponding to the target object;

[0176] The knowledge graph is linearized to obtain a linearized knowledge graph;

[0177] The linearized knowledge graph is fused with the initial encoding unit of the initial text generation model;

[0178] The text generation model containing coding units is determined based on the fusion results.

[0179] Optionally, the method further includes:

[0180] The initial encoding units of the fused knowledge graph are determined based on the fusion results;

[0181] Determine the preset parameter template corresponding to the initial text generation model, wherein the preset parameter template is used to provide preset parameter input function for the encoding unit;

[0182] The preset parameter template is concatenated with the initial encoding unit of the fused knowledge graph, and a text generation model containing the encoding unit of the fused knowledge graph is generated based on the concatenation result.

[0183] Optionally, the method further includes:

[0184] Update the preset parameters in the preset parameter template according to the text control information;

[0185] Target input information is generated based on the updated preset parameters and the first entity information;

[0186] The target input information is encoded by the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing the second entity information.

[0187] Optionally, the method further includes:

[0188] The second entity information is determined in the knowledge graph based on the first entity information and the text control information;

[0189] Based on the encoding unit that integrates knowledge graph in the text generation model, the first entity information, the text control information, and the second entity information are encoded to obtain the first entity vector corresponding to the first entity information, the text control vector corresponding to the text control information, and the second entity vector corresponding to the second entity vector.

[0190] Generate an encoded vector containing the second entity information based on the first entity vector, the text control vector, and the second entity vector.

[0191] Optionally, the method further includes:

[0192] The encoding vector is decoded by the decoding unit in the text generation model to obtain a target text sequence containing the text control information;

[0193] The target text containing the text control information is determined based on the target text sequence.

[0194] This specification provides a text generation method that receives a text generation instruction submitted by a target user through a client; in response to the text generation instruction, it acquires the user characteristics of the target user and determines text generation information associated with a target object based on the user characteristics, wherein the text generation information includes first entity information and text control information of the target object; it inputs the text generation information into a text generation model, and encodes the text generation information through an encoding unit that integrates a knowledge graph in the text generation model to obtain an encoding vector containing second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information; it decodes the encoding vector through a decoding unit in the text generation model, outputs target text containing the text control information, and feeds back the target text to the client. Based on user characteristics, text generation information containing text control information is determined. This information is then processed by a text generation model incorporating encoding units that integrate knowledge graphs to obtain target text containing the control information. Recommendation information is then generated based on the target text and relevant resources. This approach enables control over the generation of target text through text generation information. It can generate target text that meets user needs based on knowledge graphs, reducing the generation of invalid information and thus achieving controllable text generation. Furthermore, it can improve text generation efficiency and hit rate. Finally, it combines the target text and target object resources to generate recommendation information that users are more likely to want to know about the target object.

[0195] Figure 8 A structural block diagram of a computing device 800 according to an embodiment of this specification is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.

[0196] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0197] In one embodiment of this specification, the above-described components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0198] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 800 can also be a mobile or stationary server.

[0199] The processor 820 implements the text generation method when executing the computer instructions.

[0200] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the text generation method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the text generation method described above.

[0201] An embodiment of this specification also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the text generation method as described above.

[0202] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the text generation method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the text generation method described above.

[0203] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described text generation method.

[0204] The above is an illustrative example of a computer program according to this embodiment. It should be noted that the technical solution of this computer program belongs to the same concept as the technical solution of the text generation method described above. Details not described in detail in the technical solution of the computer program can be found in the description of the technical solution of the text generation method described above.

[0205] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0206] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0207] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0208] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0209] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.< / t> < / r> < / h> < / t> < / r> < / h>

Claims

1. A text generation method, comprising: Obtain the user characteristics of the target user, and determine the text generation information associated with the target object based on the user characteristics, wherein the text generation information includes the first entity information and text control information of the target object; The text generation information is input into a text generation model, and the text generation information is encoded by an encoding unit that integrates a knowledge graph in the text generation model to obtain an encoding vector containing second entity information. The second entity information is obtained from the knowledge graph by the first entity information and the text control information. The process of encoding the text generation information by the encoding unit that integrates a knowledge graph in the text generation model to obtain the encoding vector containing the second entity information includes: updating preset parameters in a preset parameter template according to the text control information, wherein the preset parameter template is used to provide preset parameter input functionality for the encoding unit; generating target input information based on the updated preset parameters and the first entity information; and encoding the target input information by the encoding unit that integrates a knowledge graph in the text generation model to obtain the encoding vector containing the second entity information. The encoding vector is decoded by the decoding unit in the text generation model to output the target text containing the text control information.

2. The method as described in claim 1, wherein obtaining the user characteristics of the target user includes: Receive text generation instructions from the target user; Determine the identity information of the target user and the object information of the target object carried in the text generation instruction; Based on the identity information, obtain the user feature set of the target user, and based on the object information, select the user features associated with the target object from the user feature set.

3. The method as described in claim 1, wherein determining the text generation information of the associated target object based on the user characteristics includes: Determine the business domain to which the target object belongs, and determine the first entity information of the target object in the knowledge graph corresponding to the business domain; Based on the user characteristics, the text control information of the target object is determined, and text generation information associated with the target object is generated based on the text control information and the first entity information.

4. The method as described in claim 1 or 3, further comprising, before inputting the text generation information into the text generation model: Obtain the initial text generation model and the knowledge graph corresponding to the target object; The knowledge graph is linearized to obtain a linearized knowledge graph; The linearized knowledge graph is fused with the initial encoding unit of the initial text generation model; The text generation model containing coding units is determined based on the fusion results.

5. The method of claim 4, wherein determining a text generation model containing encoding units based on the fusion result includes: The initial encoding units of the fused knowledge graph are determined based on the fusion results; Determine the preset parameter template corresponding to the initial text generation model; The preset parameter template is concatenated with the initial encoding unit of the fused knowledge graph, and a text generation model containing the encoding unit of the fused knowledge graph is generated based on the concatenation result.

6. The method as described in claim 1, wherein the text generation information is encoded by an encoding unit that integrates a knowledge graph in the text generation model to obtain an encoding vector containing second entity information, comprising: The second entity information is determined in the knowledge graph based on the first entity information and the text control information; Based on the encoding unit that integrates knowledge graph in the text generation model, the first entity information, the text control information, and the second entity information are encoded to obtain the first entity vector corresponding to the first entity information, the text control vector corresponding to the text control information, and the second entity vector corresponding to the second entity information. Generate an encoded vector containing the second entity information based on the first entity vector, the text control vector, and the second entity vector.

7. The method as described in claim 1, wherein the encoding vector is decoded by the decoding unit in the text generation model to output target text containing the text control information, comprising: The encoding vector is decoded by the decoding unit in the text generation model to obtain a target text sequence containing the text control information; The target text containing the text control information is determined based on the target text sequence.

8. A text generation method, comprising: Receive text generation instructions submitted by the target user for the target object in the recommendation business; In response to the text generation instruction, the user characteristics of the target user are obtained, and text generation information associated with the target object is determined based on the user characteristics, wherein the text generation information includes first entity information and text control information of the target object; The text generation information is input into a text generation model for processing to obtain the target text output by the text generation model. The text generation model includes an encoding unit and a decoding unit that integrates a knowledge graph. The text generation information is encoded by the encoding unit integrating the knowledge graph in the text generation model to obtain an encoding vector containing second entity information. The second entity information is obtained from the knowledge graph by the first entity information and the text control information. The process of encoding the text generation information by the encoding unit integrating the knowledge graph in the text generation model to obtain the encoding vector containing the second entity information includes: updating preset parameters in a preset parameter template according to the text control information, wherein the preset parameter template provides preset parameter input functionality for the encoding unit; generating target input information based on the updated preset parameters and the first entity information; and encoding the target input information by the encoding unit integrating the knowledge graph in the text generation model to obtain the encoding vector containing the second entity information. Recommendation information is generated based on the target text and the object resources of the target object, and the recommendation information is fed back to the target user.

9. A text generation method, applied on a server-side, comprising: Receive text generation instructions submitted by the target user through the client; In response to the text generation instruction, the user characteristics of the target user are obtained, and text generation information associated with the target object is determined based on the user characteristics, wherein the text generation information includes the first entity information and text control information of the target object; The text generation information is input into a text generation model, and the text generation information is encoded by an encoding unit that integrates a knowledge graph in the text generation model to obtain an encoding vector containing second entity information. The second entity information is obtained from the knowledge graph by the first entity information and the text control information. The process of encoding the text generation information by the encoding unit that integrates a knowledge graph in the text generation model to obtain the encoding vector containing the second entity information includes: updating preset parameters in a preset parameter template according to the text control information, wherein the preset parameter template is used to provide preset parameter input functionality for the encoding unit; generating target input information based on the updated preset parameters and the first entity information; and encoding the target input information by the encoding unit that integrates a knowledge graph in the text generation model to obtain the encoding vector containing the second entity information. The encoding vector is decoded by the decoding unit in the text generation model to output the target text containing the text control information, and the target text is fed back to the client.

10. A text generation apparatus, comprising: The determination module is configured to acquire user characteristics of the target user and determine text generation information associated with the target object based on the user characteristics, wherein the text generation information includes first entity information and text control information of the target object; The encoding module is configured to input the text generation information into the text generation model, and encode the text generation information through the encoding unit that integrates the knowledge graph in the text generation model to obtain an encoding vector containing second entity information, wherein the second entity information is obtained from the knowledge graph by the first entity information and the text control information; The encoding module is further configured to update the preset parameters in the preset parameter template according to the text control information, wherein the preset parameter template is used to provide the encoding unit with preset parameter input function; generate target input information based on the updated preset parameters and the first entity information; and encode the target input information through the encoding unit that integrates knowledge graph in the text generation model to obtain an encoding vector containing the second entity information. The decoding module is configured to decode the encoded vector through the decoding unit in the text generation model and output target text containing the text control information.

11. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor, when executing the computer instructions, performs the steps of the method according to any one of claims 1-7, 8, or 9.

12. A computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1-7, 8, or 9.

13. A computer program product comprising computer instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1-7, 8, or 9.