Question and answer method and device, storage medium and terminal

By combining user ID and Q&A historical data, using correlation discriminant model and dynamic similarity algorithm, the problem of insufficient response efficiency and accuracy of existing Q&A systems in multiple rounds of conversations and large-scale knowledge bases is solved, achieving a more coherent and Accurate Q&A effect.

CN119069119AInactive Publication Date: 2024-12-03CHANGSHU INSTITUTE OF TECHNOLOGY
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411565998.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2024-12-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing Q&A systems are difficult to capture the user's problem context and context when dealing with complex multi-round dialogue and large-scale knowledge bases, and the single similarity algorithm has limitations in computing performance and accuracy, resulting in insufficient response efficiency and accuracy.

Method used

By obtaining user ID and Q&A historical data, combining chat model and graph database, the correlation discrimination model is used to judge the correlation between Q&A historical data and the current problem, and dynamically select a similarity algorithm based on the correlation rate parameters to retrieve the target symptoms in the graph database. node to generate answers.

Benefits of technology

The response consistency and accuracy of the Q&A system in continuous dialogue scenarios is improved, and more targeted answers are ensured, while optimizing the accuracy and computing performance of similarity calculations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119069119A_ABST
    Figure CN119069119A_ABST
Patent Text Reader

Abstract

The invention provides a question and answer method and device, a storage medium and a terminal. The method comprises the steps of obtaining a question text and a user ID to which the question text belongs; judging whether the user ID is stored in a question and answer historical database or not, if yes, obtaining question and answer historical data of the user ID, and if not, inputting a question text into a preset chat model to obtain an answer result; judging a correlation result of the question and answer historical data and the question text by using a correlation judgment model, and if the correlation result is related, gathering the question and answer historical data and the question text as a to-be-identified question; otherwise, taking the question text as a to-be-recognized question; and searching a symptom node with the highest similarity with the to-be-identified question in all symptom nodes of the graph database to serve as a target symptom node, and obtaining a disease name corresponding to the target symptom node to serve as an answer result. The method can effectively improve the precision of positioning the target symptom text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intelligent question answering, and relates to a question answering method, and in particular to a question answering method and device, a storage medium and a terminal. Background Art

[0002] With the rapid development of artificial intelligence technology, intelligent question-answering systems are playing an increasingly important role in various application scenarios, such as medical diagnosis, intelligent customer service, education, and other fields. Through the combination of natural language processing and knowledge base, intelligent question-answering systems can understand the questions raised by users and provide accurate answers. However, existing question-answering methods have many defects when dealing with complex multi-round dialogues and large-scale knowledge bases, resulting in question-answering accuracy and response efficiency that are difficult to meet user needs.

[0003] In the prior art, question-answering systems often respond only based on the user's current input question. This single question processing method makes it difficult for the system to capture the user's question background and context in multiple rounds of conversations, especially when the user's question involves multiple steps or information continuation, the system often cannot provide continuous and accurate answers; at the same time, when calculating text similarity, existing question-answering systems usually use a single similarity algorithm. In large-scale knowledge bases or complex scenarios, the computing performance and accuracy of a single algorithm often have limitations, resulting in deviations in similarity judgments; at the same time, a single similarity algorithm is difficult to take into account different types of scenarios. When processing small-scale data, a single similarity algorithm may be too complex, resulting in low computational efficiency; and when processing large-scale data, simple algorithms cannot provide sufficient accuracy. Summary of the invention

[0004] The purpose of the present invention is to provide a question-answering method and device, a storage medium and a terminal, which are used to solve the technical problem of insufficient accuracy of the question-answering system in the prior art.

[0005] In a first aspect, the present invention provides a question-answering method, comprising: Obtaining a question text and a user ID to which the question text belongs; Determine whether the user ID is stored in the question and answer history database, if so, obtain the question and answer history data of the user ID, otherwise input the question text into a preset small talk model to obtain an answer result; Using a relevance discrimination model to determine the relevance result between the question-answering history data and the question text, if the relevance result is relevance, combining the question-answering history data and the question text as the question to be identified; otherwise, using the question text as the question to be identified; The symptom node with the highest similarity to the question to be identified is retrieved from all symptom nodes in the graph database as the target symptom node, and the disease name corresponding to the target symptom node is obtained as the answer result.

[0006] In one embodiment of the present invention, searching for a symptom node with the highest similarity to the question to be identified from among all symptom nodes in the graph database as a target symptom node includes: Get the symptom text of all symptom nodes in the graph database; Using a preset sentence relevance model to determine the relevance of all the symptom texts with the question to be identified, and obtaining a relevance result, wherein the relevance result includes relevance and irrelevance; Acquire all symptom texts whose correlation results are related as a correlation text set; The similarity between each symptom text in the relevant text set and the question to be identified is calculated using a preset similarity model, and the symptom node corresponding to the symptom text with the greatest similarity to the question to be identified is obtained as the target symptom node.

[0007] In one embodiment of the present invention, the preset sentence relevance model is an ernie_matching semantic matching model.

[0008] In one embodiment of the present invention, using a preset similarity model to calculate the similarity between each symptom text in the relevant text set and the question to be identified includes: Obtaining the ratio of the number of elements in the correlation text set to the total number of all symptom nodes in the graph database as a correlation rate parameter; According to the correlation rate interval in which the correlation rate parameter is located, obtaining a sentence similarity algorithm corresponding to the correlation rate interval as a downstream similarity algorithm; Using the downstream similarity algorithm, calculate the similarity between each symptom text in the relevant text set and the question to be identified; The union of all the relevance rate intervals is a set from 0 to 1, different relevance rate intervals have no intersection, and each relevance rate interval corresponds to a different sentence similarity algorithm.

[0009] In one embodiment of the present invention, the correlation rate interval includes a first interval, a second interval and a third interval; The correlation rate parameter range of the first interval is 0 to a first threshold value, and the corresponding sentence similarity algorithm is an edit distance algorithm; The correlation rate parameter range of the second interval is from the first threshold to the second threshold, and the corresponding sentence similarity algorithm is the cosine similarity algorithm; The correlation rate parameter range of the third interval is from the second threshold to 1, and the corresponding sentence similarity algorithm is the simhash algorithm; The first threshold is smaller than the second threshold.

[0010] In one embodiment of the present invention, the question-answering historical data is the latest round of question-answering data.

[0011] In one embodiment of the present invention, the question and answer history database is stored in Redis format.

[0012] In a second aspect, the present invention further provides a question-answering device, characterized in that it comprises: A data collection module, used to obtain a question text and a user ID to which the question text belongs; A question-answer routing module is used to determine whether the user ID is stored in the question-answer history database. If so, the question-answer history data of the user ID is obtained; otherwise, the question text is input into a preset small talk model to obtain an answer result; a relevance determination module, configured to use a relevance determination model to determine a relevance result between the question-answering history data and the question text, and if the relevance result is relevance, then combining the question-answering history data and the question text as a question to be identified; otherwise, using the question text as a question to be identified; The similarity calculation module is used to retrieve the symptom node with the highest similarity to the question to be identified from all symptom nodes in the graph database as the target symptom node, and obtain the disease name corresponding to the target symptom node as the answer result.

[0013] In a third aspect, the present invention further provides a storage medium having a computer program stored thereon, which implements the question-and-answer method as described above when executed by a processor.

[0014] In a fourth aspect, the present invention further provides a terminal, comprising a processor and a memory, wherein the memory is communicatively connected to the processor; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes the question-answering method as described above.

[0015] As described above, the question-answering method and device, storage medium and terminal of the present invention have the following beneficial effects: 1. The chat model is organically combined with medical Q&A through the Q&A history database and user ID, optimizing the Q&A user experience.

[0016] 2. The question to be identified takes into account the historical question and answer data. By judging whether the current question is related to the historical question and answer data, a more targeted answer can be generated based on the historical data, thereby improving the accuracy of question and answer and ensuring that the system can provide more coherent and accurate responses in continuous dialogue scenarios.

[0017] 3. The correlation discrimination model is used as the upstream model to judge the correlation results, and then different downstream similarity algorithms are used based on the correlation rate parameters to obtain the target symptom nodes. This method improves the accuracy of similarity calculation through staged processing, and can dynamically adjust the downstream similarity algorithm, which is conducive to ensuring the best computing performance and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A schematic diagram of the flow chart of the question-answering method according to an embodiment of the present invention is shown.

[0019] Figure 2 A schematic diagram of the process of obtaining a target symptom node in the question-answering method described in an embodiment of the present invention is shown.

[0020] Figure 3 A schematic diagram of a process for obtaining the similarity between a symptom text and a question to be identified in the question-answering method described in an embodiment of the present invention is shown.

[0021] Figure 4 A schematic diagram of the structure of the question-answering device according to an embodiment of the present invention is shown.

[0022] Figure 5 A schematic diagram of the structure of a terminal according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0023] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0024] The principles and implementation methods of the question-and-answer method and device, storage medium and terminal of this embodiment will be described in detail below so that those skilled in the art can understand the question-and-answer method, device, storage medium and terminal of this embodiment without creative work.

[0025] In order to solve the above technical problems existing in the prior art, an embodiment of the present invention provides a question-answering method.

[0026] Figure 1 FIG. 1 shows a flow chart of the question-answering method according to an embodiment of the present invention, referring to FIG. Figure 1 As shown, the question-answering method of the embodiment of the present invention mainly includes steps S100 to S400.

[0027] Step S100: Obtain the question text and the user ID to which the question text belongs.

[0028] Specifically, the question text sent by the user is received, and the user ID to which the question belongs (that is, the user ID that sent the question) is obtained at the same time, in order to query the question and answer history according to the user ID in the subsequent steps to make a personalized response. The user ID includes at least one of a mobile phone number, an ID card number, an IP address, and a user name.

[0029] Step S200: Determine whether the user ID is stored in the question and answer history database. If so, obtain the question and answer history data of the user ID. Otherwise, input the question text into the preset chat model to obtain the answer result.

[0030] In the question-and-answer method of the embodiment of the present invention, the question-and-answer history database stores the question text of each question and answer and the user ID that issued the question. After receiving the user text and user ID each time, it is retrieved whether the user ID is stored in the question-and-answer history database. If the user ID has been stored, the question-and-answer history data corresponding to the user ID is obtained, and the question-and-answer history data is the question-and-answer text generated by all previous questions and answers. If the user ID is not stored in the question-and-answer history database, the question text is input into the preset chat model, and the preset chat model can output the corresponding answer as the answer result according to the question text. Optionally, the preset chat model is a chat model based on Unit Api. Unit Api is an intelligent conversation API developed by Baidu for various vertical fields. Using Unit Api to send a get request, accept access_token, and then call a post request to transmit the conversation text. Finally, the returned reply is unpacked to obtain multiple replies, and a confidence level is attached. One is randomly selected as a reply from the replies whose confidence level is not 0.

[0031] Optionally, the question-and-answer history data is the latest round of question-and-answer data. In this technical solution, the question-and-answer history data optionally stores the latest round of question-and-answer data of the user, that is, the text of the latest question and answer. The purpose of this design is to simplify the management of historical data and optimize storage and query efficiency. Since only the latest data needs to be retrieved, the query process becomes simpler and faster. The system can directly obtain the latest question and answer records from Redis to improve response speed; in many scenarios, the user's latest question and answer have a higher relevance to the current question. By retaining only the latest question and answer records, the system can more accurately generate more relevant answers based on the current context; each time the user conducts a new round of questions and answers, the historical data will be overwritten by the latest records. This design can ensure the updating and timeliness of historical records, and the system responds based on the most relevant context, which is conducive to improving the accuracy of the answer results.

[0032] Optionally, the Q&A history database is stored in Redis. Redis is an in-memory database that can provide extremely fast read and write speeds. It can be used in Q&A to enhance the real-time nature of interaction. After the user enters a question, the system can quickly retrieve the history from Redis and generate an answer. Specifically, Redis stores data in the form of key-value pairs. The user ID can be used as the key and the user's Q&A history data can be stored as the value. Each query only requires the user ID to quickly obtain the corresponding Q&A data. At the same time, Redis supports persisting data to disk, which helps ensure the reliability of the Q&A history records.

[0033] Step S300: Use the relevance discrimination model to determine the relevance result between the question and answer history data and the question text. If the relevance result is relevant, the question and answer history data and the question text are combined as the question to be recognized; otherwise, the question text is used as the question to be recognized.

[0034] Specifically, a relevance discrimination model is used to determine the relevance between the historical Q&A data and the currently input question text, so as to measure the degree of semantic or thematic match between the historical Q&A data and the current question. If the relevance result is relevant, it means that the historical Q&A data is highly relevant to the current question text (for example, the topic of the question or the logic of the question is consistent with the topic of the historical Q&A data), that is, there is a strong semantic correlation between the two. The historical Q&A data is combined with the current question as the question to be identified, which means that subsequent questions and answers will be processed based on the historical Q&A data and the current question text, which is conducive to generating more accurate answers. This step enhances the system's understanding of the current question text through the "set" operation because it refers to the user's previous conversation records. If the relevance result of the historical Q&A data and the question text is irrelevant, that is, the historical data does not match the semantics of the current question, it is processed only according to the current question, and it is regarded as an independent question to be identified, without referring to the previous Q&A history, so as to avoid the interference of the historical Q&A data on the answer. By filtering useful context information through the relevance discrimination model, the personalization and accuracy of the system can be enhanced, ensuring that the user's historical context is effectively utilized during the question-answering process, or eliminating interference to provide independent answers when it is irrelevant. The relevance discrimination model includes a bert-base-chinese pre-training unit, a fully connected layer unit, and a softmax layer. The Bert-Base-Chinese pre-training unit uses Bert's pre-training model (bert-base-chinese) to extract the features of the text to obtain the embedding vector of the input text. The fully connected layer unit includes 5 fully connected layers, and the dimensions of the 5 fully connected layers are 768, 768, 16, 8, and 2 respectively. These fully connected layers reduce the dimensions in turn, further process and refine the high-dimensional features output by the bert-base-chinese pre-training unit, extract and compress key semantic information, so as to better meet the classification requirements. The Softmax layer outputs the probability of each category (1 or 0), and the one with a larger probability is the final prediction result. According to actual needs, technicians in this field can also choose other text matching models as relevance discrimination models.

[0035] Step S400: Retrieve the symptom node with the highest similarity to the question to be identified from all symptom nodes in the graph database as the target symptom node, and obtain the disease name corresponding to the target symptom node as the answer result.

[0036] It should be noted that the nodes in the graph database in this embodiment include symptom nodes, and each symptom node is associated with a corresponding disease name. The disease name can exist in the form of a node or in the form of an attribute in the symptom node, and the present invention does not limit this. Match the question text with all symptom nodes in the graph database, and find the symptom node that is most relevant to the question to be identified, that is, find the symptom node that is semantically closest to the question to be identified as the target symptom node. This query method based on a graph database can make full use of the correlation between symptoms and diseases, and provide more accurate and intelligent question and answer results.

[0037] Optionally, Figure 2 FIG. 1 shows a flow chart of obtaining a target symptom node in the question-answering method according to an embodiment of the present invention, referring to FIG. Figure 2 As shown, retrieving the symptom node with the highest similarity to the question to be identified from all symptom nodes in the graph database as the target symptom node includes the following steps: Step S401: Obtain the symptom texts of all symptom nodes in the graph database.

[0038] Specifically, the symptom text corresponding to each symptom node is obtained from all symptom nodes in the graph database, and the symptom text describes the symptom information of the disease for subsequent comparison with the question to be identified. Optionally, the graph database is a NEO4j database.

[0039] Step S402: using a preset sentence relevance model to determine the relevance of all symptom texts with the question to be identified, and obtaining relevance results, which include relevance and irrelevance.

[0040] The preset sentence relevance model is used to determine the relevance between each symptom text and the question to be identified, and the relevance results between all symptom texts and the question to be identified are obtained. The preset sentence relevance model is a semantic matching model in natural language processing, which evaluates the similarity between two texts from a semantic level. Optionally, the preset sentence relevance model is an ernie_matching semantic matching model. Any symptom text and the question to be identified are input into the ernie_matching semantic matching model, and the output result is 1 (the two are related) or 0 (the two are not related). According to actual needs, technical personnel in this field can also choose other models as preset sentence relevance models.

[0041] Step S403: Obtain all symptom texts whose correlation results are related as a correlation text set.

[0042] Specifically, all symptom texts with relevant results are extracted to form a relevant text set. The symptom texts in the relevant text set all have semantic relevance to the question to be identified, indicating that they may be associated with the corresponding disease in the question to be identified.

[0043] Step S404: Calculate the similarity between each symptom text in the relevant text set and the question to be identified using a preset similarity model, and obtain the symptom node corresponding to the symptom text with the greatest similarity to the question to be identified as the target symptom node.

[0044] A preset similarity model is used to calculate the similarity between each symptom text in the relevant text set and the question to be identified, and the corresponding similarity calculation result is obtained. The technicians in this field can select a suitable text matching algorithm as the preset similarity model according to the needs. Finally, the symptom text with the greatest similarity to the question to be identified is selected, and its corresponding symptom node is found and used as the target symptom node. The prior art often uses a single similarity model to calculate text similarity without preliminary screening, and noise text is also involved in the calculation, which will affect the accuracy of the results. The above-mentioned embodiment of the present application processes in stages, first using a preset sentence relevance model as an upstream model to filter out noise data that is not related to the question to be identified, thereby narrowing the search range of subsequent processing. Only the relevant text set will proceed to the next step of similarity calculation, which not only avoids irrelevant information interfering with the similarity judgment, but also further improves the accuracy of the results through two-step screening. At the same time, question and answer in medical scenarios often face a large number of symptom text nodes. If similarity calculations are performed one by one, it will take a long time. However, the present application first uses a correlation model to quickly screen out relevant texts, and then uses a similarity calculation model to further refine the similarity calculation, thereby rationally utilizing computing resources and improving the application efficiency of question and answer in large-scale data sets. The question and answer method in an embodiment of the present invention requires much less computing power than a method based on a large model.

[0045] Optionally, this embodiment provides a two-step calculation method to accurately calculate the similarity. Specifically, Figure 3 FIG. 1 is a flow chart showing the process of obtaining the similarity between the symptom text and the question sentence to be identified in the question answering method according to an embodiment of the present invention, referring to FIG. Figure 3 As shown, using a preset similarity model to calculate the similarity between each symptom text in the relevant text set and the question to be identified includes the following steps: Step S1: Obtain the ratio of the number of elements in the correlation text set to the total number of all symptom nodes in the graph database as a correlation rate parameter.

[0046] The relevance ratio parameter is used to measure the proportion of the relevance text set in the graph database. First, the number of elements in the relevance text set is calculated and compared with the total number of all symptom nodes in the graph database to obtain a relevance ratio parameter. Specifically, the calculation formula of the relevance ratio parameter is as follows: Sim_conf=rela_num / all_num Among them, Sim_conf represents the correlation rate parameter, rela_num represents the number of elements in the correlation text set, and all_num represents the total number of all symptom nodes in the graph database. Step S2: According to the relevance interval in which the relevance parameter is located, a sentence similarity algorithm corresponding to the relevance interval is obtained as a downstream similarity algorithm.

[0047] According to the interval where the correlation rate parameter is located, the corresponding downstream similarity algorithm is selected from the preset similarity algorithm library. Among them, the union of all correlation rate intervals is a set from 0 to 1, different correlation rate intervals have no intersection, and each correlation rate interval corresponds to a different sentence similarity algorithm. Specifically, the correlation rate range of 0 to 1 is divided into several non-overlapping intervals (such as [0, 0.2), [0.2, 0.5), [0.5, 1]). Each interval corresponds to a different sentence similarity algorithm. For example, when the correlation rate parameter is low, it may indicate that there are fewer relevant texts. At this time, a more efficient similarity algorithm can be selected. If the correlation rate parameter is high, it means that there are more relevant texts, and the question to be identified is related to more symptom texts. At this time, an algorithm that pays more attention to details can be selected to accurately find the most similar symptom text from more symptom texts.

[0048] Step S3: Using the downstream similarity algorithm, calculate the similarity between each symptom text in the relevant text set and the question to be identified.

[0049] After determining the downstream similarity algorithm, use the algorithm to calculate the similarity between each symptom text in the relevance text set and the question to be identified. For example, there are 20 symptom texts in the relevance text set. By calculating the similarity between each symptom text and the question to be identified, 20 similarity results can be obtained. In the above steps S1-S3, by introducing the relevance rate parameter and dynamically selecting the downstream similarity algorithm according to the different relevance rate parameters, the most appropriate algorithm is ensured to be used in different scenarios. This mechanism improves the flexibility of the question-answering method, so that it can maintain high efficiency when the relevance rate parameter is small and maintain accuracy when the relevance rate parameter is large. Therefore, when facing different questions to be identified and relevance text sets of different sizes, it can provide the best experience. At the same time, different algorithms are selected according to the relevance rate parameters to avoid excessive use of complex algorithms in simple scenarios, thereby optimizing the overall question-answering efficiency.

[0050] Optionally, the correlation rate interval includes a first interval, a second interval and a third interval; the correlation rate parameter range of the first interval is 0 to a first threshold, and the corresponding sentence similarity algorithm is an edit distance algorithm; the correlation rate parameter range of the second interval is from a first threshold to a second threshold, and the corresponding sentence similarity algorithm is a cosine similarity algorithm; the correlation rate parameter range of the third interval is from a second threshold to 1, and the corresponding sentence similarity algorithm is a simhash algorithm; wherein the first threshold is less than the second threshold. The accuracy of the edit distance algorithm, the cosine similarity algorithm and the simhash algorithm gradually increases, but the calculation time also gradually increases. Specifically, when the correlation rate interval is in the first interval, the correlation rate parameter is low. At this time, the number of elements in the correlation text set accounts for a small proportion of the total number of all symptom nodes in the graph database, that is, the number of symptom texts related to the question to be identified is small, and the overall correlation between all symptom nodes in the graph database and the question to be identified is low, so the difference is more significant. Using the edit distance algorithm as the downstream similarity algorithm can quickly and accurately obtain the similarity between each symptom text and the question to be identified; when the correlation rate interval is in the second interval, the correlation rate parameter is moderate, and the cosine similarity algorithm is applied under this condition to accurately and quickly obtain the similarity result; when the correlation rate interval is in the third interval, the correlation rate parameter is large, that is, all symptom nodes in the graph database as a whole have a high overall correlation with the question to be identified, and there are many related symptom texts. Using the simhash algorithm can more finely analyze the similarity between each symptom text and the question to be identified, which can effectively reduce the error of similarity calculation under high correlation. Therefore, the above configuration of the downstream similarity algorithm can greatly improve the accuracy and real-time performance of question answering, which is more efficient and accurate than the existing technology.

[0051] The protection scope of the question-and-answer method of the embodiment of the present invention is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present invention are included in the protection scope of the present invention.

[0052] The question-and-answer method of the embodiment of the present invention organically combines the chat model with the medical question-and-answer through the question-and-answer history database and the user ID, and at the same time determines whether the current question is related to the historical question-and-answer data, and can then generate more targeted answers in combination with the historical data, thereby improving the accuracy of the question-and-answer, and ensuring that the system can provide more coherent and accurate responses in continuous dialogue scenarios. In addition, a relevance discrimination model is used as an upstream model to determine the relevance results, and then different downstream similarity algorithms are used based on the relevance rate parameters to obtain the target symptom node. This method improves the accuracy of the similarity calculation by staged processing, and can dynamically adjust the downstream similarity algorithm, which is conducive to ensuring the best computing performance and accuracy.

[0053] In order to solve the above technical problems existing in the prior art, an embodiment of the present invention further provides a question-answering device.

[0054] Figure 4 FIG. 1 shows a schematic diagram of the structure of the question-answering device according to an embodiment of the present invention, referring to FIG. Figure 4 As shown, the question-answering device according to the embodiment of the present invention includes a data collection module, a question-answering routing module, a relevance determination module and a similarity calculation module.

[0055] A data collection module is used to obtain the question text and the user ID to which the question text belongs; The question-answer routing module is used to determine whether the user ID is stored in the question-answer history database. If so, the question-answer history data of the user ID is obtained. Otherwise, the question text is input into the preset small talk model to obtain the answer result. A relevance determination module is used to determine the relevance result between the question-answering history data and the question text using a relevance determination model. If the relevance result is relevant, the question-answering history data and the question text are combined as the question to be identified; otherwise, the question text is used as the question to be identified; The similarity calculation module is used to retrieve the symptom node with the highest similarity to the question to be identified from all symptom nodes in the graph database as the target symptom node, and obtain the disease name corresponding to the target symptom node as the answer result.

[0056] The question-and-answer device of the embodiment of the present invention organically combines the chat model with the medical question-and-answer through the question-and-answer history database and the user ID, and at the same time determines whether the current question is related to the historical question-and-answer data, and can then generate more targeted answers in combination with the historical data, thereby improving the accuracy of the question-and-answer, and ensuring that the system can provide more coherent and accurate responses in continuous dialogue scenarios. In addition, a relevance discrimination model is used as an upstream model to determine the relevance result, and then different downstream similarity algorithms are used based on the relevance rate parameters to obtain the target symptom node. This method improves the accuracy of the similarity calculation through staged processing, and can dynamically adjust the downstream similarity algorithm, which is conducive to ensuring the best computing performance and accuracy.

[0057] In order to solve the above-mentioned technical problems existing in the prior art, an embodiment of the present invention further provides a storage medium on which a computer program is stored, characterized in that when the program is executed by a processor, all steps of the question-and-answer method of the embodiment are implemented.

[0058] The specific steps of the question-and-answer method and the beneficial effects obtained by applying the readable storage medium provided by the embodiment of the present invention are the same as those in the above embodiment and will not be described in detail here.

[0059] A person of ordinary skill in the art can understand that all or part of the steps in the method for implementing the above embodiment can be completed by instructing a processor through a program, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state disk (SSD)), etc.

[0060] In order to solve the above technical problems existing in the prior art, an embodiment of the present invention further provides a terminal. Figure 5 A schematic diagram of the structure of the terminal according to an embodiment of the present invention is shown, referring to Figure 5 As shown, the terminal of the embodiment of the present invention includes a processor and a memory, and the memory and the processor are communicatively connected; the memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory, so that the terminal executes all steps of the question-and-answer method of the above embodiment.

[0061] The specific steps of the question-answering method and the beneficial effects obtained by applying the terminal provided by the embodiment of the present invention are the same as those in the above embodiment and will not be described in detail here.

[0062] It should be noted that the memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage. Similarly, the processor may also be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0063] Although the embodiments disclosed in the present invention are as above, the contents described are only embodiments adopted for facilitating the understanding of the present invention and are not intended to limit the present invention. Any technician in the technical field to which the present invention belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present invention, but the protection scope of the present invention shall still be subject to the scope defined in the attached claims.

Claims

1. A question-answering method, comprising: Obtaining a question text and a user ID to which the question text belongs; Determine whether the user ID is stored in the question and answer history database, if so, obtain the question and answer history data of the user ID, otherwise input the question text into a preset small talk model to obtain an answer result; Using a relevance discrimination model to determine the relevance result between the question-answering history data and the question text, if the relevance result is relevance, combining the question-answering history data and the question text as the question to be identified; otherwise, using the question text as the question to be identified; The symptom node with the highest similarity to the question to be identified is retrieved from all symptom nodes in the graph database as the target symptom node, and the disease name corresponding to the target symptom node is obtained as the answer result.

2. The question-answering method according to claim 1, characterized in that: Retrieving the symptom node with the highest similarity to the question to be identified from all symptom nodes in the graph database as the target symptom node includes: Get the symptom text of all symptom nodes in the graph database; Using a preset sentence relevance model to determine the relevance of all the symptom texts with the question to be identified, and obtaining a relevance result, wherein the relevance result includes relevance and irrelevance; Acquire all symptom texts whose correlation results are related as a correlation text set; The similarity between each symptom text in the relevant text set and the question to be identified is calculated using a preset similarity model, and the symptom node corresponding to the symptom text with the greatest similarity to the question to be identified is obtained as the target symptom node.

3. The question-answering method according to claim 2, characterized in that: The preset sentence relevance model is the ernie_matching semantic matching model.

4. The question-answering method according to claim 2, characterized in that: Calculating the similarity between each symptom text in the relevant text set and the question to be identified using a preset similarity model includes: Obtaining the ratio of the number of elements in the correlation text set to the total number of all symptom nodes in the graph database as a correlation rate parameter; According to the correlation rate interval in which the correlation rate parameter is located, obtaining a sentence similarity algorithm corresponding to the correlation rate interval as a downstream similarity algorithm; Using the downstream similarity algorithm, calculate the similarity between each symptom text in the relevant text set and the question to be identified; The union of all the relevance rate intervals is a set from 0 to 1, different relevance rate intervals have no intersection, and each relevance rate interval corresponds to a different sentence similarity algorithm.

5. The question-answering method according to claim 4, characterized in that: The correlation rate interval includes a first interval, a second interval and a third interval; The correlation rate parameter range of the first interval is 0 to a first threshold value, and the corresponding sentence similarity algorithm is an edit distance algorithm; The correlation rate parameter range of the second interval is from the first threshold to the second threshold, and the corresponding sentence similarity algorithm is the cosine similarity algorithm; The correlation rate parameter range of the third interval is from the second threshold to 1, and the corresponding sentence similarity algorithm is the simhash algorithm; The first threshold is smaller than the second threshold.

6. The question-answering method according to claim 1, characterized in that: The question-and-answer historical data is the latest round of question-and-answer data.

7. The question-answering method according to claim 1, characterized in that: The question and answer history database is stored in Redis format.

8. A question-answering device, characterized in that: include: A data collection module, used to obtain a question text and a user ID to which the question text belongs; A question-answer routing module is used to determine whether the user ID is stored in the question-answer history database. If so, the question-answer history data of the user ID is obtained; otherwise, the question text is input into a preset small talk model to obtain an answer result; a relevance determination module, configured to use a relevance determination model to determine a relevance result between the question-answering history data and the question text, and if the relevance result is relevance, then combining the question-answering history data and the question text as a question to be identified; otherwise, using the question text as a question to be identified; The similarity calculation module is used to retrieve the symptom node with the highest similarity to the question to be identified from all symptom nodes in the graph database as the target symptom node, and obtain the disease name corresponding to the target symptom node as the answer result.

9. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the question-and-answer method according to any one of claims 1 to 7 is implemented.

10. A terminal, characterized in that: It includes a processor and a memory, and the memory is communicatively connected to the processor; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes the question-answering method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Reference answer generation method, system and device based on historical question and answer data and computer equipment

    CN113627198A

  • Intelligent question answering system and method based on question matching

    CN114003709A

  • Knowledge question-answering method and device, equipment and storage medium

    CN116737908A

  • Data retrieval method and device applied to process industry

    CN117743361A

  • Multi-round question and answer intention recognition method and device based on knowledge base

    CN117743556A