User problem handling method and device
By using graph database and large language model in the user problem processing system, processing user dialogue information and generating accurate replies, the problem of low accuracy of user problem response in the prior art is solved, and more efficient and accurate user problem handling is achieved.
Patent Information
- Application Number
- CN202510158851.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-13
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2045-02-13
AI Technical Summary
In the prior art, the accuracy of user questions responses is poor and difficult to meet expectations.
By receiving user conversation information, pending problems are generated and word segmentation processed. The word participle results are matched with the word vector database built on the graph database to obtain the preliminary matching results. Enter the pending problems, word segmentation results and preliminary matching results into the large language model to generate intermediate matching results. Traversing the keywords in the intermediate matching results, if the keywords exist in the graph database and are not ambiguous, convert the intermediate matching results into the graph database query through pattern query, conduct query and generate user question responses.
Improve the accuracy of user questions reply, clarify user questions through multiple rounds of conversations, and ensure the comprehensiveness and accuracy of the reply information.
Smart Images

Figure CN119623485B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a method and device for processing user questions. Background Art
[0002] Most of the current mainstream RAG (Retrieval-Augmented Generation) query engines store knowledge data in a database after vector encoding, convert a query into a vector, retrieve relevant contexts from the database, and use the query and the retrieved contexts to generate a final response through a large language model (LLM). The responses generated in this way have poor accuracy and often fail to meet expectations. Summary of the Invention
[0003] The present invention provides a method and device for processing user questions, aiming to solve the defect of poor accuracy of user question responses in the prior art and achieve improved accuracy of user question responses.
[0004] The present invention provides a method for processing user questions, including the following steps: in response to receiving user conversation information, generating a question to be processed; performing word segmentation processing on the question to be processed to obtain a word segmentation result; performing word vector matching between the word segments in the word segmentation result and a word vector database to obtain a preliminary matching result, wherein the word vector database is constructed based on a graph database; inputting the question to be processed, the word segmentation result, and the preliminary matching result into a large language model, and the large language model obtaining an intermediate matching result in a preset format based on the question to be processed, the word segmentation result, the preliminary matching result, and the graph database, wherein the intermediate matching result includes keywords corresponding to the word segments and keyword attributes, and the keyword attributes include the positions of the keywords in the graph database; traversing the keywords in the intermediate matching result, and in response to the keywords existing in the graph database and being unambiguous, converting the intermediate matching result into a graph database query statement through pattern query based on the graph construction specification of the graph database; querying the graph database according to the graph database query statement to obtain a query result; and generating a user question response according to the query result.
[0005] A user problem processing method provided by the present invention further includes, before converting the intermediate matching result into a graph database query statement through pattern query according to the graph construction specification of the graph database: obtaining the correspondence between the keyword and the nodes in the graph database; if the keyword does not correspond to any node in the graph database, determining that the keyword does not exist in the graph database; if the keyword uniquely corresponds to a node in the graph database, determining that the keyword exists in the graph database and is unambiguous; if the keyword corresponds to at least two nodes in the graph database, determining that the keyword exists in the graph database but is ambiguous.
[0006] A user problem processing method provided by the present invention further includes: in response to the keyword not existing in the graph database, generating a first follow-up question according to the keyword that does not exist in the graph database, sending the first follow-up question to the user terminal for display, and saving the user conversation information as historical conversation information.
[0007] A user problem processing method provided by the present invention further includes: in response to the keyword existing in the graph database but being ambiguous, generating a second follow-up question according to the keyword that exists in the graph database but is ambiguous, sending the second follow-up question to the user terminal for display, and saving the user conversation information as historical conversation information.
[0008] A user problem processing method provided by the present invention, where the generating a problem to be processed in response to receiving user conversation information includes: in response to receiving user conversation information, obtaining historical conversation information; in response to the non-existence of the historical conversation information, generating the problem to be processed according to the user conversation information; in response to the existence of the historical conversation information, using a large language model to generate the problem to be processed according to the user conversation information and the historical conversation information.
[0009] A user problem processing method provided by the present invention further includes, before generating a problem to be processed in response to receiving user conversation information: obtaining entity data and schema data in the graph database, and constructing the word vector database based on the entity data and the schema data.
[0010] A user problem processing method provided by the present invention, where the generating a user problem reply according to the query result includes: integrating the user problem and the query result to generate the user problem reply.
[0011] The present invention also provides a user problem processing device, including the following modules: a problem to be processed generation module, configured to: in response to receiving user conversation information, generate a problem to be processed; a word segmentation processing module, configured to: perform word segmentation processing on the problem to be processed to obtain a word segmentation result; a preliminary matching result acquisition module, configured to: perform word vector matching on the word segments in the word segmentation result with a word vector database to obtain a preliminary matching result; wherein, the word vector database is constructed based on a graph database; an intermediate matching result acquisition module, configured to: input the problem to be processed, the word segmentation result, and the preliminary matching result into a large language model, and the large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and the graph database; wherein, the intermediate matching result includes keywords corresponding to the word segments and keyword attributes, and the keyword attributes include the positions of the keywords in the graph database; a pattern query processing module, configured to: traverse the keywords in the intermediate matching result, and in response to the keywords existing in the graph database and being unambiguous, based on the graph construction specification of the graph database, convert the intermediate matching result into a graph database query statement through pattern query; a graph database query module, configured to: query the graph database according to the graph database query statement to obtain a query result; a user problem reply generation module, configured to: generate a user problem reply according to the query result.
[0012] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the user problem processing method as described in any one of the above is implemented.
[0013] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the user problem processing method as described in any one of the above is implemented.
[0014] The present invention also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the user problem processing method as described in any one of the above is implemented.
[0015] The user problem processing method and device provided by the present invention generate a problem to be processed by responding to received user dialogue information, perform word segmentation on the problem to be processed to obtain a word segmentation result, perform word vector matching on the word segments in the word segmentation result with a word vector database to obtain a preliminary matching result, input the problem to be processed, the word segmentation result, and the preliminary matching result into a large language model. The large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and a graph database. Traverse the keywords in the intermediate matching result. In response to the keyword existing in the graph database and being unambiguous, based on the graph construction specification of the graph database, convert the intermediate matching result into a graph database query statement through pattern query, query the graph database according to the graph database query statement to obtain a query result, and generate a user problem reply based on the query result, improving the accuracy of the user problem reply. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0017] Figure 1 It is one of the flow diagrams of the user problem processing method provided by the present invention.
[0018] Figure 2 It is the second of the flow diagrams of the user problem processing method provided by the present invention.
[0019] Figure 3 It is the structural diagram of the user problem processing device provided by the present invention.
[0020] Figure 4 It is the structural diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] To make the objectives, technical solutions, and advantages of the present invention clearer, the following clearly and completely describes the technical solutions in the present invention with reference to the drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments in the present invention belong to the scope of protection of the present invention.
[0022] Figure 1 It is one of the flow diagrams of the user problem processing method provided by the present invention. As Figure 1 shown, the method includes the following steps:
[0023] Step S1: In response to receiving user dialogue information, generate a problem to be processed.
[0024] The user problem processing method provided by the present invention can be applied to a server. User dialogue information refers to the latest received information related to a user query. After the user problem processing device receives the user dialogue information, it generates a problem to be processed. Among them, the user dialogue information can be directly used as the problem to be processed, or the problem to be processed can be generated by processing the user dialogue information, such as format transformation, or the user dialogue information can be combined with other information to generate the problem to be processed.
[0025] Step S2: Perform word segmentation on the problem to be processed to obtain a word segmentation result.
[0026] Perform word segmentation on the problem to be processed to obtain a word segmentation result. Among them, the word segmentation result includes information about each word obtained by word segmentation. Various word segmentation tools can be used for word segmentation, such as the HANLP tool can be used for word segmentation.
[0027] For example, the problem to be processed is expressed as "How many female employees joined in 2023?"
[0028] The word segmentation result can be expressed as: ["2023", "joined", "female", "employee", "how", "many", "?"]
[0029] Step S3: Perform word vector matching between the words in the word segmentation result and a word vector database to obtain a preliminary matching result; wherein, the word vector database is constructed based on a graph database.
[0030] Most existing RAG query engines store knowledge data in a database after vector encoding, convert the query into a vector through sentence transformer to retrieve relevant context from the database, and use the query and the retrieved context to generate the final reply through LLM. This method is extremely dependent on the performance of the word vector model, and since the word vector conversion is implemented based on a deep learning framework, its implementation method is rather black-boxed and it is difficult to correct sentence meaning.
[0031] This application performs word vector matching between the words in the word segmentation result and a word vector database constructed based on a graph database to obtain a preliminary matching result. That is, the vector to be input into the large model is obtained by vector matching with a word vector database (such as an ES library) constructed based on a graph database, and the vector data to be input into the large model is obtained by matching the real vector database data, avoiding the black-boxed characteristics when the word vector model generates vector data and providing conditions for sentence meaning correction.
[0032] The matching result can be expressed as, for example:
[0033] {
[0034] "2023": ["2023", "year", ……],
[0035] "Onboarding": ["Onboarding", "status", ……],
[0036] "……"
[0037] }
[0038] Step S4: Input the problem to be processed, the word segmentation result, and the preliminary matching result into a large language model. The large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and the graph database. Among them, the intermediate matching result includes keywords corresponding to the word segmentation and keyword attributes, and the keyword attributes include the positions of the keywords in the graph database.
[0039] Use a large language model to correct the preliminary matching result to obtain an intermediate matching result. Among them, input the problem to be processed, the word segmentation result, and the preliminary matching result into the large language model, and the large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and the graph database.
[0040] An open-source large language model can be used to correct the preliminary matching result obtained by word vector matching to obtain an intermediate matching result. Examples can be input into the large language model in advance to guide the large language model to generate the intermediate matching result. Among them, the examples input into the large language model include input data examples and output data examples. The input data examples include examples of the problem to be processed, examples of word segmentation results, and examples of preliminary matching results. The output data examples include examples of intermediate matching results in a preset format. The intermediate matching result examples include keywords corresponding to the word segmentation in the word segmentation result examples and attributes of the keyword examples. The attributes of the keyword examples include the positions of the keyword examples in the graph database. The positions of the keyword examples in the graph database can be represented by the fields and tables to which the keyword examples belong in the graph database. For example, in the above preliminary matching result, "year" can be the field to which "2023" belongs.
[0041] In addition, in the examples given to the large language model, each token in the corresponding tokenization result example can have only one corresponding keyword. However, in the preliminary matching result, a single token may match multiple vectors. That is, when the large language model corrects the preliminary matching result to obtain the intermediate matching result, it can output a keyword information that best matches the user's question and the tokens in the tokenization result. Among them, the matching result corresponding to the token includes the keyword corresponding to the token and the keyword attribute. When the large language model is processing, it needs to refer to the external graph database to obtain the intermediate matching result.
[0042] Therefore, after obtaining the preliminary matching result, the problem to be processed, the tokenization result, and the preliminary matching result are input into the large language model. The large language model obtains the intermediate matching result in a preset format based on the problem to be processed, the tokenization result, the preliminary matching result, and the graph database; among them, the intermediate matching result includes the keyword corresponding to the token and the keyword attribute, and the keyword attribute includes the position of the keyword in the graph database. The position of the keyword in the graph database includes the field to which the keyword belongs and the table in which it is located.
[0043] Step S5: Traverse the keywords in the intermediate matching result. In response to the keyword existing in the graph database and being unambiguous, based on the graph construction specification of the graph database, convert the intermediate matching result into a graph database query statement through pattern query.
[0044] After all, the intermediate matching result output by the large language model is the result of computer processing, and it is necessary to confirm the correctness of the intermediate matching result output by the large language model. After there is no problem, the next step is carried out. Traverse the keywords in the intermediate matching result, obtain information on whether the keyword exists in the graph database and whether it is ambiguous. In response to the keyword existing in the graph database and being unambiguous, based on the graph construction specification of the graph database, convert the intermediate matching result into a graph database query statement through pattern query. Among them, the query rule can be constructed according to the graph construction specification of the graph database, and pattern query is performed according to the query rule. The graph database query statement can be a cyther query statement.
[0045] By ensuring that the next step is only executed when the keyword exists in the graph database and is unambiguous, it is guaranteed that the user question reply generation is carried out under the condition that the keyword is unambiguous, which is beneficial to improving the accuracy of the user question reply generation. Moreover, for a graph database that meets the graph construction specification, it can be used immediately, making the query function based on the graph database generalized and universal.
[0046] Step S6: Query the graph database according to the graph database query statement to obtain the query result.
[0047] By executing the graph database query statement, such as a cyther query statement, query the graph database to obtain the query result.
[0048] Step S7, generate a response to the user's question according to the query result.
[0049] Generate a response to the user's question according to the query result. For example, the query result can be directly used as the response to the user's question and returned to the user side, or the response to the user's question can be generated based on the query result and returned to the user side.
[0050] The user question processing method provided by the present invention includes: in response to receiving user conversation information, generating a question to be processed, performing word segmentation on the question to be processed to obtain a word segmentation result, performing word vector matching between the word segments in the word segmentation result and a word vector database to obtain a preliminary matching result, inputting the question to be processed, the word segmentation result, and the preliminary matching result into a large language model, the large language model obtaining an intermediate matching result in a preset format based on the question to be processed, the word segmentation result, the preliminary matching result, and a graph database, traversing the keywords in the intermediate matching result, in response to the keyword existing in the graph database and being unambiguous, based on the graph construction specification of the graph database, converting the intermediate matching result into a graph database query statement through pattern query, querying the graph database according to the graph database query statement to obtain a query result, and generating a response to the user's question according to the query result, thereby improving the accuracy of the response to the user's question.
[0051] According to a user question processing method provided by the present invention, before converting the intermediate matching result into a graph database query statement through pattern query based on the graph construction specification of the graph database, the method further includes: obtaining the correspondence between the keyword and the nodes in the graph database; if the keyword does not correspond to any node in the graph database, determining that the keyword does not exist in the graph database; if the keyword uniquely corresponds to a node in the graph database, determining that the keyword exists in the graph database and is unambiguous; if the keyword corresponds to at least two nodes in the graph database, determining that the keyword exists in the graph database but is ambiguous.
[0052] Before converting the intermediate matching result into a graph database query statement through pattern query based on the graph construction specification of the graph database, obtain information on whether the keyword exists in the graph database and whether it is ambiguous.
[0053] Obtaining information on whether the keyword exists in the graph database and whether it is ambiguous includes: obtaining the correspondence between the keyword and the nodes in the graph database; if the keyword does not correspond to any node in the graph database, determining that the keyword does not exist in the graph database; if the keyword uniquely corresponds to a node in the graph database, determining that the keyword exists in the graph database and is unambiguous; if the keyword corresponds to at least two nodes in the graph database, determining that the keyword exists in the graph database but is ambiguous.
[0054] The user problem processing method provided by the present invention obtains the correspondence between keywords and nodes in the graph database. If a keyword does not correspond to any node in the graph database, it is determined that the keyword does not exist in the graph database. If a keyword uniquely corresponds to a node in the graph database, it is determined that the keyword exists in the graph database and is unambiguous. If a keyword corresponds to at least two nodes in the graph database, it is determined that the keyword exists in the graph database but is ambiguous. Information about whether a keyword exists in the graph database and whether it is ambiguous is obtained, so as to perform different processing according to different situations of the keyword, further improving the accuracy of user problem replies.
[0055] According to a user problem processing method provided by the present invention, the method further includes: in response to the keyword not existing in the graph database, generating a first follow-up question according to the keyword that does not exist in the graph database, sending the first follow-up question to the user side for display, and saving the user conversation information as historical conversation information.
[0056] Most existing query engines do not perform multi-round conversations on ambiguous content to confirm information, but will guess the query intention by themselves and return results, resulting in the finally queried results may not fully meet expectations.
[0057] After the present invention obtains information about whether a keyword exists in the graph database and whether it is ambiguous, if the keyword does not exist in the graph database, a first follow-up question is generated according to the keyword that does not exist in the graph database. The first follow-up question is like "I don't know what you are talking about . Can you describe it again?" Among them, " " represents the word segmentation corresponding to the keyword that does not exist in the graph database. The first follow-up question is sent to the user side for display for the user to adjust and re-ask. At the same time, the user conversation information is saved as historical conversation information for subsequent reference.
[0058] If the user re-asks, the server receives new user conversation information again, and then the above processing process will be executed again. If there is still at least one keyword that does not exist in the graph database in the intermediate matching result obtained based on the new user conversation information, a first follow-up question will continue to be generated and returned to the user side to clarify the user problem through multi-round conversations.
[0059] The user problem processing method provided by the present invention, in response to the keyword not existing in the graph database, generates a first follow-up question according to the keyword that does not exist in the graph database, sends the first follow-up question to the user side for display, and saves the user conversation information as historical conversation information, clarifies the user problem through multi-round conversations, and further improves the accuracy of user problem replies.
[0060] A user problem processing method provided by the present invention, the method further includes: in response to the keyword existing in the graph database but being ambiguous, generating a second follow-up question according to the keyword existing in the graph database but being ambiguous, sending the second follow-up question to the user side for display, and saving the user conversation information as historical conversation information.
[0061] After the present invention obtains the information on whether the keyword exists in the graph database and whether it is ambiguous, if the keyword exists in the graph database but is ambiguous, for example, the keyword matches multiple nodes in the graph database, such as "Zhang San" exists in the employee field and also exists in the project leader field. Then, a second follow-up question is generated according to the keyword existing in the graph database but being ambiguous. The second follow-up question is, for example, "Do you mean Zhang San as the name of an employee or the project leader?" The second follow-up question is sent to the user side for display for the user to reply. At the same time, the user conversation information is saved as historical conversation information for subsequent reference.
[0062] If the user replies, and the server receives new user conversation information again, the above processing flow will be executed again. If there is still at least one keyword existing in the graph database but being ambiguous in the intermediate matching result obtained based on the new user conversation information, a second follow-up question will continue to be generated and sent back to the user side to clarify the user's problem through multiple rounds of conversation.
[0063] The user problem processing method provided by the present invention, by responding to the keyword existing in the graph database but being ambiguous, generating a second follow-up question according to the keyword existing in the graph database but being ambiguous, sending the second follow-up question to the user side for display, and saving the user conversation information as historical conversation information, clarifies the user's problem through multiple rounds of conversation, and further improves the accuracy of the user problem reply.
[0064] A user problem processing method provided by the present invention, the generating a problem to be processed in response to receiving user conversation information includes: in response to receiving user conversation information, obtaining historical conversation information; in response to the non-existence of the historical conversation information, generating the problem to be processed according to the user conversation information; in response to the existence of the historical conversation information, using a large language model to generate the problem to be processed according to the user conversation information and the historical conversation information.
[0065] When receiving user conversation information and generating a problem to be processed, confirm whether historical conversation information is stored. If there is no historical conversation information, generate the problem to be processed according to the currently received user conversation information. If there is historical conversation information, generate the problem to be processed according to the currently received user conversation information and the historical conversation information. Among them, the historical conversation information can be one or more.
[0066] When generating a problem to be processed based on the currently received user conversation information and historical conversation information, a large language model is used to generate the problem to be processed according to the user conversation information and historical conversation information. Among them, examples can be input into the large language model to guide the large language model to generate the problem to be processed according to the user conversation information and historical conversation information. The examples input into the large language model include input data examples and output data examples. The input data examples include user conversation information examples and historical conversation information examples, and the output data examples include examples of problems to be processed.
[0067] The large language model can refine an information-accurate and unambiguous problem to be processed based on the content of multi-round question and answer. It can be understood that only the historical conversation information related to the current user conversation information is meaningful for the generation of the problem to be processed. Therefore, after receiving the user's reply to the question, the historical conversation information can be deleted.
[0068] The user problem processing method provided by the present invention, by responding to the received user conversation information, obtaining historical conversation information, if there is no historical conversation information, generating a problem to be processed according to the user conversation information, if there is historical conversation information, using the large language model to generate a problem to be processed according to the user conversation information and historical conversation information, improves the accuracy of the problem to be processed, and thus further improves the accuracy of the user problem reply.
[0069] According to a user problem processing method provided by the present invention, before generating a problem to be processed in response to receiving user conversation information, the method further includes: obtaining entity data and schema data in the graph database, and constructing the word vector database based on the entity data and the schema data.
[0070] Before generating a problem to be processed in response to receiving user conversation information, it is necessary to establish a word vector database in advance. The present invention constructs a word vector database based on the graph database. Obtain entity data and schema data in the graph database, where the schema data includes information on field types, and construct a word vector database based on the entity data and schema data.
[0071] The user problem processing method provided by the present invention, by obtaining entity data and schema data in the graph database and constructing a word vector database before generating a problem to be processed in response to receiving user conversation information, ensures that the word vector database contains entity information and field information, providing a basis for vector matching using the word vector database and obtaining the matching result.
[0072] A method for processing user questions provided by the present invention, generating a user question reply according to the query result includes: integrating the user question and the query result to generate the user question reply.
[0073] When generating a user question reply according to the query result, the user question and the query result can be integrated to obtain the user question reply.
[0074] Among them, the summarization ability of the large language model can be utilized to integrate the user question and the query result through the large language model to obtain the user question reply. Examples can be input to the large language model in advance to guide the large language model to generate the user question reply. Among them, the examples input to the large language model include input data examples and output data examples. The input data examples include user question examples and query result examples, and the output data examples include user question reply examples.
[0075] The method for processing user questions provided by the present invention generates a user question reply by integrating the user question and the query result, improving the comprehensiveness of the information in the user question reply and enhancing the user experience.
[0076] Figure 2 It is the second flow schematic diagram of the method for processing user questions provided by the present invention. As Figure 2 shown, the method includes:
[0077] Generating a problem to be processed according to the user conversation information and the historical conversation information;
[0078] Performing word segmentation processing on the problem to be processed to obtain a word segmentation result;
[0079] Performing word vector matching on each word in the word segmentation result with an ES word vector database constructed based on a graph database to obtain a preliminary matching result;
[0080] Inputting the problem to be processed, the word segmentation result, and the preliminary matching result into a large language model, and the large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and the graph database;
[0081] Traversing the keywords in the intermediate matching result, and in response to the keyword existing in the graph database and being unambiguous, converting the intermediate matching result into a graph database query statement through pattern query based on the graph construction specification of the graph database;
[0082] Querying the graph database according to the graph database query statement to obtain a query result;
[0083] Generating a user question reply according to the query result and returning the user question reply.
[0084] In addition, if it is known through traversing the keywords in the intermediate matching results that the keyword does not exist in the graph database, a first follow-up question is generated based on the keyword that does not exist in the graph database, the first follow-up question is sent to the user side for display, and the user conversation information is saved as historical conversation information.
[0085] If it is known through traversing the keywords in the intermediate matching results that the keyword exists in the graph database but is ambiguous, a second follow-up question is generated based on the keyword that exists in the graph database but is ambiguous, the second follow-up question is sent to the user side for display, and the user conversation information is saved as historical conversation information.
[0086] The user problem processing method provided by the present invention provides a general method for performing efficient knowledge matching on any graph database that meets certain graph construction specification requirements, thereby realizing the generality of the query scheme. By quickly and accurately discovering the doubts in the query requirements and confirming the query intention and content in the form of multiple rounds of conversations, combined with an efficient knowledge matching method to complete knowledge extraction, and further performing a pattern query based on the objectively existing formatted knowledge information extracted, so as to realize the function of one-graph general query related to the query problem. This application is based on the rapid positioning of uncertain information and a counter-question clarification mechanism according to the problem situation, so as to ensure the authenticity of the query results. At the same time, for graph databases that meet the graph construction specifications, they can be used immediately, making the query function based on the graph database generalized and universal.
[0087] The user problem processing device provided by the present invention will be described below. The user problem processing device described below can be mutually corresponding and referred to the user problem processing method described above.
[0088] Figure 3 is a structural schematic diagram of the user problem processing device provided by the present invention. As Figure 3As shown in the figure, the device includes a problem to be processed generation module 10, a word segmentation processing module 20, a preliminary matching result acquisition module 30, an intermediate matching result acquisition module 40, a pattern query processing module 50, a graph database query module 60, and a user question reply generation module 70, where: The problem to be processed generation module 10 is used to: in response to receiving user dialogue information, generate a problem to be processed; The word segmentation processing module 20 is used to: perform word segmentation processing on the problem to be processed to obtain a word segmentation result; The preliminary matching result acquisition module 30 is used to: perform word vector matching on the words in the word segmentation result with a word vector database to obtain a preliminary matching result; where, the word vector database is constructed based on a graph database; The intermediate matching result acquisition module 40 is used to: input the problem to be processed, the word segmentation result, and the preliminary matching result into a large language model, and the large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and the graph database; where, the intermediate matching result includes keywords corresponding to the word segmentation and keyword attributes, and the keyword attributes include the positions of the keywords in the graph database; The pattern query processing module 50 is used to: traverse the keywords in the intermediate matching result, and in response to the keywords existing in the graph database and being unambiguous, based on the graph construction specification of the graph database, convert the intermediate matching result into a graph database query statement through pattern query; The graph database query module 60 is used to: query the graph database according to the graph database query statement to obtain a query result; The user question reply generation module 70 is used to: generate a user question reply according to the query result.
[0089] The user question processing device provided by the present invention, by responding to receiving user dialogue information, generating a problem to be processed, performing word segmentation processing on the problem to be processed to obtain a word segmentation result, performing word vector matching on the words in the word segmentation result with a word vector database to obtain a preliminary matching result, inputting the problem to be processed, the word segmentation result, and the preliminary matching result into a large language model, the large language model obtaining an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and the graph database, traversing the keywords in the intermediate matching result, and in response to the keywords existing in the graph database and being unambiguous, based on the graph construction specification of the graph database, converting the intermediate matching result into a graph database query statement through pattern query, querying the graph database according to the graph database query statement to obtain a query result, and generating a user question reply according to the query result, improves the accuracy of the user question reply.
[0090] Figure 4 Illustrates a schematic physical structure diagram of an electronic device, such as Figure 4As shown, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communication bus 440. Among them, the processor 410, the communications interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call the logical instructions in the memory 430 to execute the user problem processing method, which includes: generating a problem to be processed in response to receiving user dialogue information; performing word segmentation processing on the problem to be processed to obtain a word segmentation result; performing word vector matching between the word segments in the word segmentation result and a word vector database to obtain a preliminary matching result; where the word vector database is constructed based on a graph database; inputting the problem to be processed, the word segmentation result, and the preliminary matching result into a large language model, and the large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and the graph database; where the intermediate matching result includes keywords corresponding to the word segments and keyword attributes, and the keyword attributes include the positions of the keywords in the graph database; traversing the keywords in the intermediate matching result, and in response to the keyword existing in the graph database and being unambiguous, converting the intermediate matching result into a graph database query statement through pattern query based on the graph construction specification of the graph database; querying the graph database according to the graph database query statement to obtain a query result; generating a reply to the user problem according to the query result.
[0091] In addition, when the logical instructions in the above-mentioned memory 430 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0092] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the user problem processing method provided by each of the above methods. The method includes: generating a problem to be processed in response to receiving user dialogue information; performing word segmentation processing on the problem to be processed to obtain a word segmentation result; performing word vector matching between the words in the word segmentation result and a word vector database to obtain a preliminary matching result; wherein, the word vector database is constructed based on a graph database; inputting the problem to be processed, the word segmentation result, and the preliminary matching result into a large language model, and the large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and the graph database; wherein, the intermediate matching result includes keywords corresponding to the word segmentation and keyword attributes, and the keyword attributes include the positions of the keywords in the graph database; traversing the keywords in the intermediate matching result, and in response to the keyword existing in the graph database and being unambiguous, converting the intermediate matching result into a graph database query statement through pattern query based on the graph construction specification of the graph database; querying the graph database according to the graph database query statement to obtain a query result; and generating a user problem reply according to the query result.
[0093] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is configured to execute the user problem processing method provided by each of the above methods. The method includes: generating a problem to be processed in response to receiving user dialogue information; performing word segmentation processing on the problem to be processed to obtain a word segmentation result; performing word vector matching between the words in the word segmentation result and a word vector database to obtain a preliminary matching result; wherein, the word vector database is constructed based on a graph database; inputting the problem to be processed, the word segmentation result, and the preliminary matching result into a large language model, and the large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result, and the graph database; wherein, the intermediate matching result includes keywords corresponding to the word segmentation and keyword attributes, and the keyword attributes include the positions of the keywords in the graph database; traversing the keywords in the intermediate matching result, and in response to the keyword existing in the graph database and being unambiguous, converting the intermediate matching result into a graph database query statement through pattern query based on the graph construction specification of the graph database; querying the graph database according to the graph database query statement to obtain a query result; and generating a user problem reply according to the query result.
[0094] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative work.
[0095] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for handling user problems, characterized in that: include: In response to receiving user dialogue information, generating a pending question; Perform word segmentation on the problem to be processed to obtain a word segmentation result; Performing word vector matching on the word segmentation results and the word vector database to obtain a preliminary matching result; wherein the word vector database is constructed based on a graph database; The problem to be processed, the word segmentation result and the preliminary matching result are input into a large language model, and the large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result and the graph database; wherein the intermediate matching result includes a keyword and a keyword attribute that best matches the word segmentation, the keyword attribute includes the position of the keyword in the graph database, and the position of the keyword in the graph database includes the field to which the keyword belongs and the table in which it is located; Traversing the keywords in the intermediate matching results, and in response to the keywords existing in the graph database and being unambiguous, converting the intermediate matching results into graph database query statements through pattern query based on the graph construction specification of the graph database; Query the graph database according to the graph database query statement to obtain a query result; Generate a user question response based on the query result.
2. The method for handling user problems according to claim 1, characterized in that: Before converting the intermediate matching result into a graph database query statement through a pattern query based on the graph construction specification of the graph database, the method further includes: Obtaining the corresponding relationship between the keyword and the node in the graph database; If the keyword does not correspond to any node in the graph database, it is determined that the keyword does not exist in the graph database; If the keyword uniquely corresponds to a node in the graph database, it is determined that the keyword exists in the graph database and is unambiguous; If the keyword corresponds to at least two nodes in the graph database, it is determined that the keyword exists in the graph database but is ambiguous.
3. The user problem handling method according to claim 1, characterized in that: The method further comprises: In response to the keyword not existing in the graph database, a first follow-up question is generated according to the keyword not existing in the graph database, the first follow-up question is sent to the user end for display, and the user dialogue information is saved as historical dialogue information.
4. The method for handling user problems according to claim 1, characterized in that: The method further comprises: In response to the keyword existing in the graph database but being ambiguous, a second follow-up question is generated based on the keyword existing in the graph database but being ambiguous, the second follow-up question is sent to the user end for display, and the user dialogue information is saved as historical dialogue information.
5. The method for handling user problems according to claim 3 or 4, characterized in that: The step of generating a pending question in response to receiving the user dialogue information includes: In response to receiving user conversation information, acquiring historical conversation information; In response to the absence of the historical conversation information, generating the pending question according to the user conversation information; In response to the existence of the historical dialogue information, the question to be processed is generated according to the user dialogue information and the historical dialogue information using a large language model.
6. The method for handling user problems according to claim 1, characterized in that: Before generating a pending question in response to receiving user dialogue information, the method further includes: The entity data and the schema data in the graph database are obtained, and the word vector database is constructed based on the entity data and the schema data.
7. The method for handling user problems according to claim 1, characterized in that: Generating a user question reply according to the query result includes: The user question and the query result are integrated to generate a response to the user question.
8. A user problem handling device, characterized in that: include: A pending question generation module, used to: generate pending questions in response to receiving user dialogue information; A word segmentation processing module is used to: perform word segmentation processing on the problem to be processed to obtain a word segmentation result; A preliminary matching result acquisition module is used to: match the word vectors of the word segmentation results with the word vector database to obtain a preliminary matching result; wherein the word vector database is constructed based on a graph database; An intermediate matching result acquisition module is used to: input the problem to be processed, the word segmentation result and the preliminary matching result into a large language model, and the large language model obtains an intermediate matching result in a preset format based on the problem to be processed, the word segmentation result, the preliminary matching result and the graph database; wherein the intermediate matching result includes a keyword and a keyword attribute that best matches the word segmentation, the keyword attribute includes the position of the keyword in the graph database, and the position of the keyword in the graph database includes the field to which the keyword belongs and the table in which it is located; A pattern query processing module, configured to: traverse the keywords in the intermediate matching results, and in response to the keywords existing in the graph database and being unambiguous, convert the intermediate matching results into graph database query statements through pattern query based on the graph construction specification of the graph database; A graph database query module, used to: query the graph database according to the graph database query statement to obtain a query result; The user question reply generation module is used to generate a user question reply according to the query result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method for handling user problems as described in any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for handling user problems as described in any one of claims 1 to 7 is implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for handling user problems as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Interactive electronic manual data conversion system
CN118069905A
Database retrieval system using natural language for presenting understood components of an ambiguous query on a user interface
US5454106A