Data set construction method, device and equipment and readable storage medium
By identifying object entities and their connection relationships from the initial text, dividing the knowledge graph into multiple node communities, generating community description information, and finally integrating it into a data set, the problems of low information retrieval efficiency and inaccurate query results in the existing technology are solved, and more efficient and accurate information retrieval is achieved.
Patent Information
- Application Number
- CN202411721846.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the data set construction method based on knowledge graphs has shortcomings in information retrieval efficiency and the accuracy of query results, resulting in low retrieval efficiency and inaccurate query results.
The knowledge graph is constructed by identifying object entities and their connection relationships from the initial text, and the knowledge graph is divided into multiple node communities by recursively, generating community description information for each node community, and finally integrating the knowledge graph with node community information to form a data set.
It improves the efficiency of information retrieval, enhances the accuracy and detail of query results, and enables the data set to better support complex queries and meets the actual application needs of users.
Smart Images

Figure CN119578531A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data set construction method, device, equipment and readable storage medium. Background Art
[0002] At present, data processing and analysis are indispensable parts of various fields. For example, in the field of artificial intelligence, how to effectively organize, manage and utilize large-scale data has become the key to improving algorithm performance and application effects. At present, the construction of data sets including knowledge graphs usually involves obtaining the object entities and their connection relationships required to build the knowledge graph, and then completing the knowledge graph construction through visualization. However, the information retrieval efficiency of the data set constructed in this way is low, and the accuracy of the query results is not high. Summary of the invention
[0003] In view of this, in order to solve the above technical problems, the present application provides a data set construction method, device, equipment and readable storage medium.
[0004] Specifically, the present application is implemented through the following technical solutions:
[0005] According to a first aspect of an embodiment of the present application, a method for constructing a data set is provided, the method comprising:
[0006] Identify object entities and the connection relationships between different object entities from the initial text to build a knowledge graph;
[0007] Recursively dividing the knowledge graph into a plurality of node communities, wherein each node community except the bottommost level in the recursion includes at least one node community in the next level;
[0008] Generate community description information of each node community in each level based on the knowledge graph information included in the node community;
[0009] The knowledge graph is integrated with the node community containing community description information to form a data set; the data set is at least used to train the generative network.
[0010] Optionally, recursively dividing the knowledge graph into a plurality of node communities includes:
[0011] Perform community detection on the knowledge graph and divide the knowledge graph into multiple node communities of the first level; repeat community detection on each node community in the latest level, and divide it into multiple node communities of the next level until a preset level depth is reached or the scale of the node community meets the set requirements.
[0012] Optionally, generating community description information of each node community in each level according to the knowledge graph information included in the node community includes:
[0013] Obtaining community description information of each first node community at the bottom level in the recursive partitioning;
[0014] For each second node community in the level to be processed, the community description information of the second node community that belongs to the next level of the level to be processed and is included in the second node community is used to generate the community description information of the second node community; wherein the level to be processed refers to the level to be processed determined by sequentially taking the level above the level for which the community description information is most recently generated in the recursive reverse order and the order of levels upward in the recursive division.
[0015] Optionally, the generating community description information of the second node community includes:
[0016] The community description information of the node community of the next level of the level to be processed, which is included in the second node community, is input into the context window of the first large language model to obtain the community description information of the second node community generated by the first large language model based on the context window.
[0017] Optionally, the obtaining of community description information of each first node community at the bottom level in the recursive partitioning includes:
[0018] For each first node community, obtain the knowledge graph information included in the first node community; the knowledge graph information includes at least object entity information and connection relationship information between object entities;
[0019] Inputting the object entity information and the connection relationship information between the object entity and other object entities into the context window of the first language model according to the priority order of the object entities included in the knowledge graph information, until the input limit of the context window is reached;
[0020] The description information output by the first language model based on the context window is obtained as the community description information of the first node community.
[0021] Optionally, identifying object entities and connection relationships between different object entities from the initial text includes:
[0022] The initial text is divided into a plurality of text segments, and the text segments are input into a second largest language model; the names of all object entities included in the text segments are identified by the second largest language model through prompt text and / or recognition examples, and the types of the object entities are determined according to the text segment records and a first description is generated; the connection relationship between the object entities included in the text segment is identified by the second largest language model, and a second description of the connection relationship is generated.
[0023] Optionally, the method further comprises:
[0024] Using the second largest language model, evaluating the object entities and connection relationships recognized from the text segment to generate a confidence score; the confidence score is used to indicate the confidence level of the second largest language model in the recognition result;
[0025] When the confidence score is lower than a set score threshold, the text segment is re-input into the second largest language model for supplementary collection of object entities and connection relationships.
[0026] Optionally, the method further comprises:
[0027] Using the generated hint and the third language model, a covariate is generated for each object entity identified from the text segment; the covariate is used to provide other feature information about the object entity in addition to the first description.
[0028] Optionally, the method further comprises:
[0029] Before constructing the knowledge graph, the fourth language model is used to generate a first supplementary description for the identified object entity, and a second supplementary description for the connection relationship between the object entities; the first supplementary description is merged with the first description to remove duplications, so as to obtain an updated first description; the second supplementary description is merged with the second description to remove duplications, so as to obtain an updated second description.
[0030] Optionally, the method further comprises:
[0031] Obtaining a user question, and determining the relevance of the user question to each node community at the first level in the recursive partitioning;
[0032] Selecting at least one node community whose relevance meets the requirements from the node communities of the first level as the community of the current level;
[0033] Repeat the following steps for the current level community until the lowest level in the recursive partitioning is reached: determine the relevance between each node community of the next level included in the current level community and the user's question, and select at least one node community with a relevance that meets the requirements from each node community of the next level as a new current level community;
[0034] A generative network answer to the user's question is generated according to all node communities determined as current-level communities.
[0035] Optionally, the relevance of the user's question to the node community is determined in the following manner:
[0036] Based on the knowledge graph information included in the node community, an intermediate answer to the user's question is generated; using the fifth language model, the helpfulness score of the intermediate answer to the user's question is evaluated, and the helpfulness score is used as the relevance.
[0037] Optionally, the method further comprises:
[0038] According to the application scenario of the data set, obtain the real conversation in the application scenario and the question-answering conversation generated according to the data set through the sixth language model; generate a question-answering data set according to the real conversation and the question-answering conversation; integrate the question-answering data set with the knowledge graph and the node community containing community description information to obtain an updated data set.
[0039] Optionally, the method further comprises:
[0040] Acquire various types of professional knowledge related to the field under the application scenario; build a scenario knowledge base based on the professional knowledge; integrate the scenario knowledge base, the knowledge graph and the node community containing community description information to obtain an updated data set.
[0041] Optionally, the method further comprises:
[0042] Obtain a scenario-based professional examination question bank under the application scenario; convert question descriptions, options, correct answers, and answer parsing in the scenario-based professional examination question bank into structured information to construct a question bank data set; integrate the question bank data set with the knowledge graph and the node community containing community description information to obtain an updated data set.
[0043] According to a second aspect of an embodiment of the present application, a data set construction device is provided, the device comprising:
[0044] The knowledge graph construction module is used to identify object entities and the connection relationships between different object entities from the initial text to construct a knowledge graph;
[0045] A node community division module, used for recursively dividing the knowledge graph into a plurality of node communities, wherein each node community except the recursive bottom layer includes at least one node community of the next layer;
[0046] A community description information generation module is used to generate community description information of each node community in each level according to the knowledge graph information included in the node community;
[0047] A data set acquisition module is used to integrate the knowledge graph with the node community containing community description information to form a data set; the data set is at least used to train the generative network.
[0048] Optionally, the node community division module is specifically used to:
[0049] Perform community detection on the knowledge graph and divide the knowledge graph into multiple node communities of the first level; repeat community detection on each node community in the latest level, and divide it into multiple node communities of the next level until a preset level depth is reached or the scale of the node community meets the set requirements.
[0050] Optionally, the community description information generating module is specifically used to:
[0051] Obtaining community description information of each first node community at the bottom level in the recursive partitioning;
[0052] For each second node community in the level to be processed, the community description information of the second node community that belongs to the next level of the level to be processed and is included in the second node community is used to generate the community description information of the second node community; wherein the level to be processed refers to the level to be processed determined by sequentially taking the level above the level for which the community description information is most recently generated in the recursive reverse order and the order of levels upward in the recursive division.
[0053] Optionally, when the community description information generating module is used to generate the community description information of the second node community, it includes:
[0054] The community description information of the node community of the next level of the level to be processed, which is included in the second node community, is input into the context window of the first large language model to obtain the community description information of the second node community generated by the first large language model based on the context window.
[0055] Optionally, when the community description information generating module is used to obtain the community description information of each first node community at the bottom level in the recursive partitioning, it includes:
[0056] For each first node community, obtain the knowledge graph information included in the first node community; the knowledge graph information includes at least object entity information and connection relationship information between object entities;
[0057] Inputting the object entity information and the connection relationship information between the object entity and other object entities into the context window of the first language model according to the priority order of the object entities included in the knowledge graph information, until the input limit of the context window is reached;
[0058] The description information output by the first language model based on the context window is obtained as the community description information of the first node community.
[0059] Optionally, the knowledge graph construction module is specifically used for:
[0060] The initial text is divided into a plurality of text segments, and the text segments are input into a second largest language model; the names of all object entities included in the text segments are identified by the second largest language model through prompt text and / or recognition examples, and the types of the object entities are determined according to the text segment records and a first description is generated; the connection relationship between the object entities included in the text segment is identified by the second largest language model, and a second description of the connection relationship is generated.
[0061] Optionally, the device further comprises:
[0062] Using the second largest language model, evaluating the object entities and connection relationships recognized from the text segment to generate a confidence score; the confidence score is used to indicate the confidence level of the second largest language model in the recognition result;
[0063] When the confidence score is lower than a set score threshold, the text segment is re-input into the second largest language model for supplementary collection of object entities and connection relationships.
[0064] Optionally, the device further comprises:
[0065] Using the generated hint and the third language model, a covariate is generated for each object entity identified from the text segment; the covariate is used to provide other feature information about the object entity in addition to the first description.
[0066] Optionally, the device further comprises:
[0067] Before constructing the knowledge graph, the fourth language model is used to generate a first supplementary description for the identified object entity, and a second supplementary description for the connection relationship between the object entities; the first supplementary description is merged with the first description to remove duplications, so as to obtain an updated first description; the second supplementary description is merged with the second description to remove duplications, so as to obtain an updated second description.
[0068] Optionally, the device further comprises:
[0069] Obtain a user question, and determine the relevance between the user question and each node community of the first level in the recursive division; select at least one node community whose relevance meets the requirements from the node community of the first level as the current level community; repeat the following steps for the current level community until the lowest level in the recursive division is reached: determine the relevance between each node community of the next level included in the current level community and the user question, and select at least one node community whose relevance meets the requirements from each node community of the next level as the new current level community; generate a generative network answer to the user question based on all the node communities determined as the current level communities.
[0070] Optionally, the relevance of the user's question to the node community is determined in the following manner:
[0071] Based on the knowledge graph information included in the node community, an intermediate answer to the user's question is generated; using the fifth language model, the helpfulness score of the intermediate answer to the user's question is evaluated, and the helpfulness score is used as the relevance.
[0072] Optionally, the device further comprises:
[0073] According to the application scenario of the data set, obtain the real conversation in the application scenario and the question-answering conversation generated according to the data set through the sixth language model; generate a question-answering data set according to the real conversation and the question-answering conversation; integrate the question-answering data set with the knowledge graph and the node community containing community description information to obtain an updated data set.
[0074] Optionally, the device further comprises:
[0075] Acquire various types of professional knowledge related to the field under the application scenario; build a scenario knowledge base based on the professional knowledge; integrate the scenario knowledge base, the knowledge graph and the node community containing community description information to obtain an updated data set.
[0076] Optionally, the device further comprises:
[0077] Obtain a scenario-based professional examination question bank under the application scenario; convert question descriptions, options, correct answers, and answer parsing in the scenario-based professional examination question bank into structured information to construct a question bank data set; integrate the question bank data set with the knowledge graph and the node community containing community description information to obtain an updated data set.
[0078] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory and a processor; the memory is used to store a computer program; the processor is used to execute the above-mentioned data set construction method by calling the computer program.
[0079] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned data set construction method is implemented.
[0080] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0081] In the technical solution provided in the present application, a knowledge graph is constructed by identifying object entities and their connection relationships from the initial text, and then the knowledge graph is recursively divided into multiple node communities according to the hierarchy, description information is generated for each node community, and the knowledge graph is integrated with the community structure formed by the node community containing the community description information to form a data set that can be used for generative network training and question-answering tasks. This not only makes the information structure of the knowledge graph clearer and realizes a hierarchical representation of information from general to specific, thereby improving the efficiency of information retrieval, but also can effectively organize and display complex information between multiple object entities and relationships, thereby improving the accuracy and completeness of the query results, so that the data set can better support complex queries and meet the needs of users in practical applications.
[0082] It should be understood that the above general description and the following detailed description are only exemplary and explanatory and cannot limit the present application. In addition, any embodiment in the present application does not need to achieve all the above effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0084] Figure 1A It is a flowchart of a method for constructing a data set shown in an exemplary embodiment of the present application;
[0085] Figure 1B It is an example of community description information of a certain node community shown in an exemplary embodiment of the present application;
[0086] Figure 2A It is a schematic diagram of a process of dividing a knowledge graph into multiple node communities shown in an exemplary embodiment of the present application;
[0087] Figure 2B is a schematic diagram of a multi-level node community structure shown in an exemplary embodiment of the present application;
[0088] Figure 3 It is a flowchart showing a step of generating community description information of each node community layer by layer based on the hierarchical structure of the node community according to an exemplary embodiment of the present application;
[0089] Figure 4 It is a flowchart of a method for generating community description information based on a large language model, shown in an exemplary embodiment of the present application;
[0090] Figure 5A is an example table of an object entity, type and first description shown in an exemplary embodiment of the present application;
[0091] Figure 5B is an example table of a second description of a connection relationship between object entities shown in an exemplary embodiment of the present application;
[0092] Figure 6 It is a flowchart of data retrieval steps in a scenario based on a data set as external data for answering questions in a generative network, as shown in an exemplary embodiment of the present application;
[0093] Figure 7 This is a schematic diagram of a data set integrating other types of information shown in an exemplary embodiment of the present application;
[0094] Figure 8 is a structural schematic diagram of a data set construction device shown in an exemplary embodiment of the present application;
[0095] Fig. 9 It is a hardware schematic diagram of an electronic device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0096] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items, and the terms first, second, third, etc. may be used in this application to describe various information, but these information should not be limited to these terms, which are only used to distinguish the same type of information from each other.
[0097] At present, data processing and analysis are indispensable parts of various fields. For example, in the field of artificial intelligence, how to effectively organize, manage and utilize large-scale data has become the key to improving algorithm performance and application effects. As a structured knowledge storage method, knowledge graph represents object entities (such as people, places, things, etc.) and their relationships in the form of graphs, providing strong support for information retrieval, reasoning and interpretation, and has been widely used in many fields such as information retrieval, recommendation systems, and natural language processing. In the process of constructing a knowledge graph, it is necessary to collect and sort out the various object entities required to constitute the graph and the connection relationships between them, and then complete the construction of the knowledge graph through visualization tools, thereby completing the construction of a data set including the knowledge graph. However, the data set constructed based on the above method is slow when performing information retrieval, especially for large-scale retrieval requests, its retrieval efficiency is low, and the query results formed based on the data set are not accurate and detailed.
[0098] Based on this, the present application provides a dataset construction method, which constructs a knowledge graph by identifying object entities in the text and the connection relationships between object entities, and recursively divides the knowledge graph into multiple node communities of different levels, organizes the knowledge graph into a multi-level community structure that is easier to manage and process, and generates community description information for each node community, which can generally reflect the knowledge content and structural characteristics within the community, and then integrates the original knowledge graph with the node community containing the community description information to form the required dataset. This dataset not only retains the detail and structure of the knowledge graph, but also improves the abstractness and generalization of the information through the multi-level community structure and community description information. When processing information retrieval requests, the relevant node communities can be located more quickly, reducing the complexity of information retrieval, effectively improving the retrieval efficiency, and improving the accuracy and detail of the query results.
[0099] This method can be applied to many different technical fields such as medicine, education, and finance. Taking the medical scenario as an example, for the construction of a dataset dedicated to orthopedic questions and answers, this method can use various types of orthopedic-related information as the initial text to construct a knowledge graph, and use this method to construct a dataset. When a doctor or patient asks an orthopedic question, the relevant node community can be quickly located in the dataset, and an accurate and detailed answer can be given.
[0100] The above method can be applied to a terminal or a server, or to a system including a terminal and a server, and implemented through the interaction between the terminal and the server. The terminal may include but is not limited to various personal computers, laptops, smart phones, tablet computers, IoT devices and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices may include smart watches, smart bracelets, head-mounted devices, etc. The server may include an independent server or a server cluster consisting of multiple servers.
[0101] For the dataset construction method provided in this application, see Figure 1A The method is exemplarily shown in the flowchart of steps. The method can be implemented by at least the following steps:
[0102] S101, identifying object entities and connection relationships between different object entities from the initial text, and constructing a knowledge graph;
[0103] The object entity includes a noun phrase or word with clear meaning and independence, which is used to represent a specific person, thing, object or concept. For example, in medical texts, "knee", "knee joint effusion", "osteoarthritis" and "meniscus injury" are all object entities.
[0104] The connection relationship refers to a certain association or connection between object entities. In the knowledge graph, the connection relationship is usually represented by edges or arrows, connecting different object entities. For example, there is a connection relationship between the above object entities "knee" and "knee joint effusion", indicating that knee joint effusion will affect knee movement.
[0105] As a structured knowledge representation method, knowledge graphs represent object entities and the connection relationships between object entities in a graphical way. In knowledge graphs, object entities are usually represented as nodes, and connection relationships are represented as edges or arrows.
[0106] The initial text includes the text data required to build the knowledge graph, which can be obtained according to the application scenario of the knowledge graph to be built, including the description of the relationship between various realization entities and time related to the application scenario. The text data can come from various channels, such as professional knowledge introduction articles under the application scenario, professional field papers, and public existing data sets.
[0107] The initial text can be preprocessed first, which may include but is not limited to removing irrelevant characters, word segmentation, part-of-speech tagging and other steps to improve the text quality. Next, the initial text can use named entity recognition technology or methods based on rules, dictionaries, machine learning, etc. to identify object entities. For example, a pre-trained deep learning model can be used to identify noun phrases or words in the text and extract them as object entities; after identifying the object entities, the relationship extraction technology can be used to identify the connection relationship between object entities. Specifically, it can be achieved through rule-based methods, machine learning-based methods or deep learning-based methods. For example, a deep learning model can be trained to identify sentences or phrases in the text that describe the relationship between entities, and these relationships are extracted as the connection relationship of the corresponding object entities. After identifying the object entities and their connection relationships, a graph database or knowledge graph construction tool such as Neo4j, Apache Jena, etc. can be used to build a knowledge graph. During the construction process, it is necessary to ensure that each object entity and connection relationship are correctly represented and stored.
[0108] S102, recursively dividing the knowledge graph into a plurality of node communities, wherein each node community except the bottom layer in the recursion includes at least one node community in the next layer;
[0109] A node community is a set of interconnected nodes that are grouped into the same community based on sharing certain attributes, relationships, or functions. In the context of a knowledge graph, a node represents each object entity in the knowledge graph. The formation of a node community is based on the similarity or association between nodes, which can be based on a variety of factors, such as the attributes of the nodes, the types of relationships in which the nodes participate, etc., and can be determined based on the actual purpose of dividing the node community. A node community can represent a certain field, subject, or concept, and the entities within it are usually closely related to the field, subject, or concept.
[0110] Recursive partitioning refers to the continuous partitioning of the knowledge graph into smaller node communities. In recursive partitioning, each level represents a different level of partitioning. The top-level node community in the recursion refers to the node community obtained after the original knowledge graph is partitioned once, while the bottom-level node community represents the minimum granularity of the knowledge graph partitioning, which refers to the communities that cannot be further divided into multiple node communities of the next level in the process of continuously partitioning the knowledge graph into smaller node communities.
[0111] The node community of the next level can be understood as: in the recursive partitioning, the node community is further divided into smaller node communities, and the smaller node community is the node community of the “next level” of the divided node community.
[0112] The process of recursively dividing the knowledge graph into multiple node communities is actually a hierarchical and structured organization of the entities and relationships in the knowledge graph. The division can be based on the connection strength between entities, which can be determined by calculating at least one indicator such as the similarity, co-occurrence frequency, and path length between entities. The purpose of the division is to classify closely connected entities into a category to form a node community, and further recursively divide them on this basis to form multiple node communities of different levels to form a community structure.
[0113] During the division process, the knowledge graph is organized into a multi-level community structure, each level contains at least two node communities. The closer the level is to the recursive top level, the more object entities it contains in the knowledge graph. Recursion means repeated division of node communities. For multiple node communities at the same level obtained by division, each node community can be regarded as a new, smaller knowledge graph, and the smaller knowledge graph can be divided again to form the node community of the next level until the set stop condition is met. During the division process, the internal connection of the node community at the same level is stronger than the connection between the node communities. For each node community as a parent node, the internal connection of each node community at the next level it includes is usually stronger than the internal connection of the node community as the parent node.
[0114] S103, generating community description information of each node community in each level according to the knowledge graph information included in the node community;
[0115] Community description information refers to the descriptive text generated for the node community. It is a comprehensive text content that can clearly define and elaborate on each node community. It is used to clearly present the information relationship in the community and summarize the information content contained in the community. That is, the community description information can not only summarize the relationship and structure between the information within the community, but also explain in detail the specific content covered by the community and its importance, so as to quickly understand the characteristics and main content of each node community.
[0116] The community description information may be generated by summarizing the node community from the local to the whole, and may at least include the node community theme, the theme content summary of the node community, and may include multiple local content summaries and content descriptions for the local content summaries. Among them, the node community title is a brief summary of the node community, which can include a sentence or several keywords, and can quickly convey the main theme or core content of the community; the theme content summary of the node community is used to represent a high-level overview of the overall content and structure of the node community, providing a summary of the node community from a macro perspective, which is convenient for understanding the main components and key information of the community; the local content summary is based on the node community theme, and is determined from different information dimensions closely related to the node community theme. The node community theme is the core and focus of the community, and the local content summary includes different branches displayed around the core. The local content summary and the node community theme together constitute a complete framework of the community discussion content. There is a complementary relationship between different local content summaries, which provide support for the node community theme and theme content summary from different angles and levels, and the content description for the local content summary indicates a further development of each local content summary, providing more detailed background information, specific examples, related concepts and important details, and providing rich information support for the local content summary. In the process of forming the theme content summary of the node community or the content description for the local content summary, the object entities involved and the relationship between their object entities can be added as additional information.
[0117] For example, see Figure 1B An example of community description information of a node community is shown as an example. The theme of the node community is "Pain management and application of analgesics", and the theme content summary is "This community mainly revolves around pain symptoms and their management, involving the use of various analgesics and treatment plans..." Based on the theme of the node community, multiple local content summaries are formed, such as "Pain is closely related to analgesics", "Multi-purpose treatment of XX capsules", "The importance of analgesics in treatment plans", "The need for analgesics for postoperative recovery", "Diversity of pain symptoms", "Targetedness of analgesics for specific diseases", "Diversity of analgesics", etc., and the content of each local content summary is explained separately.
[0118] By generating community description information for each node community, it is easy to understand the composition of the community from multiple perspectives. Through multiple local summaries, the information characteristics of different parts of the community can be carefully analyzed and detailed explanations can be given. The main purpose of the community can also be quickly identified based on the theme of the entire node community and the theme content summary, and the core information architecture of the node community can be grasped as a whole.
[0119] S104, integrating the knowledge graph with the node community containing community description information to form a data set; the data set is at least used to train the generative network.
[0120] Regarding the integration of the knowledge graph and the node community containing community description information to form a data set, based on the fact that the nodes included in the node community belong to the object entities in the knowledge graph, the knowledge graph and the community structure formed by multiple node communities containing community description information can be combined as two related parts of data as a data set; alternatively, each object entity in the knowledge graph can be associated with the node community to which it belongs, such as adding the node community information to which each object entity belongs to the attributes of the object entity, and identifying each node community on the knowledge graph by visualizing the node community area, and adding the community description information of the node community and basic community information such as community identification, community level, etc., and using the processed knowledge graph as a data set.
[0121] The data set obtained through this step integrates the knowledge graph and the community description information of multiple node communities divided based on the knowledge graph, as well as the multi-level community structure, including the semantic structure of the knowledge graph and the community description information of the node community, and can provide richer information. This data set can be used to construct training samples for the generative network and / or as an external data basis for the generative network to answer questions.
[0122] In the disclosed embodiment, by dividing the constructed knowledge graph into multiple node communities with a hierarchical structure and generating community description information for each node community, the hierarchical organization of the knowledge graph is achieved, and the knowledge graph and the node community containing the community description information are integrated to construct a data set that retains the semantic structure of the knowledge graph and includes a multi-level node community structure and community description information. The organizational structure of the data is optimized, so that when retrieving specific information, the relevant node community can be located first, and then further accurate retrieval can be performed within the community, thereby improving the retrieval efficiency. The node community and its description information provide more accurate and rich contextual information and scope for the query, which helps to reduce the interference of irrelevant information and enhance the accuracy and detail of the query results.
[0123] In some embodiments, regarding the recursive division of the knowledge graph into multiple node communities described in the aforementioned step S102, it can be implemented in the following manner: performing community detection on the knowledge graph, and dividing the knowledge graph into multiple node communities of the first level; repeating community detection on each node community in the latest level, and dividing it into multiple node communities of the next level, until a preset level depth is reached or the scale of the node community meets the set requirements.
[0124] Among them, regarding the latest obtained level, in the first iteration of the recursion, the latest obtained level represents the first level, which is the node community level obtained by the first division of the knowledge graph; in subsequent iterations, each time the node communities of a certain level are divided to obtain multiple node communities of the next level, the next level obtained by this division is used as the latest level.
[0125] Regarding whether the size of a node community meets the set requirements, its size can be measured by parameters such as the number of nodes included in the node community or the connection density within the node community, and the corresponding parameter thresholds can be set. For example, in order to avoid the node community being too large and losing granularity, a node number threshold can be set. When the number of nodes in the node community is less than or equal to the node number threshold, the size of the node community is considered to meet the set requirements. Taking connection density as an example, a community density threshold can be set, requiring the number of connections or connection ratio within the community to reach the community density threshold, and then the size of the node community is considered to meet the set requirements.
[0126] The above-mentioned repeated operations are used to further refine the division of existing node communities, and divide each node community into smaller and more specific sub-communities (i.e., node communities at the next level). In this way, we can recursively go deep into each level of the knowledge graph. It should be understood that the recursive division will stop when the node community obtained by the latest division meets the preset termination condition, thereby obtaining a community structure with a hierarchical structure including multiple node communities.
[0127] Taking the example that the value of the recursive division level N increases with the recursion, first, for the constructed knowledge graph, it is divided into multiple node communities of the first level through step S201, and then each node community of the Nth level is divided to obtain multiple node communities of the N+1th level until the preset stop condition is reached; wherein, the value of N is a positive integer and increases sequentially; the preset stop condition includes any one of the following: the value of N meets the preset level depth; the size of the node community meets the set requirements. See Figure 2A A schematic diagram of the process of dividing a knowledge graph into multiple node communities is shown as an example. The knowledge graph is divided into multiple node communities of the first level through step S201, and the value of N is 1 at this time; next, the same step S202 is executed for each node community of the Nth level, namely: determine whether the node community satisfies any preset stop condition, and if so, stop further dividing the node community; otherwise, divide the node community to obtain the node community of the N+1th level, and return to execute step S202 after updating N.
[0128] According to the node community division method described in this embodiment, Figure 2BA schematic diagram of a multi-level node community structure is shown as an example. The knowledge graph is divided into a community structure with a level depth of 3. The constructed knowledge graph is first divided into two node communities A11 and A12 in the first level. The node community A11 is further divided into second-level node communities A21, A22 and A23. The node community A12 is further divided into second-level node communities A24 and A25. The node community scale of A22-A25 meets the set requirements, such as the number of nodes included is less than or equal to the set number threshold, and the division of node communities A22-A25 is stopped. The second-level node community A21 is further divided into third-level node communities A31 and A32, and the division is stopped when the preset level depth is reached. The node communities A31, A32 and A22-A25 in the figure all belong to the node communities at the lowest level. Each node community except the node community at the lowest level includes at least two node communities at the next level of its level. For example, the node community A11 includes three node communities at the next level of the first level (i.e., the second level).
[0129] In the disclosed embodiment, through community detection and recursive partitioning strategies, complex knowledge graphs can be quickly organized into multiple node communities with clear levels and structures. The node communities are more closely connected logically, and a multi-level node community structure is constructed, providing a data basis for subsequent data queries.
[0130] In some embodiments, after recursively dividing the knowledge graph into multiple levels of node communities, it is necessary to effectively understand and describe each node community. Therefore, for the aforementioned step S103 of generating community description information of each node community in each level based on the knowledge graph information included in the node community, this embodiment proposes a method of generating community description information of each node community level by level based on the hierarchical structure of the node community, such as Figure 3 As shown in the step flow chart, the method may at least include the following steps:
[0131] S301, obtaining community description information of each first node community at the bottom level in the recursive partitioning;
[0132] Each first node community at the bottom level in the recursive partitioning refers to each node community that meets the preset stop condition in the aforementioned embodiment, that is, the level depth of the node community reaches the preset level depth or the size of the node community meets the set requirements. Figure 2B Take the node community structure diagram of the example as an example. Figure 2BThe node communities A31 and A32 shown in the figure that meet the preset hierarchical depth, and the node communities A22, A23, A24 and A25 whose node community scales meet the set requirements, all belong to the first node community at the bottom level.
[0133] For each first node community, we can first obtain the knowledge graph information included in the first node community, such as object entity information and connection relationship information between object entities, and then use machine learning or deep neural network to analyze the knowledge graph information to generate community description information about the first node community.
[0134] S302, for each second node community in the level to be processed, the community description information of the second node community that belongs to the next level of the level to be processed and is included in the second node community is used to generate the community description information of the second node community; wherein the level to be processed refers to the level to be processed determined by sequentially taking the level above the level for which the community description information is most recently generated in the recursive reverse order and the order of levels upward in the recursive division.
[0135] That is, after generating the community description information of each first node community at the bottom level, the level above the bottom level is used as the level to be processed, and for each second community node in the level to be processed that does not include a community description, the community description information of the node community at the next level of the level to be processed, which is included in the second community node, is used to generate the community description information of the second node community, until the generation of community description information for node communities at all levels is completed.
[0136] Continue with Figure 2B Taking the node community structure of the example, the hierarchical depth of the node community is 3 levels. According to the recursive reverse hierarchical order, after generating the community description information of the node community A31 and the node community A32 in the third level, the second level is used as the level to be processed. For the node community A21 in the second level that does not have community description information, the community description information of the node community A21 is generated according to the community description information of the node communities A31 and A32; after completing the generation of the community description information of the node communities A21-A25 in the second level, the first level is used as the level to be processed. For the node community A11 that does not have community description information, it is generated according to the community description information of the node communities A21-A23, and for the node community A12, it is generated according to the community description information of the node communities A24-A25.
[0137] In the disclosed embodiment, node community description information of each level is generated in a recursive reverse order and layer by layer, so that the description of the node community of each level is clear and the community description is logically coherent, and the generated low-level information is fully utilized to construct a high-level description, thereby improving the efficiency of information integration, realizing multi-scale analysis from fine-grained to coarse-grained, and improving the accuracy and comprehensiveness of the community description information.
[0138] In some embodiments, regarding the acquisition of community description information of each first node community at the bottom level of the recursive partitioning in step S301 in the aforementioned embodiment, this embodiment provides a method for generating community description information based on a large language model. The context window input based on the large language model is limited. This embodiment further combines the priority of the object entity for context window input, such as Figure 4 The exemplary step flow chart shows that the method may include the following steps:
[0139] S401, for each first node community, obtaining knowledge graph information included in the first node community; the knowledge graph information at least includes object entity information and connection relationship information between object entities;
[0140] S402, inputting the object entity information and the connection relationship information between the object entity and other object entities into the context window of the first language model according to the priority order of the object entities included in the knowledge graph information, until the input limit of the context window is reached;
[0141] S403: Obtain description information output by the first language model based on the context window as community description information of the first node community.
[0142] Among them, the priority order of the object entities can be determined based on at least one of multiple factors such as the update frequency of the object entity, the number of relationships of the object entity as a source entity or a target entity of the connection relationship, the frequency of occurrence of the object entity in the initial text, etc.
[0143] In the disclosed embodiment, the knowledge graph information is input into the context window of the large language model according to the priority order of the object entities, which can ensure that important object entities and connection relationships are given priority. By sorting by priority, it is ensured that as much important information as possible is included in the limited input space, and resource utilization is optimized to avoid wasting on secondary or irrelevant information, so that the large language model can more accurately capture the core features and key information of the community, thereby generating more accurate and relevant community description information.
[0144] In some embodiments, corresponding to the generation of the community description information of the second node community described in the aforementioned step S302, this embodiment provides a method for generating community description information based on a large language model, that is, the community description information of the node community included in the second node community and belonging to the next level of the level to be processed can be input into the context window of the first large language model, so that the first large language model summarizes the information input in the context window, and obtains the community description information of the second node community generated by the first large language model based on the context window. Among them, the first large language model can be trained using node community samples annotated with community description information.
[0145] The context window based on the first largest language model is usually limited by the input information amount. Therefore, when the community description information of the node community of the next level of the level to be processed included in the second node community is input into the context window of the first largest language model, the community description information of the node community of each next level can be input in sequence according to the priority order of the node community of the next level of the level to be processed. Among them, the priority order of each node community of the next level of the level to be processed can be determined according to the degree of relevance between the node community of the next level and the second node community, or it can also be determined comprehensively according to the node priority included in the node community, the connection strength within the community, etc.
[0146] In the disclosed embodiment, based on the large language model with powerful text generation capabilities, by utilizing the large language model, it is possible to automatically generate description information for the node community in the level to be processed based on the community description information input in the context window, thereby reducing human intervention and improving the efficiency of generating community description information.
[0147] In some embodiments, for the identification of object entities from the initial text and the connection relationship between different object entities described in step S101 in the aforementioned embodiment, this embodiment provides an object entity and relationship identification method based on text segmentation and a large language model. In this identification method, the initial text is first segmented into multiple text segments, and the text segments are input into a second large language model; the names of all object entities included in the text segment are identified using the second large language model through prompt text and / or recognition examples, and the type of the object entity is determined according to the text segment record and a first description is generated; the connection relationship between the object entities included in the text segment is identified using the second large language model, and a second description of the connection relationship is generated.
[0148] The second largest language model refers to a pre-trained neural network model that can understand and generate natural language text, and is used to identify object entities, types of object entities, and connection relationships between object entities in text fragments. The above-mentioned prompt text is used as additional information provided to the second largest language model to guide the behavior of the model during the recognition process, so as to help the model better understand the content of the text fragment and improve the accuracy of recognition; the above-mentioned recognition examples include initial text examples, and at least one set of known object entities and connection relationships, which are used to calibrate the second largest language model. By providing recognition examples, the model can learn the rules and patterns for identifying object entities and connection relationships.
[0149] The first description includes an explanation of the object entity. For example, if the entity is "ibuprofen", its description may include a brief introduction that it is a painkiller, its main uses, its efficacy, etc. It is a general description of the object entity based on text fragment information, including relevant information such as the entity's attributes and characteristics. At the same time, the type of the object entity can be expressed as "painkillers".
[0150] The second description is a brief description of the connection relationship between the source entity and the target entity, which is used to explain the specific connection or function between the source entity and the target entity. For example, for the target entity "rotator cuff injury" and the source entity "acute trauma", there is a connection relationship between the two, and the second description corresponding to the connection relationship can be expressed as "rotator cuff injury may be caused by acute trauma".
[0151] In order to better understand the first description and the second description of this embodiment, Figure 5A The example table of object entities, types and first descriptions is shown exemplarily. The large language model accurately identifies the type of the identified object entity and generates corresponding descriptive text based on the text content. Figure 5B The example table of the second description of the connection relationship between object entities is exemplarily shown. For two object entities that have a connection relationship, the connection relationship between the two is explained through a brief text.
[0152] In the disclosed embodiment, by dividing the initial text into multiple smaller text segments, the recognition task is simplified, making the information in each segment more concentrated and easier to process, and providing prompt text and / or recognition examples to guide the second largest language model to better understand and process the text segments, enhance the adaptability and flexibility of the model, and enable it to process texts in different fields and topics, so that the second largest language model can more accurately capture the characteristics of object entities and connection relationships, thereby improving recognition accuracy and recognition efficiency. At the same time, the second largest language model is used to generate descriptive text for object entities and their connection relationships, providing richer contextual information and further enriching the content of the knowledge graph.
[0153] In some embodiments, based on the recognition errors and omissions that may exist in actual applications, in order to further improve the accuracy and reliability of recognition, this embodiment also provides a process for evaluation and supplementary collection. This method uses the second largest language model to identify and identify object entities and their connection relationships in the text fragment in the above embodiment, and then uses the second largest language model to evaluate the object entities and connection relationships identified from the text fragment to generate a confidence score; the confidence score is used to indicate the confidence level of the second largest language model in the recognition result; when the confidence score is lower than the set score threshold, the text fragment is re-input into the second largest language model for supplementary collection of object entities and connection relationships.
[0154] That is, the second largest language model is first used to conduct an in-depth evaluation of the object entities and connection relationships initially identified from the text fragment. The evaluation process is used to perform a self-quantified analysis of the accuracy of the identified object entities and connection relationships through the algorithms and logic within the model, thereby generating a confidence score as a quantitative reference indicator for the completeness of information collection, indicating the confidence of the second largest language model in the recognition result. A higher confidence score indicates a lower probability of omission or misidentification of the object entities and their connection relationships in the text fragment, while a lower confidence score reflects, to a certain extent, that there is a large uncertainty or error in the recognition result.
[0155] Based on this, a score threshold can be pre-set based on historical training conditions. When the confidence score is lower than the set score threshold, the text segment below the score threshold is re-input into the second largest language model for supplementary collection of object entities and connection relationships. At the same time, the large model can be guided to perform supplementary recognition through prompt text, thereby iteratively reusing the recognition ability of the model to remedy object entities and connection relationships that may have been omitted or misjudged in previous recognitions, so as to improve the comprehensiveness and accuracy of recognition.
[0156] In the disclosed embodiment, by introducing confidence scores and supplementary collection steps in the recognition process of object entities and their connection relationships in the second largest language model, the accuracy and reliability of recognition are improved, and the flexibility and adaptability of the system are enhanced.
[0157] In some embodiments, based on the fact that the first description generated when an object entity is recognized is usually a brief description of the object entity, in order to enhance the information richness in the data set, this embodiment provides an information enhancement processing method, which can introduce additional feature information to enrich the understanding of the object entity in the initial text. The method may include the following steps: using the generation prompt and the third language model, generating a covariate for each object entity recognized from the text segment; the covariate is used to provide other feature information about the object entity in addition to the first description. The third language model can be the same as the second language model for identifying the object entity.
[0158] As an additional feature information, the covariate supplements the first description of the object entity and provides a more detailed and multi-dimensional information perspective, which facilitates a more comprehensive description of the object entity. Taking the object entity "ibuprofen" as an example, its first description can include a brief introduction to its analgesic, main uses, efficacy, etc., and the covariate can include but is not limited to drug form, preparation chemical formula, ingredients, applicable symptoms, medication instructions, contraindications and precautions, and other information not covered in the first description.
[0159] In the disclosed embodiment, by introducing covariates as supplementary explanations to the first description, the description of the object entity in the knowledge graph contains feature information of more dimensions, enriching the description of the object entity, making the knowledge graph more comprehensive and accurate in representing the object entity, and being able to better reflect the complex relationships between entities, providing data support for the subsequent division of the knowledge graph into node communities and generating community description information for the node communities.
[0160] In some embodiments, in order to further improve the quality of knowledge graph construction and ensure the accuracy and completeness of object entities and their connection relationships, this embodiment introduces a refined preprocessing step to make full use of the text understanding and generation capabilities of the large language model to conduct more in-depth mining and supplementation of the object entities and their connection relationships identified from the initial text. The preprocessing step may include:
[0161] Before constructing the knowledge graph, a fourth language model is used to generate a first supplementary description for the identified object entity, and a second supplementary description for the connection relationship between the object entities; the first supplementary description is combined with the first description to remove duplicates to obtain an updated first description; the second supplementary description is combined with the second description to remove duplicates to obtain an updated second description. The fourth language model can be the same as the second language model for identifying the object entity.
[0162] The first supplementary description may include, but is not limited to, additional attributes, historical background, related events, and other information of the object entity, so as to more comprehensively reveal the essence and characteristics of the object entity. The second supplementary description is used to elaborate on the nature, strength, direction, and other aspects of the connection relationship between the object entities, so as to more accurately portray the interaction and connection between the object entities.
[0163] The generated first supplementary description is merged with the original first description of the object entity, and duplicate information is removed to keep a copy, so as to ensure that the updated first description contains both the basic information generated by the preliminary identification of the object entity and the new supplementary content, thereby effectively supplementing the description of the object entity. Similarly, the second supplementary description is merged with the original second description to remove duplicates, and the updated second description is obtained, which enriches the details of the connection relationship and ensures the accuracy and consistency of the description.
[0164] In the disclosed embodiments, by conducting a more in-depth and comprehensive understanding of object entities and their connection relationships before constructing the knowledge graph, the quality and information content of the constructed knowledge graph are improved, providing more accurate and rich information support for subsequent tasks such as community description information generation and information retrieval.
[0165] In some embodiments, for a data set obtained by integrating a knowledge graph with multiple node communities containing community description information, the data set can be used as an external data basis for the generative network to answer questions. Based on this, this embodiment also provides a data retrieval step based on the data set as an external data basis, and the implementation of the data retrieval step is mainly based on the relevance of the user's question and the node community in the data set. Figure 6 As shown, the data retrieval step can be implemented in the following way:
[0166] S601, obtaining a user question, and determining the relevance between the user question and each node community at the first level in the recursive division;
[0167] Relevance is used to indicate the degree of association or matching between a user's question and a node community, and is used to quantify the similarity or consistency between the subject, content or intention of the user's question and the community's characteristics, attributes or topics.
[0168] Regarding determining the relevance of user questions to each node community at the first level, it can be determined by matching the keywords in the user questions with the keywords in the community description information of the node community, or by using natural language processing technology to perform semantic analysis on the user questions, and calculating the semantic similarity between them and the community description information of the node community through methods such as cosine similarity and Jaccard similarity to determine, or by automatically outputting similarity results for the input user questions and node communities through machine learning or deep neural networks, or by using other feasible methods to calculate similarity. In actual applications, the method for determining similarity can be determined based on factors such as actual computing requirements, data availability, and computing resources, and this application does not make specific limitations on this.
[0169] S602, selecting at least one node community whose relevance meets the requirement from the node communities of the first level as the community of the current level;
[0170] The relevance requirement is used to indicate that the degree of association or matching between the node community and the user's question has reached a preset standard or threshold, which can be determined based on a variety of factors, including but not limited to the topic of the node community, the content of the user's question, the user's intention, the context, etc.
[0171] For example, if the relevance threshold is set to 0.75, then all node communities in the first level that satisfy the requirement that the relevance between the user's question and the node community is greater than or equal to 0.75 are used as the current level community.
[0172] S603, repeating the following steps for the current level community until the lowest level in the recursive partitioning is reached: determining the relevance between each node community of the next level included in the current level community and the user's question, and selecting at least one node community whose relevance meets the requirements from each node community of the next level as a new current level community;
[0173] This step describes a recursive process, which accurately locates the community most relevant to the user's question according to the recursive division hierarchy order of recursively dividing the knowledge graph into multiple node communities in step S102. The processing performed on the current level community will be repeated until the lowest level in the recursive division is reached. Each repetition involves two operations: determining the relevance, and screening the community, wherein determining the relevance refers to calculating the relevance between each node community of the next level included in the current level community and the user's question, and screening the community is to screen out at least one node community that meets the requirements from each node community of the next level according to the relevance as the new current level community. When the new current level community is determined, the above steps are repeated for the new community until the lowest level of the recursive division is reached.
[0174] by Figure 2B Taking the node community structure diagram shown in FIG. 1 as an example, the correlation between the user's question and the first-level node communities A11 and A12 is first calculated, and the node community such as A11 whose correlation meets the requirements is selected, and A11 is used as the current node community; next, the correlation between the node communities A21, A22, and A23 of the next level included in A11 and the user's question is calculated respectively, and the node communities such as A21 and A23 whose correlation meets the requirements are selected as the new current node community; then, the correlation between the node communities A31 and A32 of the next level included in the new current node community A21 and the user's question is calculated, and the node community such as A31 whose correlation meets the set requirements is selected as the new current node community. Based on the fact that A31 and A23 both belong to the node community at the lowest level, and do not include the node community at the next level, the repeated steps are stopped.
[0175] If the relevance of all the node communities of the next level included in the current node community to the user's question does not meet the set requirements, the node communities of other levels included in the next level node community can be used as the current node community. At the same time, an additional identifier can be added to indicate that the relevance of this type of current node community does not meet the requirements, so that when answering user questions, the node communities whose relevance does not meet the set requirements can be removed from all communities determined as current node communities.
[0176] S604: Generate a generative network answer to the user's question based on all node communities determined as current-level communities.
[0177] That is, after determining the multiple current-level communities that are most relevant to the user's question, the information in this type of node community can be used to generate an answer to the user's question. The answer is generated based on the information provided by the node community and combined with natural language understanding. For example, you can first obtain the community description information of each current node community and the knowledge graph information included in the community, such as object entity information and connection relationship information between object entities, and then integrate the obtained information through a generative network to generate a coherent text answer as an answer to the user's question. In addition, the text answer can also be optimized, such as using some post-processing techniques, such as grammar checking, spelling correction, etc., to ensure the accuracy and completeness of the answer.
[0178] In the disclosed embodiments, for the multi-level node communities obtained by recursively dividing the knowledge graph, in the user question scenario, the node communities with the highest relevance to the user's question are screened out in recursive hierarchical order, and irrelevant node communities are quickly excluded in each level, and the search scope is gradually narrowed to locate highly relevant node communities, thereby reducing unnecessary search space, improving the efficiency of information query, and shortening the response time; and when generating the user's answer and the final answer, the information of all node communities determined as the current level community, that is, the node communities whose relevance to the user's question meets the set requirements, is integrated, so that the generated answer is comprehensive and accurate, thereby improving the accuracy of the answer.
[0179] In some embodiments, the relevance between the user question and the node community described in step S601 in the aforementioned embodiment can also be determined in the following manner: generating an intermediate answer to the user question based on the knowledge graph information included in the node community; using the fifth language model to evaluate the helpfulness score of the intermediate answer to the user question, and using the helpfulness score as the relevance.
[0180] That is, for the node community that needs to calculate the relevance to the user's question, the information included in the node community can be used to first generate an intermediate answer to the user's question, and then the understanding ability of the large language model can be used to evaluate the helpfulness score of the intermediate answer to the user's question, where the helpfulness score can be quantified by the semantic relevance between the intermediate answer and the user's question.
[0181] In the embodiments of the present disclosure, by directly generating an intermediate answer related to the user's question and using the evaluation capability of the large language model to deeply understand the semantic connection between the intermediate answer and the user's question, and evaluating the relevance, it is possible to more directly evaluate the degree of match between the information in the node community and the user's needs. Based on the fact that the large language model can capture the subtle differences and complex relationships in the language, it avoids the indirectness and ambiguity that may exist in traditional correlation analysis, thereby more accurately evaluating the degree of help of the intermediate answer to the user's question, and using the helpfulness score as a quantitative indicator of relevance, making the evaluation results more objective and comparable.
[0182] In some embodiments, in order to enhance the practicality and generalization ability of the data set, the data set constructed based on the knowledge graph and the node community in the above embodiments can also integrate other types of data sets, such as Figure 7The information type integrated in a dataset shown as an example, the dataset constructed based on the knowledge graph and the node community can also include at least one of a question-and-answer dataset generated based on actual conversations, a knowledge base generated based on domain expertise, and a question bank dataset constructed based on scenario-based professional examination questions. The introduction of these datasets can enable the generative network to better understand natural language, master domain knowledge, and cope with various actual conversation scenarios.
[0183] Based on this, in some embodiments, when the data set also includes a question-and-answer data set generated based on actual conversations, after the knowledge graph and the node community are integrated to obtain the data set, the method may further include the following data set updating step, namely: according to the application scenario of the data set, obtaining real conversations in the application scenario, and question-and-answer conversations generated based on the data set through the sixth language model; generating a question-and-answer data set based on the real conversations and the question-and-answer conversations; integrating the question-and-answer data set, the knowledge graph, and the node community containing community description information to obtain an updated data set.
[0184] That is, you can first collect real conversations in application scenarios from various public data sources through web crawlers and other methods, and then extract the questions and answers in each real conversation and store them as independent text data structures as question-answer pairs; next, you can perform format standardization on the extracted questions and answers, including removing redundant spaces, normalizing punctuation, unifying capitalization, and other operations. For example, all full-width punctuation marks can be converted to half-width punctuation marks, and multiple consecutive spaces can be compressed into one space to ensure unified data format and reduce misunderstanding errors caused by format problems.
[0185] At the same time, through prompt engineering, the understanding and text generation capabilities of the large language model can be used to guide the large language model to extract parameters of interest from the extracted questions and / or answers, and add the parameters of interest to the text data structure of the question-answer pair as supplementary information content of the question-answer pair.
[0186] In the embodiments of the present disclosure, real conversations contain natural language used by people in daily life, including colloquial expressions, slang, abbreviations, etc., so that the question-answer pair samples are closer to reality. By introducing question-answer pairs generated based on real conversations into the dataset, the generative network can learn how to generate more natural answers that are more in line with human language habits.
[0187] In some embodiments, when the data set also includes a knowledge base generated based on domain expertise, after integrating the knowledge graph and the node community to obtain the data set, the method may also include the following data set updating steps, namely: obtaining various types of domain-related expertise under the application scenario; constructing a scenario knowledge base based on the expertise; integrating the scenario knowledge base, the knowledge graph and the node community containing community description information to obtain an updated data set.
[0188] That is, we can extract domain expertise that is highly relevant to the application scenario from various professional knowledge sources such as academic data such as professional papers and literature, encyclopedias, authoritative guidance articles, etc., organize them into a scenario database and merge them into the constructed data set.
[0189] In the disclosed embodiments, by introducing professional domain knowledge into the data set, the domain expertise of the data is enhanced, the professionalism and rigor of the generative network in generating answers is improved, and the information provided to users is ensured to be accurate and practical.
[0190] In some embodiments, when the data set also includes a question bank data set constructed based on scenario-based professional examination questions, after integrating the knowledge graph and the node community to obtain the data set, the method may also include the following data set update steps, namely: obtaining the scenario-based professional examination question bank under the application scenario; converting the question descriptions, options, correct answers and answer analysis in the scenario-based professional examination question bank into structured information to construct a question bank data set; integrating the question bank data set with the knowledge graph and the node community containing community description information to obtain an updated data set.
[0191] The professional examination question bank includes high-quality questions from various professional examinations, has high authority and professionalism, covers a wide range of knowledge areas related to application scenarios, and the examination questions usually include detailed question descriptions, options, correct answers, and answer analysis. This embodiment processes the question bank into fixed structured data containing questions-options-correct answers-answer analysis by using the replace() function of a string or regular expressions, and integrates it into a question bank data set, which is merged into the constructed data set.
[0192] In the embodiments of the present disclosure, by introducing professional examination question bank information into the data set, the authority and professionalism of the information in the data set are improved, the depth and breadth of the data set are expanded, and the generative network can have a deeper understanding of professional knowledge and logical reasoning processes, thereby improving the application ability of the generative network and the professionalism and rigor of its answers to questions.
[0193] Corresponding to the embodiment of the aforementioned data set construction method, see Figure 8As shown, the present application also provides an embodiment of a data set construction device, the device comprising:
[0194] The knowledge graph construction module 801 is used to identify object entities and connection relationships between different object entities from the initial text and construct a knowledge graph;
[0195] A node community division module 802, configured to recursively divide the knowledge graph into a plurality of node communities, wherein each node community except the recursive bottom layer includes at least one node community at the next lower layer;
[0196] A community description information generating module 803 is used to generate community description information of each node community in each level according to the knowledge graph information included in the node community;
[0197] The data set acquisition module 804 is used to integrate the knowledge graph with the node community containing community description information to form a data set; the data set is at least used to train the generative network.
[0198] In some embodiments, the node community division module is specifically used to:
[0199] Perform community detection on the knowledge graph and divide the knowledge graph into multiple node communities of the first level; repeat community detection on each node community in the latest level, and divide it into multiple node communities of the next level until a preset level depth is reached or the scale of the node community meets the set requirements.
[0200] In some embodiments, the community description information generation module is specifically used to:
[0201] Obtaining community description information of each first node community at the bottom level in the recursive partitioning;
[0202] For each second node community in the level to be processed, the community description information of the second node community that belongs to the next level of the level to be processed and is included in the second node community is used to generate the community description information of the second node community; wherein the level to be processed refers to the level to be processed determined by sequentially taking the level above the level for which the community description information is most recently generated in the recursive reverse order and the order of levels upward in the recursive division.
[0203] In some embodiments, when the community description information generating module is used to generate the community description information of the second node community, it includes:
[0204] The community description information of the node community of the next level of the level to be processed, which is included in the second node community, is input into the context window of the first large language model to obtain the community description information of the second node community generated by the first large language model based on the context window.
[0205] In some embodiments, when the community description information generation module is used to obtain the community description information of each first node community at the bottom level in the recursive partitioning, it includes:
[0206] For each first node community, obtain the knowledge graph information included in the first node community; the knowledge graph information includes at least object entity information and connection relationship information between object entities;
[0207] Inputting the object entity information and the connection relationship information between the object entity and other object entities into the context window of the first language model according to the priority order of the object entities included in the knowledge graph information, until the input limit of the context window is reached;
[0208] The description information output by the first language model based on the context window is obtained as the community description information of the first node community.
[0209] In some embodiments, the knowledge graph construction module is specifically used to:
[0210] The initial text is divided into a plurality of text segments, and the text segments are input into a second largest language model; the names of all object entities included in the text segments are identified by the second largest language model through prompt text and / or recognition examples, and the types of the object entities are determined according to the text segment records and a first description is generated; the connection relationship between the object entities included in the text segment is identified by the second largest language model, and a second description of the connection relationship is generated.
[0211] In some embodiments, the apparatus further comprises:
[0212] Using the second largest language model, evaluating the object entities and connection relationships recognized from the text segment to generate a confidence score; the confidence score is used to indicate the confidence level of the second largest language model in the recognition result;
[0213] When the confidence score is lower than a set score threshold, the text segment is re-input into the second largest language model for supplementary collection of object entities and connection relationships.
[0214] In some embodiments, the apparatus further comprises:
[0215] Using the generated hint and the third language model, a covariate is generated for each object entity identified from the text segment; the covariate is used to provide other feature information about the object entity in addition to the first description.
[0216] In some embodiments, the apparatus further comprises:
[0217] Before constructing the knowledge graph, the fourth language model is used to generate a first supplementary description for the identified object entity, and a second supplementary description for the connection relationship between the object entities; the first supplementary description is merged with the first description to remove duplications, so as to obtain an updated first description; the second supplementary description is merged with the second description to remove duplications, so as to obtain an updated second description.
[0218] In some embodiments, the apparatus further comprises:
[0219] Obtain a user question, and determine the relevance between the user question and each node community of the first level in the recursive division; select at least one node community whose relevance meets the requirements from the node community of the first level as the current level community; repeat the following steps for the current level community until the lowest level in the recursive division is reached: determine the relevance between each node community of the next level included in the current level community and the user question, and select at least one node community whose relevance meets the requirements from each node community of the next level as the new current level community; generate a generative network answer to the user question based on all the node communities determined as the current level communities.
[0220] In some embodiments, the relevance of a user's question to a node community is determined by:
[0221] Based on the knowledge graph information included in the node community, an intermediate answer to the user's question is generated; using the fifth language model, the helpfulness score of the intermediate answer to the user's question is evaluated, and the helpfulness score is used as the relevance.
[0222] In some embodiments, the apparatus further comprises:
[0223] According to the application scenario of the data set, obtain the real conversation in the application scenario and the question-answering conversation generated according to the data set through the sixth language model; generate a question-answering data set according to the real conversation and the question-answering conversation; integrate the question-answering data set with the knowledge graph and the node community containing community description information to obtain an updated data set.
[0224] In some embodiments, the apparatus further comprises:
[0225] Acquire various types of professional knowledge related to the field under the application scenario; build a scenario knowledge base based on the professional knowledge; integrate the scenario knowledge base, the knowledge graph and the node community containing community description information to obtain an updated data set.
[0226] In some embodiments, the apparatus further comprises:
[0227] Obtain a scenario-based professional examination question bank under the application scenario; convert question descriptions, options, correct answers, and answer parsing in the scenario-based professional examination question bank into structured information to construct a question bank data set; integrate the question bank data set with the knowledge graph and the node community containing community description information to obtain an updated data set.
[0228] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0229] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application. Ordinary technicians in this field can understand and implement it without creative work.
[0230] The present application also provides an electronic device. The structural diagram of the electronic device is as follows: Fig. 9 As shown, the electronic device 900 includes at least one processor 901, a memory 902 and a bus 903, and the at least one processor 901 is electrically connected to the memory 902; the memory 902 is configured to store at least one computer-executable instruction, and the processor 901 is configured to execute the at least one computer-executable instruction, thereby performing the steps of any data set construction method provided in any embodiment or any optional implementation manner in the present application.
[0231] Furthermore, the processor 901 may be a Field-Programmable Gate Array (FPGA) or other devices with logic processing capabilities, such as a Microcontroller Unit (MCU) or a Central Process Unit (CPU).
[0232] An embodiment of the present application further provides another readable storage medium storing a computer program, which is used to implement the steps of any data set construction method provided in any embodiment or any optional implementation manner of the present application when executed by a processor.
[0233] The readable storage medium provided in the embodiments of the present application includes, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or optical card. That is, the readable storage medium includes any medium that can store or transmit information in a readable form by a device (e.g., a computer).
[0234] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the particular order or sequential order shown to achieve the desired results. In some implementations, multitasking and parallel processing may be advantageous.
[0235] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for constructing a data set, characterized in that: The method comprises: Identify object entities and the connection relationships between different object entities from the initial text to build a knowledge graph; Recursively dividing the knowledge graph into a plurality of node communities, wherein each node community except the bottommost level in the recursion includes at least one node community in the next level; Generate community description information of each node community in each level based on the knowledge graph information included in the node community; The knowledge graph is integrated with the node community containing community description information to form a data set; the data set is at least used to train the generative network.
2. The method according to claim 1, characterized in that The recursive division of the knowledge graph into a plurality of node communities includes: Performing community detection on the knowledge graph, and dividing the knowledge graph into a plurality of node communities at the first level; Repeat community detection for each node community in the latest layer, and divide it into multiple node communities of the next layer, until the preset layer depth is reached or the size of the node community meets the set requirements.
3. The method according to claim 1, characterized in that: The generating of community description information of each node community in each level according to the knowledge graph information included in the node community includes: Obtaining community description information of each first node community at the bottom level in the recursive partitioning; For each second node community in the to-be-processed level, using the community description information of the node community in the next level of the to-be-processed level included in the second node community, to generate the community description information of the second node community; The to-be-processed level refers to determining the to-be-processed level in the order of the levels in the recursive reverse order and the upward level by level in the recursive division, and sequentially determining the level above the level of the level at which the community description information is most recently generated.
4. The method according to claim 3, characterized in that The generating community description information of the second node community includes: The community description information of the node community of the next level of the level to be processed, which is included in the second node community, is input into the context window of the first large language model to obtain the community description information of the second node community generated by the first large language model based on the context window.
5. The method according to claim 3, characterized in that: The obtaining of community description information of each first node community at the bottom level in the recursive partitioning includes: For each first node community, obtain the knowledge graph information included in the first node community; the knowledge graph information includes at least object entity information and connection relationship information between object entities; Inputting the object entity information and the connection relationship information between the object entity and other object entities into the context window of the first language model according to the priority order of the object entities included in the knowledge graph information, until the input limit of the context window is reached; The description information output by the first language model based on the context window is obtained as the community description information of the first node community.
6. The method according to claim 1, characterized in that The identifying of object entities and connection relationships between different object entities from the initial text includes: Segmenting the initial text into a plurality of text segments, and inputting the text segments into a second language model; Using the second largest language model to recognize the names of all object entities included in the text segment through the prompt text and / or recognition examples, and determining the type of the object entity according to the text segment record and generating a first description; The second largest language model is used to identify connection relationships between object entities included in the text segment, and a second description of the connection relationship is generated.
7. The method according to claim 6, characterized in that The method further comprises: Using the second largest language model, evaluating the object entities and connection relationships recognized from the text segment to generate a confidence score; the confidence score is used to indicate the confidence level of the second largest language model in the recognition result; When the confidence score is lower than a set score threshold, the text segment is re-input into the second largest language model for supplementary collection of object entities and connection relationships.
8. The method according to claim 6, characterized in that The method further comprises: Using the generated hint and the third language model, a covariate is generated for each object entity identified from the text segment; the covariate is used to provide other feature information about the object entity in addition to the first description.
9. The method according to claim 6, characterized in that The method further comprises: Before constructing the knowledge graph, the fourth language model is used to generate a first supplementary description for the identified object entity and a second supplementary description for the connection relationship between the object entities; Merge the first supplementary description with the first description to remove duplications, to obtain an updated first description; The second supplementary explanation is combined with the second description to remove duplications, thereby obtaining an updated second description.
10. The method according to claim 1, characterized in that The method further comprises: Obtaining a user question, and determining the relevance of the user question to each node community at the first level in the recursive partitioning; Selecting at least one node community whose relevance meets the requirements from the node communities of the first level as the community of the current level; Repeat the following steps for the current level community until the lowest level in the recursive partitioning is reached: determine the relevance between each node community of the next level included in the current level community and the user's question, and select at least one node community with a relevance that meets the requirements from each node community of the next level as a new current level community; A generative network answer to the user's question is generated according to all node communities determined as current-level communities.
11. The method according to claim 10, characterized in that The relevance of a user's question to a node community is determined in the following way: Generate an intermediate answer to the user's question based on the knowledge graph information included in the node community; The fifth language model is used to evaluate the helpfulness score of the intermediate answer to the user's question, and the helpfulness score is used as the relevance.
12. The method according to claim 1, characterized in that The method further comprises: According to the application scenario of the data set, obtain a real conversation in the application scenario and a question-answering conversation generated according to the data set through the sixth language model; generate a question-answering data set according to the real conversation and the question-answering conversation; integrate the question-answering data set with the knowledge graph and the node community containing community description information to obtain an updated data set; or, Acquire various types of professional knowledge related to the field of the application scenario; construct a scenario knowledge base based on the professional knowledge; integrate the scenario knowledge base, the knowledge graph and the node community containing community description information to obtain an updated data set; or, Obtain a scenario-based professional examination question bank under the application scenario; convert question descriptions, options, correct answers, and answer parsing in the scenario-based professional examination question bank into structured information to construct a question bank data set; integrate the question bank data set with the knowledge graph and the node community containing community description information to obtain an updated data set.
13. A data set construction device, characterized in that: The device comprises: The knowledge graph construction module is used to identify object entities and the connection relationships between different object entities from the initial text to construct a knowledge graph; A node community division module, used for recursively dividing the knowledge graph into a plurality of node communities, wherein each node community except the recursive bottom layer includes at least one node community of the next layer; A community description information generation module is used to generate community description information of each node community in each level according to the knowledge graph information included in the node community; A data set acquisition module is used to integrate the knowledge graph with the node community containing community description information to form a data set; the data set is at least used to train the generative network.
14. An electronic device, characterized in that: include: Memory, processor; The memory is used to store computer programs; The processor is used to call the computer program to implement the method according to any one of claims 1-12.
15. A readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
RAG question and answer method and system based on knowledge graph and medium
CN118673126A
Community search method and system based on k-trus nested index and storage medium
CN118885673A