Request response method and apparatus, electronic device, and storage medium

By constructing a node relationship graph and utilizing a large language model to process named entities, the problem of separating and processing structured and unstructured data was solved, resulting in more accurate user request responses and improved user experience.

CN120407755BActive Publication Date: 2026-01-23BEIJING DIPEAK TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510919706.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-03
Publication Date
2026-01-23
Estimated Expiration
2045-07-03

AI Technical Summary

Technical Problem

In traditional data management models, structured and unstructured data are processed and stored separately, resulting in a one-sided analytical perspective, making it difficult to achieve efficient information integration and utilization, and consequently leading to inaccurate responses to user requests.

Method used

By obtaining a node relationship graph containing multiple nodes representing named entities and the relationship between named entities, the system finds nodes of named entities that match the request to be processed or nodes that describe named entities from the node relationship graph, and sends them to the large language model for processing to generate response information.

Benefits of technology

It improved the accuracy of responding to user requests and enhanced the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407755B_ABST
    Figure CN120407755B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a request response method and device, electronic equipment and storage medium, relating to the technical field of computer. The method comprises: obtaining a to-be-processed request and a first node relationship graph; for each first type node, determining a first matching degree of the first type node with each other node based on the to-be-processed request; for each first matching degree greater than a first preset threshold, taking a named entity represented by the first type node corresponding to the first matching degree and text content represented by the corresponding other node as prompt information corresponding to the to-be-processed request, and obtaining response information corresponding to the to-be-processed request based on the prompt information through a large language model. Through the above method, the user request can be answered from the perspective of multiple named entities, which can effectively improve the accuracy of the response to the user request and improve the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular, the present application relates to a request response method and device, electronic equipment and storage medium. BACKGROUND

[0002] In actual scenarios, the user's request is often not a single demand, there may be sub-problems involving document content and numerical calculation, and there may also be dimensions and indicators involved in document content reasoning in numerical calculation. In the traditional data management mode, structured data is efficiently processed by a relational database, while unstructured data has long been plagued by problems such as scattered storage, difficult retrieval, and information silos due to complex formats and lack of unified models. That is, structured data and unstructured data are processed and stored separately, resulting in a one-sided analysis perspective and making it difficult to achieve efficient information integration and utilization, which in turn leads to inaccurate responses to user requests. SUMMARY

[0003] The purpose of the present application is to at least solve one of the above technical defects, and the technical scheme provided by the embodiments of the present application is as follows:

[0004] In a first aspect, the embodiments of the present application provide a request response method, comprising:

[0005] Obtaining a to-be-processed request and a first node relationship graph, the first node relationship graph comprising a plurality of nodes and a plurality of directed edges, each node being a first type node or a second type node, the first type node representing a named entity, and the second type node representing text content describing the named entity, wherein a directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to the category represented by the named entity corresponding to the one node;

[0006] For each first type node, determine a first matching degree of the first type node and other nodes in the first node relationship graph except the first type node based on the to-be-processed request, wherein the first matching degree represents the matching degree of the named entity represented by the first type node and the to-be-processed request under the condition of the text content represented by the other nodes;

[0007] For each first matching degree greater than a first preset threshold, the named entity represented by the first type node corresponding to the first matching degree and the text content represented by the corresponding other node are taken as prompt information corresponding to the to-be-processed request, and the response information corresponding to the to-be-processed request is obtained based on the prompt information by a large language model.

[0008] In a second aspect, the embodiments of the present application provide a request response device, comprising:

[0009] The request acquisition module is configured to acquire a to-be-processed request and a first node relationship graph, the first node relationship graph comprising a plurality of nodes and a plurality of directed edges, each node being a first-type node or a second-type node, the first-type node representing a named entity, and the second-type node representing text content describing the named entity, wherein a directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to a category represented by the named entity corresponding to the one node.

[0010] The node matching module is configured to, for each first-type node, determine a first matching degree of the first-type node and each other node in the first node relationship graph except the first-type node based on the to-be-processed request, wherein the first matching degree represents a matching degree of the named entity represented by the first-type node and the to-be-processed request under the condition of the text content represented by the other node.

[0011] The request response module is configured to, for each first matching degree greater than a first preset threshold, take the named entity represented by the first-type node corresponding to the first matching degree and the text content represented by the corresponding other node as prompt information corresponding to the to-be-processed request, and obtain, by the large language model, response information corresponding to the to-be-processed request based on the prompt information.

[0012] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory.

[0013] The processor executes the computer program to implement the method provided in the first aspect or any optional embodiment of the first aspect.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method provided in the first aspect or any optional embodiment of the first aspect is implemented.

[0015] The technical scheme provided by the embodiments of the present application has the following beneficial effects:

[0016] The embodiments of the present application provide the following beneficial effects: BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced.

[0018] Figure 1 A flowchart of a request response method provided by the embodiments of the present application is shown in FIG. 1.

[0019] Figure 2 A flowchart of the process of integrating the data to be integrated in an example of the embodiments of the present application is shown in FIG. 2.

[0020] Figure 3 A flowchart of the process of extracting the first node relationship graph from the preset relationship node and generating the response information in an example of the embodiments of the present application is shown in FIG. 3.

[0021] Figure 4 A structural block diagram of a request response device provided by the embodiments of the present application is shown in FIG. 4.

[0022] Figure 5 A structural diagram of an electronic device provided by the embodiments of the present application is shown in FIG. 5. DETAILED DESCRIPTION

[0023] The embodiments of the present application will be described below in conjunction with the drawings of the present application. It should be understood that the embodiments described below in conjunction with the drawings are exemplary descriptions of the technical solutions of the embodiments of the present application, and do not limit the technical solutions of the embodiments of the present application.

[0024] Those skilled in the art can understand that the singular forms "a", "an" and "the" used herein include plural forms unless specifically stated otherwise. It should be further understood that the terms "comprise" and "include" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the present technology. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element can be directly connected or coupled to the other element, or can mean that the element and the other element are connected through an intermediate element. In addition, the "connection" or "coupling" used herein can include wireless connection or wireless coupling. The term "and / or" used herein means that at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or as "B", or as "A and B".

[0025] In order to make the purposes, technical solutions and advantages of the present application more clear, the embodiments of the present application will be described in further detail below in conjunction with the drawings.

[0026] The technical solutions of the embodiments of the present application and the technical effects generated by the technical solutions of the present application are described below by describing several exemplary embodiments. It should be noted that the following embodiments can be mutually referenced, borrowed or combined. For the same terms, similar features and similar implementation steps in different embodiments, they are not described repeatedly.

[0027] Figure 1 A flowchart of a request response method is provided for the embodiments of the present application. The execution subject of the method can be a terminal (such as a computer, a mobile phone, etc.), as shown in Figure 1 The method can include the following steps.

[0028] In step S101, a to-be-processed request and a first node relationship graph are obtained. The first node relationship graph includes a plurality of nodes and a plurality of directed edges. Each node is a first type node or a second type node. The first type node represents a named entity, and the second type node represents text content describing the named entity. A directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to the category represented by the named entity corresponding to the one node.

[0029] In the embodiments of the present application, the to-be-processed request can be sent by a user and can generally be in the form of natural language. The request can be a query request, such as “Please help me query the income of XX company last year”, etc. It can also be a question, such as “Where is XX company?” etc. The embodiments of the present application do not limit this. The first node relationship graph can be a directed graph associated with the to-be-processed request. Each node in the graph represents a named entity related to the domain to which the semantics of the to-be-processed request belongs. For example, when the question raised by the user is “Please help me query the income of XX company last year”, the semantics of the question belongs to the financial domain. Therefore, the nodes included in the first node relationship graph obtained are also related to the financial domain. The nodes in the present application can be divided into first type nodes and second type nodes. The first type node can generally be a word of a named entity, such as “Shanghai”, etc. The second type node can be a piece of text describing the named entity, such as “Shanghai is a municipality directly under the Central Government”, etc. The embodiments of the present application do not limit this.

[0030] Specifically, after the terminal obtains the to-be-processed request sent by the user, the semantics of the to-be-processed request can be analyzed, and then the first node relationship graph related to the semantics of the to-be-processed request can be determined according to the result of the semantic analysis.

[0031] In step S102, for each first-type node, a first matching degree of the first-type node with each other node in the first node relation graph except the first-type node is determined based on the to-be-processed request, where the first matching degree represents a matching degree of the named entity represented by the first-type node with the to-be-processed request under the condition of the text content represented by the other node.

[0032] In an embodiment of the present application, the first matching degree can be obtained by converting the text content represented by each node and the text content of the to-be-processed request into corresponding vector forms and then calculating the cosine similarity of the vectors.

[0033] Specifically, after obtaining the first node relation graph, since each node in the first node relation graph is related to the field to which the to-be-processed request belongs, it is necessary to further filter the nodes from the first node relation graph according to the semantics of the to-be-processed request. The filtering manner can be filtering through the semantics of the to-be-processed request text content, and the semantics can be represented by converting it into a corresponding vector. The semantics of each node in the first node relation graph can also be represented by converting it into a corresponding vector. Then, the correlation between the semantics can be determined by calculating the cosine similarity of the vectors converted from the text content, thereby completing the filtering of the nodes.

[0034] Specifically, after obtaining the first node relation graph, the text content of the to-be-processed request and the named entity represented by each first-type node in the first node relation graph can be first converted into a vector form, and then the ComplEx (Complex Embedding) model can be used to represent each vector in the form of a complex number, and the specific form can be as follows:

[0035]

[0036] where S represents the complex number vector form of the named entity of the first-type node, R represents the complex number vector form of the text content of the to-be-processed request, s represents the original vector form of the named entity of the first-type node, r represents the original vector form of the text content of the to-be-processed request, Re() represents the real part, and Im() represents the imaginary part. For example, for the vector [1, 2], the converted complex number vector can be .

[0037] Then, the text content represented by each other node can also be converted into a complex number vector form in the same manner as described above, and then the first matching degree of each first-type node with each other node can be determined by the following formula:

[0038]

[0039] where f(S, R, E) is the first matching degree, and E is the complex number vector form of the other node. is a conjugate complex vector of E, denotes element-wise multiplication, and Re() denotes taking real part to ensure the first matching degree is a real number. denotes the k-th dimension of the real part of the complex-form vector S (e.g., for the complex-form vector , it can also be regarded as , then the first dimension is , and the second dimension is , denotes the k-th dimension of the real part of the complex-form vector R, denotes the k-th dimension of the real part of the complex-form vector E; denotes the k-th dimension of the imaginary part of the complex-form vector S, denotes the k-th dimension of the imaginary part of the complex-form vector R, denotes the k-th dimension of the imaginary part of the complex-form vector E.

[0040] Through the above formula, the matching degree of each first-type node and each other node is calculated respectively, and the first matching degree between each first-type node and each other node is obtained.

[0041] Optionally, the process of calculating the first matching degree can also be completed by a trained model. For example, the text content of various to-be-processed requests that the user may give and the named entities that may appear can be used as training samples of an initial model, and the text content that may describe the named entities can be used as training labels to train the initial model until the training loss of the model is less than a threshold value, and the trained model is obtained. The model loss function of the model can be as follows:

[0042]

[0043] wherein, is the square of the Euclidean norm of the error between the model prediction value and the true value, i.e., the sum of the squares of the components of the vector. γ is an interval hyperparameter (usually 1~2), and λ is an L2 regularization coefficient. Through optimization, the model learns to represent complex semantics with complex vectors, capturing anti-symmetric relationships such as "father and son" and "son and father".

[0044] In step S103, for each first matching degree greater than the first preset threshold value, the named entity represented by the first-type node corresponding to the first matching degree and the text content represented by the other node corresponding to the first matching degree are taken as prompt information corresponding to the to-be-processed request, and the large language model obtains response information corresponding to the to-be-processed request based on the prompt information.

[0045] In the embodiments of the present application, the first preset threshold value can be freely set, and the first matching degree exceeding the threshold value indicates that the named entity represented by the corresponding first type node matches the request to be processed under the condition of the text content represented by the corresponding other nodes. The prompt information can include multiple named entities or multiple pieces of text content for describing the named entities. Specifically, any first type node corresponding to a first matching degree greater than the first preset threshold value can be taken as a starting node, and the corresponding other nodes can be taken as terminal nodes. Then, the text content represented by the nodes is integrated according to the ownership relationship represented by the directed edges in the first node relationship graph, and the prompt information is obtained. Alternatively, the named entity or the text content for describing the named entity can be directly taken as the prompt information and input into the large language model. The large language model integrates the input named entities or text content and outputs the corresponding response information according to the integration result. The embodiments of the present application are not limited in this regard.

[0046] It should be noted that when the request to be processed is a query request, the large language model in the embodiments of the present application can first generate a corresponding sql (Structured Query Language, structured query language) query statement according to the prompt information, query the related results from the preset database through the sql statement, and then integrate the results into a natural language query result as the response information.

[0047] The scheme provided in the embodiments of the present application obtains a node relationship graph containing multiple nodes representing named entities and nodes representing the ownership relationship between the named entities, finds the nodes representing the named entities or the nodes describing the named entities that match the request to be processed from the node relationship graph, and sends the named entities represented by the matched nodes or the text content for describing the named entities to the large language model for processing to obtain the response information. This enables the response to the user request to be performed from the perspective of multiple named entities, effectively improves the accuracy of the response to the user request, and improves the user experience.

[0048] On the basis of the above-mentioned embodiments, as an optional embodiment, the first node relationship graph is obtained as follows:

[0049] The preset node relationship graph is obtained, and at least one candidate node and at least one candidate directed edge whose represented text content matches the semantics of each named entity contained in the request to be processed are obtained from the preset node relationship graph. The preset node relationship graph includes multiple nodes and multiple directed edges. Each node includes a first type node and a second type node. The first type node represents a named entity, and the second type node represents text content for describing the named entity. A directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to the category represented by the named entity corresponding to one node.

[0050] constructing an initial node relationship graph based on the at least one candidate node and the at least one candidate directed edge;

[0051] performing a traversal operation on each candidate node, and if a corresponding first node is determined through the traversal operation, performing a deletion operation corresponding to the candidate node;

[0052] taking the initial node relationship graph after the deletion operation corresponding to each candidate node is performed as the first node relationship graph;

[0053] For each candidate node, the traversal operation on the candidate node includes:

[0054] determining a second node currently traversed, and the first node traversed is the candidate node;

[0055] taking a node connected with the second node and pointed by a directed edge in the preset node relationship graph as an associated node corresponding to the current traversal operation;

[0056] determining a first similarity between a semantic of an ownership relationship represented by a directed edge between the second node and the associated node and a semantic represented by the request to be processed, and if the first similarity is greater than a second preset threshold, taking the associated node as a second node corresponding to a next traversal;

[0057] if the first similarity is not greater than the second preset threshold, taking the associated node as a first node corresponding to the candidate node;

[0058] the deletion operation includes:

[0059] deleting each first node and a directed edge with each first node as a starting point from the preset node relationship graph.

[0060] In the embodiments of the present application, the preset node relationship graph is constructed in advance and stored in a graph database (such as a neo4j database), and the first node relationship graph in the embodiments of the present application can be regarded as a subgraph (i.e. a part of the preset node relationship graph) in the preset node relationship graph. The candidate node can be a node that needs to be selected from the preset node relationship graph to construct the first node relationship graph. The associated node can be a node directly connected with the candidate node through a directed edge.

[0061] Specifically, the preset node relationship graph in the present application stores various nodes representing named entities from different fields and text content describing the named entities, and if the nodes related to the request to be processed are directly searched from the preset node relationship graph containing various fields, the accuracy of the response information may be affected due to the mutual interference between different fields. Therefore, a preliminary selection of each node in the preset node relationship graph is needed, and then the selected nodes are used to form the first node relationship graph to determine the response information.

[0062] Specifically, the application provides a self-adaptive pruning multi-level subgraph search method, as shown in the following formula (I) : Figure 3 The method first determines a plurality of candidate nodes and a plurality of matched candidate directed edges according to the semantics of each node and the semantics of the request to be processed, and then constructs an initial node relationship graph according to the plurality of candidate nodes and the plurality of directed edges obtained by matching. Next, each candidate node in the initial node relationship graph is traversed. The following will describe the method by way of example. For example, for candidate node A1, the nodes directly connected to A1 in the preset node relationship graph are B1, B2 and B3. Then, B1, B2 and B3 are determined as associated nodes. Then, the first similarity of B1, B2 and B3 to A1 is determined according to the semantics of the ownership relationship between the nodes. At this time, the first similarity of B1 is greater than the second preset threshold, and the first similarity of B2 and B3 is less than the second preset threshold. Then, B2 and B3 are determined as first nodes, and B1 is determined as a second node. Then, other nodes directly connected to B1 in the preset node relationship graph are determined from B1. In this way, the process is repeated until all directly connected nodes are determined from a certain node or there is no other directly connected node.

[0063] When the traversal of all candidate nodes is completed, all first nodes and directed edges starting from each first node are deleted from the preset node relationship graph, and other nodes pointed to by the directed edges starting from the deleted nodes are also deleted (for example, for the first node B2, there are the following relationships in the preset node relationship graph: B2→C1→D1 and B2→C2→D2. Then, nodes C1, C2, D1 and D2 and the directed edges B2→C1, C1→D1, B2→C2 and C2→D2 are deleted), thereby obtaining a first node relationship graph.

[0064] On the basis of the above embodiments, as an optional embodiment, the first similarity between the semantics of the ownership relationship represented by the directed edge between the second node and the associated node and the semantics represented by the request to be processed is determined, which specifically includes:

[0065] The first embedding vector corresponding to the text content of the request to be processed is obtained, and the second embedding vector corresponding to the text content of the ownership relationship is obtained. The second similarity between the first embedding vector and the second embedding vector is determined.

[0066] determine a first same character number of the text content of the request to be processed and the total character number, and determine a proportion of the first same character number in the total character number; the total character number is a sum of a character number of the text content represented by the second node, a character number of the text content represented by the associated node, and a character number of the text content of the attribution relationship;

[0067] perform weighted summation on the second similarity and the proportion to obtain the first similarity.

[0068] In the embodiments of the present application, the embedding vector corresponding to each text content can be obtained by inputting the text content into a pre-trained text vector conversion model (such as a bge-m3 vector model) and outputting the model.

[0069] Specifically, since the similarity of two pieces of text content is influenced by multiple different aspects, such as word number, semantics, and the like, in order to improve the accuracy of the traversal process, the embodiments of the present application will consider the similarity of the text content of the attribution relationship and the text content of the request to be processed from multiple aspects respectively. Specifically, the embodiments of the present application provide the following formula to calculate the first similarity:

[0070]

[0071] wherein, E query is the first embedding vector, E path is the second embedding vector, cos(E query ,E path ) is the second similarity, overlap(query, path) is the first same character number, len(path) is the total character number (for example, the request to be processed is “Shanghai Branch obtains which honor”, the character number of the text content represented by the second node, the text content represented by the associated node, and the text content of the attribution relationship is “XX Company Headquarters-Obtains-Technology Pioneer”, then the repeated characters are “obtains” and “honor”, so overlap(query, path) = 2, indicating that there are 2 overlapping characters. At this time, the total character number len(path) is 10), β is a harmonic coefficient between the two, used for weighting the second similarity and the proportion, which can be freely set according to actual needs.

[0072] Through the above formula, the similarity of the text content of the attribution relationship and the text content of the request to be processed can be considered from multiple aspects, thereby improving the accuracy of the traversal process.

[0073] On the basis of each of the above embodiments, as an optional embodiment, the preset node relationship graph is obtained by the following manner:

[0074] Obtaining a plurality of pieces of to-be-integrated data; wherein, the to-be-integrated data is table type data or non-table type data;

[0075] For each piece of to-be-integrated data, if the to-be-integrated data is table type data, the first text content represented by each cell in the table type data is determined as a named entity respectively, and the named entity represented by the cell in the table header in each column of the table and the named entity represented by the cell in the non-table header in the corresponding column are established as a belonging relationship;

[0076] For each piece of to-be-integrated data, if the to-be-integrated data is non-table type data, the second text content corresponding to the non-table type data is obtained, the second text content is divided into a plurality of text blocks containing complete semantics, and the named entity contained in each text block and the belonging relationship between each named entity are extracted by a large language model;

[0077] Each named entity and each text block is taken as a node, and the belonging relationship between each named entity and the belonging relationship between each text block and the named entity are taken as a directed edge between the corresponding two nodes, to construct a second node relationship graph;

[0078] Each node in the second node relationship graph is subjected to a de-duplication operation to obtain a preset node relationship graph.

[0079] In the embodiments of the present application, the non-table type data can be picture type data, text type data, etc. For non-text type data in the non-table type data, these data can be first converted into corresponding text type data, for example, for picture type data, layout analysis, ocr (Optical Character Recognition, optical character recognition) and other technologies can be used to convert into text form, which is not limited in the embodiments of the present application.

[0080] Specifically, in the embodiments of the present application, since the preset node relationship graph needs to contain data materials of various fields, the data materials of various fields need to be collected first. The collected data materials can be table type data or non-table type data, and the table type data and the non-table type data cannot be directly integrated usually, so the data in the embodiments of the present application can be processed respectively, and then the processed data is integrated. Specifically, as shown in FIG. 1, the data materials of various fields are collected first, and then the collected data materials are processed respectively, and then the processed data is integrated to obtain the preset node relationship graph. Figure 2As shown, for the data of table type, the first text content in each cell of the table can be taken as a named entity, and the named entity of the first text content in the cell of the table header in the column has a belonging relationship with the named entity of the first text content in each cell, and the relationship can be represented by adding a directed edge in the preset relationship node graph. For example, as shown in Table 1 below:

[0081]

[0082] Table 1

[0083] In Table 1, the cells of the table are “city”, “branch name” and “interest income”, so “city”, “branch name”, “interest income”, “Shanghai”, “Beijing”, “Guangzhou”, “Shanghai Branch”, “Beijing Branch”, “Guangzhou Branch”, “1 million”, “1.5 million”, “0.8 million” will be determined as the first text content, and in this table, “city” has a belonging relationship with “Shanghai”, “Beijing” and “Guangzhou” respectively (i.e. “city” includes “Shanghai”, “Beijing” and “Guangzhou”), “branch name” has a belonging relationship with “Shanghai Branch”, “Beijing Branch” and “Guangzhou Branch” respectively, and “interest income” has a belonging relationship with “1 million”, “1.5 million” and “0.8 million” respectively. These belonging relationships can be represented by directed edges in the preset node relationship graph, for example, a directed edge is added between the node of “city” and the node of “Shanghai” and the edge points to “city”, and the directed edge contains the text content of “belongs to”, which is used to represent that “Shanghai” belongs to a “city”.

[0084] It should be noted that the named entity in the cell of each table header in the table can also be referred to as “dimension”, and the named entity in the cell of each column other than the table header can also be referred to as “code value”, and in some application scenarios, some data does not appear in the table but appears outside the table, which can be referred to as “indicator”. The “indicator” can be calculated from the data in the table and the relationship between the data, and can have a belonging relationship with “dimension” or “code value”, and the “indicator” can also be taken as a named entity and a node is separately set in the preset node relationship graph.

[0085] And for the data of non-table type, such as Figure 2As shown, the data needs to be first converted into text form (no conversion is needed if the data is of text type), to obtain each second text content, and then each second text content is segmented into multiple text blocks containing complete semantics, and then each text block is input into a large language model, and the named entities contained in each text block and the attribution relationship of each named entity are extracted by the large language model in the manner of knowledge extraction. For example, for a text block "Shanghai and Beijing are cities", three named entities "Shanghai", "Beijing" and "city" can be extracted by the large language model in the manner of knowledge extraction, and the attribution relationship that "Shanghai" and "Beijing" both belong to "city" is extracted.

[0086] It should be noted that, in order to make the preset node relationship graph contain more detailed data information, the text block can also be used as one of the nodes, and each named entity contained in the text block will establish a corresponding attribution relationship with the text block.

[0087] After extracting each named entity and the attribution relationship between each named entity, each named entity can be used as a node, and each attribution relationship can be used as a directed edge to construct a second node relationship graph. It can be understood that, since the sources of the data to be integrated are different, there will inevitably be the same or similar named entities among the extracted named entities, and therefore further deduplication operation needs to be performed on these named entities. After the deduplication operation is completed, the preset node relationship graph can be obtained.

[0088] Optionally, as shown in Figure 2 Each text block, each named entity, and each attribution relationship can be input into a pre-trained bge-m3 (Beijing General Embedding M3) vectorization model to be converted into corresponding embedding vectors, and then used as each node in the preset node relationship graph.

[0089] On the basis of the above embodiments, as an optional embodiment, a deduplication operation is performed on each node in the second node relationship graph to obtain a preset node relationship graph, and the deduplication operation specifically includes:

[0090] For each node in the second node relationship graph, each adjacent node connected to the node through an edge is obtained.

[0091] For any two nodes in the second node relationship graph, the number of the same adjacent nodes in the two nodes is determined, and the sum of the number of adjacent nodes of each node in the two nodes is determined. The proportion of the number of the same adjacent nodes to the sum of the number of adjacent nodes is obtained. If the proportion is not less than a third preset threshold, any one node in the two nodes and the directed edge connected to the node are deleted from the second node relationship graph.

[0092] The obtained second node relationship graph after the deletion operation is completed is taken as the preset node relationship graph.

[0093] Specifically, for each node in the second node relationship graph, first, nodes representing the same named entity can be obtained, for these nodes, only one node is retained, and the other nodes can be directly deleted, and the directed edges of the other nodes are merged into the retained node, then similar nodes can be further retrieved, for each remaining node, each adjacent node connected to the node and the total number of adjacent nodes can be obtained, then each two nodes are compared one by one, the number of adjacent nodes and the number of the same adjacent nodes of the two nodes are compared, which can be specifically represented by the following formula:

[0094]

[0095] wherein A and B represent any two nodes, is a proportion, represents the number of the same adjacent nodes of the two nodes, represents the total number of adjacent nodes of the two nodes.

[0096] When the proportion is not less than a third preset threshold, it can be considered that the text content represented by the two nodes is the same, then any one of the two nodes and the directed edge connected to any one of the nodes can be deleted from the second node relationship graph, that is, the deduplication operation of the second node relationship graph is realized, and the preset relationship node graph is obtained after the deduplication operation is completed.

[0097] Optionally, as shown in Figure 2 the application embodiment can also perform a deduplication operation on the ownership relationship represented by the directed edges between the nodes, and the deduplication method is similar to that of the nodes, which will not be described in detail herein.

[0098] On the basis of the above embodiments, as an optional embodiment, at least one candidate node and at least one candidate directed edge matched with each named entity contained in the request to be processed are obtained from the preset node relationship graph, specifically including:

[0099] The text content of the request to be processed is segmented to obtain each first field, nodes corresponding to the same named entity as any first field are obtained from the preset node relationship graph as candidate nodes, and directed edges corresponding to the same ownership relationship as any first field are obtained from the preset node relationship graph as candidate directed edges;

[0100] A first embedding vector corresponding to the text content of the request to be processed is obtained, and a third embedding vector corresponding to the text content represented by each second node type node in the preset node relationship graph is obtained.

[0101] For each node of the second node type, obtain the third similarity between the third embedding vector and the first embedding vector;

[0102] The third similarity scores are sorted in descending order, and the nodes of the second node type corresponding to the first preset number of third similarity scores are determined as candidate nodes.

[0103] Specifically, before executing the adaptive pruning multi-level subgraph search method, an initial node relationship graph needs to be constructed. The nodes and directed edges in the initial node relationship graph need to be selected from a preset node relationship graph. In this embodiment, these candidate nodes and candidate directed edges can be obtained from the preset node relationship graph through retrieval. Specifically, for example... Figure 3 As shown, firstly, the text content of the request to be processed can be segmented to obtain multiple first fields. The segmentation method can be based on the segmentation and part-of-speech tagging of the jieba tool, which is not limited in this embodiment. Then, the nodes and directed edges that represent text content that are the same as any of the first fields are found from the preset node relationship graph through exact matching. These nodes and directed edges can be used as candidate nodes and candidate directed edges. At the same time, in order to provide richer information in the constructed first node relationship graph, vector similarity matching can also be adopted. That is, the similarity between the first embedding vector corresponding to the text content of the request to be processed and the third embedding vector of the text content represented by each second node type (i.e., a text content describing named entities) can be calculated. The specific formula is as follows:

[0104]

[0105] in, Score similarity The third similarity E query This is the first embedding vector. E chunk For the third embedding vector, | E query | is the magnitude of the first embedding vector, | E chunk | represents the magnitude of the third embedding vector.

[0106] After calculating the third similarity between each node and the text content of the request to be processed, a predetermined number of nodes ranked from largest to smallest can be identified as candidate nodes. It is understandable that if a node ranked high already has a candidate node, then that node can be skipped and other lower-ranked nodes can be identified as candidate nodes.

[0107] As an optional embodiment, if there is a first field that is not the same as the named entity represented by any node in the preset node relationship graph, the first field is taken as a second field.

[0108] After obtaining the node corresponding to the named entity identical to the first field from the preset node relationship graph as a candidate node, the method further includes:

[0109] Obtaining at least one second field from the first fields, the second field being not the same as the named entity represented by any node in the preset node relationship graph;

[0110] For each second field, determining an edit distance of the second field to the text content represented by each node in the preset node relationship graph and a second identical character number, for each node, performing weighted summation on the edit distance of the node and the second identical character number of the node to obtain a second matching degree of the node to the second field, and determining the node with the second matching degree greater than a fourth preset threshold as a candidate node.

[0111] The edit distance is the minimum number of editing operations in character units in the process of adjusting the second field to the text content represented by the node.

[0112] In the embodiments of the present application, the edit distance can be the number of edits required to modify one piece of text content into another piece of text content, for example, modifying "Shanghai is a city" into "Beijing is a city" requires modifying "Shanghai" into "Beijing" and "a city" into "a city", a total of two modifications, so the edit distance is 2.

[0113] Specifically, as shown in Figure 3 When there is a first field in the request to be processed that fails to match a corresponding node in the preset node relationship graph, these fields can be taken as second fields, and then further fuzzy matching is performed in the preset node relationship graph. Specifically, for each second field, the second field can be compared with the text content represented by each node in the preset node relationship graph, and the comparison includes the edit distance and the number of identical characters. Then, the two comparison contents are weighted and summed to obtain the second matching degree. The specific formula is as follows:

[0114]

[0115] wherein, Score fuzzy is the second matching degree, d edit (keyword, note) is the edit distance, overlap (keyword, note) is the second identical character number, len(note)The number of characters of the text content represented by the node and the harmonic coefficient β jointly constitute a weighted parameter.

[0116] After the second matching degrees are calculated, nodes with a second matching degree greater than a fourth preset threshold can be determined as candidate nodes.

[0117] Figure 4 A structural block diagram of a request response device provided by an embodiment of the present application is shown in Figure 4 The request response device 400 can include a request acquisition module 401, a node matching module 402, and a request response module 403, wherein

[0118] The request acquisition module 401 is configured to acquire a to-be-processed request and a first node relationship graph, the first node relationship graph including a plurality of nodes and a plurality of directed edges, each node being a first-type node or a second-type node, the first-type node representing a named entity, and the second-type node representing text content describing the named entity, wherein a directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to a category represented by the named entity corresponding to the one node.

[0119] The node matching module 402 is configured to, for each first-type node, determine a first matching degree of the first-type node with each other node in the first node relationship graph except the first-type node based on the to-be-processed request, wherein the first matching degree represents a matching degree of the named entity represented by the first-type node with the to-be-processed request under the condition of the text content represented by the other node.

[0120] The request response module 403 is configured to, for each first matching degree greater than a first preset threshold, take the named entity represented by the first-type node corresponding to the first matching degree and the text content represented by the other node corresponding to the first matching degree as prompt information corresponding to the to-be-processed request, and obtain response information corresponding to the to-be-processed request based on the prompt information by a large language model.

[0121] The scheme provided by the embodiment of the present application acquires a node relationship graph including a plurality of nodes representing named entities and nodes representing the ownership relationship between the named entities, finds a node representing a named entity or a node describing a named entity that matches a to-be-processed request from the node relationship graph, and sends the named entity represented by the matched node or the text content describing the named entity to a large language model for processing to obtain response information, so that the user request can be answered from the perspective of multiple named entities, the accuracy of the response to the user request can be effectively improved, and the user experience can be improved.

[0122] On the basis of each of the above embodiments, as an optional embodiment, the device further includes a node graph acquisition module, which is specifically configured to:

[0123] obtaining a preset node relationship graph, and obtaining at least one candidate node and at least one candidate directed edge from the preset node relationship graph, the at least one candidate node and the at least one candidate directed edge matching semantics of the text content represented by the preset node relationship graph and semantics of each named entity contained in the request to be processed; the preset node relationship graph comprises a plurality of nodes and a plurality of directed edges, each node comprises a first type node and a second type node, the first type node represents a named entity, and the second type node represents text content describing the named entity, and a directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to a category represented by the named entity corresponding to the one node;

[0124] constructing an initial node relationship graph based on the at least one candidate node and the at least one candidate directed edge;

[0125] performing a traversal operation on each candidate node, and performing a deletion operation corresponding to the candidate node if a first node is determined through the traversal operation;

[0126] taking the initial node relationship graph after the deletion operation corresponding to each candidate node is performed as a first node relationship graph;

[0127] wherein, for each candidate node, the traversal operation on the candidate node comprises:

[0128] determining a second node currently traversed, and the first node traversed is the candidate node;

[0129] taking a node connected with the second node and pointed to by a directed edge in the preset node relationship graph as an associated node corresponding to the current traversal operation;

[0130] determining a first similarity between semantics of an ownership relationship represented by a directed edge between the second node and the associated node and semantics represented by the request to be processed, and taking the associated node as a second node corresponding to a next traversal if the first similarity is greater than a second preset threshold;

[0131] if the first similarity is not greater than the second preset threshold, taking the associated node as a first node corresponding to the candidate node;

[0132] the deletion operation comprises:

[0133] deleting each first node and a directed edge starting from each first node from the preset node relationship graph.

[0134] Based on each of the above embodiments, as an optional embodiment, the node graph obtaining module is further used to:

[0135] obtaining a first embedding vector corresponding to the text content of the request to be processed, and obtaining a second embedding vector corresponding to the text content of the ownership relationship, and determining a second similarity between the first embedding vector and the second embedding vector.

[0136] determining a first number of identical characters appearing in the text content of the request to be processed and a total number of characters, and determining a proportion of the first number of identical characters in the total number of characters; the total number of characters is a sum of a number of characters of the text content represented by the second node, a number of characters of the text content represented by the associated node, and a number of characters of the text content of the belonging relationship;

[0137] performing weighted summation on the second similarity and the proportion to obtain a first similarity.

[0138] On the basis of each of the above embodiments, as an optional embodiment, the apparatus further comprises a node graph construction module, specifically configured to:

[0139] obtain a plurality of pieces of data to be integrated; wherein the data to be integrated is table type data or non-table type data;

[0140] For each piece of data to be integrated, if the data to be integrated is table type data, determine the first text content represented by each cell in the table type data as a named entity respectively, and establish a belonging relationship between the named entity represented by the cell in the table header in each column and the named entity represented by the cell in the non-table header in the corresponding column in the table;

[0141] For each piece of data to be integrated, if the data to be integrated is non-table type data, obtain the second text content corresponding to the non-table type data, divide the second text content into a plurality of text blocks containing complete semantics, and extract the named entities contained in each text block and the belonging relationship between each named entity through a large language model;

[0142] take each named entity and each text block as a node respectively, and take the belonging relationship between each named entity and the belonging relationship between each text block and the named entity as a directed edge between the corresponding two nodes, to construct a second node relationship graph;

[0143] perform a de-duplication operation on each node in the second node relationship graph to obtain a preset node relationship graph.

[0144] On the basis of each of the above embodiments, as an optional embodiment, the apparatus further comprises a node de-duplication module, specifically configured to:

[0145] For each node in the second node relationship graph, obtain each adjacent node connected to the node through an edge;

[0146] For any two nodes in the second node relationship graph, the number of same adjacent nodes in the two nodes is determined, the sum of the number of adjacent nodes of each node in the two nodes is determined, the proportion of the number of same adjacent nodes and the sum of the number of adjacent nodes is obtained, and if the proportion is not less than a third preset threshold, any one node in the two nodes and the directed edge connected with the node are deleted from the second node relationship graph.

[0147] The second node relationship graph obtained after the deletion operation is completed is taken as the preset node relationship graph.

[0148] On the basis of each of the above embodiments, as an optional embodiment, the node graph obtaining module can also be used to:

[0149] The text content of the to-be-processed request is subjected to word segmentation processing to obtain each first field, nodes corresponding to the same named entity as any first field are obtained from the preset node relationship graph as candidate nodes, and directed edges corresponding to the same ownership relationship as any first field are obtained from the preset node relationship graph as candidate directed edges.

[0150] The first embedding vector corresponding to the text content of the to-be-processed request is obtained, and the third embedding vector corresponding to the text content represented by each second node type node in the preset node relationship graph is obtained.

[0151] For each second node type node, the third similarity between the third embedding vector and the first embedding vector is obtained.

[0152] The third similarities are sorted in descending order, and the second node type nodes corresponding to the preset number of third similarities in the front of the sorting result are determined as candidate nodes.

[0153] On the basis of each of the above embodiments, as an optional embodiment, the device further includes a node fuzzy matching module, which is specifically used to:

[0154] At least one second field is obtained from each first field, and the second field is not the same as the named entity represented by any node in the preset node relationship graph.

[0155] For each second field, the edit distance of the second field and the text content represented by each node in the preset node relationship graph and the second number of same characters are determined, for each node, the edit distance of the node and the second number of same characters of the node are weighted and summed to obtain the second matching degree of the node and the second field, and the node whose second matching degree is greater than a fourth preset threshold is determined as a candidate node.

[0156] The edit distance is the minimum number of editing operations in character units in the process of adjusting the second field to the text content represented by the node.

[0157] The following is for reference. Figure 5 It illustrates an electronic device suitable for implementing embodiments of this application (e.g., performing...). Figure 1 The diagram shows the structure of the terminal device or server 500 of the method shown. The electronic devices in the embodiments of this application may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (e.g., vehicle navigation terminals), wearable devices, and fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0158] The electronic device includes a memory and a processor. The memory stores a program for executing the methods described in the various method embodiments above. The processor is configured to execute the program stored in the memory. The processor may be referred to as processing device 501 as described below. The memory may include at least one of read-only memory (ROM) 502, random access memory (RAM) 503, and storage device 508 as described below, as follows:

[0159] like Figure 5 As shown, electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from storage device 508 into random access memory (RAM) 503. RAM 503 also stores various programs and data required for the operation of electronic device 500. The processing device 501, ROM 502, and RAM 503 are interconnected via bus 504. Input / output (I / O) interface 505 is also connected to bus 504.

[0160] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.

[0161] In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for carrying out the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the methods of embodiments of the present application are performed.

[0162] It should be noted that the computer-readable storage medium described above in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to a wire, an optical fiber, an RF (radio frequency) or the like, or any suitable combination of the above.

[0163] In some embodiments, the client, server can utilize any currently known or future developed network protocols, such as HTTP (HyperText Transfer Protocol), to communicate, and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.

[0164] The computer readable medium described above can be included in the electronic device described above; or can exist separately, without being assembled into the electronic device.

[0165] The computer readable medium described above carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to:

[0166] Obtain a to-be-processed request and a first node relationship graph, the first node relationship graph comprising a plurality of nodes and a plurality of directed edges, each node being a first type node or a second type node, the first type node representing a named entity, and the second type node representing text content describing the named entity, wherein a directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to the category represented by the named entity corresponding to the one node; for each first type node, determine a first matching degree of the first type node with each second type node based on the to-be-processed request; wherein the first matching degree represents the matching degree of the named entity represented by the first type node with the to-be-processed request under the condition of the text content represented by the second type node; for each first matching degree greater than a first preset threshold, take the named entity represented by the first type node corresponding to the first matching degree and the text content represented by the corresponding second type node as prompt information corresponding to the to-be-processed request, and obtain, by a large language model, response information corresponding to the to-be-processed request based on the prompt information.

[0167] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0168] The computer program instructions can also be loaded onto a computer or other programmable information processing apparatus to cause a series of operations to be performed on the computer or other programmable information processing apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable information processing apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0169] The modules or units described in the embodiments of the present application can be implemented by software, or by hardware, or by a combination of software and hardware. In some cases, the names of the modules or units do not constitute a limitation on the modules or units themselves. For example, the first constraint obtaining module can also be referred to as a "module that obtains a first constraint".

[0170] The functions described above in the specification of the present application can be performed by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Program-specific Integrated Circuits (ASICs), Program-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.

[0171] In the context of this application, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.

[0172] It should be understood that although the steps in the flowcharts of the drawings are shown in a sequential order, these steps can not necessarily be performed in the order shown. Unless explicitly stated, the steps can be performed in any order, and the execution of some steps can even be concurrent with the execution of others. Moreover, at least some of the steps in the flowcharts can include multiple sub-steps or multiple stages, which can be performed at different times or in different orders, and not necessarily sequentially.

[0173] The above description is merely exemplary of the application, one skilled in the art will readily devise many alterations and modifications of the specific embodiments without departing from the principles of the application. Accordingly, the patent application is to be understood as including all possible alterations and modifications to the specific embodiments described or illustrated herein.

Claims

1. A request-response method, characterized in that, include: Obtain the request to be processed and the first node relationship graph. The first node relationship graph includes multiple nodes and multiple directed edges. Each node is a first type node or a second type node. The first type node represents a named entity, and the second type node represents the text content describing the named entity. A directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to the category represented by the named entity corresponding to the first node. For each first type node, a first matching degree is determined between the first type node and other nodes in the first node relationship graph other than the first type node, based on the request to be processed; wherein, the first matching degree represents the degree of matching between the named entity represented by the first type node and the request to be processed, given the text content represented by the other nodes. For each first matching degree greater than the first preset threshold, the named entity represented by the first type node corresponding to the first matching degree and the text content represented by the corresponding other nodes are used as the prompt information corresponding to the request to be processed. The response information corresponding to the request to be processed is obtained by the large language model based on the prompt information. The first node relationship diagram is obtained in the following way: Obtain a preset node relationship graph, and obtain at least one candidate node and at least one candidate directed edge from the preset node relationship graph that match the semantics of the text content represented by the graph with the semantics of each named entity contained in the request to be processed; the preset node relationship graph includes multiple nodes and multiple directed edges, each node includes a first type node and a second type node, the first type node represents a named entity, and the second type node represents the text content describing the named entity, wherein a directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to the category represented by the named entity corresponding to the first node. Construct an initial node relationship graph based on the at least one candidate node and the at least one candidate directed edge; For each candidate node, perform a traversal operation. If the first node is determined through the traversal operation, then perform the deletion operation corresponding to the candidate node. The initial node relationship graph after performing the deletion operation corresponding to each candidate node is used as the first node relationship graph; For each candidate node, the traversal operation of the candidate node includes: Determine the second node to be traversed, and the first node to be traversed is the candidate node; The node in the preset node relationship graph that is connected to the second node and is pointed to by a directed edge is taken as the associated node corresponding to the current traversal operation. Determine the first similarity between the semantics of the belonging relationship represented by the directed edge between the second node and the associated node and the semantics represented by the request to be processed. If the first similarity is greater than a second preset threshold, then the associated node is taken as the second node corresponding to the next traversal. If the first similarity is not greater than the second preset threshold, then the associated node is taken as a first node corresponding to the candidate node; The deletion operation includes: Remove each first node and the directed edges originating from each first node from the initial node relationship graph.

2. The method according to claim 1, characterized in that, The determination of the first similarity between the semantics of the directed edge representation of the attribution relationship between the second node and the associated node and the semantics of the request to be processed includes: Obtain the first embedding vector corresponding to the text content of the request to be processed, and obtain the second embedding vector corresponding to the text content of the attribution relationship, and determine the second similarity between the first embedding vector and the second embedding vector; The first number of identical characters appearing in the text content of the request to be processed and the total number of characters are determined, and the proportion of the first number of identical characters to the total number of characters is determined; the total number of characters is the sum of the number of characters in the text content represented by the second node, the number of characters in the text content represented by the associated node, and the number of characters in the text content of the attribution relationship; The first similarity is obtained by weighted summation of the second similarity and the ratio.

3. The method according to claim 1, characterized in that, The preset node relationship diagram is obtained in the following way: Obtain multiple data entries to be integrated; wherein, the data to be integrated is either tabular or non-tabular data. For each piece of data to be integrated, if the data to be integrated is table type data, then the first text content represented by each cell in the table type data is determined as a named entity, and an attribution relationship is established between the named entity represented by the cell in the header of each column of the table and the named entity represented by the cell in the corresponding column that is not in the header. For each piece of data to be integrated, if the data to be integrated is non-table data, then the second text content corresponding to the non-table data is obtained, the second text content is divided into multiple text blocks containing complete semantics, and the named entities contained in each text block and the attribution relationship between each named entity are extracted through the large language model. The second node relationship graph is constructed by taking each named entity and each text block as a node, and taking the belonging relationship between each named entity and the belonging relationship between each text block and the named entity as directed edges between corresponding two nodes. The nodes in the second node relationship graph are deduplicated to obtain the preset node relationship graph.

4. The method according to claim 3, characterized in that, The step of deduplicating each node in the second node relationship graph to obtain the preset node relationship graph includes: For each node in the second node relationship graph, obtain all adjacent nodes that are connected to the node through edges; For any two nodes in the second node relationship graph, determine the number of identical adjacent nodes in the two nodes, and determine the sum of the number of adjacent nodes of each of the two nodes. Obtain the ratio of the number of identical adjacent nodes to the sum of the number of adjacent nodes. If the ratio is not less than a third preset threshold, then delete any node in the two nodes and the directed edge connected to the any node from the second node relationship graph. The second node relationship diagram obtained after the deletion operation is completed is used as the preset node relationship diagram.

5. The method according to claim 1, characterized in that, The step of obtaining at least one candidate node and at least one candidate directed edge from the preset node relationship graph that match each named entity contained in the request to be processed includes: The text content of the request to be processed is segmented to obtain each first field. The node corresponding to the named entity that is the same as any first field is obtained from the preset node relationship graph as the candidate node. The directed edge corresponding to the belonging relationship that is the same as any first field is obtained from the preset node relationship graph as the candidate directed edge. Obtain the first embedding vector corresponding to the text content of the request to be processed, and obtain the third embedding vector corresponding to the text content represented by each second node type node in the preset node relationship graph. For each node of the second node type, obtain the third similarity between the third embedding vector and the first embedding vector; The third similarity scores are sorted in descending order, and the nodes of the second node type corresponding to the first preset number of third similarity scores are determined as the candidate nodes.

6. The method according to claim 5, characterized in that, If there exists a first field that is not the same as any named entity represented by any node in the preset node relationship diagram; After obtaining the node corresponding to any named entity with the same first field from the preset node relationship graph as a candidate node, the method further includes: Obtain at least one second field from each of the first fields, wherein the second field is different from the named entity represented by any node in the preset node relationship diagram; For each second field, determine the edit distance and the second number of identical characters between the second field and the text content represented by each node in the preset node relationship graph. For each node, perform a weighted sum of the edit distance and the second number of identical characters to obtain the second matching degree between the node and the second field. Nodes with a second matching degree greater than a fourth preset threshold are determined as candidate nodes. The edit distance is the minimum number of edit operations per character required to adjust the second field to the text content represented by the node.

7. A request-response device, characterized in that, include: The request acquisition module is used to acquire the request to be processed and the first node relationship graph. The first node relationship graph includes multiple nodes and multiple directed edges. Each node is a first type node or a second type node. The first type node represents a named entity, and the second type node represents the text content describing the named entity. A directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to the category represented by the named entity corresponding to the first node. The node matching module is used to determine, for each first type of node, a first matching degree between the first type of node and other nodes in the first node relationship graph other than the first type of node, based on the request to be processed; wherein, the first matching degree represents the degree of matching between the named entity represented by the first type of node and the request to be processed, under the condition that the text content represented by the other nodes represents. The request-response module is used to, for each first matching degree greater than a first preset threshold, take the named entity represented by the first type node corresponding to the first matching degree and the text content represented by the corresponding other nodes as the prompt information corresponding to the request to be processed, and obtain the response information corresponding to the request to be processed based on the prompt information through the large language model. The node graph acquisition module is specifically used for: Obtain a preset node relationship graph, and obtain at least one candidate node and at least one candidate directed edge from the preset node relationship graph that match the semantics of the text content represented by the graph with the semantics of each named entity contained in the request to be processed; the preset node relationship graph includes multiple nodes and multiple directed edges, each node includes a first type node and a second type node, the first type node represents a named entity, and the second type node represents the text content describing the named entity, wherein a directed edge from one node to another node indicates that the named entity corresponding to the other node belongs to the category represented by the named entity corresponding to the first node. Construct an initial node relationship graph based on the at least one candidate node and the at least one candidate directed edge; For each candidate node, perform a traversal operation. If the first node is determined through the traversal operation, then perform the deletion operation corresponding to the candidate node. The initial node relationship graph after performing the deletion operation corresponding to each candidate node is used as the first node relationship graph; For each candidate node, the traversal operation of the candidate node includes: Determine the second node to be traversed, and the first node to be traversed is the candidate node; The node in the preset node relationship graph that is connected to the second node and is pointed to by a directed edge is taken as the associated node corresponding to the current traversal operation. Determine the first similarity between the semantics of the belonging relationship represented by the directed edge between the second node and the associated node and the semantics represented by the request to be processed. If the first similarity is greater than a second preset threshold, then the associated node is taken as the second node corresponding to the next traversal. If the first similarity is not greater than the second preset threshold, then the associated node is taken as a first node corresponding to the candidate node; The deletion operation includes: Remove each first node and the directed edges originating from each first node from the initial node relationship graph.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method of any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1-6.

Citation Information

Patent Citations

  • Question and answer large language model optimization method and device, equipment and storage medium

    CN119848209A