Version number-based question and answer library updating method and related equipment
By introducing version numbers in the Q&A database to distinguish data before and after the update, the problem of resource-consuming and time-consuming Q&A database updates is solved, real-time updates and accurate retrieval are achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202410757200.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-17
AI Technical Summary
In the existing technology, updating the question and answer database consumes a lot of resources, takes a long time, and is inconvenient for users. Especially when the knowledge base is updated frequently, the question and answer database cannot be updated in time, resulting in outdated information.
The Q&A database update method based on version number is adopted. By updating the retrieval version number of the knowledge base, the Q&A database is updated in real time. The version number is introduced to distinguish the data before and after the update, thereby improving the logic and accuracy of retrieval answers.
It realizes real-time updating of the question and answer database when the knowledge base is updated, improves logic and accuracy of retrieval answers, reduces resource consumption and update time, and improves user experience.
Smart Images

Figure CN118656376A
Abstract
Description
Background Art
[0002] With the development of the Internet, in order to speed up response and reduce resource consumption, a question-answering system based on a knowledge base has been developed, which will store the question-answer pairs mined from the knowledge base in the question-answer database.
[0003] In the field of live broadcasting, the characteristic of updating information in the knowledge base is that the content becomes less each time, but the update frequency is high. In related technologies, after the knowledge base is updated, the Q&A can usually be suspended to fully update the Q&A base. However, due to the high frequency of knowledge base updates, the Q&A base cannot be frequently deactivated. Frequent suspension of Q&A and updating of the Q&A base are inconvenient for users to use. Waiting for a period of time to fully update the Q&A base will result in the Q&A in the Q&A base not being updated in time. The Q&A in the Q&A base are all outdated information from several updates of the knowledge base. Fully updating the Q&A base takes a long time and consumes more resources.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the present disclosure is to provide a method for updating a question and answer library based on a version number and related devices, which at least to a certain extent solve the problem in the prior art that the question and answer library update consumes a lot of resources, takes a long time, and is inconvenient for users.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0007] According to a first aspect of the present disclosure, a method for updating a question and answer library based on a version number is provided, the method comprising:
[0008] In response to the knowledge base data update being completed, updating the first knowledge base retrieval version number of the knowledge base to a second knowledge base retrieval version number;
[0009] Searching the question-answer database according to the first data to determine a first question-answer pair with the first data as the answer source; the first data is updated data in the knowledge database corresponding to the first knowledge database search version number;
[0010] Based on the second data and the question in the first question-answer pair, a second question-answer pair is constructed with the second data as the answer source; the second data is new data corresponding to the first data in the knowledge base corresponding to the second knowledge base retrieval version number;
[0011] According to the current first question and answer library retrieval version number of the question and answer library, add the first newly added question and answer pair version number to the second question and answer pair, update the question and answer library and update the first question and answer library retrieval version number to the second question and answer library retrieval version number; the value of the first newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number.
[0012] In a possible embodiment, after updating the question and answer database and updating the first question and answer database retrieval version number to the second question and answer database retrieval version number, the method further includes:
[0013] Retrieving the version number according to the second knowledge base to determine whether the second data is updated;
[0014] If so, the question and answer database is updated according to the updated second data until the second data is no longer updated.
[0015] In a possible embodiment, the method further includes:
[0016] Receive user questions;
[0017] Obtain multiple questions in the question-and-answer database, at least one question-and-answer pair corresponding to each question, a question-and-answer pair version number of each question-and-answer pair, and a second question-and-answer database retrieval version number;
[0018] Filter the target question-answer pair in the question-answer library according to the user's question, the retrieval version number of the second question-answer library, and the version number of the question-answer pair corresponding to each question;
[0019] If a target question-answer pair is obtained, the user is replied according to the target answer of the target question-answer pair.
[0020] In a possible embodiment, according to the user's question, the second question-and-answer database retrieval version number, and the question-and-answer pair version number corresponding to each question, the target question-and-answer pair is screened in the question-and-answer database, including:
[0021] From all the question-answer pairs, select the question-answer pairs whose version numbers are less than or equal to the second question-answer database search version number and whose version numbers are the largest, and use them as the reply question-answer pairs;
[0022] From the reply question-answer pairs, the target questions whose similarity with the user's question is greater than a preset value and whose similarity is the largest are selected to obtain the target question-answer pair.
[0023] In a possible embodiment, according to the user's question, the second question-and-answer database retrieval version number, and the question-and-answer pair version number corresponding to each question, the target question-and-answer pair is screened in the question-and-answer database, including:
[0024] Filter the target questions whose similarity with the user's questions is greater than a preset value and whose similarity is the greatest in the question-answer database, and obtain multiple intermediate question-answer pairs corresponding to the target questions;
[0025] From the intermediate question and answer pairs, select the intermediate question and answer pairs whose version number value is less than or equal to the value of the second question and answer library retrieval version number and whose version number value is the largest as the target question and answer pair.
[0026] In a possible embodiment, the method further includes:
[0027] If the target question-answer pair is not obtained, a search is performed in the knowledge base according to the user's question, the retrieval version number of the second knowledge base and the data version number of the knowledge data in the knowledge base to determine the dynamic retrieval answer to the user's question;
[0028] Reply to users based on dynamically retrieved answers.
[0029] In a possible embodiment, after replying to the user according to the dynamically retrieved answer, the method further includes:
[0030] Acquire third data in the knowledge base as a source of answers for dynamic retrieval;
[0031] Construct a third question-answer pair based on the user's question and dynamically retrieved answers;
[0032] According to the second question and answer library retrieval version number, the second newly added question and answer pair version number and the third data are added to the third question and answer pair, and the question and answer library is updated; the value of the second newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number.
[0033] In a possible embodiment, after updating the question and answer database, the method further includes:
[0034] determining whether the third data is updated;
[0035] If so, the question and answer database is updated according to the updated third data until the third data is no longer updated.
[0036] According to another aspect of the present disclosure, a device for updating a question and answer library based on a version number is provided, comprising:
[0037] A knowledge base updating unit, configured to update the first knowledge base retrieval version number of the knowledge base to a second knowledge base retrieval version number in response to completion of the knowledge base data update;
[0038] A question-answer pair retrieval unit, configured to search the question-answer database according to the first data to determine a first question-answer pair with the first data as the answer source; the first data is updated data in the knowledge database corresponding to the first knowledge database retrieval version number;
[0039] A construction unit, configured to construct a second question-answer pair using the second data as an answer source based on the second data and the question in the first question-answer pair; the second data is new data corresponding to the first data in the knowledge base corresponding to the second knowledge base retrieval version number;
[0040] A question and answer library updating unit is used to add a first newly added question and answer pair version number to the second question and answer pair according to the current first question and answer library retrieval version number of the question and answer library, update the question and answer library and update the first question and answer library retrieval version number to the second question and answer library retrieval version number; the value of the first newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number.
[0041] In a possible embodiment, the device further includes: a question-answering unit;
[0042] The question-and-answer unit is used to receive questions from users; obtain multiple questions in the question-and-answer library, at least one question-and-answer pair corresponding to each question, the question-and-answer pair version number of each question-and-answer pair, and the second question-and-answer library retrieval version number; screen target question-and-answer pairs in the question-and-answer library according to the user questions, the second question-and-answer library retrieval version number, and the question-and-answer pair version number corresponding to each question; if the target question-and-answer pair is obtained, reply to the user according to the target answer of the target question-and-answer pair.
[0043] According to yet another aspect of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any one of the methods in the first aspect by executing the executable instructions.
[0044] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, any one of the methods in the first aspect is implemented.
[0045] According to another aspect of the present disclosure, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method in the first aspect above.
[0046] The embodiment of the present disclosure provides a method, device, equipment and medium for updating a question and answer library based on a version number, which relates to the field of computer technology. The method includes: in response to the completion of the update of the knowledge base data, updating the first knowledge base retrieval version number of the knowledge base to the second knowledge base retrieval version number; searching in the question and answer library according to the first data, determining the first question and answer pair with the first data as the answer source; the first data is the updated data in the knowledge base corresponding to the first knowledge base retrieval version number; according to the second data and the question in the first question and answer pair, constructing the second question and answer pair with the second data as the answer source; the second data is the new data corresponding to the first data in the knowledge base corresponding to the second knowledge base retrieval version number; adding the first newly added question and answer pair version number to the second question and answer pair according to the current first question and answer library retrieval version number of the question and answer library, updating the question and answer library and updating the first question and answer library retrieval version number to the second question and answer library retrieval version number; the value of the first newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number. Through the above method, the question and answer library can be updated in real time when the knowledge base is updated, and the version number can be introduced to distinguish the data before and after the update, improve the logic and clarity, and the accuracy of the retrieved answer can also be improved through the version number.
[0047] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0049] Figure 1 A flowchart of a method for updating a question and answer library based on a version number in an embodiment of the present disclosure is shown;
[0050] Figure 2 A flowchart showing a knowledge base update based on version number in an embodiment of the present disclosure is shown;
[0051] Figure 3 A schematic diagram showing a knowledge base in an embodiment of the present disclosure;
[0052] Figure 4 A schematic diagram showing a question-and-answer library in an embodiment of the present disclosure;
[0053] Figure 5 A flowchart of searching for answers in a question and answer library in an embodiment of the present disclosure is shown;
[0054] Figure 6A flowchart for determining a target question-answer pair in an embodiment of the present disclosure is shown;
[0055] Figure 7 A flow chart of determining a dynamic retrieval answer in an embodiment of the present disclosure is shown;
[0056] Figure 8 A schematic diagram showing a response process in an embodiment of the present disclosure;
[0057] Fig. 9 A flow chart showing a response process in an embodiment of the present disclosure;
[0058] Fig.10 A schematic diagram showing the structure of a device for updating a question and answer library based on a version number in an embodiment of the present disclosure is shown;
[0059] Fig.11 A schematic structural diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0060] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0061] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0062] The disclosed embodiment describes a method for updating a question and answer library based on a version number, which is mainly applied to the question and answer process in the field of live broadcasting, and is specifically described through the following embodiments.
[0063] Figure 1 FIG. 1 is a flowchart of a method for updating a question and answer library based on a version number in an embodiment of the present disclosure. Figure 1 As shown, the steps include:
[0064] S102: In response to the knowledge base data update being completed, updating the first knowledge base retrieval version number of the knowledge base to a second knowledge base retrieval version number.
[0065] In a possible embodiment, if it is detected that the knowledge base data is updated, the first data of the knowledge base is updated.
[0066] A specific method of detecting whether the knowledge base data is updated may include: obtaining the latest data from the knowledge base data source, determining whether the latest data is updated, and if not, directly terminating; if so, updating the knowledge base according to the latest data.
[0067] The latest data may include structured data, such as business details data; it may also include unstructured data, such as live broadcast scripts, activity documents and other data.
[0068] Among them, according to the characteristics of high frequency of data update and small amount of data updated each time in the live broadcast field, the time period for obtaining the latest data from the knowledge base data source can be pre-set and can be obtained in real time.
[0069] In a possible embodiment, the updating method of the knowledge base may include: taking the update of the latest data as an example in the present disclosure, the updated data in the corresponding knowledge base is the first data, and after updating the knowledge base according to the latest data, the second data is obtained, wherein the first number and the second data may include multiple knowledge data, but the number of knowledge data included is the same.
[0070] The data structure in the knowledge base is described. The knowledge base includes: a knowledge base search version number, and a plurality of knowledge data. Each piece of knowledge data includes: storage data and a data version number.
[0071] Based on this data structure, the knowledge data in the knowledge base can be updated as follows: Figure 2 As shown, the following steps are included:
[0072] S202: Detecting that the first data is updated, updating each piece of knowledge data in the first data in sequence, and extracting any updated data from the first data.
[0073] S204: Update any updated data to new data corresponding to any updated data under the second data.
[0074] S206: Add a data version number to the new data according to the value of the version number retrieved from the first knowledge base, the value of the data version number being equal to the value of the version number retrieved from the second knowledge base.
[0075] S208: Continue updating until all updated data in the first data is updated, and determine that the knowledge base data update is completed.
[0076] S210: Update the first knowledge base search version number of the knowledge base to the second knowledge base search version number.
[0077] Through the above-mentioned updating method, an original knowledge data in the first data is updated to a new knowledge data in the second data. The original knowledge data in the first data will not be overwritten. The original knowledge data in the first data and the new knowledge data in the second data will be stored in the knowledge base in sequence based on the data version number.
[0078] The value of the knowledge base search version number and the value of the data version number can be expressed as numbers. For example, the knowledge base search version number is 1, the data version number is 1, and so on.
[0079] like Figure 3 As shown, Figure 3 The version in represents the version number, and the content represents the storage data of different versions, and the two are combined into a piece of knowledge data. The update process is performed in batches, and all the knowledge data included in the first data is a batch of knowledge base updates.
[0080] For example, the first data includes three pieces of knowledge data, two of which are Figure 3 The knowledge data in the table has version 1 and content b1, and the knowledge data in the table has version 0 and content d0.
[0081] The knowledge base is in the process of updating a batch of 3 pieces of knowledge data. Figure 3 It can be understood that the two pieces of knowledge data have been updated, and the two pieces of knowledge data in the second data have been obtained, namely: the knowledge data with version 2 and content b2 and the knowledge data with version 2 and content d2.
[0082] In the method disclosed herein, the update process of the knowledge base and / or question-and-answer base and the question-and-answer process of the user can exist at the same time. If there are 10 pieces of data that need to be updated in batch A of the knowledge base or question-and-answer base, two pieces of knowledge data have been updated, and there are still 8 pieces of knowledge data that have not been updated, when retrieving the answer to the question in the knowledge base or question-and-answer base, the data version number may be greater than the current knowledge base retrieval version number, or the question-and-answer version number may be greater than the current question-and-answer base retrieval version number.
[0083] After all 10 pieces of data in batch A are updated, it is determined that the knowledge base update is complete and the knowledge base retrieval version number is updated, for example, from 1 to 2.
[0084] It should be noted that the data in the knowledge base and question-answer base will not be overwritten due to updates, but multiple versions of the data will be retained. Figure 3 Taking the b type data in as an example, it can contain three versions of data from old to new: b0, b1, and b2.
[0085] Through the above method, even if questions are asked during the update process, the latest accurate answer to the question can be accurately retrieved due to the version number restriction. The knowledge base retrieval version number will be updated only after the batch update of the knowledge base is completed. There will be no problem of confusing retrieval answers and poor accuracy caused by asking questions during the update process.
[0086] S104: Searching the question-answer database according to the first data to determine a first question-answer pair using the first data as an answer source, where the first data is updated data in the knowledge database corresponding to the first knowledge database search version number.
[0087] The data structure of the question-answer database may include: question-answer version number, question, answer, and answer source. The question-answer version number is also represented by the English word version, the question and answer are represented by the corresponding English first letters, the question is represented by q, the answer is represented by a, and the answer is marked as coming from the corresponding storage data in the knowledge base through the ans_from field.
[0088] In a possible embodiment, the first question and answer pair is retrieved through the first data, and the retrieval method is similar to the retrieval method in the question and answer process, which may include: retrieving the version number and the question and answer pair version number through the first question and answer library, and searching the first data, and taking the question and answer pair whose retrieved version number value is less than or equal to the value of the first question and answer library retrieval version number, and whose question and answer pair version number value is the largest, and whose answer comes from the first data, as the first question and answer pair.
[0089] Exemplarily, the first data includes multiple first stored data. According to each first stored data, the first question and answer library retrieval version number and the question and answer pair version number, the value of the question and answer pair version number retrieved in the question and answer library is less than or equal to the value of the first question and answer library retrieval version number, and the question and answer pair version number corresponding to the question has the largest value, and the question and answer pair with each first stored data as the data source is regarded as the first question and answer pair.
[0090] For example, Figure 4 A schematic diagram of a question-answer database is shown, Figure 4 As shown in FIG. 1 , if the first data is b1, d0, and the second data is b2, d2, when searching for the first question-answer pair through the first data, Figure 4 Two question-answer pairs can be retrieved from the question-answer database, namely: version: 1, q: q2, a: ans2_1, ans_from: b1, d0; and version: 0, q: q4, a: ans4_0, ans_from: d0. The question-answer pair version numbers of the above two question-answer pairs meet the requirements, and the first data exists in the data source.
[0091] S106: Based on the second data and the question in the first question-answer pair, construct a second question-answer pair with the second data as the answer source, where the second data is new data corresponding to the first data in the knowledge base corresponding to the second knowledge base retrieval version number.
[0092] In a possible embodiment, the first data includes multiple first stored data, and the second data includes multiple corresponding second stored data. During the update process, the first question-answer pair is retrieved with each first stored data, and the second question-answer pair is constructed with each corresponding second stored data.
[0093] The specific method of updating may include: constructing a blank second question-answer pair, adding the data source of the second question-answer pair according to the corresponding second stored data; adding the question of the second question-answer pair; filling in the answer according to the corresponding second stored data, and adding the first newly added question-answer pair version number according to the first question-answer library retrieval version number. The order of adding content to the blank second question-answer pair is not fixed.
[0094] Furthermore, a more specific method may include: constructing a blank second question and answer pair, adding the corresponding second stored data as the data source in the blank second question and answer pair; adding the question in the corresponding first question and answer pair to the blank second question and answer pair; filling in the answer in the blank second question and answer pair according to the stored data of the second data; adding a first newly added question and answer pair version number to the second question and answer pair according to the first question and answer library retrieval version number, and the value of the first newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number.
[0095] Among them, if there is a change in the question in the first question-answer pair, it is necessary to specifically indicate that the question has changed, and then the changed question will be added to the blank second question-answer pair.
[0096] Here, a new second question-answer pair is constructed instead of overwriting the original first question-answer pair.
[0097] S108: Add a first newly added question and answer pair version number to the second question and answer pair according to the current first question and answer library retrieval version number of the question and answer library, update the question and answer library and update the first question and answer library retrieval version number to the second question and answer library retrieval version number, and the value of the first newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number.
[0098] In a possible embodiment, after constructing a new second question and answer pair, a first newly added question and answer pair version number is added to the second question and answer pair, and the question and answer pair version numbers are saved in the question and answer library according to the order and association relationship between the first question and answer pair and the second question and answer pair, and the question and answer library is updated.
[0099] The update process of the question and answer database and the knowledge base is performed in batches. The amount of data updated in each batch can be multiple. After all the data are updated, the retrieval version number of the question and answer database / knowledge base will be updated. Multiple data can be updated at the same time or in sequence.
[0100] For example, the first data is d0, b1, and the second data is d2, b2. When the question and answer library is updated, there are two first question and answer pairs. It is necessary to update version: 1, q: q2, a: ans2_1, ans_from: b1, d0 to version: 2, q: q2, a: ans2_2, ans_from: b2, d2, and update version: 0, q: q4, a: ans4_0, ans_from: d0 to version: 2, q: q4, a: ans4_2, ans_from: d2.
[0101] After all updates are completed, update the Q&A database retrieval version number from 1 to 2.
[0102] When updating version: 1, q: q2, a: ans2_1, ans_from: b1, d0 to version: 2, q: q2, a: ans2_2, ans_from: b2, d2, you can first update the data source from b1, d0 to b2, d2, update the questions and answers, and then update version: 0 to 2. At this time, another question and answer pair may not have been updated yet, and the question and answer pair version number will be greater than the question and answer library search version number.
[0103] After the question and answer database is updated, the first question and answer database retrieval version number is updated to the second question and answer database retrieval version number.
[0104] Through the method disclosed in the present invention, each time the knowledge base is updated, the updated first data and second data can be obtained, distinguished by version numbers, and retrieved and updated in the question and answer library, and a question and answer library retrieval version number is added to the question and answer library and a question and answer pair version number is added to the question and answer pair, thereby improving the front and back logic of the question and answer pairs in the question and answer library and making the data structure clearer during updates.
[0105] In a possible embodiment, after the question and answer database is updated, the method further includes: retrieving a version number according to the second knowledge base to determine whether the second data is updated; if so, updating the question and answer database according to the updated second data until the second data is no longer updated.
[0106] In a possible embodiment, in the related art, if multiple versions of question-answer pairs are retained in the question-answer library, multiple answers to a question may be retrieved during the question-answer process, which may cause confusion for users, who do not know which answer is the best answer. The present disclosure introduces a question-answer library retrieval version number and a question-answer pair version number. The question-answer library retains multiple versions of question-answer pairs for a question, and there are corresponding question-answer pair version numbers to represent different versions. The update time of the answer to the question can be clearly indicated, and the logic is strong. Through the question-answer library retrieval version number and the question-answer pair version number, the latest version of the question-answer pair can be accurately retrieved to obtain the answer, thereby improving the accuracy of the retrieved answer.
[0107] For question-and-answer pairs that retain multiple versions in the question-and-answer database, if only the knowledge base update is detected in real time and the question-and-answer database is updated, since the data before and after the update are not specially marked, whether it is retrieving the data source or building a new question-and-answer pair, the correlation between the data is not strong, and the probability of errors in data updates is very high. By introducing the question-and-answer database retrieval version number, the knowledge base retrieval version number, and the question-and-answer pair version number, the logic of question-and-answer pair storage can be improved. Before and after the update, the question-and-answer database can determine the update status through the question-and-answer database retrieval version number, and the question-and-answer pair can distinguish the answers to questions and data sources before and after the update through the question-and-answer pair version number, thereby improving the accuracy of data storage and use during the update process.
[0108] In a possible implementation, when a user question is received during an update process, or when a user question is received without an update, the method of retrieving the answer to the question in the question and answer database may be as follows: Figure 5 A flowchart of retrieving answers from a question-answer database is shown. Figure 5 As shown, the following steps are included:
[0109] S502: receiving a question from a user.
[0110] S504: Obtain multiple questions in the question and answer database, at least one question and answer pair corresponding to each question, a question and answer pair version number of each question and answer pair, and a second question and answer database retrieval version number.
[0111] S506: Filter the target question and answer pairs in the question and answer database according to the user's question, the second question and answer database retrieval version number, and the question and answer pair version number corresponding to each question.
[0112] In a possible embodiment, answers to user questions are filtered from the question and answer library and can be retrieved based on the value of the question and answer pair version number corresponding to the question, the value of the current second question and answer library retrieval version number of the question and answer library, and the similarity between questions.
[0113] The specific method can be exemplified as follows:
[0114] Example 1, Figure 6 A flow chart for determining a target question-answer pair is shown, Figure 6 As shown, the following steps are included:
[0115] S602: From all question-and-answer pairs, select a question-and-answer pair whose version number value is less than or equal to the value of the second question-and-answer database search version number and whose version number value is the largest, as the reply question-and-answer pair.
[0116] In a possible embodiment, Figure 4 As shown in , if the value of the question-answer database retrieval version number is 1, then the answer question-answer pairs filtered from the question-answer database can only be less than or equal to 1, and the question corresponding to the question has the largest version number, that is, the filtered content is as follows Figure 4 shown.
[0117] S604: Filter the target question whose similarity with the user's question is greater than a preset value and has the greatest similarity from the reply question-answer pairs to obtain a target question-answer pair.
[0118] In a possible embodiment, the method of determining similarity may include: determining similar questions by keyword matching; converting into feature vectors for similarity calculation, for example: using a bag-of-words model, TF-IDF matching; using knowledge graph matching, for example: representing both the question and the answer as a graph structure, and then using a graph matching algorithm to find similar questions with higher similarity.
[0119] If the similarity is greater than the preset value, it means that the question stored in the question and answer database is similar to the user's question and can be used as the answer to the user's question. If there are multiple questions whose similarities are all greater than the preset value, the question with the greatest similarity is selected as the target question to determine the target question and answer pair.
[0120] Example 2, the method for determining the target question and answer pair may also include: screening the target question in the question and answer library whose similarity with the user's question is greater than a preset value and has the largest similarity, obtaining multiple intermediate question and answer pairs corresponding to the target question, and from the intermediate question and answer pairs, screening the intermediate question and answer pair whose question and answer pair version number value is less than or equal to the value of the second question and answer library retrieval version number and whose question and answer pair version number value is the largest, as the target question and answer pair.
[0121] S508: If a target question-answer pair is obtained, the user is replied according to the target answer of the target question-answer pair.
[0122] Since the question and answer process is carried out during the update process, there may be a situation where the question and answer version number of the question and answer pair is larger than the question and answer library retrieval version number. Through the retrieval method of questions in the present disclosure, the answers to the questions can be accurately retrieved, and the answers to the questions in the update process are no longer within the retrieval range to avoid confusion. After the current batch of updates to the question and answer library is completed, the question and answer library retrieval version number is updated to retrieve the answers to the updated questions.
[0123] In a possible implementation, when a user asks a question but an answer cannot be retrieved from the question-and-answer database, related technologies generally display that there is no answer, which is inconvenient for users and has low efficiency in retrieving answers to user questions. Figure 7 A flowchart for dynamically retrieving answers is provided, such as Figure 7 As shown, the following steps are included:
[0124] S702: If the target question-answer pair is not obtained, a search is performed in the knowledge base according to the user's question, the second knowledge base retrieval version number and the data version number of the knowledge data in the knowledge base to determine a dynamic retrieval answer to the user's question.
[0125] Among them, the retrieval method of the knowledge base is similar to that of the question and answer database.
[0126] In a possible embodiment, the specific retrieval method may include: from all knowledge data, filtering out knowledge data whose data version number value is less than or equal to the value of the second knowledge base retrieval version number and whose data version number value is the largest, as reply knowledge data; from the reply knowledge data, filtering out one reply knowledge data as the answer to the user's question, which is a dynamic retrieval answer.
[0127] In a possible embodiment, according to the user's question, the intermediate knowledge data that is the answer to question A is screened in the knowledge base, and the intermediate knowledge data may correspond to multiple data version numbers; from the intermediate knowledge data, the intermediate knowledge data whose data version number is less than or equal to the value of the second knowledge base search version number and whose data version number has the largest value is screened as the dynamic search answer, and the dynamic search answer is used as the answer to the user's question. The dynamic search answer is the latest piece of knowledge data that can be used as the answer to the user's question and has the second knowledge base search version number.
[0128] In a possible embodiment, if only data needs to be retrieved and there is no input problem, only the knowledge data with a data version number value less than or equal to the value of the second knowledge base retrieval version number and the largest data version number will be screened from all knowledge data and presented on the user interface.
[0129] For example, it can be Figure 3 As shown, if the value of the second knowledge base search version number is 1, and knowledge data is searched, the retrieved knowledge data are the four contents in the dark part.
[0130] If the retrieval version number of the second knowledge base is 1, only knowledge data with data version numbers 0 or 1 can be retrieved in the knowledge base. If the data version number of knowledge data A is only 0 at most, the knowledge data retrieved is knowledge data A with data version number 0. If knowledge data B has two stored data in the knowledge base, with data version numbers 0 and 1 respectively, knowledge data B with data version number 1 will be retrieved during the retrieval process.
[0131] S704: Reply to the user based on the dynamically retrieved answer.
[0132] Through the above method, when the answer to a question cannot be retrieved in the question and answer database, knowledge mining can be performed. By dynamically and real-time searching the knowledge database, the output efficiency of the answer is improved, thereby improving the user experience.
[0133] In a possible embodiment, after replying to the user, it also includes: obtaining third data in the knowledge base as the source of answers for dynamic retrieval answers; constructing a third question and answer pair based on the user's question and the dynamic retrieval answer; adding a second newly added question and answer pair version number and the third data to the third question and answer pair based on the second question and answer library retrieval version number, and updating the question and answer library; the value of the second newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number.
[0134] In a possible embodiment, after updating the question and answer database, the method further includes: determining whether the third data is updated; if so, updating the question and answer database according to the updated third data until the third data is no longer updated.
[0135] In one possible embodiment, Figure 8 It refers to the answering process in which the user asks a question and searches for the answer to the question in the question and answer database and knowledge base.
[0136] According to different retrieval situations in the response process, the overall process can be divided into the user layer, the response layer and the knowledge mining layer. The user layer is the layer that users can directly perceive, the response layer is the layer that answers user questions, and the knowledge mining layer is the layer that dynamically retrieves answers to questions from the knowledge base.
[0137] The specific response process can be as follows: the user asks a question and searches for similar questions in the question and answer database, that is, retrieves the answer to the question. If the search is successful, the user is directly replied through the response module. If the search fails, it means that the target question and answer pair does not exist in the question and answer database. The knowledge retrieval module performs dynamic real-time search in the knowledge base, mines and constructs the answer, that is, determines the dynamic search answer, and replies to the user through the response module.
[0138] In one possible embodiment, Fig. 9 A schematic diagram of a response process is shown in FIG. Fig. 9 As shown, the following steps are included:
[0139] S902: receiving a user's question.
[0140] S904: Based on the user's question, the second question and answer database retrieval version number and the question and answer pair version number of each question, determine whether the target question and answer pair is found in the question and answer database; if so, execute S906; if not, execute S908.
[0141] S906: Reply to the user according to the target answer of the target question and answer pair.
[0142] S908: Search the knowledge base according to the user's question, the second knowledge base search version number of the knowledge base and the data version number of the knowledge data in the knowledge base to determine the dynamic search answer to the user's question.
[0143] S910: Determine whether the user has been answered; if not, execute S912 and then execute S914; if yes, execute S914.
[0144] S912: Reply to the user based on the dynamically retrieved answer.
[0145] S914: Obtain the answer source in the knowledge base as the dynamic retrieval answer, build a new question and answer pair, and update the question and answer base.
[0146] S916: Check whether the dynamic search answer is updated; if not, end; if so, execute S918.
[0147] S918: Return to step S908 to redetermine a new dynamic retrieval answer.
[0148] Based on the same inventive concept as the above method embodiment, the embodiment of the present application also provides a question and answer library updating device based on version number. Fig.10 A schematic structural diagram of a question and answer library updating device based on version number provided in an embodiment of the present application is shown.
[0149] The device 10 includes: a knowledge base updating unit 1001, which is used to update the first knowledge base retrieval version number of the knowledge base to the second knowledge base retrieval version number in response to the completion of the knowledge base data update; a question and answer pair retrieval unit 1002, which is used to search in the question and answer base according to the first data, and determine the first question and answer pair with the first data as the answer source; the first data is the updated data in the knowledge base corresponding to the first knowledge base retrieval version number; a construction unit 1003, which is used to construct a second question and answer pair with the second data as the answer source according to the second data and the question in the first question and answer pair; the second data is the new data corresponding to the first data in the knowledge base corresponding to the second knowledge base retrieval version number; a question and answer base updating unit 1004, which is used to add a first newly added question and answer pair version number to the second question and answer pair according to the current first question and answer base retrieval version number of the question and answer base, update the question and answer base and update the first question and answer base retrieval version number to the second question and answer base retrieval version number; the value of the first newly added question and answer pair version number is the same as the value of the second question and answer base retrieval version number.
[0150] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0151] Refer to the following Fig.11 The electronic device 1100 according to this embodiment of the present invention is described. Fig.11 The electronic device 1100 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0152] like Fig.11 As shown, the electronic device 1100 is in the form of a general computing device. The components of the electronic device 1100 may include but are not limited to: at least one processing unit 1110, at least one storage unit 1120, and a bus 1130 connecting different system components (including the storage unit 1120 and the processing unit 1110).
[0153] The storage unit stores program codes, which can be executed by the processing unit 1110, so that the processing unit 1110 executes the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification.
[0154] The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 11201 and / or a cache storage unit 11202 , and may further include a read-only storage unit (ROM) 11203 .
[0155] The storage unit 1120 may also include a program / utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0156] Bus 1130 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0157] The electronic device 1100 may also communicate with one or more external devices 1140 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1100, and / or communicate with any device that enables the electronic device 1100 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1150. Furthermore, the electronic device 1100 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1160. As shown, the network adapter 1160 communicates with other modules of the electronic device 1100 via a bus 1130. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0158] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0159] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0160] A program product for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0161] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0162] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0163] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0164] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0165] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0166] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0167] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0168] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. A method for updating a question-and-answer database based on a version number, characterized in that: The method comprises: In response to the knowledge base data update being completed, updating the first knowledge base retrieval version number of the knowledge base to a second knowledge base retrieval version number; Searching the question-answer database according to the first data, determining a first question-answer pair with the first data as the answer source; the first data is the updated data in the knowledge database corresponding to the first knowledge database search version number; According to the second data and the question in the first question-answer pair, a second question-answer pair is constructed with the second data as the answer source; the second data is new data corresponding to the first data in the knowledge base corresponding to the second knowledge base retrieval version number; According to the current first question and answer library retrieval version number of the question and answer library, a first newly added question and answer pair version number is added to the second question and answer pair, the question and answer library is updated and the first question and answer library retrieval version number is updated to the second question and answer library retrieval version number; the value of the first newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number.
2. The method according to claim 1, characterized in that After the question-and-answer database is updated and the first question-and-answer database retrieval version number is updated to the second question-and-answer database retrieval version number, the method further includes: Retrieving a version number according to the second knowledge base to determine whether the second data is updated; If so, the question and answer database is updated according to the updated second data until the second data is no longer updated.
3. The method according to claim 1, characterized in that The method further comprises: Receive user questions; Obtaining a plurality of questions in the question-and-answer database, at least one question-and-answer pair corresponding to each of the questions, a question-and-answer pair version number of each of the question-and-answer pairs, and a search version number of the second question-and-answer database; Filtering target question-answer pairs in the question-answer library according to the user's question, the second question-answer library retrieval version number, and the question-answer pair version number corresponding to each question; If the target question-answer pair is obtained, the user is replied according to the target answer of the target question-answer pair.
4. The method according to claim 3, characterized in that The step of screening target question-answer pairs in the question-answer library according to the user's question, the second question-answer library retrieval version number, and the question-answer pair version number corresponding to each question includes: From all the question-answer pairs, select a question-answer pair whose version number value is less than or equal to the second question-answer database search version number and whose version number value is the largest, and use it as the reply question-answer pair; From the reply question-answer pairs, a target question having a similarity with the user's question greater than a preset value and with the greatest similarity is screened to obtain a target question-answer pair.
5. The method according to claim 3, characterized in that: The step of screening target question-answer pairs in the question-answer library according to the user's question, the second question-answer library retrieval version number, and the question-answer pair version number corresponding to each question includes: Screening the question-answer database for a target question whose similarity to the user's question is greater than a preset value and whose similarity is the greatest, and obtaining a plurality of intermediate question-answer pairs corresponding to the target question; From the intermediate question-answer pairs, select the intermediate question-answer pair whose version number value is less than or equal to the second question-answer library retrieval version number and whose version number value is the largest as the target question-answer pair.
6. The method according to claim 3, characterized in that: The method further comprises: If the target question-answer pair is not obtained, searching the knowledge base according to the user's question, the second knowledge base search version number and the data version number of the knowledge data in the knowledge base to determine a dynamic search answer to the user's question; The user is replied according to the dynamically retrieved answer.
7. The method according to claim 6, characterized in that After replying the user according to the dynamic retrieval answer, the method further comprises: Acquire third data from the knowledge base as a source of answers to the dynamic retrieval answers; Constructing a third question-answer pair according to the user's question and the dynamically retrieved answer; According to the second question and answer library retrieval version number, add the second newly added question and answer pair version number and the third data to the third question and answer pair, and update the question and answer library; the value of the second newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number.
8. The method according to claim 7, characterized in that After updating the question and answer database, the method further includes: Determining whether the third data is updated; If so, the question and answer database is updated according to the updated third data until the third data is no longer updated.
9. A question and answer library updating device based on version number, characterized in that: include: A knowledge base updating unit, configured to update the first knowledge base retrieval version number of the knowledge base to a second knowledge base retrieval version number in response to completion of the knowledge base data update; A question-answer pair retrieval unit, configured to search the question-answer database according to first data to determine a first question-answer pair using the first data as an answer source; the first data is updated data in the knowledge database corresponding to the first knowledge database retrieval version number; A construction unit, configured to construct a second question-answer pair using the second data as an answer source based on the second data and the question in the first question-answer pair; the second data is new data corresponding to the first data in the knowledge base corresponding to the second knowledge base retrieval version number; A question and answer library updating unit is used to add a first newly added question and answer pair version number to the second question and answer pair according to the current first question and answer library retrieval version number of the question and answer library, update the question and answer library and update the first question and answer library retrieval version number to the second question and answer library retrieval version number; the value of the first newly added question and answer pair version number is the same as the value of the second question and answer library retrieval version number.
10. An electronic device, characterized in that: include: processor; and a memory for storing executable instructions for the processor; The processor is configured to perform the method of any one of claims 1 to 8 by executing the executable instructions.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
12. A computer program product comprising: A computer program or instruction, characterized in that when the computer program or instruction is executed by a processor, the method described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
FAQ Chinese request-answering system implementing method in tourism field
CN101373532A
Method and system for screening question and answer pairs and updating question and answer database in real time
CN104679815A
Data version number updating method and device, electronic equipment and computer storage medium
CN114328554A
Intelligent question answering system and analysis method
CN118035399A
Question and answer method, system and device and medium
CN118093828A
