Model-based information reply method and device
By querying matching Q&A information in the preset Q&A library for replies, the problem of inconsistent responses caused by unstable responses generated by artificial intelligence models is solved, and the accuracy of information reply is improved.
Patent Information
- Application Number
- CN202411078600.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-08-02
- Filing Date
- 2024-08-07
- Publication Date
- 2025-06-13
AI Technical Summary
In the existing model-based information replies methods, the response results generated by the artificial intelligence model are unstable, resulting in inconsistent responses to the same question and poor accuracy.
By obtaining the question information and querying whether there is a matching question information in the preset question and answer library, if it exists, reply based on the information to ensure that the same question is answered consistently.
Improve the accuracy of the model-based information replies process to ensure that users get consistent responses to the Q&A process of the same question.
Smart Images

Figure CN120144692A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a model-based information answering method and apparatus. Background Art
[0002] With the continuous development and progress of technology, intelligent question answering functions have gradually been developed and applied. Among them, intelligent question answering functions are mainly applied to scenarios such as customer service interaction, early childhood education, and navigation inquiries. In the process of using conventional intelligent question answering functions, the method of model-based information answering generally uses an artificial intelligence model to parse the question, obtain corresponding data from the network, and generate a reply message for answering.
[0003] Currently, in the process of model-based information answering, the method generally used is to answer using the information generated by a pre-trained artificial intelligence model through data in a network or knowledge base. However, in actual applications, since the reply results generated by the artificial intelligence model each time are not stable, that is, in some cases, asking the same question twice may result in different reply results, which leads to poor accuracy of the existing model-based information answering results due to inconsistency. Summary of the Invention
[0004] Embodiments of this application provide a model-based information answering method and apparatus, mainly aiming to solve the problem of low accuracy in the current model-based information answering process.
[0005] To solve the above technical problems, embodiments of this application provide the following technical solutions:
[0006] In a first aspect, this application provides a model-based information answering method, the method including:
[0007] Obtain question information, where the question information is received based on an interaction interface;
[0008] Determine whether there is matching question-and-answer information in a preset question-and-answer library, where the question-and-answer information is generated by processing knowledge data in a preset knowledge base through a question-and-answer algorithm;
[0009] If there is matching question-and-answer information for the question information, perform a reply operation based on the question-and-answer information.
[0010] In a second aspect, this application further provides a model-based information answering apparatus, including:
[0011] An obtaining unit, configured to obtain question information, where the question information is received based on an interaction interface;
[0012] A determination unit, configured to determine whether there is any Q&A information in a preset Q&A library that matches the question information obtained by an acquisition unit, where the Q&A information is generated by processing knowledge data in a preset knowledge library through a Q&A algorithm;
[0013] An execution unit, configured to, if the determination unit determines that there is Q&A information that matches the question information, perform a reply operation based on the Q&A information.
[0014] In a third aspect, an embodiment of the present application provides a storage medium, where the storage medium includes a stored program, and when the program runs, it controls a device where the storage medium is located to execute the model-based information reply method according to any one of the first aspects.
[0015] In a fourth aspect, an embodiment of the present application provides a model-based information reply device, where the device includes a storage medium; and one or more processors, the storage medium is coupled to the processor, and the processor is configured to execute program instructions stored in the storage medium; when the program instructions run, they execute the model-based information reply method according to any one of the first aspects.
[0016] By means of the above technical solutions, the technical solutions provided by the present application have at least the following advantages:
[0017] The present application provides a model-based information reply method and device. The present application can first obtain question information, where the question information is received based on an interaction interface; then, determine whether there is any Q&A information in a preset Q&A library that matches the question information, where the Q&A information is generated by processing knowledge data in a preset knowledge library through a Q&A algorithm; finally, if there is Q&A information that matches the question information, perform a reply operation based on the Q&A information, so as to implement the model-based information reply function. Compared with the prior art, in the embodiment of the present application, since the model-based information reply process does not generate reply information by extracting data from the network based on an artificial model, but is based on querying in a preset Q&A library, it can be ensured that when the user asks the same question twice, the same Q&A information matched in the preset Q&A library can be used for reply, avoiding the situation where the reply results are inconsistent each time when the artificial intelligence model combines network data to obtain reply information, so that the user can get a consistent reply for the same question during the Q&A process, solving the problem in the prior art that the accuracy of the model-based information reply is poor due to inconsistent replies to the same question, and thus improving the accuracy of the model-based information reply process.
[0018] The above description is only an overview of the technical solution of the present application. In order to better understand the technical means of the present application, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present application more obvious and understandable, the following specific embodiments of the present application are given. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] By reading the following detailed description with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easier to understand. In the drawings, several embodiments of the present application are shown in an exemplary rather than restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts, where:
[0020] Figure 1 FIG. shows a flowchart of a model-based information reply method provided by an embodiment of the present application;
[0021] Figure 2 FIG. shows a flowchart of another model-based information reply method provided by an embodiment of the present application;
[0022] Figure 3 FIG. shows a block diagram of the composition of a model-based information reply device provided by an embodiment of the present application;
[0023] Figure 4 FIG. shows a block diagram of the composition of another model-based information reply device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0024] Hereinafter, the exemplary embodiments of the present application will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present application can be more thoroughly understood and the scope of the present application can be fully conveyed to those skilled in the art.
[0025] It should be noted that unless otherwise specified, the technical terms or scientific terms used in the present application should have the ordinary meaning understood by those skilled in the art to which the present application belongs.
[0026] An embodiment of the present application provides a model-based information reply method, which is applied to an electronic device. Specifically as Figure 1 shown, the method includes 101-103.
[0027] 101. Obtain question information.
[0028] In some examples, the question information is received based on an interaction interface. In other examples, the question information is received by a radio of the electronic device. The embodiment of the present application does not limit the receiving manner of the question information.
[0029] In this embodiment, the question information can be input by the user, and the specific method is based on the interaction interface. In some examples, the question information can be transmitted from other devices to the local device, or the local device can provide an input device for obtaining the user's question information. In this process, the user needs to input the question they want to ask. After detecting that the user has input a question, the question information can be generated based on this question. Of course, in some cases, since the question input by the user may not be accurate or may not meet the requirements for subsequent use of the method described in this embodiment, the question can also be processed after the user inputs the question to obtain the question information. Specifically, the processing process can include operations such as correcting the semantics of the question input by the user based on natural language technology, correcting incorrect information, and correcting inappropriate vocabulary. Of course, the operations performed during the acquisition process of the question information include but are not limited to the above process, and the manufacturer can set and adjust according to actual needs, which will not be limited here.
[0030] It should be noted that the specific implementation entity of the information answering method based on the model described in this embodiment can be a separate interaction device or a specific functional module integrated in a large system. For example, the method described in this embodiment can be specifically the automatic answering function in a certain intelligent customer system. Here, the specific implementation entity of the information answering method based on the model, the specific scenarios and locations where it is deployed are not limited here, and can be set according to actual needs.
[0031] 102. Determine whether there is any Q&A information in the preset Q&A library that matches the question information.
[0032] Among them, the Q&A information is generated by processing the knowledge data in the preset knowledge library through a Q&A algorithm.
[0033] After obtaining the question information in the previous step, the method of this step can be used to start from the preset Q&A library to determine whether there is any Q&A information that matches the question information. Specifically, the preset Q&A library in this embodiment can be understood as a database built based on the preset knowledge library according to actual needs. Therefore, the Q&A information in the preset Q&A library can be obtained by processing the knowledge data in the preset knowledge library, and this processing process is based on a Q&A algorithm, which can be understood as an algorithm that can process a large amount of knowledge data in the form of Q&A. In this way, every time a user asks a question, a match will be made in the preset Q&A library to determine whether there is any matching Q&A information. In some embodiments, the Q&A information can include a question and the corresponding answer.
[0034] In the embodiments of the present application, the matching process can be carried out based on the similarity between statements. For example, when the question information A proposed by the user is relatively close to the question in the Q&A information 2 among multiple Q&A information, it can be determined that the Q&A information 2 is the Q&A information that matches the question information A. It should be noted that in the specific matching process, it can include but is not limited to the above method. In some cases, it can also be adjusted to exact matching based on the user's needs, that is, it is necessary to ensure that the question in the question information and the Q&A information is exactly the same to determine that it is the matching Q&A information. Here, the specific method adopted in the matching process is not limited herein and can be set based on needs.
[0035] It should be noted that in this embodiment, the preset Q&A library can be updated and adjusted in real time or regularly based on needs. For example, the preset Q&A library can be updated offline. New knowledge data required by the user can be input into the preset Q&A library and new Q&A information can be generated based on the Q&A algorithm. This can ensure that the Q&A information in the preset Q&A library is always updated.
[0036] 103. If there is Q&A information that matches the question information, a reply operation is performed based on the Q&A information.
[0037] When it is determined that there is Q&A information that matches the question information, it means that there is an answer that can be answered in the preset Q&A library. Then, the reply operation can be carried out based on this Q&A information that matches the question information. Specifically, the answer in the Q&A information can be directly replied, or the answer can be further processed based on the user's current scenario. For example, when the user asks about the nearest restaurant in the navigation scenario, if it is determined that there are two matching Q&A information based on the above matching process, one is a seafood restaurant and the other is a farmhouse restaurant. At this time, if it is previously collected on the interaction interface that the user is allergic to seafood, then these two Q&A information can be processed, the Q&A information with the seafood restaurant is screened out, and the other Q&A information is used for the reply operation, that is, the farmhouse restaurant is output to the user as the reply information.
[0038] This embodiment provides a model-based information reply method. Compared with the prior art, in the embodiment of the present application, since in the process of model-based information reply, data is not extracted from the network based on an artificial model to generate reply information, but is based on querying in a preset Q&A library, it can be ensured that when the user asks the same question twice successively, the same Q&A information matched in the preset Q&A library can be used for reply, avoiding the situation where the reply results are inconsistent each time when the artificial intelligence model combines network data to obtain reply information, enabling the user to get consistent replies for the same question during the Q&A process, and solving the problem in the prior art that the accuracy of model-based information reply is poor due to inconsistent replies for the same question successively, thereby improving the accuracy of the model-based information reply process.
[0039] For a more detailed description below, the embodiment of the present application provides another model-based information reply method, which is applied to an electronic device. Specifically, as Figure 2 shown, this method includes 201-205.
[0040] 201. Obtain the question information.
[0041] Among them, the question information is received based on the interaction interface.
[0042] In this embodiment, the meaning of the question information and the process of determining the question information are exactly the same as those described in the foregoing embodiment, and will not be elaborated here.
[0043] It should be noted that in this embodiment, in addition to the determination process described in the foregoing embodiment, the question information may also include a method of displaying based on voice information obtained by voice recognition after the user inputs voice, that is, after the user inputs voice information, one or more pieces of information are recognized based on the voice information and displayed on the interaction interface, and the user selects or corrects the information on the interaction interface and then receives it, and the received information is used as the question information.
[0044] 202. Determine whether there is Q&A information in the preset Q&A library that matches the question information.
[0045] Among them, the Q&A information is generated by processing the knowledge data in the preset knowledge library through a Q&A algorithm.
[0046] In the process of matching, it can be based on semantics. Based on this, this step can be specifically executed as:
[0047] Step A. Determine the semantics of the question information, and determine whether there is Q&A information in the preset Q&A library with the same semantics as the question information;
[0048] Step B: If there is any, determine that there is Q&A information that matches the said question information;
[0049] Step C: If there is none, determine that there is no Q&A information that matches the said question.
[0050] In this embodiment, the process of determining whether there is Q&A information that matches the question information is actually based on semantics, that is, comparing the semantics of the current question information with the semantics of the Q&A information in the preset Q&A library. When it is determined that there is Q&A information with the same semantics, it means that there is Q&A information that matches the question information; otherwise, it means that there is no Q&A information that matches the question information in the preset Q&A library.
[0051] In this way, by using semantics as the specific matching method, it can be ensured that during the matching process, the answer can be queried and replied according to the broadest meaning of the user's question, so as to ensure that the replied content can meet the needs of the question-asking user as much as possible and ensure the accuracy of the reply process.
[0052] Furthermore, in the actual application of the method described in this embodiment, the Q&A information specifically includes questions and answers. At the same time, the process of determining whether the semantics are the same can be based on the similarity of semantic vectors.
[0053] Based on this, the aforementioned step A: Determine the semantics of the said question information, and determine whether there is Q&A information with the same semantics as the question information in the preset Q&A library, includes:
[0054] a. Respectively extract the semantic vector of the said question information and the semantic vector of each question in the preset Q&A library;
[0055] b. Calculate whether the similarity between the semantic vector of the said question information and the semantic vector of the question exceeds a preset similarity threshold;
[0056] Based on this, the aforementioned step B: If there is any, determine that there is Q&A information that matches the said question information, specifically: If there is a question that exceeds the preset similarity threshold, determine that there is Q&A information that matches the said question information;
[0057] Similarly, the aforementioned step C: If there is none, determine that there is no Q&A information that matches the said question, specifically: If there is no question that exceeds the preset similarity threshold, determine that there is no Q&A information that matches the said question information.
[0058] In the process of determination based on semantic vectors, first, the semantic vector of the query information is calculated. Then, the semantic vectors of the questions in each Q&A information in the preset Q&A library are determined. Then, based on the similarity between the two, it is determined whether the semantics are the same. The specific process is to determine whether the similarity between the two exceeds the preset similarity threshold. When the similarity threshold is exceeded, it can be determined that the semantics of the two are the same, which means that the question of the query information and the question of the Q&A information are the same question. Thus, it can be determined that there is Q&A information in the preset Q&A library that matches the query information. On the contrary, when it is determined that the preset similarity threshold is not exceeded, it means that there is no question in the preset Q&A library with the same semantics as the query information, and there is no matching Q&A information. This realizes the function of determining whether there is matching Q&A information based on semantic vectors, thereby quantifying the process of determining questions with the same semantics as the query information, making the entire matching process more scientific and accurate.
[0059] It should be noted that in this embodiment, the process of determining semantic vectors and calculating similarity based on semantic vectors both belong to common algorithms in the field of natural language, which will not be elaborated here. Those skilled in the art can select any actual algorithm or technology that meets the above functions for processing based on their needs.
[0060] Based on the judgment of this step, there are two judgment results. One is to determine that there is matching Q&A information, and the other is to determine that there is no matching Q&A information. Here, when it is determined that there is matching Q&A information, step 203 is executed; on the contrary, if it is determined that there is no matching Q&A information, step 204 is executed.
[0061] 203. If there is Q&A information that matches the query information, perform a reply operation based on the Q&A information.
[0062] In some cases, although it is determined that there is matching Q&A information, in some cases, there may be multiple pieces of matching Q&A information. Then, at this time, it is necessary to further determine the number of pieces of matching Q&A information.
[0063] Specifically, when this step is executed, it can be:
[0064] 2031. If there is Q&A information that matches the query information, determine the number of the Q&A information;
[0065] 2032. When the number of the Q&A information does not exceed the quantity threshold, perform the reply operation based on the Q&A information.
[0066] When it is determined that the quantity does not exceed the quantity threshold, it indicates that the question raised by the user is relatively precise and not an ambiguous question. In this case, the reply operation can be performed based on the matching Q&A information, which can avoid performing ineffective replies when the question raised by the user is relatively ambiguous and can make the process of information reply based on the model more efficient and accurate.
[0067] Furthermore, in some cases, when it is determined that the quantity of Q&A information is large, it may be necessary for the user to make further confirmation or output multiple Q&A information to the user one by one.
[0068] Based on this, after step 2031, that is, after determining the quantity of the matching Q&A information, the method described in this embodiment can also be carried out in any one of the following two ways 2033 and 2034, including:
[0069] 2033. When the quantity of the Q&A information exceeds the quantity threshold, output a first prompt message to prompt the user to re-enter the question information.
[0070] When it is determined that the quantity of Q&A information exceeds the quantity threshold, it is very likely that the question submitted by the user is relatively ambiguous, resulting in the question information being able to match multiple Q&A information. At this time, the first prompt message can be output to prompt the user to re-enter the question information, so as to avoid generating a large number of reply messages when the user submits a relatively ambiguous question, affecting the user experience, and being able to reduce the ineffective reply process and improve the timeliness of the overall information reply process based on the model.
[0071] 2034. When the quantity of the Q&A information exceeds the quantity threshold, perform the reply operation based on multiple Q&A information in sequence.
[0072] In some cases, the question asked by the user may be relatively ambiguous, and it is very likely that the user is not very clear about what he wants to ask. Then, based on the method of this step, the reply operation is performed on multiple Q&A information in sequence. In this way, by providing the user with multiple reply results, the user can make a choice, so as to ensure that when the user is not sure about the specific question asked, multiple answers can be given for the user to choose from, improving the user experience.
[0073] Furthermore, in the process of selecting multiple Q&A information for reply, it can also be carried out in a certain order. Based on this, the performing the reply operation based on multiple Q&A information in sequence described in this step includes:
[0074] Perform the reply operation based on the Q&A information in sequence from the largest to the smallest in terms of proximity, where the proximity is determined based on the semantic similarity between the question information and the questions in the Q&A information;
[0075] Synchronously output a second prompt message each time a reply operation is executed to prompt the user to confirm whether to continue executing the reply operation. In this embodiment, after obtaining the question information, the semantics of the question information can be determined through a natural language processing algorithm. Then, each question-and-answer information is obtained from a preset question-and-answer library, and the semantics of the questions in each question-and-answer information are respectively determined by using the natural language processing algorithm in turn. Then, the semantic similarity degree between the question information and the questions in each question-and-answer information is calculated respectively as the proximity degree. Specifically, the process of determining semantics is as follows: keywords or key phrases can be extracted from the question information and the questions in the question-and-answer information respectively, and semantic vectors are calculated based on the probability and position of the appearance of the keywords / key phrases. Then, the similarity algorithm is used to calculate the similarity between the semantic vector of the question information and the semantic vector of the question-and-answer information, and the obtained similarity is the proximity degree between the question information and each question. Of course, any existing similarity algorithm can be used in the process of calculating the similarity between the semantic vectors of the keywords / key phrases specifically. For example, the cosine similarity algorithm can be used for calculation, which is not specifically limited here and can be selected based on actual needs.
[0076] Since in some cases, there may be multiple matching question-and-answer information for the question information, but the proximity degrees between the multiple question-and-answer information and the question information may still be different. At this time, sorting can be performed based on the proximity degree, and each question-and-answer information is replied in order from largest to smallest. A second prompt message can also be output during each reply process, and this second prompt message can remind the user whether to continue the subsequent reply to determine whether the current reply meets the user's needs. In this way, when the user's question information is relatively vague, multiple possible reasonable reply information can be given, and the replies are made in a certain order in turn, so that the replied reply information can match the question information as much as possible. For example, the replies are made in order from largest to smallest proximity degree to ensure that the results closer to what the user wants are replied first. The embodiment of the present application can also have the function of consulting the user each time a reply is made, avoiding the situation that when a certain reply result meets the user's needs, the subsequent reply results are still output, which affects the user experience. And by sorting and outputting based on the proximity degree, the effect of ensuring that the results closer to what the user wants are replied first can be achieved, thereby further improving the reply efficiency.
[0077] Further, in some cases, after outputting the second prompt message to the user, when it is confirmed that the user does not need to further reply to subsequent other Q&A information, the Q&A information corresponding to the current last reply operation can also be used as the final Q&A information. When similar question information is obtained again subsequently, the Q&A information corresponding to this reply operation (i.e., the final Q&A information) can be output to the user. This can ensure that when the user asks the same or similar questions again subsequently, a reply can be directly made based on the Q&A information of the previous same question information, avoiding the process of matching multiple Q&A information and replying sequentially, and improving the efficiency of the reply process.
[0078] In addition, in this scenario, after outputting the second prompt message to the user, if no confirmation reply from the user is detected within the preset duration, the user status can be detected in combination with the current specific scenario, and based on the user's current status, it can be confirmed whether the Q&A information corresponding to this reply operation is the final Q&A information. For example, when the method described in this embodiment is applied to a navigation scenario and it is determined that there are multiple Q&A information matching the question information, if the Q&A information is replied to the user sequentially at this time, after sending the second prompt message to the user, a feedback duration for the user can be set. If no confirmation information from the user is received after exceeding this feedback duration, the user status is obtained. When it is determined that the user is in a driving state, a meeting state, or a call state, the current unconfirmed Q&A information can be used as the final Q&A information for this question information. In this way, when the user is in a situation where it is inconvenient to give feedback, it is possible to confirm the Q&A information that is more in line with the user's needs among multiple reply information in combination with the user's current status, and then ensure the determination process of the final Q&A information in certain special cases, so that the model-based information reply method described in this embodiment has better convenience during execution. In one example, after outputting the second prompt message to the user, if no confirmation reply from the user is detected within the preset duration and it is determined that the user's current status is inconvenient to give feedback, it is confirmed that the Q&A information corresponding to this reply operation is the final Q&A information. In some examples, the scenarios where it is inconvenient to give feedback include but are not limited to driving scenarios, meeting scenarios, call scenarios, video scenarios, teaching scenarios, etc., and the corresponding states where it is inconvenient to give feedback include but are not limited to driving state, meeting state, call state, video state, teaching state, etc. This scenario can be set according to actual needs.
[0079] In another example, after the second prompt message is output to the user, if no confirmation reply from the user is detected within a preset time period and it is determined that the current state of the user is convenient for feedback, the second prompt message is continuously output to prompt the user to confirm whether the Q&A information corresponding to this reply operation is the final Q&A information. When the second prompt message is output continuously for N times and no confirmation reply from the user is detected, it is confirmed that the Q&A information corresponding to this reply operation is the final Q&A information; where N is a positive integer. It should be understood that if the number of times the second prompt message is output is less than N and a confirmation reply from the user is detected, the final Q&A information can be confirmed in combination with the foregoing embodiments, that is: when the user confirms that no further reply to subsequent other Q&A information is required, the Q&A information corresponding to the current last reply operation is used as the final Q&A information. When similar question information is obtained again subsequently, the Q&A information corresponding to the last reply operation (i.e., the final Q&A information) can be output to the user.
[0080] 204. If there is no Q&A information that matches the question information, a reply information is generated using the preset language model with the knowledge data and the reply operation is performed.
[0081] After the foregoing steps are judged, since there may be questions that are not in the preset Q&A library, in this case, it is necessary to use the preset language model for processing. The preset language model can be understood as any existing model that can generate data based on an existing database. Its main function is to retrieve the answer corresponding to the question from the database to generate the reply information. Of course, in this embodiment, the model realizes the generation operation of the reply data based on the knowledge data in the corresponding knowledge base in the preset Q&A library. In this way, it is ensured that when some questions asked for the first time do not have matching Q&A information in the preset Q&A library, a reply can still be made based on the preset language model, avoiding the situation of being unable to reply to the user's questions and ensuring the effectiveness and practicality of the information reply function based on the model.
[0082] 205. Determine the question information and the reply information as new Q&A information and add them to the preset Q&A library.
[0083] After the above steps use the preset language model to generate a reply message and perform the reply operation, it means that the current question message is a new question proposed for the first time and is not in the preset Q&A library. To ensure the consistency and convenience of subsequent replies, the question message and the corresponding reply message can be added to the preset Q&A library in real time as new Q&A information based on the method of this step, as an update to the preset Q&A library. This can ensure that when the user asks the same question message later, it can be directly matched and replied from the preset Q&A library according to the method of this embodiment, thus ensuring the consistency of subsequent replies and avoiding the problem of low reply efficiency caused by replying based on the preset language model every time a question is asked, which can improve the efficiency of the overall process of information reply based on the model.
[0084] To achieve the above object, according to another aspect of the present application, an embodiment of the present application further provides a storage medium, where the storage medium includes a stored program, and when the program runs, it controls the device where the storage medium is located to execute the above-mentioned information reply method based on the model.
[0085] To achieve the above object, according to another aspect of the present application, an embodiment of the present application further provides an information reply device based on the model. The device includes a storage medium; and one or more processors, the storage medium is coupled to the processor, and the processor is configured to execute program instructions stored in the storage medium; when the program instructions run, they execute the above-mentioned information reply method based on the model.
[0086] Further, as an implementation of the above Figure 1 and Figure 2 shown method, another embodiment of the present application further provides an information reply device based on the model. The embodiment of the information reply device based on the model corresponds to the foregoing method embodiment. For the convenience of reading, the details of the foregoing method embodiment will not be repeated one by one in this embodiment of the information reply device based on the model, but it should be clear that the device in this embodiment can correspondingly implement all the contents of the foregoing method embodiment. The main purpose of the information reply device based on the model is to solve the problem of low accuracy in the current information reply process based on the model, specifically as Figure 3 shown, the information reply device based on the model includes:
[0087] An obtaining unit 31, which can be used to obtain a question message, where the question message is received based on an interaction interface;
[0088] A determining unit 32, which can be used to determine whether there is a Q&A message in the preset Q&A library that matches the question message obtained by the obtaining unit 31, where the Q&A message is generated by processing knowledge data in the preset knowledge library through a Q&A algorithm;
[0089] The execution unit 33 can be used to perform a reply operation based on the Q&A information if the determination unit 32 determines that there is Q&A information matching the question information.
[0090] Furthermore, as Figure 4 shown, the device further includes:
[0091] The generation unit 34 can be used to generate a reply information using the knowledge data through a preset language model and perform the reply operation if the determination unit 32 determines that there is no Q&A information matching the question information;
[0092] The addition unit 35 can be used to determine the question information and the reply information generated by the generation unit 34 as new Q&A information and add them to the preset Q&A library.
[0093] Furthermore, as Figure 4 shown, the determination unit 32 includes:
[0094] The first determination module 321 can be used to determine the semantics of the question information and determine whether there is Q&A information with the same semantics as the question information in the preset Q&A library;
[0095] The second determination module 322 can be used to determine that there is Q&A information matching the question information if the first determination module 321 determines that there is Q&A information with the same semantics as the question information;
[0096] The third determination module 323 can be used to determine that there is no Q&A information matching the question if the first determination module 321 determines that there is no Q&A information with the same semantics as the question information.
[0097] Furthermore, as Figure 4 shown, the Q&A information includes a question and an answer;
[0098] The first determination module 321 can specifically be used to separately extract the semantic vector of the question information and the semantic vector of each question in the preset Q&A library; and calculate whether the similarity between the semantic vector of the question information and the semantic vector of the question exceeds a preset similarity threshold;
[0099] The second determination module 322 can specifically be used to determine that there is Q&A information matching the question information if there is a question exceeding the preset similarity threshold;
[0100] The third determination module 323 can specifically be used to determine that there is no Q&A information matching the question information if there is no question exceeding the preset similarity threshold.
[0101] Further, as Figure 4 shown, the execution unit 33 includes:
[0102] A determination module 331, which can be used to determine the quantity of the Q&A information if there is Q&A information matching the question information;
[0103] A first execution module 332, which can be used to perform the reply operation based on the Q&A information when the determination module 331 determines that the quantity of the Q&A information does not exceed the quantity threshold.
[0104] Further, as Figure 4 shown, the execution unit 33 further includes:
[0105] An output module 333, which can be used to output a first prompt message to prompt the user to re-enter the question information when the determination module 331 determines that the quantity of the Q&A information exceeds the quantity threshold;
[0106] A second execution module 334, which can be used to perform the reply operation based on multiple Q&A information in sequence when the determination module 331 determines that the quantity of the Q&A information exceeds the quantity threshold.
[0107] Further, as Figure 4 shown, the second execution module 334 can specifically be used to perform the reply operation based on the Q&A information in sequence from the largest to the smallest in terms of proximity, where the proximity is determined based on the semantic similarity between the question information and the questions in the Q&A information; and, a second prompt message is synchronously output during each reply operation to prompt the user to confirm whether to continue performing the reply operation.
[0108] An embodiment of the present application provides a model-based information answering method and apparatus. The embodiment of the present application can first obtain question information, where the question information is received based on an interaction interface; then, determine whether there is matching question-and-answer information in a preset question-and-answer library, where the question-and-answer information is generated by processing knowledge data in a preset knowledge library through a question-and-answer algorithm; finally, if there is matching question-and-answer information for the question information, perform a reply operation based on the question-and-answer information, thereby implementing the model-based information answering function. Compared with the prior art, in the embodiment of the present application, since the model-based information answering process does not extract data from the network based on an artificial model to generate reply information, but is based on querying in a preset question-and-answer library, it can be ensured that when the user asks the same question twice, the same question-and-answer information matched in the preset question-and-answer library can be used for answering, avoiding the situation where the reply results are inconsistent each time when the artificial intelligence model combines network data to obtain reply information, enabling the user to receive consistent replies for the same question during the question-and-answer process, and solving the problem in the prior art that the accuracy of model-based information answering is poor due to inconsistent replies for the same question, thereby improving the accuracy of the model-based information answering process.
[0109] An embodiment of the present application provides a storage medium, where the storage medium includes a stored program, and when the program runs, it controls the device where the storage medium is located to execute the above-mentioned model-based information answering method.
[0110] The storage medium may include non-permanent memory in a computer-readable medium, forms such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
[0111] An embodiment of the present application further provides a model-based information answering apparatus, where the apparatus includes a storage medium; and one or more processors, the storage medium is coupled to the processor, and the processor is configured to execute program instructions stored in the storage medium; when the program instructions run, they execute the above-mentioned model-based information answering method.
[0112] An embodiment of the present application provides a device, where the device includes a processor, a memory, and a program stored on the memory and executable on the processor. When the processor executes the program, the following steps are implemented: obtaining question information, where the question information is received based on an interaction interface; determining whether there is matching question-and-answer information in a preset question-and-answer library, where the question-and-answer information is generated by processing knowledge data in a preset knowledge library through a question-and-answer algorithm; if there is matching question-and-answer information for the question information, performing a reply operation based on the question-and-answer information.
[0113] Further, after determining whether there is any Q&A information matching the question information in the preset Q&A library, the method further includes:
[0114] If there is no Q&A information matching the question information, generate a reply message using the knowledge data through a preset language model and perform the reply operation;
[0115] Determine the question information and the reply information as new Q&A information and add them to the preset Q&A library.
[0116] Further, determining whether there is any Q&A information matching the question information in the preset Q&A library includes:
[0117] Determine the semantics of the question information and determine whether there is any Q&A information with the same semantics as the question information in the preset Q&A library;
[0118] If so, determine that there is Q&A information matching the question information;
[0119] If not, determine that there is no Q&A information matching the question.
[0120] Further, the Q&A information includes a question and an answer;
[0121] Determining the semantics of the question information and determining whether there is any Q&A information with the same semantics as the question information in the preset Q&A library includes:
[0122] Extract the semantic vector of the question information and the semantic vector of each question in the preset Q&A library respectively;
[0123] Calculate whether the similarity between the semantic vector of the question information and the semantic vector of the question exceeds a preset similarity threshold;
[0124] The if so, determine that there is Q&A information matching the question information includes:
[0125] If there is a question exceeding the preset similarity threshold, determine that there is Q&A information matching the question information;
[0126] The if not, determine that there is no Q&A information matching the question includes:
[0127] If there is no question exceeding the preset similarity threshold, determine that there is no Q&A information matching the question information.
[0128] Further, if there is a Q&A information that matches the question information, performing a reply operation based on the Q&A information includes:
[0129] If there is a Q&A information that matches the question information, determine the quantity of the Q&A information;
[0130] When the quantity of the Q&A information does not exceed a quantity threshold, perform the reply operation based on the Q&A information.
[0131] Further, after determining the quantity of the Q&A information if there is a Q&A information that matches the question information, the method further includes:
[0132] When the quantity of the Q&A information exceeds the quantity threshold, output a first prompt message to prompt the user to re-enter the question information;
[0133] Or,
[0134] When the quantity of the Q&A information exceeds the quantity threshold, perform the reply operation based on multiple Q&A information in sequence.
[0135] Further, performing the reply operation based on multiple Q&A information in sequence includes:
[0136] Perform the reply operation based on the Q&A information in sequence from the largest to the smallest similarity, where the similarity is determined based on the semantic similarity between the question information and the questions in the Q&A information;
[0137] Synchronously output a second prompt message each time the reply operation is performed to prompt the user to confirm whether to continue performing the reply operation.
[0138] This application also provides a computer program product, which, when executed on a data processing device, is adapted to execute program code initialized with the following method steps: obtaining question information, where the question information is received based on an interactive interface; determining whether there is Q&A information that matches the question information in a preset Q&A library, where the Q&A information is generated by processing knowledge data in a preset knowledge library through a Q&A algorithm; if there is Q&A information that matches the question information, performing a reply operation based on the Q&A information.
[0139] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.
[0140] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one or more of the processes or multiple processes and / or blocks Figure 1 one or more of the blocks or multiple blocks.
[0141] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one or more of the processes or multiple processes and / or blocks Figure 1 one or more of the blocks or multiple blocks.
[0142] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one or more of the processes or multiple processes and / or blocks Figure 1 one or more of the blocks or multiple blocks.
[0143] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0144] The memory may include non-permanent memory in the computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
[0145] A computer-readable medium includes permanent and non-permanent, removable and non-removable media that can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transitory media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0146] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or apparatus comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or apparatus. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising the element.
[0147] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, system or computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0148] The above are only embodiments of the present application and are not used to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A model-based information reply method, characterized in that: The method comprises: Get question information; Determining whether there is question and answer information matching the question information in a preset question and answer database, wherein the question and answer information is generated by processing the knowledge data in the preset knowledge database through a question and answer algorithm; If there is question-and-answer information matching the question information, a reply operation is performed based on the question-and-answer information.
2. The method according to claim 1, characterized in that After determining whether there is question and answer information matching the question information in the preset question and answer library, the method further includes: If there is no question-answer information matching the question information, generating reply information using the knowledge data through a preset language model and executing the reply operation; The question information and the answer information are determined as newly added question and answer information and added to the preset question and answer library.
3. The method according to claim 1, characterized in that The determining whether there is question and answer information matching the question information in the preset question and answer library includes: Determine the semantics of the question information, and determine whether there is question-and-answer information with the same semantics as the question information in the preset question-and-answer library; If so, determining that there is question-answer information matching the question information; If not, it is determined that there is no question and answer information matching the question.
4. The method according to claim 3, characterized in that The question and answer information includes questions and answers; The determining the semantics of the question information and determining whether there is question-and-answer information with the same semantics as the question information in the preset question-and-answer library includes: Extracting the semantic vector of the question information and the semantic vector of each question in the preset question and answer library respectively; Calculating whether the similarity between the semantic vector of the question information and the semantic vector of the question exceeds a preset similarity threshold; If so, determining that there is question-answer information matching the question information includes: If there are questions exceeding a preset similarity threshold, it is determined that there is question-answer information matching the question information; If not, determining that there is no question-and-answer information matching the question, includes: If there is no question exceeding the preset similarity threshold, it is determined that there is no question-answer information matching the question information.
5. The method according to claim 1, characterized in that If there is question-and-answer information matching the question information, performing a reply operation based on the question-and-answer information includes: If there is question and answer information matching the question information, determining the quantity of the question and answer information; When the amount of the question and answer information does not exceed the amount threshold, the reply operation is performed based on the question and answer information.
6. The method according to claim 5, characterized in that After determining the amount of question-and-answer information if there is question-and-answer information matching the question information, the method further includes: When the amount of the question and answer information exceeds the amount threshold, outputting first prompt information to prompt the user to re-enter the question information; or, When the number of the question and answer information exceeds the number threshold, the reply operation is performed sequentially based on the plurality of question and answer information.
7. The method according to claim 6, characterized in that The step of sequentially performing the reply operation based on the plurality of question and answer information includes: Performing reply operations based on the question-answer information in order from largest to smallest according to the similarity, wherein the similarity is determined based on the semantic similarity between the question information and the question in the question-answer information; The second prompt information is synchronously output each time a reply operation is executed to prompt the user to confirm whether to continue the reply operation.
8. A model-based information reply device, characterized in that: The device comprises: An acquisition unit, used for acquiring question information; A determination unit, configured to determine whether there is question and answer information matching the question information acquired by the acquisition unit in a preset question and answer database, wherein the question and answer information is generated by processing the knowledge data in the preset knowledge database through a question and answer algorithm; The execution unit is configured to execute a reply operation based on the question and answer information if the determination unit determines that there is question and answer information matching the question information.
9. A model-based information reply device, characterized in that: The device includes a storage medium; and one or more processors, wherein the storage medium is coupled to the processor, and the processor is configured to execute program instructions stored in the storage medium; when the program instructions are executed, the model-based information reply method described in any one of claims 1-7 is executed.
10. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the model-based information reply method according to any one of claims 1 to 7.