Response information generation method and device, electronic equipment and storage medium

By constructing a knowledge graph and a set of question-answer pairs, and using a large language model to generate response information, the problem of insufficient efficiency and accuracy in response information generation in existing technologies is solved, achieving efficient and accurate response information generation and improving the user interaction experience.

CN119271794APending Publication Date: 2025-01-07BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411155037.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently generate accurate response information, especially when users interact with text content, as they cannot effectively filter and generate response information that matches the target question.

Method used

By constructing a knowledge graph and a set of question-answer pairs, and using a large language model to generate response information, including information extraction, text slicing, question-answer pair construction, and a combined retrieval-generation method, accurate response information is generated.

Benefits of technology

It improves the efficiency and accuracy of response information generation, enhances the user's interactive experience and sense of participation with text content, and provides a brand-new way of interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271794A_ABST
    Figure CN119271794A_ABST
Patent Text Reader

Abstract

The invention provides a response information generation method and device, electronic equipment and a storage medium, and relates to the artificial intelligence fields of natural language processing, knowledge maps, deep learning, large models and the like. The method comprises the steps of obtaining a target question input by a user, wherein the target question is a question proposed for a target text; a question-answer pair matched with the target question is screened out from a question-answer pair set to serve as a target question-answer pair, the question-answer pair set comprises a plurality of question-answer pairs generated based on the target text, and each question-answer pair comprises the question and corresponding response information; and generating target response information corresponding to the target question according to the target question and the target question-answer pair. By applying the scheme, the generation efficiency, accuracy and the like of the target response information can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to methods, devices, electronic devices and storage media for generating response information in the fields of natural language processing, knowledge graphs, deep learning and large models. Background Art

[0002] In actual applications, users may have the need to conduct content Q&A on a certain text. For example, when reading a novel, users hope to interact with the system, ask questions about the content of the novel and obtain corresponding response (answer) information. Summary of the invention

[0003] The present disclosure provides a response information generation method, device, electronic device and storage medium.

[0004] A method for generating response information, comprising:

[0005] Obtaining a target question input by a user, wherein the target question is a question asked for a target text;

[0006] Filtering a question-answer pair matching the target question from the question-answer pair set as a target question-answer pair, wherein the question-answer pair set includes a plurality of question-answer pairs generated based on the target text, each question-answer pair includes a question and corresponding answer information;

[0007] According to the target question and the target question-answer pair, target answer information corresponding to the target question is generated.

[0008] A response information generating device comprises: an acquisition module, a screening module and a generating module;

[0009] The acquisition module is used to acquire a target question input by a user, wherein the target question is a question raised for a target text;

[0010] The screening module is used to screen out a question-answer pair matching the target question from the question-answer pair set as the target question-answer pair, wherein the question-answer pair set includes a plurality of question-answer pairs generated based on the target text, each question-answer pair includes a question and corresponding answer information;

[0011] The generation module is used to generate target answer information corresponding to the target question based on the target question and the target question-answer pair.

[0012] An electronic device, comprising:

[0013] at least one processor; and

[0014] a memory communicatively connected to the at least one processor; wherein,

[0015] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.

[0016] A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method as described above.

[0017] A computer program product comprises a computer program / instruction, wherein the computer program / instruction implements the method described above when executed by a processor.

[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0020] Figure 1 This is a flow chart of an embodiment of the method for generating response information disclosed in the present invention;

[0021] Figure 2 This is a schematic diagram of the implementation process of the pretreatment process described in the present disclosure;

[0022] Figure 3 This is a schematic diagram of the implementation flow of the dialogue generation process described in the present disclosure;

[0023] Figure 4 This is a schematic diagram of the structure of the first embodiment 400 of the response information generating device disclosed in the present invention;

[0024] Figure 5 This is a schematic diagram of the structure of the second embodiment 500 of the response information generating device of the present disclosure;

[0025] Figure 6 A schematic block diagram of an electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0026] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0027] In addition, it should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0028] Figure 1 Flow chart of an embodiment of the method for generating response information disclosed in the present invention. Figure 1 As shown, the following specific implementation methods are included.

[0029] In step 101, a target question input by a user is obtained, where the target question is a question asked for a target text.

[0030] In step 102, a question-answer pair matching the target question is selected from a question-answer pair set as a target question-answer pair. The question-answer pair set includes multiple question-answer pairs generated based on the target text, and each question-answer pair includes a question and corresponding answer information.

[0031] In step 103, target answer information corresponding to the target question is generated according to the target question and the target question-answer pair.

[0032] By adopting the scheme described in the above method embodiment, a corresponding question-answer pair set can be pre-constructed for the target text. In this way, after obtaining the target question input by the user, the question-answer pairs matching the target question can be screened out from the question-answer pair set, and then the required target response information can be generated according to the target question and the screened question-answer pairs. The whole process is simple and convenient to implement, thereby improving the efficiency of generating the target response information. Moreover, by generating the target response information with the help of the question-answer pairs in the question-answer pair set, the accuracy of the obtained target response information can be improved.

[0033] In practical applications, the target text may be a novel, etc. Accordingly, the user may ask questions about the content of the novel while reading the novel. To distinguish the questions from other questions that may arise later, the questions asked by the user are called target questions.

[0034] For the target question, a question-answer pair that matches the target question can be screened out from the question-answer pair set as the target question-answer pair. The question-answer pair set includes multiple question-answer pairs generated based on the target text, and each question-answer pair includes a question and corresponding answer information.

[0035] The question-answer pair set may be pre-generated. In some embodiments of the present disclosure, before obtaining the target question input by the user, information extraction may be performed on the target text, and a knowledge graph corresponding to the target text may be constructed based on the information extraction result, and then a question-answer pair set may be constructed based on the knowledge graph.

[0036] Through the above processing, a knowledge graph can be constructed based on the information extracted from the entire target text, so that the text content in the target text can be fully understood based on the knowledge graph, thereby improving the comprehensiveness and accuracy of the subsequently constructed question and answer pair set.

[0037] In some embodiments of the present disclosure, the method of extracting information from a target text may include: in response to determining that the number of characters included in the target text is less than or equal to a first threshold, directly extracting information from the target text; in response to determining that the number of characters included in the target text is greater than the first threshold, slicing the target text to obtain at least two sliced ​​texts, each of which includes a number of characters less than or equal to the first threshold, and extracting information from each sliced ​​text. The specific value of the first threshold may be determined according to actual needs.

[0038] In practical applications, a pre-trained information extraction model can be used to extract information from the target text. The information extraction model can be a large language model (LLM).

[0039] The information extraction model usually has certain requirements for the number of characters in the input text content. If the requirements are exceeded, the accuracy will be reduced. Therefore, for the target text, it can be first determined whether the number of characters included therein is less than or equal to the first threshold. If so, the information extraction model can be directly used to extract information from the target text. Otherwise, the target text can be sliced ​​to obtain at least two sliced ​​texts whose number of characters is less than or equal to the first threshold. For example, the target text can be sliced ​​according to chapters, and then the information extraction model can be used to extract information from each sliced ​​text.

[0040] Through the above processing, the number of characters in the text content that is the object of information extraction can be effectively limited, thereby facilitating subsequent processing, such as enabling the input of the model to better adapt to the processing capabilities of the model, thereby improving the accuracy of the information extraction results.

[0041] In some embodiments of the present disclosure, the information extraction results may include: entities, attribute information of entities, relationship information between entities, and event information related to entities. In addition, in some embodiments of the present disclosure, the information extraction results may also include: dialogue information between characters in the target text.

[0042] An entity refers to a word or phrase in a text that represents a specific thing, which may include names of people (characters), place names, names of institutions, etc. Taking a character entity (for ease of description, referred to as entity 1) as an example, the attribute information of entity 1 may include age, gender, place of residence, etc., and the relationship information between entities may include the relationship information between entity 1 and other entities, such as the father of entity 1 is Zhang San and the mother is Li Si. Event information related to entity 1 may include that the father was named king in the third year of Qianyuan, etc. In addition, the dialogue information between the characters in the target text refers to the specific dialogue content between the characters appearing in the target text (such as the characters appearing in the novel).

[0043] It can be seen that the information extraction results include various entities appearing in the target text and related diversified information (attribute information, relationship information, event information, dialogue information), thus laying a good foundation for the subsequent knowledge graph construction.

[0044] Accordingly, a knowledge graph corresponding to the target text can be constructed based on the information extraction results. In some embodiments of the present disclosure, if the target text is not sliced, the knowledge graph corresponding to the target text can be directly constructed based on the information extraction results corresponding to the target text; if the target text is sliced, the knowledge graph corresponding to the target text can be constructed based on the information extraction results corresponding to each sliced ​​text.

[0045] That is, if the target text is sliced, and a total of 5 sliced ​​texts are obtained, then the knowledge graph can be constructed by combining the information extraction results corresponding to the 5 sliced ​​texts. There is no restriction on how to construct the knowledge graph, and the existing construction method can be used. The constructed knowledge graph may include entities, attribute information of entities, relationship information between entities, and event information related to entities. In addition, it may also include dialogue information between characters in the target text, thereby forming a comprehensive and in-depth framework for understanding the content of the target text. Accordingly, the content of the target text can be fully understood and analyzed with the help of the knowledge graph, avoiding problems such as information isolation.

[0046] Furthermore, a set of question-answer pairs can be constructed based on the knowledge graph. In some embodiments of the present disclosure, questions can be constructed based on entities in the knowledge graph, attribute information of entities, relationship information between entities, and event information related to entities, with the goal of covering all questions that users may ask, and answer information corresponding to each constructed question can be generated to obtain a set of question-answer pairs.

[0047] For example, for each entity, corresponding global question-answer pairs, category-based question-answer pairs, and fine-grained question-answer pairs can be constructed respectively.

[0048] Among them, the global question-answer pair can be constructed based on entity + global information (attribute information, relationship information and event information). For example, for a person entity 1, its attribute information includes: age: 24 years old, gender: male, residence: Kyoto South City, relationship information includes: father: Zhang San, mother: Li Si, event information includes: father was crowned king in the third year of Qianyuan, then the following global question can be constructed: Who was crowned king in the third year of Qianyuan, and the corresponding response information is: Zhang San, thus obtaining a global question-answer pair, and similarly, multiple global question-answer pairs can be constructed.

[0049] The categorized question-answer pairs can be constructed based on the following information: entity + attribute information, entity + relationship information, entity + event information. For example, still taking the above entity 1 as an example, based on the entity + relationship information, the following categorized question can be constructed: Who are the family members of entity 1? The corresponding answer information is: father Zhang San, mother Li Si, thus obtaining a categorized question-answer pair. Similarly, for entity + attribute information and entity + event information, corresponding multiple categorized question-answer pairs can also be constructed respectively.

[0050] Fine-grained question-answer pairs can be constructed based on the following information: entity + a specific attribute, entity + a specific relationship. For example, taking the above entity 1 as an example, its attribute information includes three specific attributes: age, gender, and place of residence. Taking the specific attribute of age as an example, the following fine-grained question can be constructed: How old is entity 1? The corresponding answer information is: 24 years old, thus obtaining a fine-grained question-answer pair. For another example, the relationship information of entity 1 includes two specific relationships. Taking relationship 1 (father: Zhang San) as an example, the following fine-grained question can be constructed: Who is the father of entity 1? The corresponding answer information is: Zhang San, thus obtaining another fine-grained question-answer pair.

[0051] The questions in each question-answer pair and the corresponding answer information can be automatically generated by a pre-trained question-answer pair generation model. The question-answer pair generation model can be a large language model, that is, the large language model can automatically generate various questions and corresponding answer information based on the content in the knowledge graph, and then the generated question-answer pairs can be used to form the required question-answer pair set.

[0052] Through the above processing, the question-answer pair set can cover various content question-answering capabilities in the target text, and can improve the comprehensiveness and accuracy of the obtained question-answer pair set to meet the different question-asking needs of users.

[0053] After obtaining the question-answer pair set, for the target question input by the user, the question-answer pair that matches the target question can be screened out from the question-answer pair set as the target question-answer pair.

[0054] In some embodiments of the present disclosure, the K questions that best match the target question can be screened out from the questions in the question-answer pair set according to the Approximate Nearest Neighbor Index (ANN) constructed for each question in the question-answer pair set through the Retrieval-Augmented Generation (RAG) method, where K is a positive integer, and the question-answer pairs containing the screened K questions can be used as the target question-answer pairs. The specific value of K can be determined according to actual needs, such as 3.

[0055] For example, each question in the question-answer set can be embedded to generate a vector, and an ANN index can be built based on the vector for fast retrieval and recall. In addition, the RAG method is used to combine the advantages of retrieval and generation, thereby improving the accuracy and efficiency of the K questions obtained.

[0056] After obtaining the target question-answer pair, the target answer information corresponding to the target question can be generated according to the target question and the target question-answer pair.

[0057] In some embodiments of the present disclosure, the target question and the response information in the target question-answer pair may be used as inputs to a response generation model to obtain target response information output by the response generation model.

[0058] The response generation model can be a large language model. Assuming that the value of K is 3, a prompt word can be constructed based on the target question and the response information in the three target question-answer pairs, and input into the response generation model to obtain the target response information generated and output by the response generation model.

[0059] That is to say, with the help of the response generation model, the required target response information can be obtained efficiently and accurately, and the target response information can be returned to the user in a timely manner. The target response information is usually in text form.

[0060] In addition, in some embodiments of the present disclosure, after obtaining the target question input by the user, the target role corresponding to this question and answer can also be determined, and the character portrait information of the target role can be obtained. The target role is the character that appears in the target text. Accordingly, the target question, the character portrait information, and the response information in the target question and answer pair can be used as input to the response generation model to obtain the target response information that meets the characteristics of the target role output by the response generation model.

[0061] As mentioned above, the information extraction result may also include: the dialogue information between the characters in the target text. In some embodiments of the present disclosure, character portrait information of each character may be generated according to the dialogue information between the characters, and accordingly, each character may be displayed to the user in the form of a list, and the character selected by the user from the list may be used as the target character, and the character portrait information of the target character may be obtained.

[0062] For example, for each character, the following processing can be performed separately: the conversation information related to the character is used as the input of the portrait generation model, and the character portrait information of the character is obtained as the output of the portrait generation model. The portrait generation model can be a large language model, and the character portrait information can include the character's language style, personality characteristics and character background, etc.

[0063] When the user selects the target character, the character portrait information of the target character can be obtained, and the target question, the character portrait information of the target character and the response information in the target question and answer pair can be used as the input of the response generation model to obtain the target response information that meets the characteristics of the target character output by the response generation model.

[0064] If we assume that the value of K is 3, then a prompt can be constructed based on the target question, the character portrait information of the target role, and the response information in the three target question-answer pairs, and input into the response generation model to obtain the target response information generated and output by the response generation model that conforms to the language style, personality characteristics, and character background of the target role.

[0065] Through the above processing, the role imitation ability can be improved, that is, the identity of the target role can be imitated to communicate with the user, thereby enhancing the user's interactive experience and sense of participation.

[0066] For the sake of ease of expression, the process of slicing the target text to obtain segmented text, extracting information from the sliced ​​text, constructing a knowledge graph based on the information extraction results, and constructing a question-answer pair set based on the knowledge graph is called a preprocessing process, and the process of obtaining the target question input by the user and generating the corresponding target answer information is called a dialogue generation process.

[0067] Figure 2 Schematic diagram of the implementation process of the pre-processing process described in the present disclosure. Figure 2As shown in the figure, assuming that the target text is a novel, multiple sliced ​​texts can be obtained by slicing it. For each sliced ​​text, information extraction can be performed separately, so as to obtain the information extraction results corresponding to each sliced ​​text. The information extraction results may include: entities, attribute information of entities, relationship information between entities, event information related to entities, and dialogue information between characters in the target text, among which entities, attribute information of entities, relationship information between entities, and event information related to entities can all be called entity information. Figure 2 As described above, a knowledge graph can also be constructed based on the information extraction results. Furthermore, questions can be constructed based on the entities in the knowledge graph, the attribute information of the entities, the relationship information between the entities, and the event information related to the entities, with the goal of covering all questions that the user may ask, and the corresponding answer information for each constructed question can be generated separately. For example, for each entity, corresponding global question-answer pairs, categorized question-answer pairs, and fine-grained question-answer pairs can be constructed separately, and then the constructed question-answer pairs can be used to form a question-answer pair set and an index can be constructed for the question-answer pair set, etc. Figure 2 The Q in stands for question, and A stands for answer information. Figure 2 As shown, character portrait information of each character can also be generated based on the dialogue information between the characters in the knowledge graph.

[0068] Figure 3 Schematic diagram of the implementation process of the dialogue generation process described in the present disclosure. Figure 3 As shown, the target question input by the user can be obtained, and the question-answer pair that matches the target question can be screened out from the question-answer pair set as the target question-answer pair. In addition, the target role corresponding to this question and answer can be determined, and the character portrait information of the target role can be obtained. After that, the target question, the character portrait information of the target role, and the answer information in the target question-answer pair can be used as the input of the answer generation model to obtain the target answer information that meets the characteristics of the target role output by the answer generation model.

[0069] It should be noted that, for the aforementioned method embodiment, for the sake of simplicity of description, it is expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present disclosure. In addition, for parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0070] The above is an introduction to the method embodiment. The following is a further explanation of the scheme disclosed in the present invention through an apparatus embodiment.

[0071] Figure 4 FIG. 4 is a schematic diagram of the composition structure of the first embodiment 400 of the response information generating device described in the present disclosure. Figure 4 As shown, it includes: an acquisition module 401, a screening module 402 and a generation module 403.

[0072] The acquisition module 401 is used to acquire a target question input by a user, where the target question is a question asked for a target text.

[0073] The screening module 402 is used to screen out question-answer pairs that match the target question from the question-answer pair set as the target question-answer pairs. The question-answer pair set includes multiple question-answer pairs generated based on the target text, and each question-answer pair includes a question and corresponding answer information.

[0074] The generation module 403 is used to generate target answer information corresponding to the target question based on the target question and the target question-answer pair.

[0075] By adopting the scheme described in the above-mentioned device embodiment, a corresponding question-answer pair set can be pre-constructed for the target text. In this way, after obtaining the target question input by the user, the question-answer pairs matching the target question can be screened out from the question-answer pair set, and then the required target response information can be generated according to the target question and the screened question-answer pairs. The whole process is simple and convenient to implement, thereby improving the efficiency of generating the target response information. Moreover, by generating the target response information with the help of the question-answer pairs in the question-answer pair set, the accuracy of the obtained target response information can be improved.

[0076] Figure 5 FIG. 5 is a schematic diagram of the structure of the second embodiment 500 of the response information generating device of the present disclosure. Figure 5 The method comprises: an acquisition module 401 , a screening module 402 , a generation module 403 and a pre-processing module 404 .

[0077] Among them, the acquisition module 401, the screening module 402 and the generation module 403 are Figure 4 The same is true in the illustrated embodiment.

[0078] The preprocessing module 404 is used to extract information from the target text, and can construct a knowledge graph corresponding to the target text based on the information extraction result, and then can construct a question-answer pair set based on the knowledge graph.

[0079] In some embodiments of the present disclosure, the way in which the preprocessing module 404 extracts information from the target text may include: in response to determining that the number of characters included in the target text is less than or equal to a first threshold, directly extracting information from the target text; in response to determining that the number of characters included in the target text is greater than the first threshold, slicing the target text to obtain at least two sliced ​​texts, each of which includes a number of characters less than or equal to the first threshold, and extracting information from each sliced ​​text respectively.

[0080] In some embodiments of the present disclosure, the information extraction result may include: entities, attribute information of entities, relationship information between entities, and event information related to entities.

[0081] Accordingly, a knowledge graph corresponding to the target text can be constructed based on the information extraction results. In some embodiments of the present disclosure, if the target text is not sliced, the preprocessing module 404 can directly construct a knowledge graph corresponding to the target text based on the information extraction results corresponding to the target text. If the target text is sliced, the preprocessing module 404 can construct a knowledge graph corresponding to the target text based on the information extraction results corresponding to each sliced ​​text.

[0082] Furthermore, a set of question-answer pairs can be constructed based on the knowledge graph. In some embodiments of the present disclosure, the preprocessing module 404 can construct questions based on entities in the knowledge graph, attribute information of entities, relationship information between entities, and event information related to entities, with the goal of covering all questions that may be asked by users, and can generate answer information corresponding to each constructed question to obtain a set of question-answer pairs.

[0083] After obtaining the question-answer pair set, the screening module 402 can screen out the question-answer pairs that match the target question from the question-answer pair set as the target question-answer pairs for the target question input by the user obtained by the obtaining module 401.

[0084] In some embodiments of the present disclosure, the screening module 402 may screen out K questions that best match the target question from the questions in the question-answer pair set based on the ANN index constructed for each question in the question-answer pair set through the RAG method, where K is a positive integer, and the question-answer pairs containing the screened K questions may be used as the target question-answer pairs.

[0085] After obtaining the target question-answer pair, the generation module 403 may generate target answer information corresponding to the target question according to the target question and the target question-answer pair. In some embodiments of the present disclosure, the generation module 403 may use the target question and the answer information in the target question-answer pair as inputs to the answer generation model to obtain the target answer information output by the answer generation model.

[0086] In addition, in some embodiments of the present disclosure, the generation module 403 can also determine the target role corresponding to the current question and answer, and can obtain the character portrait information of the target role. The target role is the character that appears in the target text. Accordingly, the target question, the character portrait information, and the response information in the target question and answer pair can be used as inputs to the response generation model to obtain the target response information that meets the characteristics of the target role output by the response generation model.

[0087] As mentioned above, the information extraction result may also include: the dialogue information between the characters in the target text. In some embodiments of the present disclosure, the preprocessing module 404 may also generate character portrait information of each character according to the dialogue information between the characters. Accordingly, the generating module 403 may display each character to the user in the form of a list, and may use the character selected by the user from the list as the target character, thereby obtaining the character portrait information of the target character.

[0088] Figure 4 and Figure 5 The specific working process of the device embodiment shown can refer to the relevant description in the aforementioned method embodiment, which will not be repeated here.

[0089] In summary, by adopting the scheme described in the present invention, with the help of the knowledge graph constructed for the target text, the required target response information can be generated efficiently and accurately, and the role imitation capability is provided, so that users can not only ask questions at any time and obtain accurate response information, but also enhance the user's interactive experience and sense of participation, that is, it provides users with a new way of interaction and experience, and improves the accessibility and entertainment of texts such as novel content.

[0090] In addition, the scheme disclosed in the present invention can be applied to different scenarios, such as: 1) electronic readers and reading applications: users can interact with the system while reading novels, ask questions about the content of the novels and get accurate answers; 2) intelligent assistants and voice assistants: through role imitation capabilities, intelligent assistants can interact with users as characters in novels, increasing entertainment and interactivity; 3) education and training: in literary education and training, it can help students understand and analyze the content of novels, and improve learning effects through questions and answers and role-playing; 4) content creation and editing: it can help writers and editors to conduct detailed analysis and questions and answers on the plots and characters in novels, and assist in creation and editing work; 5) virtual reality and augmented reality: by simulating novel scenes and character interactions, it can provide users with an immersive experience, etc. In other words, the scheme disclosed in the present invention has wide applicability.

[0091] Furthermore, by adopting the solution disclosed in the present invention, the product becomes not only a carrier of information exchange, but also a carrier of interest exchange and community entertainment, thereby enhancing the user's sense of identity and belonging, and further increasing the user's stickiness and satisfaction.

[0092] The scheme disclosed in the present invention can be applied to the field of artificial intelligence, especially to the fields of natural language processing, knowledge graph, deep learning and large models. Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It has both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology and other major directions.

[0093] In addition, the target text, questions, and answer information in the embodiments described in this disclosure are not targeted at a specific user and do not reflect the personal information of a specific user. In the technical solution of this disclosure, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0094] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0095] Figure 6 A schematic block diagram of an electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0096] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 to a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0097] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0098] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI, Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSP, Digital Signal Processing), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the methods described in the present disclosure. For example, in some embodiments, the methods described in the present disclosure may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the methods described in the present disclosure may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the method described in the present disclosure in any other appropriate manner (for example, by means of firmware).

[0099] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard parts (ASSPs), system on chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs, which can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a dedicated or general programmable processor, which can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0100] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0101] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory (EPROM, Electronically Programmable Read-Only Memory), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM, Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0102] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0103] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0104] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0105] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0106] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for generating response information, comprising: Obtaining a target question input by a user, wherein the target question is a question asked for a target text; Filtering a question-answer pair matching the target question from the question-answer pair set as a target question-answer pair, wherein the question-answer pair set includes a plurality of question-answer pairs generated based on the target text, each question-answer pair includes a question and corresponding answer information; According to the target question and the target question-answer pair, target answer information corresponding to the target question is generated.

2. The method according to claim 1, further comprising: Before obtaining the target question input by the user, extracting information from the target text; Constructing a knowledge graph corresponding to the target text according to the information extraction results; The question-answer pair set is constructed according to the knowledge graph.

3. The method according to claim 2, wherein: The extracting information from the target text comprises: In response to determining that the number of characters included in the target text is less than or equal to a first threshold, directly extracting information from the target text; In response to determining that the number of characters included in the target text is greater than the first threshold, the target text is sliced ​​to obtain at least two sliced ​​texts, each of which includes a number of characters less than or equal to the first threshold, and information is extracted from each sliced ​​text.

4. The method according to claim 3, wherein: The step of constructing the knowledge graph corresponding to the target text according to the information extraction result includes: In response to not performing slicing processing on the target text, constructing the knowledge graph according to the information extraction result corresponding to the target text; In response to slicing the target text, the knowledge graph is constructed by combining the information extraction results corresponding to each slice text.

5. The method according to claim 2, wherein: The information extraction result includes: entities, attribute information of entities, relationship information between entities, and event information related to entities.

6. The method according to claim 5, wherein: The step of constructing the question-answer pair set according to the knowledge graph includes: According to the entities, the attribute information, the relationship information and the event information in the knowledge graph, questions are constructed with the goal of covering all questions that may be asked by the user, and answer information corresponding to each constructed question is generated to obtain the question-answer pair set.

7. The method according to claim 1, wherein: The step of selecting a question-answer pair matching the target question from the question-answer pair set as a target question-answer pair includes: According to the nearest neighbor search index constructed for each question in the question-answer pair set, K questions that best match the target question are screened out from the questions in the question-answer pair set through a retrieval enhancement generation method, where K is a positive integer, and the question-answer pairs containing the screened K questions are taken as the target question-answer pairs.

8. The method according to any one of claims 1 to 7, wherein: The generating target answer information corresponding to the target question according to the target question and the target question-answer pair includes: The target question and the answer information in the target question-answer pair are used as inputs of an answer generation model to obtain the target answer information output by the answer generation model.

9. The method according to claim 5 or 6, further comprising: After obtaining the target question input by the user, determining the target role corresponding to the current question and answer, and obtaining the character portrait information of the target role, wherein the target role is the character that appears in the target text; The target question, the character portrait information and the response information in the target question-answer pair are used as inputs of a response generation model to obtain target response information that meets the characteristics of the target character and is output by the response generation model.

10. The method according to claim 9, wherein: The information extraction result also includes: dialogue information between characters in the target text; The method further comprises: generating character portrait information of each character according to the dialogue information between the characters; Among them, determining the target role corresponding to this question and answer and obtaining the character portrait information of the target role includes: displaying each character to the user in the form of a list, taking the character selected by the user from the list as the target role, and obtaining the character portrait information of the target role.

11. A response information generating device, comprising: Acquisition module, screening module and generation module; The acquisition module is used to acquire a target question input by a user, wherein the target question is a question raised for a target text; The screening module is used to screen out a question-answer pair matching the target question from the question-answer pair set as the target question-answer pair, wherein the question-answer pair set includes a plurality of question-answer pairs generated based on the target text, each question-answer pair includes a question and corresponding answer information; The generation module is used to generate target answer information corresponding to the target question based on the target question and the target question-answer pair.

12. The apparatus according to claim 11, further comprising: A preprocessing module is used to extract information from the target text, construct a knowledge graph corresponding to the target text according to the information extraction result, and construct the question-answer pair set according to the knowledge graph.

13. The device according to claim 12, wherein: In response to determining that the number of characters included in the target text is less than or equal to a first threshold, the preprocessing module directly extracts information from the target text; in response to determining that the number of characters included in the target text is greater than the first threshold, the target text is sliced ​​to obtain at least two sliced ​​texts, each of which has a number of characters less than or equal to the first threshold, and information is extracted from each sliced ​​text.

14. The device according to claim 13, wherein: In response to not slicing the target text, the preprocessing module constructs the knowledge graph according to the information extraction results corresponding to the target text, and in response to slicing the target text, constructs the knowledge graph in combination with the information extraction results corresponding to each sliced ​​text.

15. The device according to claim 12, wherein: The information extraction result includes: entities, attribute information of entities, relationship information between entities, and event information related to entities.

16. The device according to claim 15, wherein: The preprocessing module constructs questions based on the entities, attribute information, relationship information and event information in the knowledge graph, with the goal of covering all questions that may be asked by the user, and generates answer information corresponding to each constructed question to obtain the question-answer pair set.

17. The device according to claim 11, wherein: The screening module selects K questions that best match the target question from the questions in the question-answer pair set based on the nearest neighbor search index constructed for each question in the question-answer pair set through a retrieval enhancement generation method, where K is a positive integer, and the question-answer pairs containing the K screened questions are used as the target question-answer pairs.

18. The device according to any one of claims 11 to 17, wherein: The generation module uses the target question and the response information in the target question-answer pair as inputs of a response generation model to obtain the target response information output by the response generation model.

19. The device according to claim 15 or 16, wherein: The generation module is further used to determine the target role corresponding to this question and answer, and obtain the character portrait information of the target role, the target role is the character that appears in the target text, and use the target question, the character portrait information and the response information in the target question and answer pair as inputs to the response generation model to obtain the target response information that meets the characteristics of the target role output by the response generation model.

20. The device according to claim 19, wherein The information extraction result also includes: dialogue information between characters in the target text; The preprocessing module is further used to generate character portrait information of each character according to the dialogue information between the characters; The generating module is further used to present various characters to the user in the form of a list, use the character selected by the user from the list as the target character, and obtain the character portrait information of the target character.

21. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.

22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1 to 10.

23. A computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 10 is implemented.