An intelligent question-answering method, device and electronic device
By extracting the characteristic words of real-time questions and calculating their similarity and correlation with the text intention group of the preset service scenario, the problem of low answerability and accuracy of the existing question-and-answer system is solved, and more efficient and accurate question answers are achieved.
Patent Information
- Application Number
- CN202210345780.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2042-03-31
AI Technical Summary
When the existing question-and-answer system determines whether the received questions are answerable, the judgment accuracy is low, resulting in poor user experience.
By receiving real-time questions, extracting their characteristic words, calculating the similarity between these characteristic words and text meaning groups in the preset service scenario, selecting the text meaning group with the highest similarity as the target text meaning group, and calculating the correlation between the characteristic words and the feature words in the target text meaning group to determine whether the question is answerable.
The accuracy and efficiency of question answers are improved, and the accuracy of question answers is enhanced through the matching of service scenarios.
Smart Images

Figure CN114661883B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular, to an intelligent question-answering method, device, and electronic device. Background Art
[0002] Currently, intelligent customer service is very popular and comprehensively covers fields such as government affairs, finance, commerce, culture, and tourism. Users have extremely urgent practical needs for intelligent multi-round question-answering systems in the open knowledge field. This system involves various modal and multi-strategy question-answering response methods. In the current corpus knowledge base of the system, effectively distinguishing answerable questions from unanswerable questions is a necessary way to achieve friendly and user-friendly answers.
[0003] However, when the core model of the current question-answering system determines whether a received question is answerable, the judgment accuracy rate is often low, resulting in poor user experience. Summary of the Invention
[0004] The purpose of the embodiments of the present invention is to provide an intelligent question-answering method, device, and electronic device to solve the problem of low judgment accuracy rate when the existing question-answering system determines whether a received question is answerable. The specific technical solutions are as follows:
[0005] In the first aspect of the embodiments of the present application, first, an intelligent question-answering method is provided. The method includes:
[0006] Receiving a real-time question, and extracting feature words of the real-time question to obtain to-be-oriented correlation words;
[0007] Calculating the similarity between the to-be-oriented correlation words and one or more text semantic groups corresponding to each preset service scenario in a plurality of preset service scenarios, and selecting the text semantic group with the highest similarity as the target text semantic group;
[0008] Calculating the correlation degree between the to-be-oriented correlation words and multiple feature words in the target text semantic group;
[0009] Determining whether the real-time question is answerable according to the correlation degree of the multiple feature words.
[0010] Optionally, the determining whether the real-time question is answerable according to the correlation degree of the multiple feature words includes:
[0011] According to the calculated correlation degree of the multiple feature words, selecting the correlation degree greater than the adaptive discrimination threshold as the first correlation degree;
[0012] Selecting the correlation text corresponding to the feature word with the highest correlation degree among the first correlation degrees to answer the real-time question.
[0013] Optionally, determining whether the real-time question is answerable according to the relevance of the multiple feature words includes:
[0014] When the relevance of the multiple feature words is less than the adaptive discrimination threshold, output that the real-time question is not answerable.
[0015] Optionally, the steps of obtaining the adaptive discrimination threshold include:
[0016] Obtain multiple original corpora;
[0017] Identify the multiple original corpora to obtain the scenario labels of each original corpus;
[0018] For any scenario label, create a user question library for the original corpus corresponding to the scenario label;
[0019] Calculate the relevance between each user question in the user question library and each original corpus corresponding to the scenario label to obtain multiple second relevances;
[0020] Obtain the adaptive discrimination threshold according to multiple second relevances and the judgment result of whether the user question is answerable.
[0021] Optionally, obtaining the adaptive discrimination threshold according to multiple second relevances and the judgment result of whether the user question is answerable includes:
[0022] Select the median of the multiple second relevances as the threshold to be output;
[0023] Compare each second relevance with the threshold to be output, and judge whether each user question can be answered to obtain a judgment result. Among them, if the second relevance is greater than the threshold to be output, it is determined to be answerable, and if the second relevance is less than the threshold to be output, it is determined to be not answerable;
[0024] Compare the judgment result with the preset standard judgment result, calculate the current loss, and correct the threshold to be output according to the current loss. Return to the step of comparing each second relevance with the threshold to be output and judging whether each user question can be answered to obtain a judgment result, and continue to execute until the current loss is less than the preset loss threshold to obtain the adaptive discrimination threshold.
[0025] Optionally, calculating the similarity between the to-be-directed related word and one or more text semantic groups corresponding to each preset service scenario in multiple preset service scenarios, and selecting the text semantic group with the highest similarity as the target text semantic group includes:
[0026] Calculate the similarity between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios to obtain multiple text similarities;
[0027] Select the text semantic group corresponding to the text similarity with the largest value among the multiple text similarities as the target text semantic group.
[0028] Optionally, the calculating the similarity between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios to obtain multiple text similarities includes:
[0029] Calculate the similarity between the to-be-oriented related word and the multiple text semantic groups according to a pre-created weight matrix to obtain the multiple text similarities.
[0030] Optionally, the receiving the real-time question and extracting the characteristic words of the real-time question to obtain the to-be-oriented related word includes:
[0031] Receive the real-time question input by the user on the interaction interface, and extract the characteristic words of the real-time question to obtain the to-be-oriented related word.
[0032] In the second aspect of the embodiments of the present application, an intelligent question-answering device is provided. The device includes:
[0033] A related word extraction module, configured to receive a real-time question and extract the characteristic words of the real-time question to obtain a to-be-oriented related word;
[0034] A correlation degree selection module, configured to calculate the similarity between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and select the text semantic group with the highest similarity as the target text semantic group;
[0035] A correlation degree calculation module, configured to calculate the correlation degree between the to-be-oriented related word and multiple characteristic words in the target text semantic group;
[0036] A question answering module, configured to determine whether the real-time question can be answered according to the correlation degrees of the multiple characteristic words.
[0037] Optionally, the question answering module includes:
[0038] A first correlation degree acquisition sub-module, configured to select the correlation degrees greater than the adaptive discrimination threshold as the first correlation degrees according to the correlation degrees of the multiple characteristic words;
[0039] A first correlation degree selection module, configured to select the correlation text corresponding to the characteristic word with the highest correlation degree among the first correlation degrees to answer the real-time question.
[0040] Optionally, the first correlation degree obtaining sub-module is configured to output that the real-time question cannot be answered when the correlation degrees of the multiple feature words are all less than the adaptive discrimination threshold.
[0041] Optionally, the apparatus further includes:
[0042] An original corpus obtaining module, configured to obtain a plurality of original corpora;
[0043] An original corpus identification module, configured to identify the plurality of original corpora to obtain the scenario labels of the respective original corpora;
[0044] A question bank creation module, configured to create a user question bank for the original corpus corresponding to the scenario label for any scenario label;
[0045] A second correlation degree obtaining module, configured to calculate the correlation degrees between each user question in the user question bank and each original corpus corresponding to the scenario label, to obtain a plurality of second correlation degrees;
[0046] An adaptive discrimination threshold calculation module, configured to obtain an adaptive discrimination threshold according to a plurality of second correlation degrees and a judgment result for judging whether the user question can be answered.
[0047] Optionally, the adaptive discrimination threshold calculation module includes:
[0048] A threshold selection sub-module, configured to select the median of the plurality of second correlation degrees as the threshold to be output;
[0049] A question judgment sub-module, configured to compare each second correlation degree with the threshold to be output, and judge whether each user question can be answered, to obtain a judgment result, wherein if the second correlation degree is greater than the threshold to be output, it is determined that it can be answered, and if the second correlation degree is less than the threshold to be output, it is determined that it cannot be answered;
[0050] A threshold revision sub-module, configured to compare the judgment result with a preset standard judgment result, calculate the current loss, and correct the threshold to be output according to the current loss, and return to the step of comparing each second correlation degree with the threshold to be output and judging whether each user question can be answered to obtain a judgment result, and continue to execute until the current loss is less than a preset loss threshold, to obtain an adaptive discrimination threshold.
[0051] Optionally, the correlation degree selection module includes:
[0052] A text similarity calculation sub-module, configured to calculate the similarities between the to-be-oriented correlation word and one or more text semantic groups corresponding to each preset service scenario in a plurality of preset service scenarios, to obtain a plurality of text similarities;
[0053] A text similarity selection sub-module is used to select the text group corresponding to the text similarity with the largest value among the multiple text similarities as the target text group.
[0054] Optionally, the text similarity calculation sub-module is specifically configured to calculate the similarity between the to-be-oriented correlation word and multiple text groups corresponding to each preset service scenario in the multiple preset service scenarios according to a pre-created weight matrix, so as to obtain the multiple text similarities.
[0055] Optionally, the correlation word extraction module is specifically configured to receive the real-time question input by the user in the interaction interface, and extract the feature words of the real-time question to obtain the to-be-oriented correlation word.
[0056] On the other hand, an embodiment of the present application further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus;
[0057] The memory is used to store a computer program;
[0058] The processor is configured to implement the steps of any of the above intelligent question-answering methods when executing the program stored on the memory.
[0059] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above intelligent question-answering methods are implemented.
[0060] On the other hand, an embodiment of the present application further provides a computer program product including instructions, which when running on a computer, causes the computer to execute the steps of any of the above intelligent question-answering methods.
[0061] Advantages of the embodiments of the present invention:
[0062] An intelligent question-answering method, device, and electronic device provided by an embodiment of the present invention can receive a real-time question, and extract the feature words of the real-time question to obtain a to-be-oriented correlation word; calculate the similarity between the to-be-oriented correlation word and one or more text groups corresponding to each preset service scenario in multiple preset service scenarios, and select the text group with the highest similarity as the target text group; calculate the correlation degree between the to-be-oriented correlation word and multiple feature words in the target text group; and determine whether the real-time question can be answered according to the calculated correlation degrees of the multiple feature words. It can be seen that through the method of the embodiment of the present application, the text group of the corresponding service scenario can be selected according to the received real-time question, and then a judgment on whether the real-time question can be answered can be given according to the associated text group corresponding to the service scenario. Therefore, not only can the efficiency of question answering be improved through the matching of service scenarios, but also the accuracy of question answering can be improved.
[0063] Of course, it is not necessary for any product or method implementing the present invention to achieve all the above-mentioned advantages simultaneously. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other embodiments based on these drawings.
[0065] Figure 1 It is a schematic flowchart of an intelligent question-answering method provided by an embodiment of the present application;
[0066] Figure 2 It is a schematic flowchart of a process for obtaining the semantic groups of the target text provided by an embodiment of the present application;
[0067] Figure 3 It is a schematic flowchart of a process for answering real-time questions provided by an embodiment of the present application;
[0068] Figure 4 It is a schematic flowchart of a process for obtaining an adaptive discrimination threshold provided by an embodiment of the present application;
[0069] Figure 5 It is another schematic flowchart of an intelligent question-answering method provided by an embodiment of the present application;
[0070] Figure 6 It is a schematic structural diagram of an intelligent question-answering device provided by an embodiment of the present application;
[0071] Figure 7 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0072] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art based on the present application belong to the scope of protection of the present invention.
[0073] To solve the problem of low judgment accuracy in the prior art when a question-and-answer system determines whether a received question can be answered, the present application provides an intelligent question-answering method, device, and electronic device.
[0074] In the first aspect of the embodiments of the present application, first, an intelligent question-answering method is provided, and the method includes:
[0075] Receive real-time questions, extract the characteristic words of the real-time questions, and obtain the correlation words to be oriented.
[0076] Calculate the similarity between the correlation words to be oriented and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and select the text semantic group with the highest similarity as the target text semantic group.
[0077] Calculate the correlation degree between the correlation words to be oriented and multiple characteristic words in the target text semantic group.
[0078] Determine whether the real-time question can be answered according to the correlation degree of multiple characteristic words.
[0079] It can be seen that through the method of the embodiment of the present application, the text semantic group of the corresponding service scenario can be selected according to the received real-time question, and then a judgment on whether the real-time question can be answered can be given according to the associated text semantic group corresponding to the service scenario. Therefore, not only can the efficiency of question answering be improved through the matching of service scenarios, but also the accuracy of question answering can be improved.
[0080] Specifically, refer to Figure 1 , Figure 1 which is a schematic flow chart of an intelligent question answering method provided by the embodiment of the present application, including:
[0081] Step S11: Receive a real-time question, extract the characteristic words of the real-time question, and obtain the correlation words to be oriented.
[0082] Optionally, receiving a real-time question and extracting the characteristic words of the real-time question to obtain the correlation words to be oriented includes: receiving the real-time question input by the user on the interaction interface and extracting the characteristic words of the real-time question to obtain the correlation words to be oriented. Among them, the correlation words to be oriented in the embodiment of the present application can be the characteristic word stems obtained by extracting the characteristic words of the real-time question for explaining the real-time question. Specifically, the original noun words and verb stems can be extracted from the real-time question as the correlation words to be oriented. Among them, receiving the real-time question can receive the real-time question input by the user on the interaction interface in ways such as voice input and / or keyboard input. For example, the user inputs "What's the weather like today?" through voice on the interaction interface.
[0083] Among them, the characteristic words of the real-time question can be extracted through a pre-trained network model or other means for extracting characteristic vocabulary. For example, when the user input is "What's the weather like today?", the extracted characteristic word stems can be "today" and "weather", that is, for the real-time question "What's the weather like today?", the extracted characteristic words are "today" and "weather".
[0084] The method of the embodiment of the present application can be applied to a smart terminal and can be implemented through the smart terminal. Specifically, the smart terminal can be a computer, a mobile phone, a smart interaction terminal (such as a smart robot), etc.
[0085] Step S12: Calculate the similarity between the to-be-oriented correlation word and one or more text semantic groups corresponding to each preset service scenario among the multiple preset service scenarios, and select the text semantic group with the highest similarity as the target text semantic group.
[0086] Among them, the preset service scenario can be a scenario where real-time problems may be applied, which are preset. For example, asking about the weather, asking about the time, asking about the route, etc. For each preset service scenario, one or more text semantic groups can be set. The text semantic group can be a set of characteristic words that may be used in the corresponding application scenario. For example, when the preset service scenario is asking about the weather, characteristic words such as temperature, air pressure, and rain may be used. That is, when the preset service scenario is the weather inquiry scenario, a corresponding text semantic group includes characteristic words such as temperature, air pressure, and rain. Optionally, multiple text semantic groups can be set for one preset service scenario. For example, when the preset service scenario is asking about the weather, for rain, a text semantic group can be set: characteristic words such as light rain, moderate rain, heavy rain, and thunderstorm; for wind direction, a text semantic group can be set: characteristic words such as southeast wind, southwest wind, and northeast wind.
[0087] Calculating the similarity between the to-be-oriented correlation word and one or more text semantic groups corresponding to each preset service scenario among the multiple preset service scenarios can be obtained by calculating the similarity between the to-be-oriented correlation word and the orientation words of the multiple preset service scenarios. Specifically, the orientation words of each text semantic group can be preset. The orientation word can be a word preset to represent the application field or service scenario to which the text semantic group belongs. Specifically, the orientation word can be a word selected from the characteristic words of the text semantic group or a word set by the user according to the content of the text semantic group. For example, a certain text semantic group includes characteristic words such as temperature, air pressure, and rain. These characteristic words are applied to the weather field, so the orientation word of this text semantic group can be weather. When calculating the similarity between the to-be-oriented correlation word and one or more text semantic groups corresponding to each preset service scenario among the multiple preset service scenarios, the similarity between the to-be-oriented correlation word and the orientation word can be calculated, such as calculating the similarity between the to-be-oriented correlation word and the orientation word "weather". Specifically, calculating the similarity between the to-be-oriented correlation word and the orientation word of each text semantic group can be calculated in various ways. For example, the cosine similarity, Jaccard similarity coefficient, Pearson correlation coefficient, etc. between the to-be-oriented correlation word and the orientation word can be calculated.
[0088] Step S13: Calculate the correlation degree between the to-be-oriented correlation word and multiple characteristic words in the target text semantic group.
[0089] Among them, to calculate the correlation degree between the to-be-oriented related word and each feature word in the target text semantic group, it can be calculated by calculating the similarity. Specifically, it can be the same as or different from the similarity calculation method in the previous step. For example, to calculate the correlation degree between the to-be-oriented related word and each feature word in the target text semantic group, it can be calculated by calculating the cosine similarity, Jaccard similarity coefficient, Pearson correlation coefficient, etc. between the to-be-oriented related word and each feature word.
[0090] Among them, each feature word in the target text semantic group can be a feature word extracted from the related text. For example, when extracting feature words from the related text, the related text includes: the temperature in Xi'an on July 25 is 25°C to 32°C, the precipitation probability in Xi'an on July 25 is 30%, the wind force in Xi'an on July 25 is level 2, etc. The extracted feature words are respectively Xi'an, temperature, precipitation probability, and wind force.
[0091] Step S14, determine whether the real-time question can be answered according to the correlation degrees of multiple feature words.
[0092] When it is determined that the real-time question can be answered, the related text corresponding to the feature word with the highest correlation degree can be selected to answer the real-time question, or the related text corresponding to the feature word with the largest correlation degree value can be selected to answer the real-time question. Specifically, when answering the real-time question according to the related text, the related text can also be edited and output. For example, the related text can be edited and output through a pre-created template. Specifically, templates for different questions can be pre-created. For example, for questions related to temperature, create a template: **The temperature in (location) today is** (temperature). When editing and outputting the related text through the pre-created template, the corresponding template can be matched, and then the related text is used to fill the template to obtain the answer to the real-time question and output it. For example, the related text corresponding to the feature word with the highest correlation degree is that the temperature in Xi'an on July 25 is 25°C to 32°C. This related text can be added to the pre-created template. When the user asks about the temperature in Xi'an today (July 25), the final answer output to the user is: The temperature in Xi'an today is 25°C to 32°C.
[0093] It can be seen that through the method of the embodiment of the present application, the text semantic group of the corresponding service scenario can be selected according to the received real-time question, and then it can be determined whether the real-time question can be answered according to the related text semantic group corresponding to the service scenario. When the real-time question can be answered, the corresponding related text can be selected from the related text semantic group corresponding to the service scenario to answer the real-time question. Thus, not only can the efficiency of question answering be improved through the matching of service scenarios, but also the accuracy of question answering can be improved.
[0094] Optionally, refer to Figure 2, step S12 calculates the similarity between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and selects the text semantic group with the highest similarity as the target text semantic group, including:
[0095] Step S121 calculates the similarity between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and obtains multiple text similarities;
[0096] Step S122 selects the text semantic group corresponding to the text similarity with the largest value among the multiple text similarities as the target text semantic group.
[0097] Among them, to calculate the similarity between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, the similarity between the to-be-oriented related word and the orientation words of multiple preset service scenarios can be calculated. Specifically, a weight matrix corresponding to the orientation words of each preset service scenario can be created. Optionally, each row or each column in the weight matrix can be a feature vector corresponding to an orientation word. Optionally, the orientation words of each preset service scenario can be the orientation words of the text semantic group. To calculate the similarity between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios and obtain multiple text similarities, it includes: calculating the similarity between the to-be-oriented related word and multiple text semantic groups according to the pre-created weight matrix corresponding to each orientation word, and obtaining multiple text similarities. Specifically, the to-be-oriented related word can be vectorized to obtain a corresponding related word vector, then calculate the product of the related word vector and the weight matrix corresponding to the orientation word, and finally obtain a vector composed of text similarities. For example, the related word vectors are [1, 2, 0], [1, 0, 1], [1, 0, 0], and the weight matrix is Then, by calculating the product of the related word vector and the weight matrix, a [0.2, 0.3, 0.2] composed of text similarities can be obtained, that is, the text similarities corresponding to the related word vectors [1, 2, 0], [1, 0, 1], [1, 0, 0] are 0.2, 0.3, 0.2 respectively, and calculate each text similarity in this way to obtain multiple text similarities.
[0098] Among them, to select the text semantic group corresponding to the text similarity with the largest value among the multiple text similarities as the target text semantic group, the text similarities can be sorted, and according to the sorting result, the text similarity with the largest value is selected, and the corresponding text semantic group is selected as the target text semantic group according to the text similarity with the largest value.
[0099] It can be seen that, through the method of the embodiments of the present application, the similarity between the to-be-oriented associated word and one or more text semantic groups corresponding to each preset service scenario in multiple preset service scenarios can be calculated to obtain multiple text similarities, and the text semantic group corresponding to the text similarity with the largest value among the multiple text similarities is selected as the target text semantic group, so as to facilitate selecting the corresponding associated text according to the target text semantic group to answer the question.
[0100] Optionally, referring to Figure 3 , step S14 determines whether the real-time question can be answered according to the association degrees of multiple feature words, including:
[0101] Step S141, according to the association degrees of multiple feature words, select the association degrees greater than the adaptive discrimination threshold as the first association degrees;
[0102] Step S142, select the associated text corresponding to the feature word with the highest association degree among the first association degrees to answer the real-time question.
[0103] Among them, according to the calculated association degrees of multiple feature words, select the association degrees greater than the adaptive discrimination threshold as the first association degrees, which can sort the association degrees of multiple feature words, and then according to the sorting result, select the association degrees greater than the adaptive discrimination threshold as the first association degrees. For example, when the adaptive discrimination threshold is 0.8, the calculated association degrees of multiple feature words are: 0.95, 0.86, 0.75 respectively, then 0.95 and 0.86 can be selected as the first association degrees, and select the feature word corresponding to 0.95 among the first association degrees to answer the real-time question.
[0104] Specifically, selecting the associated text corresponding to the feature word with the highest association degree among multiple first association degrees to answer the real-time question can edit and output the associated text when answering the real-time question according to the associated text. For example, the associated text can be edited and output through a pre-created template. Specifically, reference can be made to the above embodiments.
[0105] Optionally, step S14 determines whether the real-time question can be answered according to the association degrees of multiple feature words, and further includes: when the association degrees of multiple feature words are all less than the adaptive discrimination threshold, output that the real-time question cannot be answered. For example, when the adaptive discrimination threshold is 0.8, the calculated association degrees of multiple feature words are: 0.45, 0.6, 0.55 respectively. By comparison, it can be seen that the calculated association degrees are all less than the adaptive discrimination threshold, then output that the real-time question cannot be answered. Among them, the adaptive discrimination threshold can be obtained through the method of subsequent embodiments and will not be elaborated here.
[0106] It can be seen that through the method of the embodiments of the present application, according to the calculated correlation degrees of multiple feature words, the correlation degrees greater than the adaptive discrimination threshold can be selected as the first correlation degrees, and the correlation text corresponding to the feature word with the highest correlation degree among the multiple first correlation degrees can be selected to answer the real-time problem, so that it is possible to judge whether the problem can be answered according to the first correlation degree and the preset adaptive discrimination threshold, and answer when it can be answered.
[0107] Optionally, the adaptive discrimination threshold in the above embodiments can be pre-calculated. Specifically, refer to Figure 4 , the above method further includes:
[0108] Step S41, obtaining multiple original corpora;
[0109] Step S42, identifying the multiple original corpora to obtain the scenario labels of each original corpus;
[0110] Step S43, for any scenario label, creating a user question library for the original corpus corresponding to the scenario label;
[0111] Step S44, calculating the correlation degrees between each user question in the user question library and each original corpus corresponding to the scenario label to obtain multiple second correlation degrees;
[0112] Step S45, obtaining the adaptive discrimination threshold according to the multiple second correlation degrees and the judgment result of whether the user question can be answered.
[0113] Optionally, obtaining the adaptive discrimination threshold according to the multiple second correlation degrees and the judgment result of whether the user question can be answered includes: selecting the median of the multiple second correlation degrees as the threshold to be output; comparing each second correlation degree with the threshold to be output to judge whether each user question can be answered to obtain the judgment result, where if the second correlation degree is greater than the threshold to be output, it is determined that the user question related to the second correlation degree can be answered, and if the second correlation degree is less than the threshold to be output, it is determined that the user question related to the second correlation degree cannot be answered; comparing the judgment result with the preset standard judgment result, calculating the current loss, and correcting the threshold to be output according to the current loss, and then returning to the step of comparing each second correlation degree with the threshold to be output to judge whether each user question can be answered to obtain the judgment result and continuing to execute until the current loss is less than the preset loss threshold to obtain the adaptive discrimination threshold, that is, taking the threshold to be output when the current loss is less than the preset loss threshold as the adaptive discrimination threshold.
[0114] Among them, the original corpus in the embodiments of the present application can be the corpus collected for answering the questions input by the user. For example, the temperature today is 21°C, today is * month * day, etc.
[0115] Identify multiple original corpora and obtain the scenario tags for each original corpus. The scenario tags for each original corpus can be obtained by identifying the scenarios of the original corpora. Specifically, to identify the scenarios of the original corpora, keywords can be extracted from the original corpora, and then scenario tags can be matched based on the extracted keywords to obtain the scenario tags. For example, when extracting keywords from the original corpus "The temperature today is 21°C", the keyword "temperature" is obtained, and based on this keyword "temperature", it is matched with multiple preset scenario tags to obtain the matching scenario tag as "temperature".
[0116] For any scenario tag, create a user question bank for the original corpora corresponding to the scenario tag. The corresponding user questions can be matched according to the user's historical questions to obtain the user question bank. Specifically, the user questions answered through this original corpus can be counted, and the user question bank is composed of the counted user questions. For example, through statistical analysis of historical search records, the questions searched by users and answered through the original corpus "The temperature today is 21°C" are: "What's the temperature today?", "Is it hot today?", "How's the weather today?", etc. These questions are combined to form the user question bank corresponding to the scenario tag "temperature".
[0117] Calculate the relevance between each user question in the user question bank and each original corpus corresponding to the scenario tag as the second relevance. The relevance between each user question in the user question bank corresponding to the scenario tag and each original corpus corresponding to the scenario tag (i.e., the second relevance) can be identified according to the scenario tag. Specifically, when calculating the relevance between each user question in the user question bank and each original corpus corresponding to the scenario tag, a similarity calculation method can be used, that is, calculate the similarity between each user question and each original corpus corresponding to the scenario tag. The similarity can be calculated by calculating the cosine similarity, Jaccard similarity coefficient, Pearson correlation coefficient, etc. between the user question and the original corpus. For example, for the scenario tag "temperature", the corresponding original corpora are "The temperature today is 21°C" and "The temperature today is hotter than yesterday", and the corresponding user questions are: "What's the temperature today?", "Is it hot today?", "How's the weather today?". Then calculate the second relevance between each original corpus and each user question, and the second relevance between the original corpus "The temperature today is 21°C" and the user questions "What's the temperature today?", "Is it hot today?", "How's the weather today?" are 0.98, 0.86, and 0.89 respectively, and the second relevance between the original corpus "The temperature today is hotter than yesterday" and the user questions "What's the temperature today?", "Is it hot today?", "How's the weather today?" are 0.83, 0.87, and 0.88 respectively.
[0118] Select the median of multiple second correlation degrees as the threshold to be output. The multiple second correlation degrees can be sorted, and then the median can be selected through the sorting. For example, sort the multiple second correlation degrees to get the sorting: 0.98, 0.89, 0.88, 0.87, 0.86, 0.83, and then calculate the median as 0.875, and use this median 0.875 as the threshold to be output.
[0119] Compare each second correlation degree with the threshold to be output, and judge whether each user question can be answered to obtain a judgment result. Among them, if the second correlation degree is greater than the threshold to be output, it is determined that it can be answered; if the second correlation degree is less than the threshold to be output, it is determined that it cannot be answered. For example, in the user question library, the user questions are: "What's the temperature today?", "Is it hot today?", "How's the weather today?", and the second correlation degrees of the original corpus "The temperature today is 21°C" corresponding to the user file are: 0.98, 0.86, 0.89 respectively. Then compare the second correlation degrees with the threshold to be output 0.875, and it can be judged that the user questions "What's the temperature today?" and "How's the weather today?" can be answered, while "Is it hot today?" cannot be answered.
[0120] Among them, compare the judgment result with the preset standard judgment result, and calculate the current loss. It can be calculated through an absolute value loss function, an exponential loss function, etc. The standard judgment result in the embodiments of the present application can be the correct judgment result pre-annotated manually, and then calculate the corresponding loss according to the comparison result. For example, the correct judgment result pre-annotated manually is: "What's the temperature today?", "Is it hot today?", and "How's the weather today?" can all be answered. Then compare the judgment result that "What's the temperature today?" and "How's the weather today?" can be answered, while "Is it hot today?" cannot be answered with the preset standard judgment result that all can be answered, and it is obtained that the user question "Is it hot today?" is judged wrongly. Among the three questions, one is judged wrongly, and then the current loss can be calculated as 33.3%. The loss threshold in the embodiments of the present application can be a preset threshold. For example, the preset loss threshold is 5%. By comparison, it is obtained that the current loss of 33.3% does not meet the requirement of the preset loss threshold, that is, the current loss value is not less than the preset loss threshold. Then, the threshold to be output is corrected according to the current loss. For example, increase the threshold to be output. Continuing with the above example, increase the threshold to be output from 0.875 to 0.885. The specific increase ratio can be set / preset according to requirements, and return to the step "Compare each second correlation degree with the threshold to be output, and judge whether each user question can be answered to obtain a judgment result" to continue execution until the obtained current loss is less than the preset loss threshold. Use the threshold to be output corresponding to when the current loss is less than the preset loss threshold as the adaptive discrimination threshold, that is, use the threshold to be output obtained in the last loop as the adaptive discrimination threshold.
[0121] It can be seen that, through the method of the embodiments of the present application, it is possible to obtain a judgment result by determining whether the current question can be answered, calculate the current loss according to the judgment result, correct the to-be-output threshold according to the current loss to obtain an adaptive discrimination threshold, so that it is possible to judge whether the question can be answered according to the final adaptive discrimination threshold, thereby improving the accuracy of question answering.
[0122] Optionally, referring to Figure 5 , Figure 5 which is another schematic flowchart of the intelligent question answering method provided by the embodiments of the present application, including:
[0123] 1. Scene corpus preprocessing. Among them, when preprocessing the scene corpus, vectorization and / or normalization processing, etc. can be performed on the scene corpus;
[0124] 2. Adding scene labels to the original corpus according to the LDA (Linear Discriminant Analysis) engineering model. Among them, adding scene labels to the original corpus can automatically add scene labels through a pre-trained engineering model. Through this model, semantic recognition of the original corpus and automatic addition of labels can be performed;
[0125] 3. Establishing a coarse-grained scene-oriented text weight matrix (i.e., the weight matrix corresponding to the oriented words) through the task-inspired pre-training algorithm. Among them, establishing a coarse-grained scene-oriented text weight matrix can set corresponding text weight matrices for multiple scenes according to the task-inspired pre-training algorithm;
[0126] 4. Around the scene label, establishing a user question library using a generative model, training the user question and the associated text in a self-attention manner, taking the median of the correlation probability distribution as the adaptive threshold to judge whether the user question can be answered. Among them, the user question library can be a set of user questions generated according to the original corpus. Training the user question and the associated text in a self-attention manner, taking the median of the correlation probability distribution as the adaptive threshold (i.e., the to-be-output threshold) to judge whether the user question can be answered can be achieved by calculating the correlation degree between the user question and each associated text and comparing the correlation degree with the adaptive threshold (i.e., the to-be-output threshold);
[0127] 5. Use the context global loss (i.e., the current loss) of the associated text of the user's question sentence to predict the change trend of the association degree in real time, dynamically compensate the adaptive threshold (i.e., the threshold to be output), and optimize through multi-round training to obtain the optimal adaptive threshold (i.e., the adaptive discrimination threshold) to improve the judgment accuracy. Among them, by using the context global loss of the associated text of the user's question sentence to predict the change trend of the association degree in real time and dynamically compensate the adaptive threshold (i.e., the threshold to be output), the adaptive threshold (i.e., the threshold to be output) can be corrected, thereby improving the judgment accuracy;
[0128] 6. For the real-time question sentence input on the user interaction interface, extract the original noun words and verb phrase stems, and generate the to-be-oriented associated entity phrase (i.e., the to-be-oriented associated word). Among them, a certain interaction interface can be preset in advance, and the user can input real-time questions through this interface. The implementation method of extracting the original noun words and verb phrase stems in the real-time question can be extracted with reference to the above-mentioned implementation method;
[0129] 7. Map the to-be-oriented associated entity phrase to the service scenario orientation word list space, calculate the similarity between the to-be-oriented associated entity phrase and the orientation word, and compare and select the fine-grained semantic association of the text semantic group (i.e., the target text semantic group) corresponding to the orientation word with the highest similarity. Among them, mapping the to-be-oriented associated entity phrase to the service scenario orientation word list space and calculating the similarity between the to-be-oriented associated entity phrase and the orientation word can vectorize the to-be-oriented associated entity phrase and the service scenario orientation word, and then obtain the similarity between the two by calculating the cosine similarity, Jaccard similarity coefficient, Pearson correlation coefficient, etc. between the two;
[0130] 8. Quickly and accurately judge whether the current user's question sentence can be answered. Among them, when it is judged that the current question sentence can be answered, the user's question sentence can be answered according to the feature words corresponding to the fine-grained semantic association of the text semantic group with the highest association degree (i.e., the target text semantic group).
[0131] See Figure 6 , Figure 6 which is a schematic structural diagram of an intelligent question-answering device provided by an embodiment of the present application, including:
[0132] An associated word extraction module 601, configured to receive a real-time question and extract the feature words of the real-time question to obtain a to-be-oriented associated word;
[0133] An association degree selection module 602, configured to calculate the similarity between the to-be-oriented associated word and one or more text semantic groups corresponding to each preset service scenario in multiple preset service scenarios, and select the text semantic group with the highest similarity as the target text semantic group;
[0134] An association degree calculation module 603, configured to calculate the association degree between the to-be-oriented associated word and multiple feature words in the target text semantic group;
[0135] A question answering module 604 is configured to determine whether a real-time question is answerable according to the relevance degrees of multiple feature words.
[0136] Optionally, the question answering module 604 includes:
[0137] A first relevance degree obtaining sub-module is configured to select, according to the relevance degrees of multiple feature words, the relevance degrees greater than an adaptive discrimination threshold as the first relevance degrees;
[0138] A first relevance degree selection module is configured to select the relevant text corresponding to the feature word with the highest relevance degree among the first relevance degrees to answer the real-time question.
[0139] Optionally, the first relevance degree obtaining sub-module is specifically configured to output that the real-time question is not answerable when the relevance degrees of multiple feature words are all less than the adaptive discrimination threshold.
[0140] Optionally, the above-mentioned device further includes:
[0141] A raw corpus obtaining module is configured to obtain multiple raw corpora;
[0142] A raw corpus identification module is configured to identify multiple raw corpora to obtain the scenario labels of each raw corpus;
[0143] A question library creation module is configured to create a user question library of the raw corpora corresponding to the scenario label for any scenario label;
[0144] A second relevance degree obtaining module is configured to calculate the relevance degrees between each user question in the user question library and each raw corpus corresponding to the scenario label to obtain multiple second relevance degrees;
[0145] An adaptive discrimination threshold calculation module is configured to obtain an adaptive discrimination threshold according to multiple second relevance degrees and the judgment result of whether the user question is answerable.
[0146] Optionally, the adaptive discrimination threshold calculation module includes:
[0147] A threshold selection sub-module is configured to select the median of multiple second relevance degrees as the threshold to be output;
[0148] A question judgment sub-module is configured to compare each second relevance degree with the threshold to be output to judge whether each user question is answerable to obtain a judgment result, wherein if the second relevance degree is greater than the threshold to be output, it is determined to be answerable, and if the second relevance degree is less than the threshold to be output, it is determined to be not answerable;
[0149] A threshold revision sub-module, which is used to compare the judgment result with the preset standard judgment result, calculate the current loss, correct the to-be-output threshold according to the current loss, return to compare each second correlation degree and the to-be-output threshold, judge whether each user question can be answered, and continue to execute the step of obtaining the judgment result until the current loss is less than the preset loss threshold, so as to obtain an adaptive discrimination threshold.
[0150] Optionally, the correlation degree selection module 602 includes:
[0151] A text similarity calculation sub-module, which is used to calculate the similarity between the to-be-directed correlation word and one or more text semantic groups corresponding to each preset service scenario in multiple preset service scenarios, and obtain multiple text similarities;
[0152] A text similarity selection sub-module, which is used to select the text semantic group corresponding to the largest text similarity value among the multiple text similarities as the target text semantic group.
[0153] Optionally, the text similarity calculation sub-module is specifically used to calculate the similarity between the to-be-directed correlation word and multiple text semantic groups according to the pre-created weight matrix, and obtain multiple text similarities.
[0154] Optionally, the correlation word extraction module 601 is specifically used to receive the real-time question input by the user on the interaction interface, and extract the feature words of the real-time question to obtain the to-be-directed correlation word.
[0155] It can be seen that through the device of the embodiment of the present application, the text semantic group of the corresponding service scenario can be selected according to the received real-time question, and then the corresponding associated text can be selected according to the associated text semantic group corresponding to the service scenario to answer the real-time question. Therefore, not only can the efficiency of question answering be improved through the matching of service scenarios, but also the accuracy of question answering can be improved.
[0156] The embodiment of the present invention also provides an electronic device, as Figure 7 shown, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,
[0157] The memory 703 is used to store a computer program;
[0158] When the processor 701 is used to execute the program stored on the memory 703, the following steps are implemented:
[0159] Receive a real-time question, and extract the feature words of the real-time question to obtain the to-be-directed correlation word;
[0160] Calculate the similarity between the correlation word to be oriented and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and select the text semantic group with the highest similarity as the target text semantic group;
[0161] Calculate the correlation degree between the correlation word to be oriented and multiple feature words in the target text semantic group;
[0162] Determine whether the real-time question can be answered according to the correlation degrees of multiple feature words.
[0163] The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0164] The communication interface is used for communication between the above electronic device and other devices.
[0165] The memory may include a Random Access Memory (RAM), and may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0166] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0167] In another embodiment provided by the present invention, a computer-readable storage medium is also provided. A computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any of the above intelligent question-answering methods are implemented.
[0168] In another embodiment provided by the present invention, there is also provided a computer program product containing instructions, which when running on a computer, causes the computer to execute any one of the intelligent question-answering methods in the above embodiments.
[0169] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
[0170] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device including the element.
[0171] Each embodiment in this specification is described in a related manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, electronic device, storage medium, and computer program product, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant parts, reference can be made to the partial description of the method embodiments.
[0172] The above are only the preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are all included in the protection scope of the present invention.
Claims
1. An intelligent question-answering method, characterized in that, the method includes: Receiving a real-time question, and extracting the feature words of the real-time question to obtain a to-be-oriented correlation word; Calculating the similarity between the to-be-oriented correlation word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and selecting the text semantic group with the highest similarity as the target text semantic group; Calculating the correlation degree between the to-be-oriented correlation word and multiple feature words in the target text semantic group; Determining whether the real-time question can be answered according to the correlation degrees of the multiple feature words; wherein, the determining whether the real-time question can be answered according to the correlation degrees of the multiple feature words includes: According to the correlation degrees of the multiple feature words, selecting the correlation degrees greater than the adaptive discrimination threshold as the first correlation degrees, wherein the steps of obtaining the adaptive discrimination threshold include: obtaining multiple original corpora; identifying the multiple original corpora to obtain the scenario labels of each original corpus; for any scenario label, creating a user question bank of the original corpus corresponding to the scenario label; calculating the correlation degrees between each user question in the user question bank and each original corpus corresponding to the scenario label to obtain multiple second correlation degrees; obtaining the adaptive discrimination threshold according to the multiple second correlation degrees and the judgment result of judging whether the user question can be answered; Selecting the correlation text corresponding to the feature word with the highest correlation degree among the first correlation degrees to answer the real-time question.
2. The method according to claim 1, characterized in that, the determining whether the real-time question can be answered according to the correlation degrees of the multiple feature words includes: When the correlation degrees of the multiple feature words are all less than the adaptive discrimination threshold, outputting that the real-time question cannot be answered.
3. The method according to claim 1, characterized in that, the obtaining the adaptive discrimination threshold according to the multiple second correlation degrees and the judgment result of judging whether the user question can be answered includes: Selecting the median of the multiple second correlation degrees as the to-be-output threshold; Comparing each of the second correlation degrees with the to-be-output threshold, and judging whether each user question can be answered to obtain a judgment result, wherein if the second correlation degree is greater than the to-be-output threshold, it is determined that it can be answered, and if the second correlation degree is less than the to-be-output threshold, it is determined that it cannot be answered; Comparing the judgment result with a preset standard judgment result, calculating to obtain a current loss, and correcting the to-be-output threshold according to the current loss, and returning to the step of comparing each of the second correlation degrees with the to-be-output threshold and judging whether each user question can be answered to obtain a judgment result, and continuing to execute until the current loss is less than a preset loss threshold to obtain the adaptive discrimination threshold.
4. The method according to claim 1, characterized in that, the calculating the similarity between the to-be-oriented correlation word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and selecting the text semantic group with the highest similarity as the target text semantic group includes: Calculate the similarity between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and obtain multiple text similarities; Select the text semantic group corresponding to the text similarity with the largest value among the multiple text similarities as the target text semantic group.
5. The method according to claim 4, wherein, the calculating the correlation degree between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and obtaining multiple text similarities includes: Calculate the similarity between the to-be-oriented related word and the multiple text semantic groups according to the pre-created weight matrix, and obtain the multiple text similarities.
6. An intelligent question answering device, wherein, the device includes: A related word extraction module, configured to receive a real-time question, and extract the feature words of the real-time question to obtain a to-be-oriented related word; A correlation degree selection module, configured to calculate the similarity between the to-be-oriented related word and one or more text semantic groups corresponding to each preset service scenario among multiple preset service scenarios, and select the text semantic group with the highest similarity as the target text semantic group; A correlation degree calculation module, configured to calculate the correlation degree between the to-be-oriented related word and multiple feature words in the target text semantic group; A question answering module, configured to determine whether the real-time question can be answered according to the correlation degrees of the multiple feature words, including: selecting the correlation degrees greater than the adaptive discrimination threshold as the first correlation degrees according to the correlation degrees of the multiple feature words; selecting the associated text corresponding to the feature word with the highest correlation degree among the first correlation degrees to answer the real-time question; wherein, the steps of obtaining the adaptive discrimination threshold include: obtaining multiple original corpora; identifying the multiple original corpora to obtain the scenario labels of each original corpus; for any scenario label, creating a user question library of the original corpus corresponding to the scenario label; calculating the correlation degrees between each user question in the user question library and each original corpus corresponding to the scenario label to obtain multiple second correlation degrees; obtaining the adaptive discrimination threshold according to the multiple second correlation degrees and the judgment result of determining whether the user question can be answered.
7. An electronic device, wherein, It includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus; The memory is used to store a computer program; The processor is configured to implement the method steps described in any one of claims 1-5 when executing the program stored on the memory.
8. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the method steps described in any one of claims 1-5.
Citation Information
Patent Citations
Method and device for processing unknown questions in intelligent questions and answers, computer equipment and medium
CN111309881A