Model training method, question response method, device and apparatus
By selecting similar negative examples from the knowledge base to train the semantic matching model, the intention of intent recognition in the existing technology is solved, the technical problems of intent recognition in the existing technology are solved, and the technical problems of intelligent customer service in intent recognition are solved, and the response accuracy of intelligent customer service is improved.
Patent Information
- Application Number
- CN202210319488.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-29
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2042-03-29
AI Technical Summary
In the intent recognition process of existing intelligent customer service, the intent is split too finely, which increases confusion, reduces the recognition accuracy of the matching model, and leads to poor response effects.
Build a knowledge base, select a second knowledge point similar to the first knowledge point as a negative example, and train the semantic matching model through comparative learning to improve the ability to recognize subtle differences between intentions.
It improves the accuracy of intelligent customer service's responses to user questions, can better identify and distinguish subtle differences between different intentions, and improves response results.
Smart Images

Figure CN114637835B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of model training technology, and in particular to a model training method, question answering method, device and equipment. Background Art
[0002] Intent recognition refers to identifying the purpose of a user's question. It's a crucial component of intelligent customer service. By identifying the user's intent, intelligent customer service can find similar questions in the knowledge base and push the answer to the user.
[0003] In existing technologies, in order to make the responses of intelligent customer service more accurate, R&D personnel will continuously refine and split the intent. When a user asks a question, they will find multiple similar intents from the refined intent, and then use the matching model to distinguish the one that is most similar to the user's intent. From it, they will find the answer corresponding to the user's input question and respond to the user more accurately.
[0004] However, when existing technologies split intents, the finer the split, the greater the confusion between intents, which will cause the matching model to be unable to distinguish subtle differences between similar intents, ultimately leading to a decrease in the recognition accuracy of the matching model and poor response results of intelligent customer service. Summary of the Invention
[0005] The present application provides a model training method, question answering method, device and equipment for solving the problem of poor answering effect of existing intelligent customers.
[0006] In a first aspect, an embodiment of the present application provides a model training method, comprising:
[0007] Obtaining business corpus of the target business, and constructing a knowledge base based on the business corpus, wherein the knowledge base stores knowledge points for answering questions;
[0008] According to the knowledge base, a first knowledge point, a representative question and similar questions answered by the first knowledge point are obtained, wherein the representative question and the similar questions have the same semantics;
[0009] Acquire, from the knowledge base, a second knowledge point whose similarity to the first knowledge point is greater than a preset similarity threshold, and a representative question and similar questions of the second knowledge point;
[0010] The representative questions and similar questions of the first knowledge point are used as positive examples, and the representative questions and similar questions of the second knowledge point are used as negative examples to construct training samples;
[0011] The semantic matching model to be trained is trained according to the training samples to obtain a trained semantic matching model.
[0012] In a possible design of the first aspect, training the semantic matching model to be trained according to the training sample to obtain the trained semantic matching model includes:
[0013] According to the positive examples and negative examples in the training samples, comparative learning training is performed on the semantic matching model to be trained to obtain a trained semantic matching model, and the number of the negative examples is greater than the number of the positive examples.
[0014] In another possible design of the first aspect, performing comparative learning on the semantic matching model to be trained based on the positive examples and negative examples in the training samples to obtain the trained semantic matching model includes:
[0015] Inputting the preset anchor text, the positive examples and the negative examples in the training sample into the language encoding layer of the semantic matching model to be trained for encoding, thereby obtaining an anchor text vector, a positive example sentence vector and a negative example sentence vector;
[0016] Calculating contrast loss based on the anchor text vector, the positive sentence vector, and the negative sentence vector;
[0017] The semantic matching model to be trained is trained according to the contrast loss to obtain a trained semantic matching model.
[0018] In another possible design of the first aspect, constructing a knowledge base based on the business corpus includes:
[0019] Clustering the business corpus according to semantic similarity to obtain N clusters, where N is a positive integer not less than 1;
[0020] Each cluster is split or merged to obtain M knowledge points. The semantics of each knowledge point are different. M is a positive integer not less than 1.
[0021] The knowledge base is constructed based on the M knowledge points.
[0022] In another possible design of the first aspect, constructing the knowledge base based on the M knowledge points includes:
[0023] Obtaining representative questions answered by various knowledge points in the business corpus, and determining the semantics of the representative questions;
[0024] According to the semantics of the representative question, questions matching the semantics of the representative question are retrieved from the business corpus as similar questions to the representative question;
[0025] The knowledge base is constructed based on each knowledge point, a representative question of each knowledge point, and similar questions to the representative questions.
[0026] In another possible design of the first aspect, obtaining the first knowledge point according to the knowledge base includes:
[0027] At least one knowledge point is selected from the knowledge points in the knowledge base as the first knowledge point.
[0028] In another possible design of the first aspect, obtaining, based on the knowledge base, a first knowledge point, representative questions and similar questions answered by the first knowledge point includes:
[0029] Obtaining a first knowledge point and L questioning methods corresponding to the first knowledge point from the knowledge base, where L is a positive integer not less than 1;
[0030] Determine the type and quantity of each question method corresponding to the first knowledge point;
[0031] Determine a representative question of the first knowledge point from the L questioning methods according to the type and number of each questioning method;
[0032] Determine similar questions to the first knowledge point based on representative questions of the first knowledge point.
[0033] In another possible design of the first aspect, obtaining, from the knowledge base, a second knowledge point having a similarity with the first knowledge point greater than a preset similarity threshold includes:
[0034] Obtaining expression keywords for each knowledge point in the knowledge base, wherein the expression keywords are keywords that appear in the text of the knowledge point;
[0035] A knowledge point corresponding to an expression keyword whose similarity with the expression keyword of the first knowledge point is greater than a preset similarity threshold is obtained as the second knowledge point.
[0036] In another possible design of the first aspect, obtaining a second knowledge point similar to the first knowledge point, a representative question, and similar questions of the second knowledge point from the knowledge base includes:
[0037] Obtaining the second knowledge point and K questioning methods corresponding to the second knowledge point from the knowledge base, where K is a positive integer not less than 1;
[0038] Determining the types and quantities of various questioning methods corresponding to the second knowledge point;
[0039] According to the type and number of each questioning method, a representative question of the second knowledge point is determined from the K questioning methods;
[0040] Determine similar questions to the second knowledge point based on representative questions of the second knowledge point.
[0041] In a second aspect, an embodiment of the present application provides a question answering method, comprising:
[0042] Get the target question submitted by the user;
[0043] Determine the rough intent of the target problem according to a preset classification model;
[0044] Retrieving at least two groups of answer pairs that answer the target question from the knowledge base corresponding to the coarse intent, wherein the answer pairs include questions and knowledge points that answer the questions;
[0045] Determining a target answer pair from the at least two groups of answer pairs using a pre-trained semantic matching model, wherein the semantic matching model is trained through comparative learning using positive and negative examples as training samples, the positive examples including representative questions and similar questions of a first knowledge point, and the negative examples including representative questions and similar questions of a second knowledge point whose similarity to the first knowledge point is greater than a preset similarity threshold;
[0046] Selecting a knowledge point from the target answer pair to answer the target question;
[0047] determining a target response pair from the at least two groups of response pairs according to the sorting result;
[0048] Select the knowledge points in the target answer pair and answer the target question.
[0049] In a third aspect, an embodiment of the present application provides a model training device, comprising:
[0050] A knowledge base construction module is used to obtain business corpus of the target business and construct a knowledge base based on the business corpus, wherein the knowledge base stores knowledge points for answering questions;
[0051] a question acquisition module, configured to acquire, from the knowledge base, a first knowledge point, a representative question answered by the first knowledge point, and similar questions, wherein the representative question and the similar question have the same semantics;
[0052] A knowledge point acquisition module, configured to acquire, from the knowledge base, a second knowledge point whose similarity to the first knowledge point is greater than a preset similarity threshold, and a representative question and similar questions of the second knowledge point;
[0053] a sample construction module, configured to construct training samples by taking the representative questions and similar questions of the first knowledge point as positive examples and the representative questions and similar questions of the second knowledge point as negative examples;
[0054] The training module is used to train the semantic matching model to be trained according to the training samples to obtain a trained semantic matching model.
[0055] In a fourth aspect, an embodiment of the present application provides a question answering device, comprising:
[0056] The acquisition module is used to obtain the target question submitted by the user;
[0057] A classification module, configured to determine a rough idea of the target problem based on a preset classification model;
[0058] A retrieval module is configured to retrieve at least two groups of answer pairs that answer the target question from the knowledge base corresponding to the coarse intent, wherein the answer pairs include a question and a knowledge point that answers the question;
[0059] a matching module for determining a target answer pair from the at least two groups of answer pairs using a pre-trained semantic matching model, wherein the semantic matching model is trained through comparative learning using positive and negative examples as training samples, the positive examples comprising representative questions and similar questions of a first knowledge point, and the negative examples comprising representative questions and similar questions of a second knowledge point whose similarity to the first knowledge point is greater than a preset similarity threshold;
[0060] The answer module is used to select the knowledge points in the target answer pair and answer the target question.
[0061] In a fifth aspect, an embodiment of the present application provides a computer device, comprising a memory and at least one processor;
[0062] The memory stores computer-executable instructions;
[0063] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method described above.
[0064] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the method described above.
[0065] In a seventh aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which implement the method described above when executed by a processor.
[0066] The model training method, question answering method, device and equipment provided in the embodiments of the present application construct a knowledge base, select a second knowledge point similar to the first knowledge point in the knowledge base, use the representative questions and similar questions of the first knowledge point as positive examples, and use the representative questions and similar questions of the second knowledge point as negative examples. The constructed training samples can be used to perform comparative training on the model, so that the trained semantic matching model can better identify and distinguish subtle differences between knowledge points, thereby improving the accuracy of answering user questions. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application;
[0068] Figure 1 A schematic diagram of a scenario of the question answering method provided in an embodiment of the present application;
[0069] Figure 2 A flowchart of the first embodiment of the model training method provided in the embodiment of the present application;
[0070] Figure 3 A flowchart of the second embodiment of the model training method provided in the embodiment of the present application;
[0071] Figure 4 A schematic diagram of the construction of training data provided in an embodiment of the present application;
[0072] Figure 5 A schematic diagram of the framework of the semantic matching model provided in the embodiment of the present application;
[0073] Figure 6 A schematic diagram of the framework of the knowledge base structure provided in the embodiment of the present application;
[0074] Figure 7 A flowchart of a question answering method provided in an embodiment of the present application;
[0075] Figure 8 A schematic diagram of the structure of the model training device provided in an embodiment of the present application;
[0076] Figure 9 A schematic diagram of the structure of a question answering device provided in an embodiment of the present application;
[0077] Figure 10 A schematic diagram of the question answering process provided in an embodiment of the present application;
[0078] Figure 11 A schematic diagram of the structure of a computer device provided in an embodiment of the present application.
[0079] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0080] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0081] Figure 1 A schematic diagram of a scenario of a question answering method provided in an embodiment of the present application, such as Figure 1 As shown, when a user is talking to an intelligent customer service representative through the Internet, the user can enter questions, such as "When will the goods be shipped?", "Where is the logistics?", etc. After receiving the questions raised by the user, the intelligent customer service representative needs to identify the user's true intention based on the questions entered by the user, so that it can accurately answer the user's questions.
[0082] In the prior art, intent recognition mostly uses text classification methods, but an obvious disadvantage of text classification methods is that they require a large amount of training data to train the text classification model, and the training data under each category also needs to be balanced. In real-life applications, in order to ensure more accurate responses, intents are constantly split and refined. The more refined the intent is, the greater the confusion between intents, and the more difficult it is to collect training data under each refined category, resulting in a decrease in the recognition accuracy of the text classification model. In response to the above problems, the prior art has proposed another method, which divides intent into several coarse categories, first identifies a coarse intent through a classification model, and then identifies the fine intent under the coarse intent through the Frequently Asked Questions (FAQ) answering method under the coarse intent and responds to the user's intent.
[0083] FAQ answering generally uses a retrieval-based approach. This approach first analyzes the user's question, then uses the parsed question to search the index for question-answer pairs similar to the user's question. These pairs are then scored and ranked using a semantic matching model, ultimately outputting the answer to the highest-scoring pair. This FAQ answering approach can address the difficulty of collecting and unbalanced training data for refined intents. However, as intents become more refined, similarities between them increase, and the semantic matching model can become confused by the refined intents, resulting in reduced answer accuracy.
[0084] In response to the above problems, the embodiments of the present application provide a model training method, a question answering method, an apparatus and a device, which selects a second knowledge point with a high degree of similarity to the first knowledge point from the knowledge base, takes the representative questions and similar questions of the first knowledge point as negative examples, and takes the representative questions and similar questions of the second knowledge point as positive examples, and performs comparative learning and training on the semantic matching model, so that the semantic matching model can better identify and distinguish the subtle differences between different intentions, find the knowledge point that can most accurately respond to the user's intention, and respond to the user's intention.
[0085] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0086] Figure 2 This is a flow chart of the first embodiment of the model training method provided in the embodiment of the present application. The method can be applied to computer devices, such as Figure 2 As shown, the method may include the following steps:
[0087] S201: Obtain business corpus of the target business, and construct a knowledge base based on the business corpus.
[0088] The knowledge base stores knowledge points for answering questions. For example, a knowledge point can form an answer pair with the question being answered. For example, if the question is "How to use the waybill number to query logistics", the knowledge point can be the answer to the question.
[0089] In this embodiment, knowledge points can also represent user intent. For example, different users may ask questions in different ways (i.e., user questions), but their actual intent may be the same. For example, each user may want to know how to query logistics by order number, but each user may ask questions in a different way. For user questions with the same intent but different questioning methods, the knowledge point that answers the user question can be the same.
[0090] In this embodiment, different businesses have different business corpora. Taking intelligent customer service as an example, businesses can be classified into order reminders and after-sales service. Taking order reminders as an example, order reminders can be further divided into shipping inquiries and logistics inquiries. For example, users may ask "when will the goods be shipped" and "where is the logistics?" Further, logistics inquiries can be further divided into waybill number inquiries. For example, users may ask "how to use the waybill number to query logistics" and "where can I see the waybill number?" The answers to these questions are knowledge points. By sorting out and distinguishing the knowledge points and the answered questions in the business corpus, a knowledge base is constructed.
[0091] S202: Obtain a first knowledge point, representative questions answered by the first knowledge point, and similar questions based on the knowledge base.
[0092] In this embodiment, the representative question may refer to a common question format corresponding to the first knowledge point, and the similar question refers to a question format similar to the representative question. That is, the representative question and the similar question have the same semantics.
[0093] For example, representative questions can cover a variety of different types of questioning methods. For example, for the same intention (for example, a user wants to know how to query logistics by order number), different users have different ways of asking questions. Representative questions refer to one or more questioning methods that can represent these different questioning methods.
[0094] For example, each knowledge point may have only a few or dozens of representative questions, and each representative question may have several or dozens of similar questions. That is, a knowledge point may have multiple representative questions, and each representative question may have multiple similar questions.
[0095] In this embodiment, any of the M knowledge points in the knowledge base has a representative question and similar questions. When constructing the knowledge base, a binding relationship can be established between each knowledge point and its corresponding representative question and similar question based on the business corpus. Through the binding relationship, the representative question and similar question corresponding to each knowledge point can be found.
[0096] S203: Acquire a second knowledge point whose similarity to the first knowledge point is greater than a preset similarity threshold, and a representative question and similar questions of the second knowledge point from the knowledge base.
[0097] In this embodiment, the second knowledge point refers to a knowledge point that is highly similar to the first knowledge point and is easily confused. A preset similarity threshold can be set. By comparing the similarities between the various knowledge points, if the similarity between the two knowledge points is greater than the preset similarity threshold, it indicates that the two knowledge points are highly similar and easily confused.
[0098] Illustratively, the first knowledge point may be one or more knowledge points arbitrarily selected from the M knowledge points in the knowledge base, which may include multiple corresponding second knowledge points.
[0099] S204: Take the representative questions and similar questions of the first knowledge point as positive examples, and the representative questions and similar questions of the second knowledge point as negative examples, to construct training samples.
[0100] S205 : Train the semantic matching model to be trained according to the training samples to obtain a trained semantic matching model.
[0101] In this embodiment, the number of first knowledge points can be one or more, and each first knowledge point can correspond to multiple second knowledge points, that is, one positive example can correspond to multiple negative examples, and the number of negative examples is greater than the number of positive examples.
[0102] Among them, when training the semantic matching model to be trained, the difference between positive examples and negative examples should be magnified to improve the model's recognition of positive examples and negative examples.
[0103] The embodiment of the present application constructs a knowledge base, selects a second knowledge point similar to the first knowledge point from the knowledge base, takes the representative questions and similar questions of the first knowledge point as positive examples, and takes the representative questions and similar questions of the second knowledge point as negative examples. The constructed training samples can be used to perform comparative training on the model, so that the trained semantic matching model can better identify and distinguish subtle differences between knowledge points, thereby improving the accuracy of answering user questions.
[0104] Figure 3 This is a flow chart of the second embodiment of the model training method provided in the embodiment of the present application, as shown in FIG. Figure 3 As shown, it may include the following steps:
[0105] S301: Obtain business corpus of the target business, and construct a knowledge base based on the business corpus.
[0106] S302: Obtain a first knowledge point, representative questions answered by the first knowledge point, and similar questions based on the knowledge base.
[0107] S303: Acquire a second knowledge point whose similarity to the first knowledge point is greater than a preset similarity threshold, and a representative question and similar questions of the second knowledge point from the knowledge base;
[0108] S304: Take the representative question and similar questions of the first knowledge point as positive examples, and the representative question and similar questions of the second knowledge point as negative examples, to construct training samples;
[0109] S305 , performing comparative learning training on the semantic matching model to be trained based on the positive examples and negative examples in the training samples to obtain a trained semantic matching model.
[0110] The knowledge base stores knowledge points for answering questions, representing questions with the same semantics as similar questions. In this embodiment, steps S301-S304 are the same as steps S201-S204 above and will not be repeated here. In step S305, comparative learning supervision is a type of self-supervised learning, which mainly involves automatically constructing similar and dissimilar instances. The learned model is required to make similar instances closer in the projected space and dissimilar instances farther apart in the projected space.
[0111] Among them, similar instances are positive examples, including representative questions and similar questions with the first knowledge point, and dissimilar instances are negative examples, including representative questions and similar questions with the second knowledge point.
[0112] Figure 4 A schematic diagram of the construction of the training data provided in the embodiment of the present application is shown in FIG. Figure 4 As shown, taking the knowledge base as an example, including knowledge points 1, 2, and 3, each knowledge point includes at least one representative question and similar questions similar to the representative question. Knowledge point 1 has D representative questions, namely, representative question 1, representative question 2, and representative question D, where D is a positive integer not less than 1. Representative question 1 has two similar questions, namely similar question 11 and similar question 12. Representative question 2 has three similar questions, namely similar question 21, similar question 22, and similar question 23. Representative question D has two representative questions, namely representative question D1 and representative question D2.
[0113] In this example, knowledge point 1 is used as the first knowledge point, and knowledge points 2 and 3 are used as the second knowledge points. The representative question 1 and similar questions 11 and 12 of the first knowledge point are used as similar instances (i.e., positive examples). The representative question and similar questions of knowledge point 2 are used as dissimilar instances (i.e., the first negative example). The representative question and similar questions of knowledge point 3 are used as dissimilar instances (i.e., the second negative example). The resulting training sample includes the positive example, the first negative example, and the second negative example.
[0114] The embodiment of the present application constructs positive and negative examples and trains the semantic matching model to be trained through comparative learning, so that the model can learn subtle semantic differences and improve the ability to recognize and distinguish detailed intentions.
[0115] Furthermore, in some embodiments, the above step S305 can be implemented by the following steps:
[0116] Input the preset anchor text, positive examples and negative examples in the training sample into the language encoding layer of the semantic matching model to be trained for encoding, and obtain the anchor text vector, positive example sentence vector and negative example sentence vector;
[0117] Calculate the contrast loss based on the anchor text vector, positive sentence vector, and negative sentence vector;
[0118] The semantic matching model to be trained is trained according to the contrast loss to obtain a trained semantic matching model.
[0119] In this embodiment, the semantic matching model to be trained may include a semantic encoding layer and a contrastive loss layer. The semantic encoding layer generates sentence vector representations for the input data, followed by a contrastive loss layer for calculating contrastive loss. The idea is to maximize the similarity between the adjacent positive example sentence vectors and the anchor text vector, while making the negative example sentence vectors farther away from the anchor text vector. The vector similarity can be the commonly used cosine similarity.
[0120] Exemplarily, the Bidirectional Encoder Representation from Transformers (BERT) can be selected as the preset semantic encoding layer.
[0121] For example, Figure 5 A schematic diagram of the framework of the semantic matching model provided in the embodiment of the present application is shown in FIG. Figure 5 As shown, the input data includes anchor text, positive text, negative text 51, negative text 52, and negative text 53. BERT is used as the semantic encoding layer to generate sentence vector representations for the input text, resulting in anchor text vector representations, positive text vector representations, negative text vector representations 54, negative text vector representations 55, and negative text vector representations 56. The contrastive loss layer calculates the contrastive loss based on the sentence vector representations generated by BERT. The idea is to maximize the similarity between the positive sentence vector and the anchor text while making the negative sentence vector further away from the anchor text. Here, cosine similarity can be used as the vector similarity.
[0122] The embodiment of the present application selects representative questions and similar questions of the second knowledge point that are easily confused with the first knowledge point as negative examples, and performs comparative learning through positive and negative examples, so that the model can learn deep and subtle semantic differences and improve the generalization ability of the model.
[0123] In some embodiments, the above step S201 of "building a knowledge base based on the business corpus" can be implemented by the following steps:
[0124] Cluster the business corpus according to semantic similarity to obtain N clusters;
[0125] Split or merge each cluster to obtain M knowledge points;
[0126] Based on M knowledge points, a knowledge base is constructed.
[0127] Among them, N is a positive integer not less than 1, the semantics of each knowledge point are different, and M is a positive integer not less than 1.
[0128] In this embodiment, the clustering process can be unsupervised and performed by a computer. Each cluster obtained by clustering can actually be understood as a rough aggregation of similar knowledge points. After clustering is completed, each cluster is split or merged separately, splitting knowledge points with more distant similarity into different clusters, and merging knowledge points with closer similarity into a single knowledge point.
[0129] The embodiment of the present application clusters the business corpus to obtain clusters, and then sorts the clusters and splits or merges them to obtain M knowledge points. This can reasonably distinguish each knowledge point and avoid the occurrence of identical knowledge points in the M knowledge points.
[0130] Furthermore, the above step of "building a knowledge base based on M knowledge points" can be specifically implemented through the following steps:
[0131] Obtain representative questions answered at each knowledge point in the business corpus and determine the semantics of the representative questions;
[0132] According to the semantics of the representative's question, questions that match the semantics of the representative's question are retrieved from the business corpus and regarded as similar questions to the representative's question;
[0133] A knowledge base is constructed based on each knowledge point, the representative question of each knowledge point and the similar questions of the representative questions.
[0134] For each knowledge point, we can identify common questions corresponding to each knowledge point. These are representative questions. For example, there are typically only a few or a dozen representative questions. After obtaining these representative questions, we further expand the list of similar questions using business corpus data. We search the business corpus for similar questions that share the same semantics as the representative questions. Finally, we associate each knowledge point with its representative and similar questions, creating question-answer pairs and ultimately building a knowledge base.
[0135] For example, Figure 6 A schematic diagram of the framework of the knowledge base structure provided in the embodiment of the present application is shown as follows: Figure 6 As shown, the business corpus can be clustered to form N clusters. Each cluster can be sorted and knowledge points can be split or merged. For example, knowledge points with close similarity can be merged, while knowledge points with distant similarity can be split. After sorting each cluster, several knowledge points can be obtained, such as knowledge point 61, knowledge point 62, knowledge point 63, knowledge point 64, and knowledge point 65. The common questions corresponding to each knowledge point can be used as representative questions. Based on the representative questions, similar questions can be further expanded from the business corpus. Ultimately, representative questions and similar questions for each knowledge point are obtained and stored in the knowledge base, completing the construction of the knowledge base.
[0136] The embodiment of the present application determines the semantics of the representative question and expands similar questions to the representative question from the business corpus. Based on the representative question and similar questions, positive examples and negative examples can be constructed as training samples to train the model, thereby improving the model's recognition accuracy between different knowledge points.
[0137] In some embodiments, the above step S202 can be implemented by the following steps:
[0138] Obtaining a first knowledge point and L questioning methods corresponding to the first knowledge point in the knowledge base;
[0139] Determine the types and number of questioning methods corresponding to the first knowledge point;
[0140] According to the type and number of each questioning method, determine the representative question of the first knowledge point from L questioning methods;
[0141] Determine similar questions to the first knowledge point based on representative questions of the first knowledge point.
[0142] Wherein, L is a positive integer not less than 1.
[0143] In this embodiment, when the user intentions of L questioning methods are the same, the first knowledge point can be used to answer the L questioning methods. Among the L questioning methods, the most representative questioning method can be found as the representative question based on the type and number of each questioning method (i.e., questioning frequency).
[0144] In some implementations, the knowledge base includes several knowledge points, and the first knowledge point may be at least one knowledge point selected from the knowledge points in the knowledge base.
[0145] The embodiment of the present application can find the most representative question method among L question methods through the type and number of each question method, and use it as a representative question. Similar questions can be determined through the representative question, which can make the two samples used as positive examples different and improve the generalization ability of the model.
[0146] In some embodiments, the step S203 of "obtaining a second knowledge point in the knowledge base having a similarity with the first knowledge point greater than a preset similarity threshold" can be specifically implemented by the following steps:
[0147] Obtain the expression keywords of each knowledge point in the knowledge base, where the expression keywords are the keywords that appear in the text of the knowledge point;
[0148] A knowledge point corresponding to an expression keyword whose similarity with the expression keyword of the first knowledge point is greater than a preset similarity threshold is obtained as the second knowledge point.
[0149] In this embodiment, the second knowledge point refers to a knowledge point that is easily confused with the first knowledge point, that is, the second knowledge point is highly similar to the first knowledge point and difficult to distinguish. The expression keyword of the first knowledge point can be a keyword in the text of the first knowledge point, and the expression keyword can be obtained by performing keyword extraction on the text of the first knowledge point.
[0150] Exemplarily, the occurrence frequency of each word in the text of the first knowledge point may be obtained, and words with an occurrence frequency greater than a preset frequency threshold may be used as expression keywords.
[0151] Exemplarily, when there is a knowledge point in the knowledge base whose expression keyword reaches a preset similarity threshold with the expression keyword of the first knowledge point, the knowledge point is used as the second knowledge point, wherein the number of the second knowledge points includes at least two.
[0152] The embodiment of the present application uses keywords to find knowledge points that are easily confused with the first knowledge points as the second knowledge points, and uses representative questions and similar questions of the second knowledge points as negative examples. Negative examples can be constructed purposefully, so that the distinction between positive examples and negative examples is small, so that the model can learn deeper semantic information, and avoid the excessive distinction between positive examples and negative examples that causes the model to only be able to learn shallow keyword differences.
[0153] In some embodiments, the above step S203 of "obtaining a second knowledge point similar to the first knowledge point, a representative question of the second knowledge point, and similar questions in the knowledge base" can be specifically implemented by the following steps:
[0154] Obtaining the second knowledge point and K questioning methods corresponding to the second knowledge point in the knowledge base;
[0155] Determine the types and number of questioning methods corresponding to the second knowledge point;
[0156] According to the type and number of each questioning method, a representative question of the second knowledge point is determined from the K questioning methods;
[0157] Determine similar questions to the second knowledge point based on representative questions of the second knowledge point.
[0158] Wherein, K is a positive integer not less than 1.
[0159] In this embodiment, when the user intent of K question types is the same, the second knowledge point can be used to answer these K question types. Among these K question types, the most representative question type can be identified based on the type and number of each question type (i.e., question frequency) as the representative question. Question types with semantic similarities to the representative question can then be identified in the business corpus as similar questions.
[0160] Figure 7This is a flow chart of a question answering method provided in an embodiment of the present application. This method can be applied to computer devices, such as Figure 7 As shown, the method may specifically include the following steps:
[0161] S701, obtaining the target question submitted by the user;
[0162] S702: Determine the rough intent of the target problem based on a preset classification model;
[0163] S703, searching the knowledge base corresponding to the coarse intent to obtain at least two groups of answer pairs that answer the target question;
[0164] S704: using a pre-trained semantic matching model, determining a target response pair from at least two groups of response pairs;
[0165] S705: Select the knowledge point in the target answer pair and answer the target question.
[0166] Among them, the answer pair includes a question and a knowledge point that answers the question. The semantic matching model is obtained through comparative learning based on positive examples and negative examples as training samples. The positive examples include representative questions and similar questions of the first knowledge point, and the negative examples include representative questions and similar questions of the second knowledge point whose similarity to the first knowledge point is greater than a preset similarity threshold.
[0167] In this embodiment, the preset classification model can be a text classification model. After the user enters a question, the rough intention can be determined based on the question entered by the user. For example, if the question entered by the user is "Why hasn't the goods been shipped yet", the rough intention of the user is determined to be urging the order.
[0168] The user's coarse intent can include various categories, such as logistics queries. Each coarse intent corresponds to a knowledge base containing several knowledge points. Each knowledge point and the question it answers can be combined to form a set of answer pairs. When the target question is similar to a question in a pair, that answer pair is selected.
[0169] In this embodiment, the similarities between the selected answer pairs are usually high, making them difficult to distinguish. A pre-trained semantic matching model can be used to score these selected answer pairs. The target answer pair that is closest to the target question has a higher score. Ultimately, the highest-scoring answer pair is selected as the target answer pair.
[0170] The embodiment of the present application uses a pre-trained semantic matching model for sorting, which can distinguish subtle differences between answer pairs, accurately obtain the knowledge points that answer the user's target question, and improve the accuracy of the answer.
[0171] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0172] Figure 8 This is a schematic diagram of the structure of the model training device provided in the embodiment of the present application. The model training device can be integrated into a computer device, or can be independent of the computer device and work together with the computer device to implement the solution of this embodiment. Figure 8 As shown, the model training device 80 may specifically include a knowledge base construction module 81 , a question acquisition module 82 , a knowledge point acquisition module 83 , a sample construction module 84 and a training module 85 .
[0173] Among them, the knowledge base construction module 81 is used to obtain the business corpus of the target business and construct a knowledge base based on the business corpus. The question acquisition module 82 is used to obtain the first knowledge point, the representative questions and similar questions answered by the first knowledge point based on the knowledge base. The knowledge point acquisition module 83 is used to obtain the second knowledge point whose similarity with the first knowledge point is greater than the preset similarity threshold and the representative questions and similar questions of the second knowledge point in the knowledge base. The sample construction module 84 is used to take the representative questions and similar questions of the first knowledge point as positive examples and the representative questions and similar questions of the second knowledge point as negative examples to construct training samples. The training module 85 is used to train the semantic matching model to be trained based on the training samples to obtain the trained semantic matching model.
[0174] The knowledge base stores knowledge points for answering questions, which means that the semantics of the question is the same as that of similar questions.
[0175] In some embodiments, the training module 85 can be specifically used to perform comparative learning training on the semantic matching model to be trained based on positive examples and negative examples in the training samples to obtain a trained semantic matching model.
[0176] Among them, the number of negative examples is greater than the number of positive examples.
[0177] Optionally, in some embodiments, the training module 85 may be specifically used to:
[0178] Input the preset anchor text, positive examples and negative examples in the training sample into the language encoding layer of the semantic matching model to be trained for encoding, and obtain the anchor text vector, positive example sentence vector and negative example sentence vector;
[0179] Calculate the contrast loss based on the anchor text vector, positive sentence vector, and negative sentence vector;
[0180] The semantic matching model to be trained is trained according to the contrast loss to obtain a trained semantic matching model.
[0181] In some embodiments, the knowledge base construction module 81 may be specifically used to:
[0182] Cluster the business corpus according to semantic similarity to obtain N clusters;
[0183] Each cluster is split or merged to obtain M knowledge points. The semantics of each knowledge point are different. M is a positive integer not less than 1.
[0184] Based on M knowledge points, a knowledge base is constructed.
[0185] Wherein, N is a positive integer not less than 1.
[0186] Optionally, in some embodiments, the knowledge base construction module 81 may be specifically used to:
[0187] Obtain representative questions answered at each knowledge point in the business corpus and determine the semantics of the representative questions;
[0188] According to the semantics of the representative's question, questions that match the semantics of the representative's question are retrieved from the business corpus and regarded as similar questions to the representative's question;
[0189] A knowledge base is constructed based on each knowledge point, the representative question of each knowledge point and the similar questions of the representative questions.
[0190] In some embodiments, the question acquisition module 82 may be specifically used to:
[0191] At least one knowledge point is selected from the knowledge points in the knowledge base as the first knowledge point.
[0192] Optionally, in some embodiments, the question acquisition module 82 may be specifically used to:
[0193] Obtaining a first knowledge point and L questioning methods corresponding to the first knowledge point in the knowledge base, where L is a positive integer not less than 1;
[0194] Determine the types and number of questioning methods corresponding to the first knowledge point;
[0195] According to the type and number of each questioning method, determine the representative question of the first knowledge point from L questioning methods;
[0196] Determine similar questions to the first knowledge point based on representative questions of the first knowledge point.
[0197] In some embodiments, the above-mentioned knowledge point acquisition module can be specifically used to:
[0198] Obtain the expression keywords for each knowledge point in the knowledge base;
[0199] A knowledge point corresponding to an expression keyword whose similarity with the expression keyword of the first knowledge point is greater than a preset similarity threshold is obtained as the second knowledge point.
[0200] Among them, the expression keywords are keywords that appear in the text of the knowledge point.
[0201] Optionally, the above-mentioned knowledge point acquisition module can be specifically used for:
[0202] Obtaining the second knowledge point and K questioning methods corresponding to the second knowledge point in the knowledge base;
[0203] Determine the types and number of questioning methods corresponding to the second knowledge point;
[0204] According to the type and number of each questioning method, a representative question of the second knowledge point is determined from the K questioning methods;
[0205] Determine similar questions to the second knowledge point based on representative questions of the second knowledge point.
[0206] Wherein, K is a positive integer not less than 1.
[0207] Figure 9 This is a schematic diagram of the structure of the question answering device provided in the embodiment of the present application. The question answering device can be integrated into a computer device, or can be independent of the computer device and work together with the computer device to complete the solution of this embodiment. Figure 9 As shown, the question answering device 90 includes an acquisition module 91 , a classification module 92 , a retrieval module 93 , a matching module 94 and a response module 95 .
[0208] The acquisition module 91 is used to obtain the target question submitted by the user. The classification module 92 is used to determine the coarse intent of the target question based on a preset classification model. The retrieval module 93 is used to retrieve at least two groups of answer pairs that answer the target question from the knowledge base corresponding to the coarse intent. The matching module 94 is used to use a pre-trained semantic matching model to determine the target answer pair from the at least two groups of answer pairs. The answer module 95 is used to select the knowledge points in the target answer pair and answer the target question.
[0209] Among them, the answer pair includes a question and a knowledge point that answers the question. The semantic matching model is obtained through comparative learning based on positive examples and negative examples as training samples. The positive examples include representative questions and similar questions of the first knowledge point, and the negative examples include representative questions and similar questions of the second knowledge point whose similarity to the first knowledge point is greater than a preset similarity threshold.
[0210] In this embodiment, the entire question answering device can be mainly divided into two parts. The first part is to divide the user question into N coarse intents according to the classification model, and the second part is to find the detailed intent closest to the user intent with the help of the trained semantic matching model (that is, the trained semantic matching model can score and sort similar question and answer pairs retrieved from the knowledge base, and output the answer pair with the highest score as the target answer pair). Finally, the user is answered according to the detailed intent. Among them, user intent can be divided into coarse intent and detailed intent according to different granularity, and coarse intent can usually be further divided into detailed intent.
[0211] Specifically, Figure 10 A schematic diagram of the question answering process provided in the embodiment of the present application is shown in FIG. Figure 10 As shown in the figure, user questions (which are equivalent to user intentions) can be classified by the classification model to obtain N coarse intentions (N is a positive integer not less than 1), and then the fine intentions can be obtained by identifying the semantic matching model, that is, finding the target answer pair to accurately answer the user questions.
[0212] The classification model can be a multi-level structure, which is trained using a text classification model. As for the semantic matching model, the first step is to build a knowledge base, and then use the built knowledge base to automatically construct training data to train the semantic matching model.
[0213] In this embodiment, the knowledge base stores knowledge points under a certain business. These knowledge points have corresponding representative questions and similar questions. The representative questions and similar questions are semantically consistent, but there may be differences in text form. One knowledge point may correspond to multiple representative questions, and one representative question may correspond to multiple similar questions. In the training process of the semantic matching model, the representative questions and similar questions of the first knowledge point can be used as positive examples, and the representative questions and similar questions of the second knowledge point that are highly similar to the first knowledge point and easily confused with each other can be used as negative examples to construct training samples, and the semantic matching model is trained through comparative learning. The semantic matching model finally trained can distinguish the differences between intentions more subtly, and obtain the detailed intention that is closest to the user's intention, that is, the answer pair with the highest score is finally obtained as the target answer pair, thereby answering the user.
[0214] The device provided in the embodiments of the present application can be used to execute the method in the above embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0215] It should be noted that it should be understood that the division of the various modules of the above device is merely a division of logical functions. In actual implementation, they can be fully or partially integrated into a physical entity, or they can be physically separated. Moreover, these modules can all be implemented in the form of software called by a processing element; or they can all be implemented in the form of hardware; or some modules can be implemented in the form of software called by a processing element, and some modules can be implemented in the form of hardware. For example, the determination module can be a separately established processing element, or it can be integrated into a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called by a processing element of the above device to perform the functions of the above determination module. The implementation of other modules is similar. In addition, these modules can all or partly be integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. During implementation, each step of the above method or each of the above modules can be completed by the hardware integrated logic circuit in the processor element or by instructions in the form of software.
[0216] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented by scheduling program code on a processing element, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0217] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, 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 process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)).
[0218] Figure 11 This is a schematic diagram of the structure of the computer device provided in the embodiment of the present application. Figure 11 As shown, the computer device 1100 includes: at least one processor 1101 , a memory 1102 , a bus 1103 and a communication interface 1104 .
[0219] The processor 1101 , the communication interface 1104 and the memory 1102 communicate with each other via the bus 1103 .
[0220] The communication interface 1104 is used to communicate with other devices. The communication interface includes a communication interface for data transmission and a display interface or operation interface for human-computer interaction.
[0221] The processor 1101 is configured to execute computer-executable instructions stored in the memory 1102 , and specifically may execute relevant steps in the method described in the above embodiment.
[0222] The processor may be a central processing unit, an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in a computer device may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.
[0223] The memory is used to store programs. The memory may include high-speed RAM memory and may also include non-volatile memory, such as at least one disk storage.
[0224] This embodiment further provides a computer-readable storage medium, in which computer instructions are stored. When at least one processor of a computer device executes the computer instructions, the computer device executes the methods provided in the various embodiments described above.
[0225] This embodiment further provides a program product, which includes computer instructions stored in a readable storage medium. At least one processor of a computer device can read the computer instructions from the readable storage medium, and at least one processor can execute the computer instructions to cause the computer device to implement the methods provided in the various embodiments described above.
[0226] In this application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship; in the formula, the character " / " indicates that the previous and next associated objects are in a "division" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0227] It is understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not intended to limit the scope of the embodiments of the present application. In the embodiments of the present application, the order of the sequence numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0228] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A model training method, characterized in that: include: Obtaining business corpus of the target business, and constructing a knowledge base based on the business corpus, wherein the knowledge base stores knowledge points for answering questions; According to the knowledge base, a first knowledge point, a representative question and similar questions answered by the first knowledge point are obtained, wherein the representative question and the similar questions have the same semantics; Acquire, from the knowledge base, a second knowledge point having an expression keyword similarity with the first knowledge point greater than a preset similarity threshold, and a representative question and similar questions of the second knowledge point, wherein the expression keyword is a keyword appearing in the text of the knowledge point; The representative questions and similar questions of the first knowledge point are used as positive examples, and the representative questions and similar questions of the second knowledge point are used as negative examples to construct training samples; According to the positive examples and negative examples in the training samples, comparative learning training is performed on the semantic matching model to be trained to obtain a trained semantic matching model.
2. The method according to claim 1, characterized in that The number of the negative examples is greater than the number of the positive examples.
3. The method according to claim 2, characterized in that The step of performing comparative learning on the semantic matching model to be trained based on the positive examples and negative examples in the training samples to obtain the trained semantic matching model includes: Inputting the preset anchor text, the positive examples and the negative examples in the training sample into the language encoding layer of the semantic matching model to be trained for encoding, thereby obtaining an anchor text vector, a positive example sentence vector and a negative example sentence vector; Calculating contrast loss based on the anchor text vector, the positive sentence vector, and the negative sentence vector; The semantic matching model to be trained is trained according to the contrast loss to obtain a trained semantic matching model.
4. The method according to claim 1, wherein The knowledge base is constructed based on the business corpus, including: Clustering the business corpus according to semantic similarity to obtain N clusters, where N is a positive integer not less than 1; Each cluster is split or merged to obtain M knowledge points. The semantics of each knowledge point are different. M is a positive integer not less than 1. The knowledge base is constructed based on the M knowledge points.
5. The method according to claim 4, characterized in that The knowledge base is constructed based on the M knowledge points, including: Obtaining representative questions answered by various knowledge points in the business corpus, and determining the semantics of the representative questions; According to the semantics of the representative question, questions matching the semantics of the representative question are retrieved from the business corpus as similar questions to the representative question; The knowledge base is constructed based on each knowledge point, a representative question of each knowledge point, and similar questions to the representative questions.
6. The method according to claim 1, characterized in that The acquiring of the first knowledge point according to the knowledge base includes: At least one knowledge point is selected from the knowledge points in the knowledge base as the first knowledge point.
7. The method according to claim 1, characterized in that The step of obtaining a first knowledge point, representative questions answered by the first knowledge point, and similar questions according to the knowledge base includes: Obtaining a first knowledge point and L questioning methods corresponding to the first knowledge point from the knowledge base, where L is a positive integer not less than 1; Determine the type and quantity of each question method corresponding to the first knowledge point; Determine a representative question of the first knowledge point from the L questioning methods according to the type and number of each questioning method; Determine similar questions to the first knowledge point based on representative questions of the first knowledge point.
8. The method according to claim 1, characterized in that Acquiring representative questions and similar questions of the second knowledge point in the knowledge base includes: Obtaining K questioning methods corresponding to the second knowledge point in the knowledge base, where K is a positive integer not less than 1; Determining the types and quantities of various questioning methods corresponding to the second knowledge point; According to the type and number of each questioning method, a representative question of the second knowledge point is determined from the K questioning methods; Determine similar questions to the second knowledge point based on representative questions of the second knowledge point.
9. A question answering method, characterized in that: include: Get the target question submitted by the user; Determine the rough intent of the target problem according to a preset classification model; Retrieving at least two groups of answer pairs that answer the target question from the knowledge base corresponding to the coarse intent, wherein the answer pairs include questions and knowledge points that answer the questions; Using a pre-trained semantic matching model, a target answer pair is determined from the at least two groups of answer pairs, wherein the semantic matching model is trained through contrastive learning using positive and negative examples as training samples, the positive examples including representative questions and similar questions of a first knowledge point, the negative examples including representative questions and similar questions of a second knowledge point whose similarity to an expression keyword of the first knowledge point is greater than a preset similarity threshold, the expression keyword being a keyword that appears in the text of the knowledge point; Select the knowledge points in the target answer pair and answer the target question.
10. A model training device, characterized in that: include: A knowledge base construction module is used to obtain business corpus of the target business and construct a knowledge base based on the business corpus, wherein the knowledge base stores knowledge points for answering questions; a question acquisition module, configured to acquire, from the knowledge base, a first knowledge point, a representative question answered by the first knowledge point, and similar questions, wherein the representative question and the similar question have the same semantics; A knowledge point acquisition module is configured to acquire, from the knowledge base, a second knowledge point having an expression keyword similarity with the first knowledge point greater than a preset similarity threshold, and a representative question and similar questions of the second knowledge point, wherein the expression keyword is a keyword appearing in the text of the knowledge point; a sample construction module, configured to construct training samples by taking the representative questions and similar questions of the first knowledge point as positive examples and the representative questions and similar questions of the second knowledge point as negative examples; The training module is used to perform comparative learning training on the semantic matching model to be trained based on the positive examples and negative examples in the training samples to obtain the trained semantic matching model.
11. A question answering device, characterized in that: include: The acquisition module is used to obtain the target question submitted by the user; A classification module, configured to determine a rough idea of the target problem based on a preset classification model; A retrieval module is configured to retrieve at least two groups of answer pairs that answer the target question from the knowledge base corresponding to the coarse intent, wherein the answer pairs include a question and a knowledge point that answers the question; a matching module for determining a target answer pair from the at least two groups of answer pairs using a pre-trained semantic matching model, wherein the semantic matching model is trained through comparative learning using positive and negative examples as training samples, the positive examples comprising representative questions and similar questions of a first knowledge point, the negative examples comprising representative questions and similar questions of a second knowledge point whose similarity to an expression keyword of the first knowledge point is greater than a preset similarity threshold, the expression keyword being a keyword that appears in the text of the knowledge point; The answer module is used to select the knowledge points in the target answer pair and answer the target question.
12. A computer device, characterized in that: comprising a memory and at least one processor; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, which are used to implement the method according to any one of claims 1 to 9 when executed by a processor.
14. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Recognition rejection method in intention recognition, electronic device and storage medium
CN109871446A
Text matching optimization method and device
CN113051374A
Matching method and device based on text processing, computer equipment and storage medium
CN113761887A