Text generation method, electronic device and storage medium

By constructing the target map and generating the target problem, the problem of insufficient quality and coverage of Q&A data in the existing technology is solved, and high accuracy and comprehensive text generation effect is achieved.

CN119202203BActive Publication Date: 2025-05-16ALIBABA CLOUD FEITIAN (HANGZHOU) CLOUD COMPUTING TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411687798.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-05-16
Estimated Expiration
2044-11-22

AI Technical Summary

Technical Problem

In the prior art, the update speed, data quality and domain coverage of Q&A data cannot meet the needs of the large model retrieval enhancement generation system, resulting in poor text generation effect.

Method used

By obtaining the pending data, building a target map to describe different entities and their associations in the data, generating target problems and identifying problem types, and ultimately generating reply text based on the target problems and problem types.

Benefits of technology

It improves the accuracy and comprehensiveness of text generation. The generated questions and answers are both profound and broad, and can accurately reflect the theme and key information of the data to be processed, solving the problem of poor text generation effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202203B_ABST
    Figure CN119202203B_ABST
Patent Text Reader

Abstract

The present application discloses a text generation method, an electronic device, and a storage medium, which relate to large model technology and the field of text processing. The method comprises: obtaining data to be processed; constructing a target graph of the data to be processed based on the data structure information of the data to be processed, wherein the target graph is used to describe the association between different entities and different entities in the data to be processed; generating a target question of the data to be processed based on the target graph, and identifying the question type of the target question; generating a reply text of the target question based on the target question and the question type. The present application solves the technical problem of poor text generation effect in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of large model technology and text generation, and more specifically, to a text generation method, an electronic device and a storage medium. Background Art

[0002] At present, although there are a large number of open source question answering (QA) data sets, their update speed, data quality and domain coverage often cannot meet the development needs of large-scale model retrieval enhancement generation systems. For private domain data, there is a lack of ready-made question-answer pairs, and generating QA data through manual expert annotation is not only inefficient but also costly. In addition, from the user's perspective, it is a difficult problem to ask questions about key information in documents and generate complex problems that associate multiple paragraphs of text with multiple documents. The accuracy of the currently generated QA pairs is low, resulting in poor text generation effects in related technologies.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present application provide a text generation method, an electronic device, and a storage medium to at least solve the technical problem of poor text generation effect in the related art.

[0005] According to one aspect of an embodiment of the present application, a text generation method is provided, including: obtaining data to be processed; constructing a target graph of the data to be processed based on data structure information of the data to be processed, wherein the target graph is used to describe different entities in the data to be processed and the association relationship between different entities; generating a target question of the data to be processed based on the target graph, and identifying the question type of the target question; and generating a reply text for the target question based on the target question and the question type.

[0006] According to one aspect of an embodiment of the present application, a text generation method is provided, including: in response to an input instruction acting on an operation interface, displaying data to be processed on the operation interface; in response to a confirmation instruction acting on the data to be processed, displaying a target question and a reply text of the target question on the operation interface, wherein the reply text is generated based on the target question and the question type, the question type is obtained by identifying the target question, the target question is generated based on a target graph, the target graph is constructed based on data structure information of the data to be processed, and the target graph is used to describe different entities in the data to be processed and the association relationship between different entities.

[0007] According to one aspect of an embodiment of the present application, a text generation method is provided, comprising: obtaining data to be processed by calling a first interface, wherein the first interface includes a first parameter, and the parameter value of the first parameter includes the data to be processed; constructing a target graph of the data to be processed based on data structure information of the data to be processed, wherein the target graph is used to describe different entities in the data to be processed and the association relationship between different entities; generating a target question of the data to be processed based on the target graph, and identifying the question type of the target question; generating a reply text of the target question based on the target question and the question type; and outputting the target question and the reply text by calling a second interface, wherein the second interface includes a second parameter, and the parameter value of the second parameter includes the target question and the reply text.

[0008] According to another aspect of the embodiments of the present application, a computer terminal is further provided, including: a memory storing an executable program; and a processor for running the program, wherein the method in each embodiment of the present application is executed when the program is running.

[0009] According to another aspect of an embodiment of the present application, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the methods in each embodiment of the present application.

[0010] According to another aspect of the embodiments of the present application, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present application is implemented.

[0011] According to another aspect of an embodiment of the present application, a computer program product is also provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present application is implemented.

[0012] According to another aspect of the embodiments of the present application, a computer program is also provided, and when the computer program is executed by a processor, the methods in the various embodiments of the present application are implemented.

[0013] In an embodiment of the present application, data to be processed is obtained; a target graph of the data to be processed is constructed based on data structure information of the data to be processed, wherein the target graph is used to describe the association relationships between different entities and different entities in the data to be processed; a target question of the data to be processed is generated based on the target graph, and the question type of the target question is identified; based on the target question and the question type, a reply text of the target question is generated, thereby achieving the purpose of improving the text generation effect; it is easy to notice that by constructing a target graph, not only the complex associations between entities can be accurately described, but also the main purpose and key information of the document can be refined through the structural characteristics of the graph, so that it is possible to generate target questions with greater depth and breadth, and different strategies are adopted to generate reply texts by determining the question type of the target question, thereby improving the accuracy and comprehensiveness of the generated text, thereby solving the technical problem of poor text generation effect in related technologies.

[0014] It is easy to notice that the above general description and the following detailed description are only for the purpose of exemplifying and explaining the present application, and do not constitute a limitation of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0016] Figure 1 is a schematic diagram of an application scenario of a text generation method according to an embodiment of the present application;

[0017] Figure 2 is a flowchart of a text generation method according to an embodiment of the present application;

[0018] Figure 3 is a flowchart of a graph index construction according to an embodiment of the present application;

[0019] Figure 4 is a flow chart of question and answer content generation according to an embodiment of the present application;

[0020] Figure 5 is a flowchart of a text generation method according to an embodiment of the present application;

[0021] Figure 6 is a flowchart of a text generation method according to an embodiment of the present application;

[0022] Figure 7 is a schematic diagram of a text generation device according to an embodiment of the present application;

[0023] Figure 8 is a schematic diagram of a text generation device according to an embodiment of the present application;

[0024] Fig. 9 is a schematic diagram of a text generation device according to an embodiment of the present application;

[0025] Fig.10 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] The technical solution provided in this application is mainly implemented using large-scale model technology. The large model here refers to a deep learning model with large-scale model parameters, which can usually contain hundreds of millions, tens of billions, hundreds of billions, trillions or even more than 10 trillion model parameters. The large model can also be called a foundation model / foundation model. The large model is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks, and the model has good generalization ability, such as large-scale language model (LLM), multi-modal pre-training model, etc.

[0029] It should be noted that when the large model is actually applied, the pre-trained model can be fine-tuned through a small number of samples so that the large model can be applied to different tasks. For example, the large model can be widely used in natural language processing (NLP), computer vision, speech processing and other fields, and can be specifically applied to computer vision tasks such as visual question answering (VQA), image caption (IC), image generation, etc. It can also be widely used in text-based sentiment classification, text summary generation, machine translation and other natural language processing tasks. Therefore, the main application scenarios of the large model include but are not limited to digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc. In the embodiment of the present application, data processing through a large model in a text generation scenario is used as an example for explanation.

[0030] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:

[0031] A knowledge graph is an information structure used to represent and store knowledge, usually using a graphical approach to organize data. It builds a complex network through nodes (representing entities, such as people, places, things, etc.) and edges (representing the relationship between entities) to better understand and reason about information.

[0032] Retrieval Augmented Generation (RAG) means that when answering questions or generating text, the big model will first retrieve relevant information from a large amount of text data, and then answer or generate text based on the retrieved information, thereby improving the quality of the answer, rather than leaving it to the big model.

[0033] Large Language Model (LLM) is based on deep learning technology and is trained with a large amount of text data to understand and generate natural language. LLM can be used for a variety of tasks, including text generation, translation, question answering, dialogue systems, etc. Due to its large parameter scale and rich training data, LLM usually has strong language understanding and generation capabilities.

[0034] The large language series model (Q wen) is based on the transformer architecture and is trained on ultra-large-scale pre-training data.

[0035] Community detection algorithm (Leiden algorithm), which implements hierarchical clustering by greedily optimizing modularity, recursively merging communities into single nodes, and repeating the process in a compressed graph.

[0036] Chunking, in building LLM-based applications such as RAG, chunking is to divide text into meaningful segments, and the divided text blocks are called chunks.

[0037] According to an embodiment of the present application, a text generation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0038] Considering the huge number of model parameters of the large model and the limited computing resources of the mobile terminal, the above-mentioned text generation method provided in the embodiment of the present application can be applied to Figure 1 The application scenarios shown are not limited to these. Figure 1 is a schematic diagram of an application scenario of a text generation method according to an embodiment of the present application. Figure 1 In the application scenario shown, the large model is deployed in the server 10, and the server 10 can be connected to one or more client devices 20 through a local area network connection, a wide area network connection, an Internet connection, or other types of data networks. The client device 20 here may include but is not limited to: a smart phone, a tablet computer, a laptop computer, a PDA, a personal computer, a smart home device, a vehicle-mounted device, etc. The client device 20 can interact with the user through a graphical user interface to implement the call of the large model, thereby implementing the method provided in the embodiment of the present application.

[0039] In the embodiment of the present application, the system composed of the client device and the server can perform the following steps: the client device uploads the data to be processed, and the server constructs the target map of the data to be processed based on the data structure information of the data to be processed; generates the target question of the data to be processed based on the target map, and identifies the question type of the target question; generates the reply text of the target question based on the target question and the question type. It should be noted that the embodiment of the present application can be performed in the client device when the operating resources of the client device can meet the deployment and operation conditions of the large model.

[0040] Under the above operating environment, this application provides Figure 2 The text generation method shown. Figure 2 is a flowchart of a text generation method according to an embodiment of the present application. Figure 2As shown, the method may include the following steps:

[0041] Step S202, obtaining data to be processed;

[0042] The above-mentioned data to be processed refers to the original information or documents that need to be analyzed and converted to generate question-answering data. In this application, the data to be processed can be from documents, product manuals, technical reports, etc. These data often contain a large amount of unstructured information and need to be processed to extract knowledge and generate questions. Among them, the data to be processed can be structured (such as database tables) or unstructured (such as text documents, web page content, etc.).

[0043] In an optional embodiment, the data to be processed may be uploaded to the server through an interactive operation, so that the server may generate a target question and a reply text to the target question related to the data to be processed based on the data to be processed.

[0044] Step S204, constructing a target graph of the data to be processed based on the data structure information of the data to be processed;

[0045] Among them, the target graph is used to describe the relationship between different entities and different entities in the data to be processed.

[0046] The above-mentioned data structure information may refer to the structured information about entities, relationships and contexts extracted from the data to be processed. For example, in an enterprise document, an "entity" may be the departments involved in the enterprise, the effective date of the document, etc.; a "relationship" may be the affiliation between departments, the association between dates and events, etc.

[0047] The target graph mentioned above can be a knowledge graph built based on entities and relationships in the data to be processed, which is used to describe the key concepts in the data and the complex connections between them. For example, in a technical report, the target graph can include all technical terms, product names, technical processes and other entities in the report, as well as the relationships between these entities, such as which technologies the product is built with, the relationship between the steps in the technical process, etc.

[0048] In an optional embodiment, the target graph can be constructed using entities, relationships, and context information extracted from the data to be processed. By constructing the target graph, the unstructured data to be processed can be converted into a structured knowledge graph, which is convenient for subsequent query and analysis. The nodes in the target graph can represent entities, the edges can represent the relationships between entities, and the attributes on the edges can describe the type and strength of the relationship.

[0049] For example, entities such as "security gateway", "data encryption service" and "review standard" can be extracted from the technical report of enterprise cloud platform security practice, as well as the relationships between them, such as the "use" relationship between "security gateway" and "data encryption service", and the "compliance" relationship between "data encryption service" and "review standard". Through these entities and relationships, a target map describing enterprise cloud platform security practices can be constructed.

[0050] Step S206, generating a target problem of the data to be processed based on the target graph, and identifying the problem type of the target problem;

[0051] The above-mentioned target questions can be questions generated based on the target graph, aiming to test or verify the understanding of entities and relationships in the target graph. For example, detailed questions about key technologies or products in the report, or summary questions about the main theme of the entire report can be generated.

[0052] The above question types can refer to question categories divided according to the content and purpose of the questions, such as detail questions, connection questions, and summary questions. Detail questions focus on understanding specific entities or relationships, while summary questions aim to summarize the comprehensive information of multiple entities and relationships.

[0053] In an optional embodiment, after the target graph is constructed, a series of questions can be generated using the entities, relationships, and overall structure in the graph. The target questions can be generated based on the deep understanding and mining of the information in the graph. Through the relevance of the graph, questions that contain both specific details and complex relationships between entities can be generated, so that it is convenient to obtain a reply text that can reflect the main idea of ​​the data to be processed based on the target question.

[0054] Furthermore, after generating the target question, the answer strategy and information depth required for the target question can be determined by identifying the question type of the target question.

[0055] The above-mentioned detailed questions focus on the detailed information of a specific entity or relationship in the graph, such as "How does a firewall prevent unauthorized access?" in the above text. To answer such questions, it is necessary to accurately extract the attributes and related relationships of the entities from the graph.

[0056] The above-mentioned connection questions focus on the connections between multiple entities in the graph, such as "How do data encryption and authentication in cloud computing work together?" Answering such questions requires understanding the multi-hop relationships in the graph and the mechanisms of interaction between entities.

[0057] The above summary questions are intended to summarize the key information in the graph, such as "What are the core elements of the security strategy of the enterprise cloud platform?" or "What is the overall security architecture of the cloud computing platform?" Answering such questions requires high-level analysis and summary of the graph, which may involve a comprehensive description of multiple entities and relationships.

[0058] Identifying the question type of the target question helps to adopt a more appropriate approach when answering the question, ensuring the accuracy and completeness of the answer. For example, for summary questions, an overview containing multiple key entities and relationships can be generated, while detail questions may only require specific information about a certain entity. This processing method based on question type makes the generated question and answer data more targeted and practical, and can better serve a variety of application scenarios such as knowledge retrieval, learning assessment, and automated question and answering.

[0059] This application realizes the automatic mining and creation of high-quality and diverse questions from structured knowledge graphs through question generation and question type identification, which not only improves the efficiency of question and answer data generation, but also ensures the accuracy and applicability of the data.

[0060] Step S208: Generate a response text for the target question based on the target question and the question type.

[0061] The above-mentioned response text can be an answer or response to the target question, and its content and form vary depending on the type of question. For example, the response text of a detail question may directly quote the attributes or statements of the relevant entity, while the response text of a summary question may contain a comprehensive overview of multiple entities and relationships.

[0062] Depending on the type of question and the content of the question itself, LLM can be used to generate answers to questions. If the question type is detail-oriented, the model will provide detailed information about specific entities; if it is summary-oriented, it will give an overview of multiple entities and relationships; if it is a connection-oriented question, it will explain the relationships and connections between entities.

[0063] This application ensures that the generated question-and-answer data reaches a high level in terms of complexity, accuracy, and interpretability. For detailed questions, it can refer to the entities involved in the question and their attributes and relationship information in the target graph to quickly generate a highly accurate reply text; for summary questions, it can provide in-depth and comprehensive answers. This method not only improves the quality of question-and-answer data, but also improves the effectiveness of question-and-answer systems based on knowledge graphs, and can more effectively serve scenarios such as knowledge retrieval, learning evaluation, and automatic question-and-answering.

[0064] For example, for the above detailed question "Which components are responsible for data encryption in the enterprise cloud platform?", the LLM may answer: "Data encryption is mainly the responsibility of the security gateway and data encryption service components. The security gateway is used to perform preliminary encryption on data entering and leaving the cloud platform, while the data encryption service provides more advanced encryption algorithms to ensure the security of data during transmission within and outside the cloud environment." For summary questions, the LLM may provide an overview of multiple components and strategies, such as: "The security strategy of the enterprise cloud platform includes multi-level encryption, authentication, access control and standard review. These strategies ensure the security and standardization of data during transmission, storage and processing." For connection questions, the model may explain the functional coordination or interaction mechanism between the two entities.

[0065] In an optional embodiment, a suitable answer strategy can be selected according to the type of the target question. The present application can divide the questions into two categories: detail type and summary type. Detail type questions focus on the attributes of specific entities or specific relationships between entities, while summary type questions require comprehensive information involving multiple entities and relationships. For detail type questions, the system will directly use LLM to generate specific and direct answers. When generating answers, LLM will refer to the entities involved in the question and their attributes and relationship information in the target map. At the same time, the system also generates the reference source of the answer, that is, the entity or relationship of the answer in the map, to ensure the verifiability and credibility of the answer. For summary type questions, the system uses a more complex method to generate answers. First, multiple entities and relationships related to the question are extracted from the target map, and this information is summarized and multiple intermediate answers are generated. Then, the system scores the quality of each intermediate answer, and finally integrates the intermediate answers with higher scores, and generates a comprehensive final answer through LLM. This method ensures that the answer to the summary type question is both comprehensive and in-depth, and can comprehensively consider the multiple aspects involved in the question and the complex relationship between entities.

[0066] For example, if the target question is "How to build a comprehensive cloud computing security system?", this is a typical summary question. The system will extract multiple entities related to cloud computing security from the target graph, such as "firewall", "data encryption service", "authentication system", "access control", etc., as well as the relationships between them, such as "firewall is used to prevent unauthorized network access", "data encryption service provides data encryption and decryption functions", etc. The system aggregates this information and generates multiple intermediate answers about firewalls, data encryption, and authentication, and then performs quality scoring. Finally, through the integration of LLM, a comprehensive answer covering all key security components and strategies is generated.

[0067] In an optional embodiment, first, the data to be processed is obtained. Then, a target graph is constructed based on the structural information such as entities and relationships in the data to be processed. After the target graph is constructed, the entities and relationships in the target graph are used to generate questions and identify the types of questions. Finally, a corresponding reply text is generated according to the type of question and the content of the question itself. The reply text can contain the answer to the question and the reference source of the relevant entity to ensure the accuracy and interpretability of the answer. By constructing a target graph, the present application can not only accurately describe and understand the entities and relationships in the data to be processed, but also generate different types of high-quality questions through the complex association of the graph. Seed questions can be generated first using the target graph, and the seed questions can be further expanded to obtain complex questions covering multiple entities and multi-hop relationships, that is, the above-mentioned target questions, thereby improving the depth and breadth of the questions. At the same time, by distinguishing the types of questions and generating reply texts in a targeted manner, the accuracy and comprehensiveness of the answers can be guaranteed, avoiding the problem of out-of-context answers or missing information due to output restrictions.

[0068] The text generation method provided in this application aims to overcome the problem of poor text generation effect in the prior art, and through two key steps, it can achieve a significant improvement in the generation effect of the target question and its response text.

[0069] In the process of building the target graph, the data structure information of the data to be processed can be used to build the target graph. The target graph not only covers different entities, but also describes in detail the relationship between these entities, including direct and indirect connections, entity attributes, and declaration information between entities. By building the target graph, the system can more comprehensively understand the structure and content of the data to be processed, so the generated questions are deeper and broader, covering the main purpose and key details of the document, and increasing the diversity and complexity of the questions.

[0070] In the process of determining the question type and generating the reply text, the target question can be generated based on the target graph, and the type of question can be further identified, that is, whether the question is a detail question or a summary question. This identification process is carried out by analyzing the context information of the question, the complexity of the entities involved, and the scope of the question. Based on the question type, the system uses different strategies to generate reply text. For detail questions, the system directly generates detailed and specific answers based on the context information and entity relationships of the question; for summary questions, the system generates a comprehensive reply text covering multiple knowledge points by gathering key information from multiple entity clusters to provide a comprehensive answer. The identification of question types and the targeted generation of reply texts ensure the accuracy and comprehensiveness of the reply texts and improve the quality of question and answer data.

[0071] The above-mentioned text generation method can comprehensively improve the text generation effect from both the question text and the reply text levels. The generated questions and answers have both depth and breadth, as well as greater accuracy and comprehensiveness. This method is particularly suitable for processing complex documents, and can effectively extract and generate high-quality question-and-answer data to meet users' information needs in different scenarios. It also provides rich training samples for the training and fine-tuning of large models, which helps improve the performance of large models in question-and-answer tasks. In specific implementation, this method can significantly improve the efficiency and quality of generating question-and-answer data, and provide more powerful data support for question-and-answer systems based on knowledge graphs.

[0072] Through the above steps, the data to be processed is obtained; based on the data structure information of the data to be processed, a target graph of the data to be processed is constructed, wherein the target graph is used to describe the association relationship between different entities and different entities in the data to be processed; based on the target graph, a target question of the data to be processed is generated, and the question type of the target question is identified; based on the target question and the question type, a reply text of the target question is generated, thereby achieving the purpose of improving the text generation effect; it is easy to notice that by constructing the target graph, not only the complex associations between entities can be accurately described, but also the main purpose and key information of the document can be refined through the structural characteristics of the graph, so that it is possible to generate target questions with greater depth and breadth, and different strategies are adopted to generate reply texts by determining the question type of the target question, thereby improving the accuracy and comprehensiveness of the generated text, thereby solving the technical problem of poor text generation effect in related technologies.

[0073] In the above embodiments of the present application, a target graph of the data to be processed is constructed based on the data structure information of the data to be processed, including: segmenting the data to be processed based on the data structure information to obtain multiple text blocks, wherein different text blocks contain different contents in the data to be processed; extracting first entity information of the data to be processed from the multiple text blocks; and generating a target graph based on the first entity information and the multiple text blocks.

[0074] The first entity information mentioned above may include but is not limited to entities, entity types, and relationships between entities.

[0075] The above entities can be objects or concepts with unique meanings that appear in the text. They can be names of people, places, organizations, events, products, concepts, etc.

[0076] The above entity types refer to the categories or labels of entities that appear in a specific field, which are used to divide and identify different types of entities. For example, in the medical field, entity types may include "disease", "symptom", "drug", "treatment plan", etc.

[0077] The entity relationships mentioned above are connections between entities, indicating how entities interact or influence each other. For example, there may be a relationship of "technical application" between "artificial intelligence" and "cloud computing". When constructing entity relationship extraction samples, representative and clearly structured relationship instances in the field should be selected, which can demonstrate the diversity and complexity of entity relationships.

[0078] The above data structure information may be the organization structure, format and hierarchy within the document or data, including but not limited to titles, subtitles, paragraphs, tables, picture annotations, etc. Such structure information helps to understand the logical framework and information distribution of the document.

[0079] The above-mentioned text blocks can be obtained by segmenting the data to be processed to obtain text fragments with independent meanings. Different text blocks can be described around a theme or an entity. Optionally, the data to be processed can be segmented through a structure tree to obtain multiple text blocks. The data to be processed can be segmented according to the document directory structure and semantics.

[0080] The process of segmenting the data to be processed through data structure information and structure tree to obtain multiple text blocks is a systematic method that aims to extract small pieces of text with complete semantics and clear logic from the original data to be processed, so as to provide easier-to-process input for subsequent tasks such as entity and relationship extraction, knowledge graph construction, and question-answering data generation.

[0081] Data structure information refers to the internal organizational structure and format information of a document, including elements such as titles, subtitles, paragraphs, lists, tables, formulas, etc. This information not only helps to understand the outline and logical structure of a document, but also guides how to divide a document into multiple text blocks more reasonably and accurately. Using data structure information, you can ensure that each text block contains a complete semantic unit to avoid information fragmentation and omission.

[0082] A structure tree is a hierarchical data structure used to represent the hierarchy and organization of a document. By analyzing the document's structural elements such as titles and paragraphs, the various parts of the document are organized into a tree structure, where the root node of the tree represents the entire document, and the child nodes represent the various chapters, paragraphs, or lists in the document. The construction of the structure tree is usually based on the title hierarchy of the document, for example, the first-level title is the top-level node of the tree, the second-level title is its child node, and so on, until the lowest structural element of the document.

[0083] The use of the structure tree is to serve as a guiding framework for text segmentation. By traversing the structure tree, the various components of the document can be identified and the document can be segmented into a series of coherent text blocks. Each text block usually corresponds to one or more nodes in the structure tree, which not only maintains the integrity of the information and the coherence of the context, but also makes the size of the text block moderate for subsequent processing.

[0084] First, the system reads the data to be processed and parses its data structure information to identify the title, paragraph, list and other elements in the document. Based on the parsed data structure information, the structure tree of the document is constructed, and the various parts of the document are organized into a tree structure according to their hierarchical relationship. By traversing the structure tree, the document is divided into multiple text blocks according to the hierarchy and content of the nodes. Usually, a text block can be a paragraph, a list or a chapter, so that each text block contains a relatively independent and complete semantic unit. During the segmentation process, ensure that each text block can independently express a complete concept or information fragment, while maintaining logical coherence with adjacent text blocks to avoid information fragmentation caused by improper segmentation. According to the needs of subsequent processing (such as the input limit of the model or the density requirement of information), the size of the text block is appropriately adjusted to ensure that each text block contains sufficient information without exceeding the processing limit of the model.

[0085] Through the above steps, the data to be processed is segmented and multiple text blocks are obtained, which not only preserves the original structure and semantics of the document, but also provides easier-to-process and understand input for subsequent tasks such as entity and relationship extraction. These text blocks, as the basis for building the knowledge graph, will help generate more accurate and comprehensive entities and relationships, and ultimately improve the quality and credibility of question-answering data.

[0086] In an optional embodiment, the data to be processed can be divided into multiple text blocks based on data structure information. Each text block contains specific content in the document, which may be a paragraph or chapter, ensuring the efficiency and pertinence of subsequent processing. Entity information is extracted from multiple text blocks. The capabilities of the large language model (LLM) can be used to extract the name, type and attributes of the entity, as well as the relationship between the entities based on the domain-adaptive prompt word template to form the basic elements of the graph. A target graph is constructed based on the extracted first entity information and multiple text blocks. The nodes in the graph represent entities, and the edges represent the relationships between entities. The entire graph reflects the structure and information association of the data to be processed.

[0087] Different from the traditional method of directly constructing a graph after entity extraction, this application first conducts an in-depth analysis of the context of the extracted first entity information in multiple text blocks to understand the meaning and role of these entities in different contexts. Specifically, for each entity, the system will search for descriptions related to the entity in all text blocks, identify its attributes, functions, and potential connections with other entities. For example, for the entity "cloud computing platform", the system will search for descriptions related to it in all text blocks, such as its architecture, service type, security measures, etc., and identify its association with other entities (such as "data security", "virtual machine", "user access").

[0088] This application also considers multimodal information in text blocks, such as non-text elements such as tables, images, and formulas, and combines these elements with entity information to generate richer graph nodes and edges. For example, if a text block contains an image about the cloud computing platform architecture, the system will identify the entities involved in the image and their relationships, and fuse this information with the text information in the graph to build a more comprehensive graph representation.

[0089] In the process of building the graph, this application uses community detection algorithms (such as the Leiden algorithm) to perform cluster analysis on entities and relationships to identify entity clusters with similar topics or functions, which helps to summarize and understand the document content from different angles and granularities. Through community detection, the entities and relationships in the graph are divided into different communities, each of which represents a group of closely connected entities and relationships with common characteristics.

[0090] In addition to building the structure of the graph, this application also generates vector representations for each entity and relationship in the graph through graph embedding technology (such as Node2Vec), which provides semantic representations of entities and relationships in high-dimensional vector space, facilitating subsequent graph query and analysis. Graph embedding not only considers the direct links between entities and relationships, but also their positions and paths in the graph, thereby generating richer and more accurate vector representations.

[0091] This application also constructs a hierarchical structure of the graph. By analyzing the hierarchical relationships between entities and relationships (such as subordinate relationships and inclusion relationships), the graph is divided into multiple levels, each of which represents the association of entities and relationships at different levels. The construction of the hierarchical structure helps to understand the document content from macro to micro, from global to local, and provides a hierarchical perspective for generating high-quality question-answering data.

[0092] In addition to entity and relationship information, this application also integrates metadata of text blocks, such as author information, document title, chapter title, etc. These metadata are added to the graph as additional attributes of entities or as enhanced information of relationships, further enriching the connotation of the graph and improving the accuracy and practicality of the graph.

[0093] Through the above method, the target graph constructed by this application not only contains the basic information of entities and relationships, but also integrates multi-level information such as multimodal information, community detection results, graph embedding and hierarchical structure, so that the graph can more comprehensively and accurately reflect the main theme and details of the document, and provide rich background knowledge and structured information for the subsequent question and answer data generation, which is conducive to the generation of high-quality, multi-angle question and answer data.

[0094] This application constructs a comprehensive, accurate and structured target graph through deep analysis of entity relationships, fusion of multimodal information, community detection and clustering, graph embedding, hierarchical structure construction and metadata fusion, which effectively supports the generation of high-quality question and answer data, and also provides strong support for subsequent graph query and analysis.

[0095] Through the above steps, this application can efficiently convert unstructured data to be processed into a structured knowledge graph. Graph construction not only relies on the original entity and relationship extraction, but also can use LLM to update the graph, and summarize each entity and relationship through LLM to generate a brief and informative description, which helps to improve the readability and query efficiency of the graph. At the same time, the construction of the graph also fully considers the logical structure of the data, and ensures the integrity of the entity information through the segmentation of text blocks, avoiding the fragmentation and misunderstanding of information.

[0096] For example, taking the technical report of "Cloud Computing Platform Architecture and Security Strategy" as an example, the following steps can be followed. The report is first divided into multiple text blocks, such as "Architecture Overview", "Security Components", "Data Encryption Service" and "Standard Strategy" chapters, each of which becomes an independent text block. From each text block, use LLM to extract entity information. For example, the "Architecture Overview" text block may extract the entities "Virtual Machine" and "Cloud Storage"; the "Data Encryption Service" text block may extract the entity "Data Encryption Service" and its relationship with "Virtual Machine" and "Cloud Storage", such as "Use" and "Protect". Based on the extracted entity information and relationship information, build a target graph. In the graph, "Virtual Machine", "Cloud Storage" and "Data Encryption Service" will become nodes, and the relationship between them will become edges, such as "Virtual Machine Uses Data Encryption Service" and "Cloud Storage is Protected by Data Encryption Service". After the graph is generated, use LLM to summarize each entity and relationship to generate a concise description. For example, summarize "Data Encryption Service" as "Cloud Platform Component that Provides Data Security Encryption". Through this series of steps, not only is a graph reflecting the structure and content of the technical report constructed, but the summary capability of LLM is also used to ensure the refinement and efficiency of the graph information. The final graph will be used to generate high-quality, reliable question-and-answer data.

[0097] In the above embodiment of the present application, the first entity information of the data to be processed is extracted from multiple text blocks, including: extracting a target text from the data to be processed; determining a target field to which the data to be processed belongs based on the target text; constructing a prompt word template based on the target text and the target field; inputting the prompt word template into a large model, and using the large model to extract the first entity information from the multiple text blocks.

[0098] The target text mentioned above can be a fragment selected from the data to be processed, which is used to reveal the key themes or entities of the data to be processed. For example, in a technical report on "Cloud Computing Platform Architecture and Security Strategy", a paragraph that describes in detail how security components protect data can be used as the target text. The target text refers to one or more important text information extracted from the data to be processed for subsequent analysis and domain identification. It contains key information that can reflect the main content and characteristics of the data, and is the basis for determining the domain to which the data belongs and building a prompt word template.

[0099] By analyzing the target text, the specific field to which the data to be processed belongs can be identified. For example, if the target text contains a large number of terms about cloud computing, virtual machines, and data security, then it can be determined that the data to be processed belongs to the field of cloud computing or IT security. Based on the target text and the identified target field, a prompt word template suitable for the field can be constructed. The prompt word template is used to guide the large model to extract entity information more accurately, ensuring that the extracted information is relevant to the field and representative. The constructed prompt word template is input into the large model, and the large model can more accurately extract entity information related to the target field from multiple text blocks. This information will be used for subsequent knowledge graph construction and question-answering data generation.

[0100] For example, assume that the data to be processed is a paper on "The Application of Blockchain Technology in Supply Chain Management". The system first extracts a target text containing key terms such as "blockchain", "supply chain", "smart contract" and "product traceability" from the paper. This target text not only reflects the main topic of the paper, but also provides background information related to the field. Subsequently, by analyzing the target text, the system determines that the paper belongs to the field of blockchain technology and supply chain management. Based on this field information, the system constructs a special prompt word template, including terms such as "distributed ledger", "encryption algorithm", "supply chain node" and "product certification", to guide the large model to more accurately extract relevant entity information from multiple text blocks of the paper.

[0101] The above target text is used for domain identification and prompt word template construction, ensuring the accuracy and pertinence of subsequent entity information extraction. By intelligently selecting and analyzing the target text, the system can better understand the subject and content of the data to be processed, thereby improving the efficiency and quality of the entire process. The intelligent extraction and use of the target text can significantly improve the accuracy and efficiency of entity information extraction in subsequent steps. The target ensures that the large model can focus on key information when processing complex data, avoids the interference of irrelevant information, and improves the quality of knowledge graph construction. In addition, by constructing prompt word templates for specific fields, the system can more effectively guide the large model to extract information, thereby generating higher quality question and answer data to meet the needs of domain experts and users for information depth and accuracy. In high-tech fields such as blockchain technology and cloud computing, this method of domain identification and information extraction based on target text is particularly important, which can ensure that the knowledge graph and question and answer data generated by the system are closely related to the field, and improve the value and practicality of the information.

[0102] The target domain mentioned above can be the industry or professional field to which the data to be processed belongs, such as cloud computing, artificial intelligence, law, medicine, etc. The target domain determines the construction direction of entity types, relationships and prompt word templates, which can be used to realize the subsequent entity information extraction.

[0103] The above-mentioned prompt template can be a pre-designed instruction pattern or question format used to guide LLM to perform specific tasks, such as entity information extraction. Templates usually contain placeholders and examples so that the model can understand and perform tasks.

[0104] In an optional embodiment, the target text can be identified from the data to be processed, and by determining the target domain to which the data belongs, a domain-related prompt word template is constructed, and finally, entity information extraction is performed based on the template using LLM. Representative or key text fragments can be selected from the data to be processed, and these fragments can reflect the subject or entity information of the data. The target text is analyzed to identify the industry or professional field to which the data belongs. This step is the basis for constructing the prompt word template, ensuring that the subsequent entity information extraction can focus on the entity types and relationships within the field. Based on the target text and the target domain, one or more prompt word templates are designed, and the templates contain domain-specific entity types and relationship extraction samples to guide the large model to perform more accurate entity information extraction. The constructed prompt word template is input into the large model, and the large model performs entity information extraction based on the prompt word template and the content of multiple text blocks, including the name, type, attribute and relationship between entities of the entity.

[0105] By building domain-adaptive prompt word templates, the accuracy and efficiency of entity information extraction are significantly improved. Determining the target domain and building domain-specific prompt word templates can guide the large model to better understand the context of the text and the true meaning of the entity, avoiding the extraction bias that may be caused by general entity types and samples. By fine-tuning the prompt words, the large model can more accurately identify and extract domain-related entities and relationships, thereby providing accurate basic information for building high-quality knowledge graphs.

[0106] In the above embodiment of the present application, constructing a prompt word template based on the target text and the target field includes: obtaining the entity type contained in the target field; generating second entity information based on the entity type; and constructing the prompt word template based on the target text and the second entity information.

[0107] The above entity types can be used to represent different types of entities that are classified, such as "person", "place", "organization", "product characteristics", etc. Determining entity types helps to more accurately identify and classify entities in the text, thereby building a more clearly structured and information-rich graph.

[0108] The second entity information is the entity information generated based on the target domain in the process of building the prompt word template, including the name, type, attribute and relationship of the entity. Different from the first entity information directly extracted from the data to be processed, the second entity information is prepared in advance for building the prompt word template, and is used to guide the large model in the entity and relationship extraction process in a specific field.

[0109] In an optional embodiment, the entity types contained in the target domain can be obtained, and a large model (LLM) can be used to generate a set of second entity information related to the target domain entity types, including the name, type, attributes and relationship of the entity. This step is intended to create a domain-related entity information library to provide samples for the subsequent construction of prompt word templates. Combining the target text and the second entity information, one or more prompt word templates are designed. These prompt word templates will contain domain-related entity types and relationship extraction samples to guide the large model to extract entity information more accurately.

[0110] First, we need to conduct an in-depth analysis of the target text to understand its core themes and key information points. The target text may already contain preliminary entity information and domain background, so analyzing the target text can help us identify the main entities, concepts, and contexts. For example, if the target text is an abstract about "cloud computing security", analyzing this text will help us identify key entities and concepts such as "cloud computing", "security", "data protection", and "access control".

[0111] Second entity information usually refers to entity information extracted from multiple text blocks in the Graph Indexing stage, including entity types, attributes, and relationships between entities. This information may be more detailed and structured than the information in the target text. By integrating the second entity information and analyzing the types, attributes, and relationships between entities, the content of the prompt word template can be further refined and enriched to ensure that it can guide the large model to extract entity information that is closely related to the target text and representative.

[0112] When designing prompt word templates, it is necessary to consider domain adaptability, entity types and attributes, entity relationships, context and context, and question diversity.

[0113] The above-mentioned domain adaptability ensures that the prompt word template can adapt to the domain to which the target text belongs. For example, if the target text belongs to the field of cloud computing security, the template should contain terms and concepts related to cloud computing security, such as "cloud storage", "encryption algorithm", "authentication", etc.

[0114] The above entity types and attributes are combined with the second entity information to integrate the entity types and attributes into the prompt word template, guiding the large model to extract more entity information related to these types and attributes, for example, "Please list all entities related to 'cloud computing' security, including but not limited to services, tools, protocols, etc."

[0115] The above entity relationships can guide large models to generate complex problems involving entity associations, for example, "describing the relationship between 'data protection' and 'access control' in the 'cloud computing' platform."

[0116] The above context and context require that the template should contain contextual information of the target text to help the large model understand the background and context of the entity information and generate more accurate question-answering data, for example, "In the context, how are 'security' measures applied to the 'cloud computing' platform? Please generate relevant questions based on the following text description."

[0117] The diversity of the above questions means that when designing prompt word templates, we must also consider the diversity of questions to ensure that the template can guide the large model to generate different types of questions, including detailed questions, summary questions, and questions involving the relationship between entities. For example, "Please generate questions about the technical principles, application cases, and future trends of 'cloud computing security'."

[0118] After designing the preliminary prompt word template, adjust and optimize it according to the feedback and generation results of the large model. This may include fine-tuning the vocabulary in the template, increasing or decreasing the coverage of entity types and attributes, and optimizing the way the question is expressed to ensure that the template can guide the large model to generate high-quality and highly relevant question and answer data. Finally, design a series of quality control measures to evaluate and adjust the effectiveness of the prompt word template, including but not limited to manually reviewing the generated question and answer data, using evaluation indicators (such as accuracy, coverage, and diversity) to quantify the effectiveness of the template, and continuously optimizing the template through iterative testing.

[0119] In summary, designing a prompt word template is a multi-step process that requires in-depth analysis of the target text and second entity information to ensure that the template can guide the large model to accurately extract entity information and generate high-quality question-answering data that is closely related to the domain. This process not only improves the relevance and accuracy of the generated data, but also increases the diversity and complexity of the questions, providing a solid foundation for subsequent question-answering data generation and quality control.

[0120] Through accurately designed prompt word templates, the large model can more accurately understand the main idea of ​​the target text, extract relevant entity information, and generate high-quality question-and-answer data that not only covers the core concepts of smart contracts and blockchain, but also explores the complex relationships between them, providing users with comprehensive and in-depth knowledge answers.

[0121] The prompt word template constructed through the above steps can significantly improve the accuracy and efficiency of entity information extraction of large models in specific fields. Obtaining the entity type in the target field ensures that the model can focus on field-related information during extraction, avoiding the field-irrelevant misleading that may be caused by general models. Generate the second entity information and construct the prompt word template. Through domain-adaptive examples and instructions, further guide the model to extract higher-quality entity information, making the constructed graph more accurate and complete, thus providing a solid foundation for the generation of high-quality question-answering data.

[0122] The domain-adaptive prompt word template created above can not only guide the model to extract entity information more accurately in a specific domain, but also generate high-quality entity information and relationships closely related to the domain, providing an effective means for constructing a target graph that accurately reflects domain knowledge, thereby providing a more accurate and in-depth information foundation for the generation of high-quality question and answer data.

[0123] In the above embodiment of the present application, a target graph is generated based on the first entity information and multiple text blocks, including: merging entity information of the same type in the first entity information to obtain third entity information; and generating a target graph based on the third entity information and multiple text blocks.

[0124] The third entity information mentioned above is used to represent a more refined and representative entity information set obtained by merging and summarizing entity information of the same type during entity information extraction and processing. For example, multiple "company" type entities may be merged into a representative "company" node, which contains the common attributes and relationships of all companies.

[0125] In an optional embodiment, by merging entities of the same type in the first entity information to obtain the third entity information, it helps to reduce duplicate nodes in the graph, making the graph structure more concise and convenient for subsequent graph operations and queries. By building a target graph based on the third entity information and multiple text blocks, the relationship between entities can be converted into a graph structure, in which entities are nodes and relationships are edges, forming a knowledge graph that reflects the content and structure of the document.

[0126] By merging entity information, duplication and redundancy in the graph are reduced, making the graph more concise and easier to understand. Merging similar entity information into third-entity information helps to centrally display the common attributes and relationships of entities, improving the readability and query efficiency of the graph. At the same time, generating the target graph based on the merged entity information and text blocks can ensure that the graph not only covers the comprehensive information of the document, but also improves the clarity and searchability of the graph by reducing redundancy and repetition, providing a structured and refined information framework for subsequent question-and-answer data generation.

[0127] For example, assume that the following entity information has been extracted from the technical report "Cloud Computing Platform Architecture and Security Strategy": entities "Virtual Machine A", "Virtual Machine B" and "Virtual Machine C", of type "Virtual Machine"; entities "Data Encryption Service X" and "Data Encryption Service Y", of type "Data Encryption Service"; entities "Access Control Policy A" and "Access Control Policy B", of type "Access Control Policy". Entities of the same type are merged to obtain the third entity information "Virtual Machine", which contains the information and attributes of all virtual machines; the third entity information "Data Encryption Service", which contains the information of all data encryption services; the third entity information "Access Control Policy", which contains the information of all access control policies. Based on the merged third entity information and multiple text blocks, a target graph is generated. The graph will contain nodes such as "Virtual Machine", "Data Encryption Service" and "Access Control Policy", which are connected by relationship edges, reflecting the association between these entities in cloud computing security practices, such as "Virtual Machine Uses Data Encryption Service" and "Access Control Policy Applied to Virtual Machine".

[0128] Through the above steps, the constructed target graph not only clearly reflects the key information and structure of the document, but also reduces redundancy and repetition through the merging and summarization of entity information, thereby improving the readability and query efficiency of the graph. This is crucial for the subsequent generation of high-quality question-answering data based on the target graph, because it ensures the accuracy and structured characteristics of the graph as an information source, thereby improving the relevance and depth of the generated question-answering data.

[0129] In the above embodiment of the present application, a target graph is generated based on the third entity information and multiple text blocks, including: extracting an initial graph from multiple text blocks based on the third entity information and the entity structure information of the third entity information; clustering the initial graph to obtain multiple entity clusters, wherein entities belonging to the same entity cluster are mutually related; and updating the initial graph based on the multiple entity clusters to obtain a target graph.

[0130] In an optional embodiment, the declarations, attributes and relationships of each entity can be extracted from multiple text blocks based on the third entity information to form an initial graph reflecting the entity structure. The hierarchical community detection algorithm (Leiden) can be used to recursively cluster the initial graph to generate a community hierarchy of entities, ensuring that the division of entity clusters is both mutually exclusive and exhaustive, thereby obtaining the above-mentioned multiple entity clusters. The initial graph can be updated based on Leiden, and the information related to each other between entities belonging to the same entity cluster can be integrated and adjusted to generate the final target graph.

[0131] The entity structure information of the third entity information extracted above includes not only the static attributes of the entity, but also dynamic declarations and time-sensitive information, which enables the graph to more comprehensively reflect the true situation of the entity. Performing community detection and entity clustering helps to form hierarchical entity associations in the graph, thereby more clearly understanding the complex relationships between entities. Updating the graph to the final target graph ensures the accuracy and completeness of the graph.

[0132] The above clustering process can organize the entities in the graph into multiple entity clusters with internal connections and correlations by analyzing the similarities and associations between entities. This process not only improves the structural clarity of the graph, but also provides a more systematic information framework for subsequent question-answering data generation. The goal of clustering is to identify and form natural groups between entities based on the strength of the relationship between entities, attribute similarity, or the frequency of co-appearance in the same context. Through clustering, entities with similar functions, attributes, or relationships can be grouped together to form entity clusters, which helps to understand the relationship between entities from a macro level, while reducing redundant information in the graph and improving the readability and query efficiency of the graph.

[0133] In order to achieve the above objectives, the present application may use the Leiden hierarchical community detection algorithm for clustering. The Leiden algorithm is an efficient community detection method that can recursively identify communities of different sizes in a graph until a preset community size threshold is reached. While ensuring that the entities within each community are highly correlated, the Leiden algorithm also ensures the independence and clear boundaries between different communities, that is, a "mutually exclusive, set-exhaustive" community division method. This method can effectively reveal the multi-level associations between entities and form a clear entity cluster hierarchy.

[0134] In an optional embodiment, starting from an initial graph constructed based on the third entity information and entity structure information, this graph contains entity nodes and the edges (relationships) between them, forming a network graph, and using the Leiden algorithm to perform recursive community detection on the initial graph. The algorithm will divide the entities into different communities based on the relationship strength and attribute similarity between entities. This process will be repeated until the size of each community meets a specific threshold condition. Through community detection, the entities in the graph are organized into multiple entity clusters. Entities within the same entity cluster are clustered together based on their strong association and similarity, while different entity clusters represent different information themes or functional areas in the graph. Based on the formed entity cluster structure, the initial graph is updated, which may include optimizing the edge weights (relationship strength) between entities, adding or deleting entities and relationships, and reorganizing the connections between entities to ensure that the structure of the graph is more reasonable and coherent, while also reflecting the hierarchical relationship of the entity clusters.

[0135] Through the clustering process, the target graph can not only clearly reflect the association and hierarchy between entities, but also provide a deep understanding of entity clusters, which is very important for the subsequent steps of question and answer data generation. The formation of entity clusters helps to expand around the core topic when generating questions and answers, avoiding isolated questions and answers, so that the generated questions and answers are more complex and in-depth, covering the key information and comprehensive content of the document, and providing users with a richer and more valuable question and answer experience.

[0136] In the above embodiment of the present application, the initial graph is updated based on multiple entity clusters to obtain a target graph, including: obtaining cluster information of multiple entity clusters; refining the cluster information to obtain key information of multiple entity clusters; performing feature extraction on the cluster information and the key information to obtain an information vector; and embedding the information vector into the graph vector corresponding to the initial graph to obtain a target graph.

[0137] The above cluster information contains detailed information about entity clusters, such as a list of member entities, relationships between entities, entity attributes and declarations within the cluster, etc. This information describes the complete characteristics and internal structure of each cluster.

[0138] The above key information can be the most core and important information points extracted from the cluster information. The key information can highly summarize the theme, function or important entity of the cluster. The key information is the basis for subsequent feature extraction and vector representation.

[0139] The above information vector can be a numerical vector that converts cluster information and key information into a numerical vector through feature extraction. These vectors represent the semantic characteristics and key features of the cluster in a high-dimensional space. The information vector is a key element embedded in the graph vector to enhance the information retrieval and understanding capabilities of the graph.

[0140] In an optional embodiment, cluster information of multiple entity clusters can be obtained, and detailed entity information, relationships, attributes, and declarations can be collected from each entity cluster obtained in the clustering process. Representative and important entities and relationships can be screened out from the cluster information to form a key information set, which helps to reduce redundancy and focus on the core features of the cluster. Feature extraction is performed on the cluster information and key information, and the extracted features can be converted into information vectors. The semantic characteristics of each entity cluster are encoded into a high-dimensional space through vector representation. The information vector is fused into the graph vector corresponding to the initial graph. This process updates the representation of entities and relationships in the graph, so that the graph not only contains the original node and edge information, but also incorporates the semantic features and structural information of the community, and finally obtains the target graph.

[0141] In an optional embodiment, a community detection algorithm (such as the Leiden algorithm) is used to cluster entities and relationships in the graph into different clusters. Each cluster represents a group of closely related entities with similar attributes or functions. Through community detection, the hierarchical structure of the clusters and the composition information of each cluster can be obtained. The entities and clusters in the graph are embedded into a high-dimensional vector space using graph embedding technology (such as Node2Vec or GraphSAGE). This technology takes into account the position, links, and community structure of the entities in the graph, and the generated vectors can not only reflect the semantic characteristics of the entities, but also reflect their relative position and importance in the cluster.

[0142] For each cluster, the vectors of all entities in it can be weighted averaged to produce a vector representation of the cluster. The weighting can be adjusted based on the number of connections of the entity in the cluster, the entity's influence score (such as PageRank score), or the level in the cluster hierarchy to ensure that the generated vector can reflect the core characteristics of the cluster. In addition to basic graph embedding, the cluster vector can also be enhanced with the attributes, declarations, and contextual information of the entity. By converting this information into vectors and fusing them, the semantic representation of the cluster can be further enriched.

[0143] High-frequency and high-information keywords can be extracted from the target text as key information. These keywords often reflect the core theme and key points of the text. Performing part-of-speech tagging and named entity recognition on keywords to determine their grammatical functions and entity types helps to more accurately understand the role and meaning of keywords in the text.

[0144] Use pre-trained semantic vectorization models to convert keywords into semantic vectors. These models can capture the contextual information and potential semantic meaning of keywords, thereby generating more accurate vector representations. The contextual information of keywords (such as other entities, attributes, or relationships that appear near the keywords) is also converted into vectors and fused with the keyword vectors to enhance the semantic representation capabilities of the vectors.

[0145] Finally, feature selection and dimensionality reduction are performed on the generated vectors to remove redundant information and retain the most critical features for question-answer generation. This process can improve the efficiency and calculation speed of the vectors while maintaining their core semantic information.

[0146] After cluster information and key information are converted into information vectors, the degree of association between them can be measured by calculating the similarity between vectors (such as cosine similarity or dot product). In the question-answer generation stage, these information vectors can be used as input to the large model to help the model generate questions and answers that are closely related to cluster information and key information, thereby improving the accuracy and complexity of the generated data.

[0147] For example, suppose you are processing a document about "The Application of Blockchain Technology in Supply Chain Management". In the process of cluster information feature extraction, we use community detection algorithms to cluster entities related to blockchain and supply chain management into clusters, use graph embedding technology to generate vector representations for each cluster, and fuse entity attributes and declaration information to enhance these vectors. In key information feature extraction, we extract keywords such as "blockchain", "supply chain", "product traceability", etc., and use semantic vectorization models to convert them into vector representations. In the question and answer generation stage, the big model will generate questions and answers closely related to blockchain and supply chain management based on these converted information vectors, ensuring that the generated question and answer data not only covers the main theme of the document, but also contains complex entity associations and in-depth detailed information.

[0148] The above method can be used to extract features of cluster information and key information and convert them into information vectors, which can provide accurate semantic guidance for question and answer data generation, enhance the relevance and accuracy of generated data, and at the same time increase the complexity and diversity of the data, effectively addressing the challenges of generating high-quality question and answer data.

[0149] The semantic understanding and retrieval capabilities of the graph can be enhanced by vectorizing community information. By acquiring and refining cluster information, the semantic characteristics of entity clusters can be captured, while feature extraction and vector representation convert these characteristics into numerical vectors, which facilitate efficient retrieval and analysis in the graph vector space. Embedding information vectors into graph vectors not only enhances the dynamics and time-series processing capabilities of the graph, but also improves the depth and query efficiency of the graph by combining the hierarchical structure and semantic features of the community, providing a richer and more accurate information framework for the generation of subsequent question-and-answer data.

[0150] Through the above-mentioned graph update process, the target graph not only clearly reflects the associations and hierarchies between entities in structure, but also enhances the semantic understanding and retrieval capabilities of the graph in vector representation. This means that when generating question-and-answer data based on the graph, the system can more accurately identify and extract entities and relationships related to specific clusters, and the generated questions and answers are more in-depth and relevant, covering the key information and comprehensive content of the document, providing users with a richer and more valuable question-and-answer experience. At the same time, the embedding of information vectors also improves the query efficiency of the graph, enabling the system to quickly locate the entity cluster most relevant to the question, thereby generating more accurate and timely answers.

[0151] In the above embodiments of the present application, generating a target problem for the data to be processed based on the target graph includes: generating an initial problem based on cluster information of multiple entity clusters; and expanding the initial problem using the target graph to obtain the target problem.

[0152] In an optional embodiment, an initial question can be generated based on the cluster information of the entity cluster, and then the initial question can be expanded using the complex relationships and multi-hop information in the target graph to cover more details and levels, and finally the target question can be obtained. This process ensures the diversity and depth of the questions, while being closely related to the main theme and key information of the document, providing a solid foundation for the generation of high-quality question-answering data. Optionally, the target graph can be input into a large model, and the large model can be used to expand the initial question based on the content recorded in the target graph to obtain the target question.

[0153] First, we need to deeply analyze the hierarchical structure, entity types, entity attributes, and relationships between entities of the entity cluster. This step requires comprehensive consideration of the location of the entity cluster in the knowledge graph, the influence and relevance of the entity, and the connection density and topic consistency within the entity cluster. For example, if the cluster information indicates that there is an entity cluster around the theme of "blockchain technology in supply chain applications", the analysis should focus on identifying key entities in the cluster (such as "supply chain", "blockchain", "product traceability"), entity attributes (such as "creation time", "version"), and relationships between entities (such as the association between "blockchain technology" and "product traceability").

[0154] The cluster information of entity clusters is converted into vector representation using graph embedding technology. By calculating the vector representation of each entity in the cluster and combining the number of connections, influence score or entity attributes of the entity for weighted average, an information vector representing the semantic characteristics of the entire cluster can be generated. These information vectors not only contain the basic information of the entity, but also reflect the theme and structural characteristics of the entity cluster, providing semantic guidance for generating cluster-related questions.

[0155] Design a series of question templates that can guide the big model to generate questions based on the cluster information of the entity cluster. The design of the question template needs to fully consider the specific attributes and relationships of the entity cluster to ensure that the generated questions can both reflect the main theme of the cluster and explore the complex relationships between entities. For example, for the entity cluster around "Blockchain technology in supply chain application", the following question templates can be designed: "What is the relationship between entity [entity type] and entity [another entity type] in the cluster?", "Which attributes of entity [entity type] are related to the cluster theme?", "What are the main claims or facts of entity [entity type] in the cluster?", "How does the entity cluster affect [aspect / result] of [topic / concept]?", "What are the application cases of entity [entity type] in the cluster at [time / place / context]?".

[0156] Based on the designed question template and the information vector of the entity cluster, the big model is used to generate specific questions. During the generation process, the big model will combine the vector representation of the entity cluster and the guidance of the question template to generate questions that are highly relevant to the subject of the entity cluster and the relationship between entities. For example, for the entity cluster of "Blockchain technology in supply chain application", the big model may generate the following questions: a. "How does blockchain technology achieve product traceability in the supply chain?", "What is the role of smart contracts in blockchain supply chain management?", "How does the decentralized network in supply chain management affect product safety?", "How does blockchain technology improve transaction efficiency in the supply chain?", "What is the implementation mechanism of product traceability in the blockchain supply chain?".

[0157] Finally, the generated initial questions are quality controlled to ensure that they are not only relevant to the topic and structure of the entity clusters, but also answerable, accurate, and diverse. This step can be evaluated and screened by manual review, automatic evaluation based on specific scoring criteria, or combined with other large models.

[0158] Through the above steps, the initial questions are generated based on the cluster information of the entity clusters. This process can not only capture the core topics and key entities of the document, but also explore the complex relationships between entities. The generated questions are therefore deep and broad, laying a solid foundation for the generation of high-quality question-answering data. This method is particularly suitable for processing documents involving multiple related entities and complex relationships. It can effectively improve the relevance and complexity of question-answering data and meet users' information needs in different scenarios.

[0159] Through the above steps, a series of high-quality target questions can be generated. These questions are closely related to the main theme and key information of the document, covering the complex relationships and dynamic characteristics between entities. The structure and knowledge of the target graph can be used to generate more comprehensive, in-depth and hierarchical questions, which improves the diversity and complexity of the question-answering data, enhances the effectiveness of the generated questions and the credibility of the answers. At the same time, through the expansion of questions, multi-hop relationships between entities can be mined, and complex questions involving multiple entities and document paragraphs can be generated, further improving the domain richness and interpretability of the question-answering data, and providing higher-quality data support for scenarios such as evaluation and model fine-tuning training.

[0160] In the above embodiment of the present application, a reply text for the target question is generated based on the target question and the question type, including: in response to the question type being the first type, obtaining associated information associated with the target question from the target graph; and generating a reply text based on the associated information and the target question.

[0161] The above reply text may be an answer to a specific question, usually including a direct answer to the question, additional explanation of relevant details, elaboration of background information, etc., aiming to provide users with complete and accurate information. The first type is the detailed type.

[0162] In an optional embodiment, when the question type is identified as the first type, i.e., a detailed question, related information can be obtained from the target graph, and entities, relationships, and attributes related to the question can be retrieved from the target graph based on the keywords and concepts in the question. This related information provides the details and context required to answer the question. A reply text is generated based on the related information and the target question, and the retrieved related information can be combined with the question itself to generate a detailed answer using the capabilities of LLM, while including reference sources to enhance the interpretability and quality of the answer.

[0163] By combining the target graph and the large model, high-quality response text is generated, especially for detailed questions. Not only does it provide accurate and detailed answers based on the contextual information of the question, but it also enhances the interpretability and quality control of the question and answer data by citing sources. By obtaining related information from the target graph, the system can deeply mine the relationships and details between entities in the document. The generated response text covers all aspects of the question, ensuring the comprehensiveness and accuracy of the answer. At the same time, the provision of cited sources enables users to trace the basis of the answer, improves the transparency of the answer and the user's trust in the information, and also provides a basis for subsequent quality judgments, ensuring that the generated question and answer data meets the requirements of high credibility and high quality.

[0164] Through the above steps, the system can generate in-depth and accurate response text for detailed questions, while providing information sources, enhancing the interpretability, transparency and credibility of the Q&A data, providing users with a high-quality Q&A experience, and facilitating subsequent quality control and optimization. In the field of cloud computing, this detailed and rigorous way of answering questions can help users understand the technical details in the document more deeply and improve the efficiency and depth of information acquisition.

[0165] In the above embodiment of the present application, a reply text is generated based on related information and a target question, including: in response to the question type being the second type, key information of multiple entity clusters is segmented to obtain multiple information blocks; multiple sub-reply texts are generated according to the multiple information blocks and the target question; and multiple sub-reply texts are screened based on the degree of association between the multiple sub-reply texts and the target question to obtain a reply text.

[0166] The second type of questions mentioned above mainly refers to summary questions, which usually require comprehensive analysis and summary of key information of multiple entity clusters to provide a comprehensive answer covering multiple knowledge points. The response text for summary questions includes the integration of key information of multiple entity clusters, as well as the analysis and summary of this information to answer the comprehensive needs of the question. The first type mentioned above is the summary type.

[0167] In an optional embodiment, multiple information blocks can be generated based on the community summaries of multiple entity clusters, and then a sub-response text is generated for each information block, and the relevance of each sub-response text to the target question is evaluated. Sub-response texts with high relevance can be selected to avoid redundant information and improve the efficiency and quality of answers. Finally, these highly relevant sub-response texts will be summarized to form a comprehensive and refined final answer, answering the original summary question.

[0168] Generating multiple sub-response texts according to the multiple information blocks and the target question, and evaluating the degree of relevance of each sub-response text to the target question, are key steps in achieving high-quality and controllable question and answer in the question and answer data generation system.

[0169] First, conduct an in-depth analysis of each information block to understand its core entities, relationships, and statements. Using the associated information in the knowledge graph, each information block is enhanced to supplement the relevant entity information and relationship chain to ensure the comprehensiveness and depth of the sub-response text. For example, for an information block about "blockchain technology", enhancement may involve adding relevant entities such as "encryption algorithm", "distributed ledger", "smart contract" and their relationships. Design a series of question templates that can guide the big model to generate sub-questions related to the target question but specifically focused on the information block. Template design needs to combine the semantic and structural features of the information block to ensure that the generated sub-questions are both relevant and diverse. For example, for the "blockchain technology" information block, the template can be "In [blockchain technology], how does [encryption algorithm] ensure data security?" or "What is the role of [distributed ledger] in [blockchain technology]?" Use the big model to generate sub-response text for each information block and the designed question template. During the generation process, the big model uses the given information block and question template to generate detailed answers. Each sub-response text addresses a specific piece of information, but the answer takes into account the context of the overall target question to ensure its relevance to the target question. For example, the sub-response text may explain in detail how "encryption algorithms" protect data security in "blockchain technology" and mention the auxiliary role of "smart contracts".

[0170] Use a pre-trained semantic vectorization model to convert the sub-reply text and the target question into vector representations, and then calculate the cosine similarity or dot product between the two vectors to evaluate the semantic relevance. A higher similarity score indicates that the sub-reply text is semantically closely related to the target question. Identify keywords in the sub-reply text and the target question, and evaluate the relevance between the text and the question by matching keywords. Keyword matching can be based on scores or part-of-speech tags to ensure that words with important semantic value are matched. If the sub-reply text contains key entities and concepts in the target question, its relevance score will be increased accordingly.

[0171] Using the logical reasoning ability of the knowledge graph, check whether the information in the sub-response text is logically consistent with the entities and relationships involved in the target question. For example, if the target question is about how "blockchain technology" affects "supply chain management", and the sub-response text discusses the role of "blockchain technology" in "data security" but fails to directly link to "supply chain management", then its relevance score may be low.

[0172] On the basis of automated evaluation, human experts are introduced to review to ensure the accuracy of machine evaluation. Human experts can make subjective judgments on sub-response texts to evaluate whether they truly answer the core points of the target question and whether the depth and breadth of their information meet the requirements.

[0173] Finally, the results of the above automatic evaluation and human expert review are combined to generate a comprehensive score of the relevance of each sub-response text to the target question. This score can be a weighted average, where the weights of semantic similarity, keyword matching, and logical reasoning evaluation can be adjusted according to specific scenarios and needs.

[0174] Through the above-mentioned achievable method, multiple sub-response texts can be generated for multiple information blocks and target questions in the knowledge graph, and the degree of relevance of each sub-response text to the target question can be effectively evaluated, ensuring that the generated question-and-answer data is both comprehensive and in-depth, and closely related to the target question, meeting the needs of high-quality question-and-answer data generation. This method is particularly suitable for processing question-and-answer scenarios involving multiple related entities and complex relationships, and can effectively improve the accuracy and consistency of responses, and enhance the credibility and practicality of question-and-answer data.

[0175] For the generation of summary questions, comprehensive and in-depth answers can be generated through comprehensive analysis of key information of multiple entity clusters. Through segmentation and screening, the system avoids redundant information in the answers, improves the efficiency and quality of the answers, and ensures the accuracy and relevance of the final answers. In addition, through the use of community summaries, the system can cover a wider range of entity cluster information, provide a comprehensive perspective, and meet users' needs for in-depth understanding of complex issues.

[0176] In the above embodiment of the present application, multiple sub-reply texts are screened based on the degree of association between the multiple sub-reply texts and the target question to obtain a reply text, including: screening multiple sub-reply texts based on the degree of association between the multiple sub-reply texts and the target question to obtain an initial reply text; adjusting the initial reply text based on a preset text word count to obtain a reply text.

[0177] The above initial response text is a preliminary integrated text obtained after screening multiple sub-response texts, which contains information from multiple sub-response texts that are highly relevant to the target question. The response text is the final, adjusted answer text. Based on the initial response text, it is further adjusted according to the preset text word count to ensure that the length of the answer is moderate, contains rich information, and is easy to read and understand.

[0178] Adjusting the initial response text based on the preset word count is a key step to ensure that the generated question-answer data is in a uniform format and easy to understand and process. This process aims to adjust the initial, potentially lengthy or brief response text to an ideal length that is neither too redundant nor omits important information, in order to optimize the user's reading experience and information acquisition efficiency.

[0179] First, extract the core entities and key relations directly related to the answer from the initial response text. This step can be achieved through named entity recognition and relation extraction technology to ensure that the core information is retained even when the text length is adjusted later. Evaluate the difference between the length of the initial response text and the preset text word count. The preset text word count may be based on a specific question and answer application scenario, such as a knowledge base or a text summary in a specific format.

[0180] If the initial reply text is too long, redundant information needs to be streamlined. Use text summarization techniques (such as extraction-based summarization methods or generation-based summarization methods) to retain the key information points in the reply text while removing irrelevant details. For example, using extractive summarization algorithms such as TextRank can identify important sentences in the text; using generative summarization algorithms such as Seq2Seq models can reconstruct the core information of the text.

[0181] If the initial reply text is too short and the preset number of words requires more information, relevant information can be supplemented through knowledge graph retrieval or large model generation. Using entity and relationship information, other entities and relationships related to the core entity can be retrieved from the knowledge graph, or a large model can be used to generate supplementary information related to keywords to enhance the completeness and depth of the reply text.

[0182] When adjusting the length of the text, it is important to maintain the structure and coherence of the reply text. The adjusted text should maintain clear logic and fluent sentences. Use conjunctions and transition sentences to ensure the logical relationship and semantic coherence between the parts before and after the adjustment.

[0183] While using automatic technology to adjust the text length, manual review is introduced to ensure that the adjusted text not only meets the preset word count, but also retains the core meaning and information integrity of the original text. Manual review can fine-tune the adjustment results of automatic technology and correct possible semantic deviations or information missing.

[0184] If the preset text word count range is strict, multiple iterations can be performed to gradually adjust the text length until the preset conditions are met. In each iteration, text summarization and information supplementation techniques are used to gradually adjust the text, and manual review is performed to ensure the quality of information during the adjustment process.

[0185] For example, suppose the initial reply text is a 300-word description of "The Application of Blockchain Technology in Supply Chain Management", and the preset text word count is between 100 and 150 words. First, extract key entity information from the text, such as "blockchain technology", "supply chain management", "product tracking", etc. Then, use the algorithm to summarize the text and retain a condensed reply of about 150 words. Next, check whether the condensed text retains the core information points. If there is information missing, use the large model generation technology to supplement the 100-word supplementary text based on the keywords "blockchain technology" and "supply chain management". Finally, manually review the condensed and supplemented text to ensure that it meets the preset word count requirements while retaining the full meaning and information depth of the reply text. The above values ​​are for example only and are not specifically limited.

[0186] Through the above steps, the initial reply text can be effectively adjusted based on the preset word count to obtain a reply text that meets the word count requirements and maintains information integrity, providing a unified format and easy-to-understand text foundation for the generation and application of high-quality question and answer data, thereby improving the user's reading experience and information acquisition efficiency.

[0187] In an optional embodiment, multiple sub-response texts can be screened based on their relevance to the target question to obtain an initial response text. The system evaluates the relevance between each intermediate answer and the target question and sorts them according to the model score (0-100, not limited here, and the score value can be adjusted according to actual conditions). Intermediate answers with lower scores will be filtered out, while intermediate answers with higher scores will be integrated into the initial response text. By streamlining and adjusting the initial response text, deleting redundant information, and retaining the most relevant and important information to the question, it is ensured that the final generated response text meets the preset word limit.

[0188] Through the above steps, the system can generate high-quality, appropriately long final answers to summary questions, which not only cover the key information of the document, but also are optimized according to the questions and goals, thereby improving the refinement and information density of the answers, and providing users with an answer that is both comprehensive and easy to understand. This ensures that when the system generates question and answer data, it not only meets the comprehensiveness requirements of information, but also takes into account the user experience, avoids the reading difficulties that may be caused by overly long texts, and facilitates subsequent quality control and data management.

[0189] This application designs a QA generation method based on knowledge graph retrieval enhancement, which is divided into two stages: graph indexing and question answering (QA) generation. First, the knowledge graph index is constructed, the text data is parsed and the text is segmented, and the information required for the knowledge graph index is extracted using LLM based on the text segmentation results, and then a series of knowledge enhancements are performed on the Graph. In the QA generation stage, based on the enhanced Graph, high-quality QA data is obtained through seed question generation, QA expansion and quality control.

[0190] In the Graph Indexing stage, this application uses LLM to process text data based on special prompts to extract entities and relationships to build a knowledge graph. The purpose of building a knowledge graph is not only to increase the association relationship in the following text when generating QA, but also to perform multi-layer clustering, so as to better generate valuable questions and extract the key information and main points of text data.

[0191] Figure 3 is a flowchart of constructing a graph index according to an embodiment of the present application. Figure 3 As shown, it includes a text data parsing module, a text data segmentation module, a text data enhancement module, an adaptive prompt template creation module, a graph construction module, a graph enhancement module, and a graph summary module.

[0192] The text data parsing module first performs a deep analysis of the input text data, converting the text data content into a text form containing multimodal elements such as tables, images, formulas, etc., and uses the text data segmentation module to further divide the text data into structured small blocks, namely Text Units. Each block contains the content of one or more chapters, providing a basis for subsequent processing. Subsequently, the text data enhancement module generates a semantic representation for each Text Unit through embedding technology to form a basic data unit, which is convenient for the construction and analysis of the map.

[0193] Before the graph is built, the adaptive prompt template creation module intervenes to design and optimize the prompt template by analyzing the text data domain and role, which helps LLM to extract entities and relationships more accurately and improve the quality of the graph. Based on the optimized prompt template, the graph construction module extracts entities, relationships, and statements from Text Units, merges and summarizes entities and relationships with the same characteristics, ensures the consistency of the graph through entity resolution, and uses LLM's deep understanding ability to generate concise and information-rich descriptions, ultimately forming a structured graph representation.

[0194] To further optimize the graph, the graph enhancement module enhances the structure and semantic representation of the graph through two key steps: community detection and graph embedding. The Leiden algorithm identifies and clusters communities in the graph to form a hierarchical structure, while the node embedding algorithm (Node2Vec algorithm) generates a vector representation of the graph, providing implicit semantic features for communities and nodes, and enhancing the search and understanding capabilities of the graph.

[0195] Finally, the graph summary module generates multi-granularity community reports and summaries based on the above processing results, generates descriptions and impact assessments of each community through LLM, provides a comprehensive understanding of different levels of the graph, and converts these reports into vector representations to provide efficient support for subsequent complex queries and reasoning. Throughout the entire process, the close connection between modules and the layer-by-layer abstract construction of information ultimately generate a highly structured, semantically rich, and clearly hierarchical knowledge graph, laying a solid foundation for the generation of high-quality question-answering data.

[0196] For the text data parsing module, text data segmentation module and text data enhancement module, the input text data is first parsed and segmented to obtain text units (Text Units), and then different text units are embedded to create basic data units. The text unit is the basic processing unit in the entire process. The subsequent extraction of entities and relationships and the generation of knowledge graphs all depend on these text units and the corresponding embedded information, and the text unit can be used as a source reference for knowledge items.

[0197] The above-mentioned text data parsing and segmentation first parses and segments the text data. This application can use the file parsing function of the knowledge center of the open path platform (open trek platform) to convert the file into a text containing multimodal elements such as tables, images, formulas, etc., and then divide the text data into smaller text blocks according to the text directory structure and semantics through the structure tree segmentation. Different text blocks contain the content of one or more chapters.

[0198] In the above text embedding, each text block will be converted into an embedding representation. These embedding vectors will capture the semantic information of the text block and will be used for further processing and graph generation in subsequent stages.

[0199] For the creation of adaptive prompt templates (prompt-tuning), when extracting entities and relationships from files in a certain industry field, the general entity types and extraction samples in the prompts may lead to unsatisfactory extraction results, thus affecting the graph construction effect. Therefore, before building the graph, it is necessary to use the capabilities of LLM to automatically fine-tune the prompt template to adapt to the domain of the input file. A special prompt template is designed in this application, which can use LLM to generate domains, roles, entity types and context-based learning examples (In-Context Learning Examples, referred to as ICL examples) according to the text in turn to achieve domain-adaptive entity type generation and ICL example generation. Domain-adaptive prompt templates can be created to improve the accuracy of graph construction.

[0200] When creating a prompt template, you can sample some chunks from the original corpus, use LLM to analyze the information in the chunk, identify the field to which the text data belongs, and design a prompt based on the chunk information and the text data field. Use LLM to generate a domain expert role that is good at solving problems related to the field. Set LLM as a domain expert, and design a prompt to generate relevant entity types for the text data in the field based on chunk information and the text data field. Set LLM as a domain expert, and design a prompt to generate entity and entity relationship extraction samples for the text data in the field based on chunk information and field-related entity types. Use the generated entity types and extraction samples to create a prompt template for entity and relationship extraction in the field.

[0201] For the graph construction module, the Text Units are analyzed to extract the basic elements of the graph, namely, entities, relationships, and claims. The goal of this stage is to generate entities and relationships related to the knowledge graph from the text and summarize these elements into a structured representation.

[0202] You can implement entity and relationship extraction first, process Text Units first, extract entities and relationships from the original text, merge entities with the same name and type, and merge relationships with the same source and target, which ensures the simplicity and effectiveness of the graph.

[0203] When implementing entity and relationship summarization, after generating the graph of entities and relationships, summarize each entity and relationship to generate a concise description. The purpose of this stage is to optimize the graph information through summarization so that each entity and relationship has a short and informative description. The summarization process can be implemented through LLM, which can extract important information from the original description to ensure that the graph remains concise and effective.

[0204] Entity resolution is used to resolve entities that represent the same real-world entity but have different names. For example, different texts may refer to the same company. Entity resolution is very important to ensure the consistency of entities in the graph.

[0205] Finally, statement extraction is implemented. Entity statements are extracted from the Text Unit. These statements represent positive factual statements (structured information) with evaluation status and time constraints. The extracted statements are called covariates, which provide certain dynamic graph capabilities and time series processing capabilities, which are very useful in subsequent analysis.

[0206] For the graph enhancement module, the system currently has a usable entity and relationship graph. Next, we need to further understand the community structure of the graph and enhance the graph with additional information. This stage is completed through two steps: community detection and graph embedding. Community detection provides explicit community structure to help understand how different entities form groups in the graph. Graph embedding provides implicit semantic representation to enhance the search capability of the graph in the query stage.

[0207] In the process of community detection, the Leiden hierarchical community detection algorithm is used to recursively cluster the graph until a certain community size threshold is reached to generate a community hierarchy of entities in the graph. The Leiden algorithm can efficiently establish an explicit graph hierarchical community structure, and the community division method in each layer of the structure is "mutually exclusive and set exhaustive".

[0208] In the graph embedding process, the vector representation (GraphEmbedding) of the graph is generated through the node embedding algorithm (Node2Vec). Node2Vec is a technology that maps graph nodes to vector space, so that the nodes and relationships in the graph can be represented in a high-dimensional vector space. Graph embedding helps to understand the implicit structure of the graph and provides an additional vector space that can be used to search for related concepts in the query phase. Through this embedded representation, relevant nodes and relationships in the graph can be searched more efficiently semantically.

[0209] After the above stages of processing, we already have a functional graph containing entities, relationships, and community hierarchies, and have completed the graph embedding generated by Node2Vec. Next, we generate community reports based on these community data to provide summaries of the graph at different levels of granularity, and generate vector representations for these community reports through embedding technology. Through these steps, we can provide a high-level understanding of the Graph at different community granularities and enhance its responsiveness to complex queries. The steps of generating community reports, summarizing community reports, and community embedding can be performed later.

[0210] For the step of generating community reports, LLM can be used to generate summary reports for each community. These reports provide key information within each community and the severity of the impact of the community, as well as a specific understanding of the graph. By generating these community reports, we can better understand how different communities in the graph are formed, and provide different levels of summary perspectives for subsequent reasoning or queries. For example, if a community is at the top level of the graph, the report may cover the entire graph; while lower-level community reports focus more on local clusters.

[0211] For the step of summarizing the community report, you can generate a concise version of the report by summarizing the community report. Based on the community granularity that the report focuses on, it provides an overview or detailed analysis of the graph. These summary reports help understand the communities in the graph from a higher level and help quickly obtain information related to a specific community during subsequent reasoning or query processes.

[0212] For the community embedding step, the community can be embedded into the vector space by generating vector representations (embedding) for community reports and their summaries, providing an additional vector space representation for subsequent queries, making it more efficient to search for relevant community content when retrieving based on the community's semantic information.

[0213] In the QA generation stage, we first use community reports to generate high-quality seed questions, then expand the seed questions based on Graph, and use the method of extending questions around the main content of text data to improve the effectiveness and complexity of QA. Finally, LLM is used for QA quality control.

[0214] Figure 4 1 is a flow chart of question and answer content generation according to an embodiment of the present application. Figure 4As shown in FIG, it includes a seed question generation module, a question and answer content expansion module, and a quality control module. The seed question generation module is used to sort the community reports (report 1, report 2…report k) in the community report queue, and select the top K that can summarize the key information of the text data to generate seed questions. The question and answer content expansion module can associate information based on the complex relationship connections constructed by the knowledge graph, thereby expanding the amount of information and complexity of the seed question. The seed question can be used as a query to recall the relevant entities, relationships, entity attributes, community reports, and blocks of original text data from the knowledge graph, which are used to expand the seed question using a large model, and then generate answers based on the generated query and context, and finally generate the reply content. In the quality control module, quality control can be achieved from the perspectives of effectiveness, answerability, correctness, and comprehensiveness. If it passes, the question and answer content is generated, and the basis for generating the question and answer content is output. If it fails, the question and answer content is directly deleted.

[0215] For the seed question generation module, currently, seed questions are generated based on the content of a certain chunk or related QA is directly generated. This has extremely high requirements on the quality of the chunk and whether it contains key information of the text data. In addition, this method only focuses on local details and lacks the mining of global relationships between chunks. In order to solve these problems, this application generates seed questions based on the main content of the text data and obtains the main content of the text data from the Graph. In the Graph Indexing stage, after the hierarchical community clustering of the Leiden community detection algorithm, the communities in the Graph are divided into multiple levels from low to high. Level can be used to represent the level of a community. The smaller the number, the higher the level. The report generated for each community can provide an understanding of the text data from multiple granularity points. The report contains a title and summary, and cites key entities, relationships and statements in the community substructure, and also gives an impact severity score ranking (rank), a floating point score between 0-10, representing the severity of the impact of the entity composition in the community. Community detection fully mines the association and hierarchical relationships between chunks, and summarizes the text data in a coarse and fine granularity through community reports, effectively extracting the main content of the text data.

[0216] This application sorts the reports (report 1, report 2…report k) according to the level and severity of the community reports, and selects the top K reports that can summarize the key information of the text data to generate seed questions. This batch of questions is small in number, but representative and closely related to the main content of the text data.

[0217] For the question-answering content expansion module, since complex relational connections are constructed using the knowledge graph, these connections can be used to expand the amount of information and complexity of the seed question. The seed question is used as a query, and relevant entities, relationships, entity attributes, community reports, and original text are recalled from the graph and put into the context to expand the question based on the seed question. Then, the answer is generated based on the generated query and context at the same time to avoid the answer being too abstract or incomplete due to the limitation of the output token.

[0218] In the process of question generation, since complex relational connections are constructed using the knowledge graph, these connections can be used to expand the amount of information and complexity of the seed question. The seed question is used as a query to obtain relevant entities from the knowledge graph through embedding, and then various entity-related information is sorted, and some are selected and put into the context for extended questions based on the seed question. The recalled content specifically includes: associated original text, community reports associated with entities, associated entities, entity-related relationship information, entity attributes (including statements, etc.), and answer generation. After the association enhancement of the knowledge graph, various types and complexities of questions are generated. The present invention divides the generated questions into summary questions and detail questions, and uses different methods to generate answers for different types of questions.

[0219] For detailed questions, the answer to the query can be generated directly based on the context information of the generated query. When generating the answer, the reference source can be attached to enhance the explainability of QA and quality judgment.

[0220] For summary questions, at a given community level, multiple intermediate answers are generated based on multiple community summaries, and then the intermediate answers are aggregated to generate the final answer. The community summary can be randomly shuffled and divided into multiple chunks of preset sizes to ensure that the information related to the question is not overly concentrated in a certain context window, thereby causing information loss. Based on each chunk, an intermediate answer to the query is generated, and the model scores this answer (0-100) to indicate the degree of help of the answer in generating the final answer. Answers with 0 points are directly filtered. The intermediate answers are sorted in descending order according to the score and then placed in the context window of the LLM until the token limit is reached. Finally, let the LLM answer the query based on these intermediate answers to get the final answer.

[0221] For the quality control module, a large language model can be used to effectively judge and screen the generated question and answer content (QA) to further improve the quality and accuracy of the generated question and answer data. By screening the generated question and answer content, the user experience can be effectively improved and ensure that the information obtained by the user is reliable and comprehensive.

[0222] You can choose a suitable LLM as a judgment tool, and the screening process will be divided into judgment standard setting, automated screening and manual review.

[0223] Among them, the judgment standard setting can be used to define specific judgment standards, including but not limited to the validity, answerability, correctness of answers, and comprehensiveness of answers of queries. Among them, the validity of queries is used to analyze whether the questions are clear, specific, and answerable. For example, whether there is enough information to generate effective replies. Answerability is used to evaluate whether the questions can provide reasonable answers through existing knowledge. The correctness of answers is used to check whether the answers accurately reflect the facts and avoid the spread of false information. The comprehensiveness of answers is used to evaluate whether the answers cover all aspects of the questions and provide enough information to meet user needs. Automated screening is used to input the above standards into LLM for automated scoring. The model will evaluate each question-answer pair, score it, and filter out content that does not meet the standards. Manual review is used to conduct a certain proportion of manual review on the basis of automatic screening to ensure that the judgment results of the model meet expectations and adjust or improve the screening standards.

[0224] This application proposes a method for generating question-and-answer data based on knowledge graph retrieval enhancement. First, the important information of the text data extracted by the Graph is used to generate high-quality seed questions. The accuracy of extracting and summarizing the key information and main information of the text data is improved through the adaptive construction of the Graph domain and the enhancement of the Graph, thereby improving the value and effectiveness of the generated questions. The complex relationship connections in the knowledge graph are then used to expand the amount of information and complexity of the seed questions. This method of QA expansion around the main content of the text data can generate questions involving multi-hop relationships, which increases the complexity of the query while ensuring the validity of the query. Finally, LLM is used to perform quality control on the generated data to further improve the quality and accuracy of the generated question-and-answer data and ensure credibility and interpretability.

[0225] In this application, high-quality seed questions based on the main theme of the full text can be generated. First, a high-precision Graph construction is achieved through the creation of a domain-adaptive prompt template, and then the key information of the text data and the summary of the main theme of the full text are provided for question generation through Graph enhancement, so that the generated seed questions are closely related to the main content of the text data, and the value and effectiveness of the generated questions are improved. An extended QA generation method is designed, which first generates high-quality seed questions around the main content of the text data, and then uses the complex relationship connections in the knowledge graph to expand the QA. This QA generation method can generate complex questions and summary questions involving multi-hop relationships, while ensuring the validity of the query, while improving the complexity of the query. A QA generation quality control method is designed, which generates citation sources while generating QA, and uses LLM to evaluate and judge the quality of the generated results from multiple angles such as effectiveness, answerability, correctness, and comprehensiveness, further improving the quality and accuracy of the generated question and answer data, and ensuring credibility and explainability.

[0226] This application proposes a method for generating question-answer data based on knowledge graph retrieval enhancement, which uses a large model to extract text information to build a graph index, and improves the accuracy of Graph construction by creating a domain-adaptive prompt template. At the same time, the Graph is used to enhance the extraction of key information of text data and the main theme of the full text. In the QA generation stage, high-quality seed questions are first generated based on the main information of the text data extracted by the Graph, and then the complex relationship connections in the knowledge graph are used to expand the information volume and complexity of the seed questions, and the corresponding answers and citation sources are obtained. This method of QA expansion around the main content of the text data not only improves the query effectiveness and complexity, but also improves the controllability of QA generation. Finally, LLM is used to control the quality of the generated data to ensure credibility and explainability.

[0227] In response to the demand for high-quality question-and-answer data, this application extracts the main theme of the full text based on the knowledge graph to generate seed questions, then uses the relationship network to expand high-quality questions and answers, and finally uses a large model to perform quality control on the generated results to achieve high-quality and reliable question-and-answer generation. This application generates high-quality seed questions based on the main theme of the full text, and expands them through complex relationships in the graph to ensure the effectiveness of high-quality questions and answers while increasing complexity. By providing a method for quality control of question-and-answer data, citation sources are generated while generating question-and-answer data, and a large model is used to evaluate the quality of the generated results from multiple angles to ensure credibility and explainability.

[0228] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0229] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, 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 application.

[0230] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0231] According to an embodiment of the present application, a text generation method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here. Figure 5 is a flow chart of a text generation method according to an embodiment of the present application. Figure 5 As shown, the method includes:

[0232] Step S502, in response to an input instruction acting on the operation interface, displaying the data to be processed on the operation interface;

[0233] The above-mentioned operation interface can be used to display the data to be processed, wherein the operation interface can include a variety of different controls for the user to operate, so as to display the data to be processed on the operation interface.

[0234] Step S504, in response to the confirmation instruction acting on the data to be processed, the target question and the reply text of the target question are displayed on the operation interface.

[0235] Among them, the reply text is generated based on the target question and the question type. The question type is obtained by identifying the target question. The target question is generated based on the target graph. The target graph is constructed based on the data structure information of the data to be processed. The target graph is used to describe the association relationship between different entities and different entities in the data to be processed.

[0236] The above confirmation instruction may be generated by a user's touch operation on the operation interface when processing of the data to be processed is required.

[0237] According to an embodiment of the present application, a text generation method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here. Figure 6 is a flow chart of a text generation method according to an embodiment of the present application. Figure 6 As shown, the method includes:

[0238] Step S602, obtaining the data to be processed by calling the first interface;

[0239] The first interface includes a first parameter, and a parameter value of the first parameter includes data to be processed.

[0240] The above-mentioned first interface can be an interface for data interaction between the cloud server and the client, and the data to be processed can be passed into the interface function as the first parameter of the interface function to achieve the purpose of uploading the data to be processed to the cloud server.

[0241] Step S604, constructing a target graph of the data to be processed based on the data structure information of the data to be processed;

[0242] Among them, the target graph is used to describe the relationship between different entities and different entities in the data to be processed.

[0243] Step S606, generating a target problem of the data to be processed based on the target graph, and identifying the problem type of the target problem;

[0244] Step S608, generating a response text for the target question based on the target question and the question type;

[0245] Step S610: output the target question and reply text by calling the second interface.

[0246] The second interface includes a second parameter, and a parameter value of the second parameter includes a target question and a reply text.

[0247] The above-mentioned second interface can be an interface for data interaction between the cloud server and the client. The cloud server can pass the target question and reply text into the interface function as the second parameter of the interface function to achieve the purpose of sending the target question and reply text to the client.

[0248] According to an embodiment of the present application, a text generation device for implementing the above-mentioned text generation method is also provided. Figure 7 is a schematic diagram of a text generation device according to an embodiment of the present application, such as Figure 7 As shown, the device 700 includes: an acquisition module 702 , a construction module 704 , an identification module 706 , and a generation module 708 .

[0249] Among them, the acquisition module is used to acquire the data to be processed; the construction module is used to construct a target graph of the data to be processed based on the data structure information of the data to be processed, wherein the target graph is used to describe the association relationship between different entities and different entities in the data to be processed; the identification module is used to generate a target question of the data to be processed based on the target graph, and identify the question type of the target question; the generation module is used to generate a reply text of the target question based on the target question and the question type.

[0250] It should be noted that the acquisition module 702, the construction module 704, the identification module 706, and the generation module 708 correspond to steps S202 to S208 in the above embodiment, and the four modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the above embodiment. It should be noted that the above modules or units can be hardware components or software components stored in a memory and processed by one or more processors, and the above modules can also be run in the server 10 provided in the above embodiment as part of the device.

[0251] In the above embodiments of the present application, the construction module is also used to segment the data to be processed based on the data structure information to obtain multiple text blocks, wherein different text blocks contain different contents in the data to be processed; extract the first entity information of the data to be processed from the multiple text blocks; and generate a target graph based on the first entity information and the multiple text blocks.

[0252] In the above embodiments of the present application, the construction module is also used to extract target text from the data to be processed; determine the target field to which the data to be processed belongs based on the target text; construct a prompt word template based on the target text and the target field; input the prompt word template into the large model, and use the large model to extract the first entity information from multiple text blocks.

[0253] In the above embodiment of the present application, the construction module is also used to obtain the entity type contained in the target field; generate the second entity information based on the entity type; and construct a prompt word template based on the target text and the second entity information.

[0254] In the above embodiment of the present application, the construction module is also used to merge entity information belonging to the same type in the first entity information to obtain third entity information; and generate a target graph based on the third entity information and multiple text blocks.

[0255] In the above embodiments of the present application, the construction module is also used to extract an initial graph from multiple text blocks based on the third entity information and the entity structure information of the third entity information; cluster the initial graph to obtain multiple entity clusters, wherein entities belonging to the same entity cluster are mutually related; and update the initial graph based on the multiple entity clusters to obtain a target graph.

[0256] In the above embodiments of the present application, the construction module is also used to obtain cluster information of multiple entity clusters; refine the cluster information to obtain key information of multiple entity clusters; perform feature extraction on the cluster information and key information to obtain an information vector; embed the information vector into the graph vector corresponding to the initial graph to obtain a target graph.

[0257] In the above embodiments of the present application, the identification module is also used to generate an initial question based on cluster information of multiple entity clusters; and to expand the initial question using the target graph to obtain a target question.

[0258] In the above embodiment of the present application, the generation module is also used to generate a reply text for the target question based on the target question and the question type, including: in response to the question type being the first type, obtaining associated information associated with the target question from the target graph; and generating a reply text based on the associated information and the target question.

[0259] In the above embodiment of the present application, the generation module is also used to, in response to the question type being the second type, segment the key information of multiple entity clusters to obtain multiple information blocks; generate multiple sub-reply texts based on the multiple information blocks and the target question; and filter the multiple sub-reply texts based on the degree of correlation between the multiple sub-reply texts and the target question to obtain a reply text.

[0260] In the above embodiment of the present application, the generation module is also used to screen multiple sub-reply texts based on the degree of correlation between the multiple sub-reply texts and the target question to obtain an initial reply text; and adjust the initial reply text based on a preset text word count to obtain a reply text.

[0261] According to an embodiment of the present application, a text generation device for implementing the above-mentioned text generation method is also provided. Figure 8 is a schematic diagram of a text generation device according to an embodiment of the present application, such as Figure 8 As shown, the device 800 includes: a first display module 802 and a second display module 804 .

[0262] Among them, the first display module is used to respond to input instructions acting on the operation interface, and display the data to be processed on the operation interface; the second display module is used to respond to confirmation instructions acting on the data to be processed, and display the target question and the reply text of the target question on the operation interface, wherein the reply text is generated based on the target question and the question type, the question type is obtained by identifying the target question, the target question is generated based on the target map, the target map is constructed based on the data structure information of the data to be processed, and the target map is used to describe the association relationship between different entities and different entities in the data to be processed.

[0263] It should be noted that the first display module 802 and the second display module 804 correspond to steps S502 to S504 in the above embodiment, and the two modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in the above embodiment. It should be noted that the above modules or units can be hardware components or software components stored in a memory and processed by one or more processors, and the above modules can also be run as part of the device in the server 10 provided in the above embodiment.

[0264] According to an embodiment of the present application, a text generation device for implementing the above-mentioned text generation method is also provided. Fig. 9 is a schematic diagram of a text generation device according to an embodiment of the present application, such as Fig. 9 As shown, the device 900 includes: a calling module 902 , a building module 904 , an identification module 906 , a generating module 908 , and an output module 910 .

[0265] Among them, the calling module is used to obtain the data to be processed by calling the first interface, wherein the first interface includes a first parameter, and the parameter value of the first parameter includes the data to be processed; the building module is used to build a target graph of the data to be processed based on the data structure information of the data to be processed, wherein the target graph is used to describe the association relationship between different entities and different entities in the data to be processed; the identification module is used to generate a target problem of the data to be processed based on the target graph, and identify the problem type of the target problem; the generation module is used to generate a reply text of the target problem based on the target problem and the problem type; the output module is used to output the target problem and the reply text by calling the second interface, wherein the second interface includes a second parameter, and the parameter value of the second parameter includes the target problem and the reply text.

[0266] It should be noted that the above-mentioned calling module 902, construction module 904, identification module 906, generation module 908, and output module 910 correspond to steps S602 to S610 in the above-mentioned embodiment, and the five modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in the above-mentioned embodiment. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in a memory and processed by one or more processors, and the above-mentioned modules can also be run in the server 10 provided in the above-mentioned embodiment as part of the device.

[0267] It should be noted that the preferred implementation scheme involved in the above embodiments of the present application is the same as the scheme provided in the above embodiments, as well as the application scenario and implementation process, but is not limited to the scheme provided in the above embodiments.

[0268] The embodiment of the present application may provide an electronic device, which may be any electronic device in a group of electronic devices. Optionally, in this embodiment, the electronic device may also be replaced by a terminal device such as a mobile terminal.

[0269] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.

[0270] In this embodiment, the computer terminal can execute the program code in the method.

[0271] Optionally, Fig.10 is a structural block diagram of an electronic device according to an embodiment of the present application. Fig.10 As shown, the electronic device A may include: one or more (only one is shown in the figure) processors 102, a memory 104, a storage controller, and a peripheral interface, wherein the peripheral interface is connected to a radio frequency module, an audio module, and a display.

[0272] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the methods in the above embodiments. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal A via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0273] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: obtain the data to be processed; construct a target graph of the data to be processed based on the data structure information of the data to be processed, wherein the target graph is used to describe different entities in the data to be processed and the association relationship between the different entities; generate a target question for the data to be processed based on the target graph, and identify the question type of the target question; and generate a reply text for the target question based on the target question and the question type.

[0274] Those skilled in the art will understand that Fig.10 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Fig.10 It does not limit the structure of the above electronic device. For example, the electronic device A may also include more or fewer components (such as a network interface, a display device, etc.) than those shown in the figure, or have Fig.10 Different configurations are shown.

[0275] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0276] The embodiment of the present application further provides a computer-readable storage medium. Optionally, in this embodiment, the computer-readable storage medium can be used to store the program code executed by the method provided in the above embodiment.

[0277] Optionally, in this embodiment, the above storage medium may be located in any electronic device in a group of electronic devices in a computer network, or in any mobile terminal in a group of mobile terminals.

[0278] Optionally, in this embodiment, the computer-readable storage medium is configured to store program codes for performing the following steps: obtaining data to be processed; constructing a target graph of the data to be processed based on data structure information of the data to be processed, wherein the target graph is used to describe different entities in the data to be processed and the association relationships between the different entities; generating a target question for the data to be processed based on the target graph, and identifying the question type of the target question; and generating a reply text for the target question based on the target question and the question type.

[0279] The embodiment of the present application further provides a computer program product. Optionally, in this embodiment, the computer program product may include a computer program, and the computer program implements the method provided in the embodiment when executed by a processor.

[0280] The embodiments of the present application also provide a computer program product. Optionally, the computer program product may include a non-volatile computer-readable storage medium, which may be used to store a computer program, and when the computer program is executed by a processor, the method provided in the embodiments is implemented.

[0281] The embodiment of the present application further provides a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, the method provided in the above embodiment is implemented.

[0282] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0283] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0284] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0285] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0286] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc., which can store program code.

[0287] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A text generation method, characterized in that: include: Get the data to be processed; Constructing a target graph of the data to be processed based on the data structure information of the data to be processed, wherein the target graph is used to describe different entities in the data to be processed and the association relationships between the different entities, and the data structure information is used to represent structured information of entities, relationships and contexts in the data to be processed; Generate a target question of the data to be processed based on the target graph, and identify the question type of the target question by analyzing the context information of the target question, the complexity of the entities involved, and the scope of the target question, wherein the question type includes one of the following: a detail question and a summary question, wherein the detail question is used to describe the detail information of the target graph, and the summary question is used to describe the comprehensive information of the target graph; Based on the target question and the question type, generate a response text for the target question; Wherein, based on the target question and the question type, generating a reply text of the target question includes: In response to the question type being the detail question, acquiring associated information associated with the target question from the target graph; and generating the reply text based on the associated information and the target question; In response to the question type being the summary question, key information of multiple entity clusters is segmented to obtain multiple information blocks; multiple sub-reply texts are generated according to the multiple information blocks and the target question; the multiple sub-reply texts are filtered based on the degree of association between the multiple sub-reply texts and the target question to obtain the reply text, wherein the segmentation and the filtering are used to remove redundant information.

2. The method according to claim 1, characterized in that Constructing a target graph of the data to be processed based on the data structure information of the data to be processed, including: Segmenting the data to be processed based on the data structure information to obtain a plurality of text blocks, wherein different text blocks contain different contents in the data to be processed; Extracting first entity information of the data to be processed from the multiple text blocks; The target graph is generated based on the first entity information and the multiple text blocks.

3. The method according to claim 2, characterized in that Extracting first entity information of the data to be processed from the multiple text blocks includes: Extracting a target text from the data to be processed, wherein the target text is used to describe key information in the data to be processed; Determining the target field to which the data to be processed belongs according to the target text; Constructing a prompt word template based on the target text and the target domain; The prompt word template is input into a large model, and the first entity information is extracted from the multiple text blocks using the large model.

4. The method according to claim 3, characterized in that Constructing a prompt word template based on the target text and the target domain includes: Obtaining entity types contained in the target domain; generating second entity information based on the entity type; The prompt word template is constructed based on the target text and the second entity information.

5. The method according to claim 2, characterized in that: Generating the target graph based on the first entity information and the plurality of text blocks includes: Merging entity information of the same type in the first entity information to obtain third entity information; The target graph is generated based on the third entity information and the multiple text blocks.

6. The method according to claim 5, characterized in that Generating the target graph based on the third entity information and the multiple text blocks includes: Extracting an initial graph from the plurality of text blocks based on the third entity information and entity structure information of the third entity information; Clustering the initial graph to obtain a plurality of entity clusters, wherein entities belonging to the same entity cluster are associated with each other; The initial graph is updated based on the multiple entity clusters to obtain the target graph.

7. The method according to claim 6, characterized in that The initial graph is updated based on the multiple entity clusters to obtain the target graph, including: Obtaining cluster information of the multiple entity clusters; Refining the cluster information to obtain key information of the multiple entity clusters; Extracting features from the cluster information and the key information to obtain an information vector; The information vector is embedded into the graph vector corresponding to the initial graph to obtain the target graph.

8. The method according to claim 1, characterized in that Generating a target problem of the data to be processed based on the target graph includes: Generate initial questions based on cluster information of multiple entity clusters; The initial problem is expanded using the target graph to obtain the target problem.

9. The method according to claim 1, characterized in that: The plurality of sub-reply texts are screened based on the degree of association between the plurality of sub-reply texts and the target question to obtain the reply text, including: Filtering the multiple sub-reply texts based on the degree of relevance between the multiple sub-reply texts and the target question to obtain an initial reply text; The initial reply text is adjusted based on a preset text word count to obtain the reply text.

10. A text generation method, characterized in that: include: In response to an input instruction acting on the operation interface, displaying the data to be processed on the operation interface; In response to a confirmation instruction acting on the data to be processed, a target question and a reply text of the target question are displayed on the operation interface, wherein the reply text is generated based on the target question and a question type, the question type is obtained by identifying the target question by analyzing the context information of the target question, the complexity of the entities involved and the scope of the target question, the target question is generated based on a target graph, the target graph is constructed based on the data structure information of the data to be processed, the target graph is used to describe different entities in the data to be processed and the association relationship between the different entities, the data structure information is used to represent the structured information of entities, relationships and contexts in the data to be processed, and the question type includes one of the following: a detail question and a summary question, the detail question is used to describe the detail information of the target graph, and the summary question is used to describe the comprehensive information of the target graph; Among them, in response to the question type being the detail question, the reply text is generated based on the associated information of the target question and the target question, and the associated information is obtained from the target graph; in response to the question type being the summary question, the reply text is obtained by screening the multiple sub-reply texts based on the degree of association between the multiple sub-reply texts and the target question, and the multiple sub-reply texts are obtained according to multiple information blocks and the target question, and the multiple information blocks are obtained by segmenting the key information of multiple entity clusters, and the segmentation and the screening are used to remove redundant information.

11. A text generation method, characterized in that: include: Acquire the data to be processed by calling a first interface, wherein the first interface includes a first parameter, and a parameter value of the first parameter includes the data to be processed; Constructing a target graph of the data to be processed based on the data structure information of the data to be processed, wherein the target graph is used to describe different entities in the data to be processed and the association relationships between the different entities, and the data structure information is used to represent structured information of entities, relationships and contexts in the data to be processed; Generate a target question of the data to be processed based on the target graph, and identify the question type of the target question by analyzing the context information of the target question, the complexity of the entities involved, and the scope of the target question, wherein the question type includes one of the following: a detail question and a summary question, wherein the detail question is used to describe the detail information of the target graph, and the summary question is used to describe the comprehensive information of the target graph; Based on the target question and the question type, generate a response text for the target question; Output the target question and the reply text by calling a second interface, wherein the second interface includes a second parameter, and a parameter value of the second parameter includes the target question and the reply text; Wherein, based on the target question and the question type, generating a reply text of the target question includes: In response to the question type being the detail question, acquiring associated information associated with the target question from the target graph; and generating the reply text based on the associated information and the target question; In response to the question type being the summary question, key information of multiple entity clusters is segmented to obtain multiple information blocks; multiple sub-reply texts are generated according to the multiple information blocks and the target question; the multiple sub-reply texts are filtered based on the degree of association between the multiple sub-reply texts and the target question to obtain the reply text, wherein the segmentation and the filtering are used to remove redundant information.

12. An electronic device, characterized in that: include: A memory storing an executable program; A processor, configured to run the program, wherein the program executes the method according to any one of claims 1 to 11 when running.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 11.

14. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Question generation method and device, computer equipment and storage medium

    CN114880443A

  • Question and answer method and device and computer readable storage medium

    CN115563239A

  • Voice dialogue script generation method and device and electronic equipment

    CN116312456A

  • Question answering method and device based on financial service, electronic equipment and storage medium

    CN116340475A

  • Interest point recommendation method and device, equipment and storage medium

    CN117390286A