User question processing method and device
By using graph database and large language model in the user problem processing system, processing user dialogue information and generating accurate user problem responses, the problem of low accuracy of user problem responses 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
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-13
- Publication Date
- 2025-03-14
- 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 is performed. 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, query and generate user question responses.
Improve the accuracy of user question responses, clarify user questions through multiple rounds of dialogue, and ensure the authenticity and accuracy of query results.
Smart Images

Figure CN119623485A_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 handling user problems. Background Art
[0002] Most of the current mainstream RAG (retrieval-augmented generation) query engines vectorize knowledge data and store them in a database, convert queries into vectors, retrieve relevant context from the database, and use the query and retrieved context to generate the final response through a large language model (LLM). The responses generated in this way are less accurate and often fail to meet expectations. Summary of the invention
[0003] The present invention provides a user question processing method and device, which are used to solve the defect of poor accuracy of user question replies in the prior art and improve the accuracy of user question replies.
[0004] The present invention provides a method for processing user questions, comprising the following steps: generating a question to be processed in response to receiving user dialogue information; performing word segmentation processing on the question to be processed to obtain a word segmentation result; performing word vector matching on 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 obtains 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 and keyword attributes corresponding to the word segmentation, and the keyword attribute includes the position of the keyword 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 a pattern query based on a graph database construction specification; 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.
[0005] According to a user problem processing method provided by the present invention, before the intermediate matching result is converted into a graph database query statement through a pattern query based on the graph construction specification of the graph database, the method also includes: obtaining the correspondence between the keyword and the node 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] According to a user question processing method provided by the present invention, the method also includes: in response to the keyword not existing in the graph database, generating a first follow-up question based on the keyword not existing in the graph database, sending the first follow-up question to the user end for display, and saving the user conversation information as historical conversation information.
[0007] According to a user question processing method provided by the present invention, the method also includes: in response to the keyword existing in the graph database but being ambiguous, generating a second follow-up question based on the keyword existing in the graph database but being ambiguous, sending the second follow-up question to the user end for display, and saving the user conversation information as historical conversation information.
[0008] According to a user problem processing method provided by the present invention, in response to receiving user dialogue information, generating a problem to be processed includes: in response to receiving user dialogue information, obtaining historical dialogue information; in response to the absence of the historical dialogue information, generating the problem to be processed based on the user dialogue information; in response to the existence of the historical dialogue information, using a large language model to generate the problem to be processed based on the user dialogue information and the historical dialogue information.
[0009] According to a user question processing method provided by the present invention, before generating a question to be processed in response to receiving user dialogue information, the method also 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.
[0010] According to a user question processing method provided by the present invention, generating a user question reply based on the query result includes: integrating the user question and the query result to generate the user question reply.
[0011] The present invention also provides a user question processing device, comprising the following modules: a to-be-processed question generation module, used to: generate a to-be-processed question in response to receiving user dialogue information; a word segmentation processing module, used to: perform word segmentation processing on the to-be-processed question to obtain a word segmentation result; a preliminary matching result acquisition module, used to: perform word vector matching on 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, used to: input the to-be-processed question, the word segmentation result and the preliminary matching result into a large language model, wherein the large language model is based on the to-be-processed question, the word segmentation result, the preliminary matching result and The graph database obtains an intermediate matching result in a preset format; wherein the intermediate matching result includes keywords and keyword attributes corresponding to the word segmentation, and the keyword attributes include the position of the keyword in the graph database; a pattern query processing module 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, convert the intermediate matching result into a graph database query statement through a pattern query based on the graph construction specification of the graph database; a graph database query module is used to: query the graph database according to the graph database query statement to obtain a query result; a user question response generation module is used to: generate a user question response based on the query result.
[0012] The present invention also provides 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, any of the user problem processing methods described above is implemented.
[0013] 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, the user problem processing method described in any one of the above is implemented.
[0014] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the user problem processing methods described above.
[0015] The user question processing method and device provided by the present invention generate a pending question in response to receiving user dialogue information, perform word segmentation processing on the pending question to obtain a word segmentation result, perform word vector matching on the word segmentation result and a word vector database to obtain a preliminary matching result, input the pending question, 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 pending question, the word segmentation result, the preliminary matching result and the graph database, traverses the keywords in the intermediate matching result, responds to the keyword existing in the graph database and is unambiguous, based on the graph database construction specification, converts the intermediate matching result into a graph database query statement through a pattern query, queries the graph database according to the graph database query statement to obtain a query result, generates a user question reply according to the query result, and improves the accuracy of the user question 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 embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 This is one of the flow charts of the user problem handling method provided by the present invention.
[0018] Figure 2 This is the second flow chart of the user problem handling method provided by the present invention.
[0019] Figure 3 It is a structural schematic diagram of the user problem processing device provided by the present invention.
[0020] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] Figure 1 This is one of the flow charts of the method for handling user problems provided by the present invention, such as Figure 1 As shown, the method comprises the following steps: Step S1: In response to receiving user dialogue information, generate a problem to be processed.
[0023] The user question processing method provided by the present invention can be applied to the server. User dialogue information refers to the latest received user query related information. After receiving the user dialogue information, the user question processing device generates a pending question. Among them, the user dialogue information can be directly used as the pending question, or the user dialogue information can be processed, such as format conversion, to generate the pending question, or the user dialogue information can be combined with other information to generate the pending question.
[0024] Step S2: perform word segmentation on the problem to be processed to obtain a word segmentation result.
[0025] The problem to be processed is segmented to obtain a segmentation result. The segmentation result includes information of each segmentation obtained by the segmentation. Various segmentation tools can be used for segmentation, such as the HANLP tool.
[0026] For example, the problem to be addressed is expressed as “How many female employees will be employed in 2023?” The word segmentation result can be expressed as: [″2023″, ″joining employment″, ″female″, ″employee″, ″there are″, ″how many″, ″?”].
[0027] Step S3: perform 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.
[0028] Most existing RAG query engines encode knowledge data into vectors and store them in a database. They convert queries into vectors through a sentence transformer, retrieve relevant context from the database, and use the query and retrieved context to generate the final reply through LLM. This method is extremely dependent on the performance of the word vector model, and because word vector conversion is based on a deep learning framework, its implementation is relatively black-box, making it difficult to correct sentence meaning.
[0029] This application matches the word vectors of the word segmentation results with the word vector database built based on the graph database to obtain a preliminary matching result. That is, the vector to be input into the large model is obtained by matching the vector with the word vector database built based on the graph database (such as the ES library), and the vector data to be input into the large model is obtained by matching the real vector library data, which avoids the black-box characteristic of the word vector model when generating vector data, and provides conditions for sentence meaning correction.
[0030] The matching result can be expressed as: { ″2023″: [″2023″, ″year″, …], ″Job Entry″: [″Job Entry″, ″status″,……], ″…″ } Step S4: 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 and keyword attributes corresponding to the word segmentation, and the keyword attributes include the position of the keyword in the graph database.
[0031] The large language model is used to correct the preliminary matching results to obtain intermediate matching results. The problem to be processed, the word segmentation results and the preliminary matching results are input into the large language model, and the large language model obtains the intermediate matching results in a preset format based on the problem to be processed, the word segmentation results, the preliminary matching results and the graph database.
[0032] An open source large language model can be used to correct the preliminary matching results obtained by word vector matching, and then obtain intermediate matching results. Samples can be input to the large language model in advance to guide the large language model to generate intermediate matching results. Among them, the samples input to the large language model include input data samples and output data samples, the input data samples include problem samples to be processed, word segmentation result samples and preliminary matching result samples, the output data samples include intermediate matching result samples in a preset format, the intermediate matching result samples include keyword samples corresponding to the word segmentation in the word segmentation result sample and the attributes of the keyword samples, and the attributes of the keyword samples include the position of the keyword samples in the graph database. The position of the keyword sample in the graph database can be represented by the fields and tables to which the keyword sample belongs in the graph database. For example, in the above preliminary matching results, "year" can be the field to which "2023" belongs.
[0033] In addition, in the samples given to the large language model, each word segmentation in the corresponding word segmentation result sample may have only one corresponding keyword. However, a word segmentation in the preliminary matching result 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 question and the word segmentation result. Among them, the matching result corresponding to the word segmentation includes the keyword and keyword attributes corresponding to the word segmentation. When the large language model is processing, it needs to refer to the external graph database to obtain the intermediate matching result.
[0034] Therefore, after obtaining the preliminary matching results, the problem to be processed, the word segmentation results and the preliminary matching results are input into the large language model, and the large language model obtains the intermediate matching results in a preset format based on the problem to be processed, the word segmentation results, the preliminary matching results and the graph database; wherein the intermediate matching results include the keywords and keyword attributes corresponding to the word segmentation, and the keyword attributes include the location of the keyword in the graph database. The location of the keyword in the graph database includes the field to which the keyword belongs and the table in which it is located.
[0035] Step S5, 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.
[0036] After all, the intermediate matching results output by the large language model are the results of computer processing, and the correctness of the intermediate matching results output by the large language model needs to be confirmed. If there is no problem, proceed to the next step. Traverse the keywords in the intermediate matching results, obtain information on whether the keywords exist in the graph database and whether there is ambiguity, 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 queries based on the graph database construction specifications. Among them, query rules can be constructed according to the graph database construction specifications, and pattern queries can be performed according to the query rules. The graph database query statement can be a cyther query statement.
[0037] By confirming that the keyword exists in the graph database and is unambiguous before executing the next step, it ensures that the user question response is generated when the keyword is unambiguous, which is conducive to improving the accuracy of user question response generation. In addition, for graph databases that meet the graph construction specifications, it can be used immediately, making the query function based on the graph database generalized and universal.
[0038] Step S6: query the graph database according to the graph database query statement to obtain query results.
[0039] By executing graph database query statements, such as cyther query statements, the graph database is queried to obtain query results.
[0040] Step S7: Generate a response to the user's question based on the query result.
[0041] Generate a user question reply based on the query result. For example, the query result can be directly used as the user question reply and returned to the user end, or the user question reply can be generated based on the query result and returned to the user end.
[0042] The user question processing method provided by the present invention generates a pending question in response to receiving user dialogue information, performs word segmentation processing on the pending question to obtain a word segmentation result, performs word vector matching on the word segmentation result and a word vector database to obtain a preliminary matching result, inputs the pending question, 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 pending question, the word segmentation result, the preliminary matching result and the graph database, traverses the keywords in the intermediate matching result, and in response to the keywords existing in the graph database and being unambiguous, converts the intermediate matching result into a graph database query statement through a pattern query based on a graph database construction specification, queries the graph database according to the graph database query statement to obtain a query result, generates a user question reply according to the query result, and improves the accuracy of the user question reply.
[0043] According to a user problem processing method provided by the present invention, before the intermediate matching result is converted into a graph database query statement through a pattern query based on the graph construction specification of the graph database, the method also includes: obtaining the correspondence between the keyword and the node 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.
[0044] Based on the graph database construction specification, before converting the intermediate matching results into graph database query statements through pattern query, obtain information on whether the keywords exist in the graph database and whether there is ambiguity.
[0045] Obtaining information on whether the keyword exists in the graph database and whether it is ambiguous, including: 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 the 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.
[0046] The user question processing method provided by the present invention obtains the correspondence between keywords and nodes 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 the 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. This realizes the acquisition of information on whether the keyword exists in the graph database and whether it is ambiguous, so that different processing can be performed according to different situations of the keyword, further improving the accuracy of the response to user questions.
[0047] According to a user question processing method provided by the present invention, the method also includes: in response to the keyword not existing in the graph database, generating a first follow-up question based on the keyword not existing in the graph database, sending the first follow-up question to the user end for display, and saving the user conversation information as historical conversation information.
[0048] Most existing query engines do not conduct multiple rounds of dialogue on ambiguous content to confirm information, but instead guess the query intent and return the results on their own, resulting in the final query results not being completely in line with expectations.
[0049] After obtaining information about whether the 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, for example, "I don't know what you are saying. What is it? Can you describe it again? "Among them, " " indicates the word segment corresponding to the keyword that does not exist in the graph database. The first follow-up question is sent to the user end for display, so that the user can adjust and ask the question again. At the same time, the user dialogue information is saved as historical dialogue information for subsequent reference.
[0050] If the user asks the question again, the server will receive new user dialogue information and re-execute the above process. If there is still at least one keyword that does not exist in the graph database in the intermediate matching results obtained based on the new user dialogue information, the first follow-up question will be generated and returned to the user to clarify the user's question through multiple rounds of dialogue.
[0051] The user question processing method provided by the present invention, in response to the keyword not existing in the graph database, generates a first follow-up question based on the keyword not existing in the graph database, sends the first follow-up question to the user end for display, and saves the user conversation information as historical conversation information, clarifies the user question through multiple rounds of conversations, and further improves the accuracy of responding to user questions.
[0052] According to a user question processing method provided by the present invention, the method also includes: in response to the keyword existing in the graph database but being ambiguous, generating a second follow-up question based on the keyword existing in the graph database but being ambiguous, sending the second follow-up question to the user end for display, and saving the user conversation information as historical conversation information.
[0053] After obtaining information on whether the keyword exists in the graph database and whether it is ambiguous, the present invention generates a second follow-up question based on the keyword that exists in the graph database but is ambiguous, such as the keyword matches multiple nodes in the graph database, such as "Zhang San" exists in the employee field and "Zhang San" exists in the project leader field. The second follow-up question is such as "Are you talking about Zhang San, the name of the employee or the person in charge of the project?" The second follow-up question is sent to the user end for display, so that the user can reply. At the same time, the user dialogue information is saved as historical dialogue information for subsequent reference.
[0054] If the user replies, the server will receive new user dialogue information again and re-execute the above process. If there is still at least one ambiguous keyword in the graph database in the intermediate matching results obtained based on the new user dialogue information, the second follow-up question will be generated and returned to the user to clarify the user's question through multiple rounds of dialogue.
[0055] The user question processing method provided by the present invention, in response to the existence of ambiguous keywords in the graph database, generates a second follow-up question based on the ambiguous keywords that exist in the graph database, sends the second follow-up question to the user end for display, and saves the user conversation information as historical conversation information, clarifies the user question through multiple rounds of conversations, and further improves the accuracy of the user question response.
[0056] According to a user problem processing method provided by the present invention, in response to receiving user dialogue information, generating a problem to be processed includes: in response to receiving user dialogue information, obtaining historical dialogue information; in response to the absence of the historical dialogue information, generating the problem to be processed based on the user dialogue information; in response to the existence of the historical dialogue information, using a large language model to generate the problem to be processed based on the user dialogue information and the historical dialogue information.
[0057] When receiving user conversation information and generating pending questions, confirm whether historical conversation information is stored. If historical conversation information does not exist, generate pending questions based on the currently received user conversation information. If historical conversation information exists, generate pending questions based on the currently received user conversation information and historical conversation information. The historical conversation information may be one or more pieces.
[0058] When generating pending questions based on currently received user dialogue information and historical dialogue information, the large language model is used to generate pending questions based on the user dialogue information and historical dialogue information. Samples may be input to the large language model to guide the large language model to generate pending questions based on the user dialogue information and historical conversation information. The samples input to the large language model include input data samples and output data samples, the input data samples include user dialogue information samples and historical dialogue information samples, and the output data samples include pending question samples.
[0059] The large language model can refine a question to be processed that is accurate and unambiguous based on the content of multiple rounds of questions and answers. It is understandable that only the historical conversation information related to the current user conversation information is meaningful for the generation of the question to be processed. Therefore, after getting the user's reply to the question, the historical conversation information can be deleted.
[0060] The user question processing method provided by the present invention obtains historical conversation information in response to receiving user conversation information, generates a pending question based on the user conversation information in response to the absence of historical conversation information, and generates a pending question based on the user conversation information and the historical conversation information using a large language model in response to the existence of historical conversation information, thereby improving the accuracy of the pending question and further improving the accuracy of the user question response.
[0061] According to a user question processing method provided by the present invention, before generating a question to be processed in response to receiving user dialogue information, the method also 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.
[0062] In response to receiving user dialogue information, before generating the problem to be processed, a word vector database needs to be established in advance. The present invention builds a word vector database based on a graph database. Entity data and schema data in the graph database are obtained, wherein the schema data includes information of field types, and a word vector database is built based on the entity data and schema data.
[0063] The user problem processing method provided by the present invention obtains entity data and schema data in a graph database before generating a problem to be processed in response to receiving user dialogue information, and constructs a word vector database based on the entity data and schema data, thereby ensuring that the word vector database contains entity information and field information, and providing a basis for using the word vector database to perform vector matching and obtain matching results.
[0064] According to a user question processing method provided by the present invention, generating a user question reply based on the query result includes: integrating the user question and the query result to generate the user question reply.
[0065] When generating a user question reply based on the query result, the user question and the query result may be integrated to obtain the user question reply.
[0066] The large language model can be used to organize and summarize user questions and query results through the large language model to obtain responses to user questions. Samples can be input to the large language model in advance to guide the large language model to generate responses to user questions. The samples input to the large language model include input data samples and output data samples. The input data samples include user question samples and query result samples, and the output data samples include user question response samples.
[0067] The user question processing method provided by the present invention generates user question replies by integrating user questions and query results, thereby improving the comprehensiveness of information in the user question replies and improving user experience.
[0068] Figure 2 This is the second flow chart of the method for handling user problems provided by the present invention. Figure 2 As shown, the method includes: Generate pending questions based on user conversation information and historical conversation information; Perform word segmentation on the problem to be processed to obtain the word segmentation result; Each word in the word segmentation result is matched with the ES word vector database built based on the graph database to obtain a preliminary matching result; The problem to be processed, the word segmentation result and the preliminary matching result are input into the large language model, and the large language model obtains the 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; 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 database construction specification; Query the graph database according to the graph database query statement to obtain the query result; Generate user question responses based on the query results and return the user question responses.
[0069] In addition, if it is found that the keyword does not exist in the graph database by traversing the keywords in the intermediate matching results, 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 end for display, and the user conversation information is saved as historical conversation information.
[0070] If it is found through traversing the keywords in the intermediate matching results that the keywords exist in the graph database but are ambiguous, a second follow-up question is generated based on the keywords that exist in the graph database but are ambiguous, the second follow-up question is sent to the user end for display, and the user conversation information is saved as historical conversation information.
[0071] The user problem handling method provided by the present invention provides a universal method for performing efficient knowledge matching on any graph database that meets certain map construction specifications, thereby achieving universality of the query solution. By quickly and accurately discovering the doubt points in the query requirements and confirming the query intent and content in the form of multiple rounds of dialogue, combining efficient knowledge matching methods to complete knowledge extraction, and further executing pattern queries based on the extracted objective and real formatted knowledge information, the function of one-picture query related to the query problem is realized. This application is based on the rapid positioning of uncertain information and a counter-question clarification mechanism based on the problem situation, so that the authenticity of the query results is guaranteed. At the same time, for graph databases that meet the map construction specifications, it can be used out of the box, making the query function based on the graph database generalized and universal.
[0072] The user problem handling device provided by the present invention is described below. The user problem handling device described below and the user problem handling method described above can be referenced to each other.
[0073] Figure 3 Schematic diagram of the structure of the user problem handling device provided by the present invention. Figure 3As shown, the device includes a pending question 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, wherein: the pending question generation module 10 is used to: generate a pending question in response to receiving user dialogue information; the word segmentation processing module 20 is used to: perform word segmentation processing on the pending question to obtain a word segmentation result; the preliminary matching result acquisition module 30 is used to: perform word vector matching on the word segmentation result with the word vector database to obtain a preliminary matching result; wherein the word vector database is constructed based on the graph database; the intermediate matching result acquisition module 40 is used to: input the pending question, the word segmentation result and the preliminary matching result into a large language model type, 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 and keyword attributes corresponding to the word segmentation, and the keyword attributes include the position of the keyword 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 a 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 response generation module 70 is used to: generate a user question response according to the query result.
[0074] The user question processing device provided by the present invention generates a pending question in response to receiving user dialogue information, performs word segmentation processing on the pending question to obtain a word segmentation result, performs word vector matching on the word segmentation result and a word vector database to obtain a preliminary matching result, inputs the pending question, 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 pending question, the word segmentation result, the preliminary matching result and the graph database, traverses the keywords in the intermediate matching result, and in response to the keywords existing in the graph database and being unambiguous, converts the intermediate matching result into a graph database query statement through a pattern query based on a graph database construction specification, queries the graph database according to the graph database query statement to obtain a query result, generates a user question reply according to the query result, and improves the accuracy of the user question reply.
[0075] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4As shown, the electronic device may include: a processor (processor) 410 , a communication interface (Communications Interface) 420 , a memory (memory) 430 and a communication bus 440 , wherein the processor 410 , the communication interface 420 , and the memory 430 communicate with each other through the communication bus 440 . The processor 410 can call the logic instructions in the memory 430 to execute the user question processing method, which includes: in response 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; matching the word segmentation in the word segmentation result with the 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 and keyword attributes corresponding to the word segmentation, and the keyword attribute includes the position of the keyword 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 a pattern query based on the graph database construction specification; 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.
[0076] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0077] 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 the above methods, which 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; matching the word segmentation 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; inputting the problem to be processed, the word segmentation result and the preliminary matching result into a large language model; type, 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 and keyword attributes corresponding to the word segmentation, and the keyword attribute includes the position of the keyword in the graph database; traverses the keywords in the intermediate matching result, and in response to the keywords existing in the graph database and being unambiguous, converts the intermediate matching result into a graph database query statement through a pattern query based on the graph database construction specification; queries the graph database according to the graph database query statement to obtain a query result; and generates a user question reply according to the query result.
[0078] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the user question processing method provided by the above methods, the method comprising: generating a question to be processed in response to receiving user dialogue information; performing word segmentation processing on the question to be processed to obtain a word segmentation result; performing word vector matching on 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 is based on the question to be processed. Processing the question, the word segmentation result, the preliminary matching result and the graph database to obtain an intermediate matching result in a preset format; wherein the intermediate matching result includes keywords and keyword attributes corresponding to the word segmentation, and the keyword attributes include the position of the keyword in the 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 a pattern query; querying the graph database according to the graph database query statement to obtain a query result; generating a user question reply according to the query result.
[0079] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0080] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0081] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions 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 keywords and keyword attributes corresponding to the word segmentation, the keyword attributes include 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; A user question response is generated according to 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 user problem handling method 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 keywords and keyword attributes corresponding to the word segmentation, the keyword attributes include 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 claimed 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 claimed in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Intelligent question and answer implementation method and system based on large model and semantic map
CN117271724A
Knowledge question-answering method and device, equipment and storage medium
CN117828057A
Interactive electronic manual data conversion system
CN118069905A
Graph database query method and device based on large language model and graph structure
CN118093632A
Information matching method and system based on large language model
CN118484510A