Knowledge base processing, model training methods, computer equipment and storage media

By processing question and answer corpus through sentence vector extraction model and based on similarity calculation and self-attention processing, the problems of low manual collection efficiency and poor clustering controllability in the expansion of intelligent customer service knowledge base are solved, and efficient and accurate expansion of the knowledge base is achieved.

CN115221316BActive Publication Date: 2025-09-23IFLYTEK SOUTH CHINA ARTIFICIAL INTELLIGENCE RES INST GUANGZHOU CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210669626.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-14
Publication Date
2025-09-23
Estimated Expiration
2042-06-14

AI Technical Summary

Technical Problem

When building an intelligent customer service knowledge base, existing technologies have low manual data collection efficiency and poor controllability of the overall clustering method, which cannot effectively discover new expansion data, resulting in poor knowledge base expansion effect.

Method used

By obtaining question and answer corpus, using the sentence vector extraction model to extract vectors and semantic features, determining the target question and answer corpus based on similarity calculation, and adding relevant question texts to the knowledge base, combining self-attention processing and loss value to adjust model parameters, the efficient expansion of the knowledge base is achieved.

Benefits of technology

It achieves efficient and accurate mining of relevant question texts in question and answer corpus, improves the expansion efficiency and accuracy of the knowledge base, and can quickly build a high-quality intelligent customer service knowledge base.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115221316B_ABST
    Figure CN115221316B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a knowledge base processing and model training method, a computer device, and a storage medium, including: performing vector extraction on a question and answer corpus to obtain a question vector and an answer vector; determining a target question and answer corpus based on a first similarity between the question vector and the knowledge base question vector, and a second similarity between the question vector and the knowledge base answer vector, wherein the knowledge base question vector is a question vector corresponding to a first question text in the knowledge base, and the knowledge base answer vector is an answer vector corresponding to the first question text; adding the question text in the target question and answer corpus as a second question text associated with the first question text to the knowledge base; and mining question text associated with the question text in the knowledge base in the question and answer corpus based on the first similarity between the question text and the question text, and the second similarity between the answer text and the question text, thereby efficiently and accurately expanding the knowledge base.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a knowledge base processing, model training method, computer equipment and storage medium. Background Art

[0002] With the rapid development of artificial intelligence (AI), particularly natural language processing (NLP), intelligent customer service has emerged. Intelligent customer service can answer user questions based on a knowledge base, providing 24 / 7 service. In intelligent customer service systems, it is often necessary to collect users' potential intentions, generate domain-specific knowledge, and use this knowledge to construct intent classification models for various selection branches within the customer service process. Generally speaking, knowledge base construction relies heavily on manual data review and annotation, which is inefficient. Some technical solutions rely on data clustering, using cluster centers as discovery centers before adding this data to the knowledge base. However, these overall clustering methods have poor controllability and are ineffective in discovering new, expanded data. Summary of the Invention

[0003] The embodiments of the present application provide a knowledge base processing, model training method, computer equipment and storage medium, which can efficiently and accurately mine relevant question texts in question and answer corpus and expand the knowledge base.

[0004] In a first aspect, the present application provides a knowledge base processing method, the method comprising:

[0005] Acquire multiple groups of question-answer corpora, each group of question-answer corpora including a question text and an answer text corresponding to the question text;

[0006] Performing vector extraction on the question and answer corpus to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text;

[0007] Determining a target question-and-answer corpus among the multiple groups of question-and-answer corpora based on a first similarity between the question vector and a knowledge base question vector, and a second similarity between the question vector and a knowledge base answer vector, wherein the knowledge base question vector is a question vector corresponding to a first question text in the knowledge base, and the knowledge base answer vector is an answer vector corresponding to the first question text;

[0008] The question text in the target question-answering corpus is added to the knowledge base as the second question text associated with the first question text.

[0009] In a second aspect, the present application provides a method for training a sentence vector extraction model, characterized by comprising:

[0010] Acquire a question-and-answer corpus, wherein the question-and-answer corpus includes a question text and an answer text corresponding to the question text, and there is an association between question texts in different question-and-answer corpora;

[0011] Based on the input layer of the sentence vector extraction model, the character vector representation and the word vector representation of the question and answer corpus are fused to obtain a vector to be processed;

[0012] Based on the semantic representation layer of the sentence vector extraction model, semantic features are extracted from the vector to be processed to obtain a semantic feature vector representation of the question and answer corpus;

[0013] Based on the output layer of the sentence vector extraction model, self-attention processing is performed on the semantic feature vector to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text;

[0014] Determining a loss value of the sentence vector extraction model based on a first similarity between question vectors corresponding to associated question texts and a second similarity between the question vector and the answer vector;

[0015] Adjust model parameters of the sentence vector extraction model according to the loss value.

[0016] In a third aspect, the present application provides a computer device comprising a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the steps of the above method when executing the computer program.

[0017] In a third aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. If the computer program is executed by a processor, the steps of the above method are implemented.

[0018] The present application discloses a knowledge base processing and model training method, a computer device and a storage medium. The method includes: obtaining multiple groups of question and answer corpora, performing vector extraction on the question and answer corpora to obtain question vectors corresponding to question texts and answer vectors corresponding to answer texts; determining a target question and answer corpus in the multiple groups of question and answer corpora based on a first similarity between the question vector and the knowledge base question vector, and a second similarity between the question vector and the knowledge base answer vector, wherein the knowledge base question vector is the question vector corresponding to the first question text in the knowledge base, and the knowledge base answer vector is the answer vector corresponding to the first question text; adding the question text in the target question and answer corpus as the second question text associated with the first question text to the knowledge base; and mining question text associated with the question text in the knowledge base in the question and answer corpus based on the first similarity between the question text and the question text, and the second similarity between the answer text and the question text, thereby efficiently and accurately expanding the knowledge base. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0020] Figure 1 A flowchart of a knowledge base processing method provided in an embodiment of the present application;

[0021] Figure 2 Schematic diagram of an application scenario of a knowledge base processing method in one embodiment;

[0022] Figure 3 A flowchart of a method for training a sentence vector extraction model provided in an embodiment of the present application;

[0023] Figure 4 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. 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.

[0025] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined, or partially merged, so the actual execution order may vary depending on the actual situation.

[0026] See also Figure 1 , Figure 1 It is a flowchart of a knowledge base processing method provided in an embodiment of the present application.

[0027] The knowledge base processing methods provided in the embodiments of this application can be applied to terminals or servers. Terminals can be electronic devices such as mobile phones, tablet computers, laptop computers, desktop computers, and personal digital assistants. Servers can be standalone servers or server clusters. However, for ease of understanding, the following embodiments will be described in detail using the method applied to a server.

[0028] In some embodiments, as Figure 2As shown, the server obtains question and answer corpus from the terminal and processes the knowledge base according to the knowledge base processing method. In some embodiments, based on the knowledge base, the server can provide intelligent customer service, that is, a customer service system.

[0029] A knowledge base, also known as an intelligent database or artificial intelligence database, is a structured knowledge cluster constructed to solve problems in a specific field or domains. A knowledge base generally consists of standard questions and their corresponding extended questions. A standard question is a standardized description of an intent, while its corresponding extended questions are a colloquial description of that intent. For example, for the intent of checking phone bills, the standard question might be defined as "Check phone bills," while extended questions might be expressed as "Please help me check this month's phone bill," "How much is my phone bill this month?", etc. As a crucial component of intelligent customer service systems, the quality of the knowledge base directly impacts the accuracy of the information returned to users. The goal of a customer service system is to use semantic metrics to identify the extended questions that best match the user input and map them to corresponding standard questions for use in the customer service process.

[0030] Generally speaking, data collection for intent recognition relies on manual collection and organization to form intent-expanded question pairs. However, manual collection is very inefficient and lacks comprehensive coverage. Currently, some solutions use word embedding models to convert sentences into sentence vectors, then cluster them using methods such as k-means. The cluster centers are then used as discovery centers, and this data is then added to the knowledge base. However, clustering methods based on word embeddings have poor overall controllability and are unable to effectively discover new expanded question data. Furthermore, clustering tends to identify sentences with extremely high sentence similarity, which is not very meaningful for knowledge base growth. Furthermore, the effect of unsupervised data is poor.

[0031] The knowledge base processing method provided in the embodiment of the present application can efficiently and accurately mine relevant question texts in the question and answer corpus and expand the knowledge base.

[0032] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features therein may be combined with each other.

[0033] like Figure 1 As shown, the knowledge base processing method includes the following steps S110 to S140.

[0034] Step S110: Acquire multiple groups of question-answer corpora, each group of which includes a question text and an answer text corresponding to the question text.

[0035] In some optional embodiments, the question and answer corpus is text stored locally by a device for implementing the knowledge base processing method, text obtained by the device from a network, text obtained by the device from an input device connected thereto, text obtained by the device from other electronic devices, text converted by the device based on voice information, etc., but of course it is not limited to these.

[0036] For example, customer service semantic text conversations (or customer service semantic materials) are collected to construct semantic question-answer pairs between users and customer service personnel, namely, question-answer corpora. Each set of question-answer corpora includes a question text and a corresponding answer text, which can be called a qa pair.

[0037] For example, multiple sets of question-answering corpora include q1-a1, q2-a3, q4-a4, ..., qn-an.

[0038] Step S120: Perform vector extraction on the question and answer corpus to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text.

[0039] It can be understood that the question vector is a vectorized representation of the question text, and the answer vector is a vectorized representation of the answer text. The similarity between the vectorized identifiers can be determined in the vector space, and this similarity can be used to describe the similarity between texts.

[0040] Exemplarily, vector extraction is performed on the question and answer corpus based on a sentence vector extraction model.

[0041] Optionally, the sentence vector extraction model is a model based on a bidirectional LSTM (Bidirectional Long-Short Term Memory, Bi-LSTM, bidirectional long short-term memory) network structure. The bidirectional LSTM network structure includes a forward LSTM and a backward LSTM (Long-Short Term Memory). The input sequence is input into the forward LSTM neural network and the backward LSTM neural network in forward and reverse order respectively for feature extraction. The vector formed by concatenating the two output vectors (i.e., the extracted feature vectors) is used as the final feature expression of the input sequence.

[0042] In some embodiments, the model topology of the sentence vector extraction model includes: an input layer, a semantic representation layer, and an output layer. The input layer is used to determine the vectorized representation of the input text, the semantic representation layer is used to extract semantic features from the vectorized representation of the input text, and the output layer is used to perform self-attention processing on the semantic features extracted by the semantic representation layer to obtain a sentence vector for the input text.

[0043] In some implementations, step S120 performs vector extraction on the question and answer corpus to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text, including steps S121 to S123.

[0044] Step S121: Based on the input layer of the sentence vector extraction model, the character vector representation and the word vector representation of the question and answer corpus are fused to obtain a vector to be processed.

[0045] For example, the input of the input layer of the sentence vector extraction model is the word vector and character vector of the text. By fusing the character vector representation and the word vector representation, both the information of the words in the text and the relative influence of the characters in the text on the words can be utilized. The amount of information in the vector to be processed obtained by the fusion processing is richer, which can improve the accuracy of the model in vector extraction, thereby improving the accuracy of knowledge base processing.

[0046] Optionally, when fusing character vector representations and word vector representations, a word can be used as the smallest semantic unit, and the representation of the word semantic unit can be obtained through the information of the characters within the word, and the representation of the word obtained through the characters can be combined with the representation of the original word.

[0047] Optionally, when fusing the character vector representation and the word vector representation, the character is used as the smallest semantic unit, and the information of the word in which a character is located in the sentence is combined with the information of the character.

[0048] For example, for each input sentence, if it is limited to 60 characters, the dimension of the character vector of each character is 100 dimensions, and the dimension of the word vector of each word corresponding to each character is also 100 dimensions. The character vector is convolved with convolution kernels of different scales, such as (2*100), (3*100), etc., to obtain vectors of different combinations of characters, and then processed by self-attention to obtain a 100-dimensional representation composed of the character vectors of each character in each word. Then, the word vector of the text is added to the obtained word vectors of each character in each word to obtain new 100-dimensional vector representations of these characters; then the vector to be processed for the entire sentence is a two-dimensional matrix of (60, 100).

[0049] Step S122: Based on the semantic representation layer of the sentence vector extraction model, semantic features are extracted from the vector to be processed to obtain a semantic feature vector representation of the question and answer corpus.

[0050] The semantic representation layer mainly extracts semantic features from the two-dimensional matrix received from the input layer. The semantic representation layer can use a network with a bidirectional LSTM structure. For example, its step size is 30 and the number of hidden layer neuron nodes is 100. Then, for the forward LSTM and backward LSTM, each hidden layer outputs (1, 100)-dimensional features respectively. The features output by the forward LSTM and backward LSTM are concatenated to obtain the (30, 200)-dimensional hidden layer feature output H of the sentence. Self-attention processing can also be performed on the concatenated (30, 200)-dimensional feature matrix to calculate the influence weight of each hidden layer on the entire sentence. After that, a fully connected transformation is performed on the feature matrix output by the entire hidden layer to obtain a 200-dimensional vector, which constitutes the semantic feature vector representation of each position in the sentence.

[0051] Step S123: Based on the output layer of the sentence vector extraction model, self-attention processing is performed on the semantic feature vector to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text.

[0052] A self-attention operation is added to the output of the middle layer to shrink the semantic feature vector representation of the question-answer corpus and obtain the sentence vector of the question-answer corpus.

[0053] Exemplarily, step S123 includes: performing self-attention processing on the semantic feature vector based on the first sub-network of the output layer to obtain a question vector corresponding to the question text; and performing self-attention processing on the semantic feature vector based on the second sub-network of the output layer to obtain a response vector corresponding to the response text, wherein the parameters of the second sub-network are different from those of the first sub-network. For example, for user and customer service input, sub-networks with different parameters are used to obtain vector representations of the user and customer service sentences, respectively, such as question vector V1 and response vector V2.

[0054] In some embodiments, the vector similarity between the question vector and the answer vector output by the sentence vector extraction model can be used to indicate the correlation between the question text and the answer text, and the vector similarity between the question vector and the question vector output by the sentence vector extraction model can be used to indicate the correlation between the question text and the question text; for example, the vector similarity is cosine similarity, of course, it is not limited to this; the smaller the vector similarity, the stronger the correlation between the text; for example, the correlation between the question text and the answer text corresponding to the question text is strong, and the correlation between the extended questions corresponding to the same standard question (i.e., qq pairs) is strong. In other words, the vector output by the sentence vector extraction model has similarity measurement properties in qa pairs and qq pairs.

[0055] In some implementations, an existing database in the customer service system may be retrieved, and standard questions within the same knowledge point may be paired to form similar standard question pairs (qq pairs), ie, associated question texts.

[0056] In some embodiments, when training a sentence vector extraction model, there are two training objectives: qa pair similarity and qq pair similarity.

[0057] Exemplarily, based on a first similarity between question vectors corresponding to associated question texts and a second similarity between the question vector and the answer vector, a loss value of the sentence vector extraction model is determined, and model parameters of the sentence vector extraction model are adjusted based on the loss value.

[0058] Exemplarily, the first loss value of the sentence vector extraction model is determined based on the similarity between the question vector of the question text in the question and answer corpus and the question vector of the associated question text, as well as the similarity between the question vector of the question text and the question vector of an unassociated question text.

[0059] For example, the first loss value L1 of the sentence vector extraction model is expressed as follows:

[0060] L1=1-cosine(Q,Q+)+cosine(Q,Q-)

[0061] Among them, Q and Q+ represent the question vectors of two mutually related question texts, that is, the sentence vectors in the qq pair; Q- represents the question vector of the question text that is not under the same knowledge point as Q, that is, the question vector of an unrelated question text. For example, Q- can be obtained by random screening.

[0062] By adding the similarity between the question vector of the question text and the question vector corresponding to the unrelated question text into the first loss function, the accuracy of the first loss value can be improved, and the trained model can achieve more accurate data processing results.

[0063] Exemplarily, the second loss value of the sentence vector extraction model is determined based on the similarity between the question vector of the question text and the answer vector of the answer text, and the similarity between the question vector of the question text and the answer vector corresponding to an unrelated question text.

[0064] For example, the second loss value L2 of the sentence vector extraction model is expressed as follows:

[0065] L2=1-cosine(Q,A+)+cosine(Q,A-)

[0066] Among them, Q and A+ respectively represent the question vector of the question text and the answer vector of the answer text corresponding to the question text, that is, the sentence vector in the qa pair; A- represents the answer vector of the answer text corresponding to the unrelated question text, that is, the sentence vector of different answers; cosine() is the angle cosine function.

[0067] By adding the similarity between the question vector of the question text and the answer vector corresponding to the unrelated question text into the second loss function, the accuracy of the second loss value can be improved, and the trained model can achieve more accurate data processing results.

[0068] Exemplarily, model parameters of the sentence vector extraction model are adjusted according to the first loss value and the second loss value.

[0069] By adjusting the model parameters of the sentence vector extraction model according to the first loss value, the vector similarity between the question vector extracted by the sentence vector extraction model and the question vector can be used to indicate the correlation between the question text and the question text; by adjusting the model parameters of the sentence vector extraction model according to the second loss value, the vector similarity between the question vector extracted by the sentence vector extraction model and the answer vector can be used to indicate the correlation between the question text and the answer text; thereby obtaining a sentence vector extraction model with similarity measurement properties.

[0070] Step S130: Determine the target question and answer corpus in the multiple groups of question and answer corpora based on the first similarity between the question vector and the knowledge base question vector, and the second similarity between the question vector and the knowledge base answer vector, wherein the knowledge base question vector is the question vector corresponding to the first question text in the knowledge base, and the knowledge base answer vector is the answer vector corresponding to the first question text.

[0071] In some embodiments, the first similarity is the text similarity between question vectors; illustratively, different question texts whose first similarity of question vectors is greater than or equal to a first preset threshold can be determined as associated question texts, such as being determined as extended questions corresponding to the same standard question.

[0072] The second similarity is the semantic similarity between the question text and the answer text. For example, answer texts and question texts whose second similarity is greater than or equal to a second preset threshold can be determined as related questions and answers. For example, different question texts related to the same answer text can be determined as associated question texts, such as extended questions corresponding to the same standard question.

[0073] In some embodiments, step S130 includes step S131 and step S132.

[0074] Step S131: Based on a first similarity between the question vector and a knowledge base question vector, determine a question vector whose first similarity is greater than or equal to a first preset threshold, and determine the question and answer corpus corresponding to the question vector as the first question and answer corpus.

[0075] For example, a first similarity between the question vector corresponding to each group of question-and-answer corpora and the sentence vectors of all extended questions in the knowledge base can be determined, that is, a similarity measurement is performed between the question vector in the qa pair and the extended questions already in the knowledge base. The qa pairs whose first similarity is greater than or equal to a first preset threshold can be marked as the first question-and-answer corpus. The question text in the first question-and-answer corpus can be determined as the question text associated with the corresponding extended question, such as being determined as the extended question corresponding to the same standard question.

[0076] Optionally, qa pairs having a first similarity greater than or equal to a first preset threshold may be manually screened, and the qa pairs that have passed the manual screening process may be marked as the first question-answer corpus.

[0077] The expanded questions mined based on the first similarity generally have a high similarity with the expanded questions already in the knowledge base, and usually have little effect on the knowledge base expansion. In this embodiment of the application, mining can be performed based on the similarity measure of customer service answers, and based on the second similarity, effective expanded questions with a low first similarity can be mined.

[0078] Step S132: Determine a question vector whose second similarity is greater than or equal to a second preset threshold value based on the second similarity between the question vector corresponding to the second question and answer corpus and the answer vector of the knowledge base, and determine the second question and answer corpus corresponding to the question vector as the third question and answer corpus, wherein the second question and answer corpus is the question and answer corpus in the multiple groups of question and answer corpora except the first question and answer corpus.

[0079] Exemplarily, in step S131, the question texts with a high first similarity have been filtered out, and the question and answer corpus remaining after selecting the first question and answer corpus can be referred to as the second question and answer corpus. In the second question and answer corpus, by measuring the similarity between the question vector of the second question and answer corpus and the answer vector of the knowledge base, it can be determined that the question text with a second similarity greater than or equal to a second preset threshold with respect to the answer vector of the knowledge base, such as the answer text of the first question and answer corpus, is a question text related to the answer text; the second question and answer corpus where the question text is located can be marked as the third question and answer corpus. The question text and the question text corresponding to the answer text can be determined as associated question texts, such as being determined as extended questions corresponding to the same standard question.

[0080] Optionally, when the question and answer corpus corresponding to the question vector is determined as the first question and answer corpus in step S131, the first question and answer corpus can be added to the knowledge base. When the third question and answer corpus is determined in step S132 based on the second similarity between the question vector corresponding to the second question and answer corpus and the answer vector of the knowledge base, the third question and answer corpus can be determined based on the second similarity between the question vector of the second question and answer corpus and the answer text of the first question and answer corpus. Alternatively, the first question and answer corpus determined in step S131 may not be added to the knowledge base first, and in step S132, the answer vector corresponding to the answer text already in the knowledge base is used, and the answer text is the answer text of the first question text.

[0081] Optionally, QQ pairs whose second similarity is greater than or equal to a second preset threshold value may be manually screened, and the second question-answer corpus that has passed the manual screening process may be marked as the third question-answer corpus based on the manually screened QQ pairs.

[0082] It should be noted that the first preset threshold corresponding to the first similarity and the second preset threshold corresponding to the second similarity may be equal or unequal.

[0083] The target question-answer corpus includes question texts in the first question-answer corpus and question texts in the third question-answer corpus. Mining the second question-answer corpus based on a similarity measure of the answer texts in the first question-answer corpus can mine extended questions that have a lower first similarity but are still valid, i.e., have a higher semantic similarity to the answer texts, based on the second similarity. This allows efficient and accurate mining of relevant question texts in the question-answer corpus, thus expanding the knowledge base.

[0084] Step S140: Add the question text in the target question-answer corpus as the second question text associated with the first question text to the knowledge base.

[0085] Exemplarily, the question texts in the target question-answer corpus include question texts with a high text similarity to the first question text, and also include question texts with a high semantic similarity to the answer texts corresponding to these question texts, which can quickly and accurately expand the knowledge base.

[0086] In some embodiments, the method further includes steps S150 to S170.

[0087] Step S150: Cluster the question texts corresponding to the fourth question and answer corpus based on the first similarity between the question vectors corresponding to the fourth question and answer corpus, and determine the fourth question and answer corpus corresponding to the question texts of the same category as the fifth question and answer corpus, where the fourth question and answer corpus is the question and answer corpus in the second question and answer corpus excluding the third question and answer corpus.

[0088] For example, after screening in steps S120 and S130, the question texts in the remaining question and answer corpus (i.e., the fourth question and answer corpus) do not belong to the standard questions already in the knowledge base. Data clustering can be performed on these question texts to mine new standard questions.

[0089] For example, by clustering the question texts corresponding to the fourth question-and-answer corpus based on the first similarity, question texts with high text similarity can be grouped into one category. Based on the question texts in each category, a standard question and an expanded question corresponding to the standard question can be determined. For example, the cluster center can be used as a new standard question. For example, the fourth question-and-answer corpus corresponding to question texts in the same category can be referred to as the fifth question-and-answer corpus.

[0090] Optionally, question texts of the same category may be manually screened, and the fourth question-answer corpus corresponding to the manually screened question texts may be referred to as the fifth question-answer corpus.

[0091] Step S160: Determine a question vector whose second similarity is greater than or equal to a second preset threshold value based on the second similarity between the answer vector corresponding to the fifth question and answer corpus and the question vector corresponding to the sixth question and answer corpus, and determine the sixth question and answer corpus corresponding to the question vector as the seventh question and answer corpus, wherein the sixth question and answer corpus is the question and answer corpus in the fourth question and answer corpus excluding the fifth question and answer corpus.

[0092] After the new standard questions and extended questions are screened out in step S150, question texts related to the answer texts in the fifth question and answer corpus can be mined based on the second similarity in the remaining question and answer corpus, i.e., the sixth question and answer corpus. Question texts whose second similarity with the answer text of the fifth question and answer corpus is greater than or equal to the second preset threshold can be determined to be question texts related to the answer text, and the question texts corresponding to the answer texts can be determined to be associated question texts, such as extended questions corresponding to the same standard question. Optionally, QQ pairs whose second similarity is greater than or equal to the second preset threshold can be manually screened, and the sixth question and answer corpus that has passed the manual screening process can be marked as the seventh question and answer corpus based on the manually screened QQ pairs.

[0093] Based on the similarity measure of the answer texts in the fifth question-and-answer corpus, mining the sixth question-and-answer corpus can identify, based on the second similarity, effective extended questions that have a lower first similarity but a higher semantic similarity to the answer text. This allows for efficient and accurate mining of relevant question texts within the question-and-answer corpus, expanding the knowledge base.

[0094] Step S170: Add the question text in the fifth question-answer corpus and the question text in the seventh question-answer corpus as third question text to the knowledge base.

[0095] The third question text is not associated with the first question text or the second question text. Through steps S150 to S170, new standard questions and corresponding extended questions can be mined from the fourth question-answer corpus, thus efficiently and accurately expanding the knowledge base.

[0096] The knowledge base processing method provided in an embodiment of the present application includes: obtaining multiple groups of question and answer corpora, performing vector extraction on the question and answer corpora, and obtaining question vectors corresponding to question texts and answer vectors corresponding to answer texts; determining a target question and answer corpus in the multiple groups of question and answer corpora based on a first similarity between the question vector and the knowledge base question vector, and a second similarity between the question vector and the knowledge base answer vector, wherein the knowledge base question vector is a vector corresponding to a first question text in the knowledge base, and the knowledge base answer vector is an answer vector corresponding to the first question text; adding the question text in the target question and answer corpus as a second question text associated with the first question text to the knowledge base; based on the first similarity between the question text and the question text, and the second similarity between the answer text and the question text, mining question text associated with the question text in the knowledge base in the question and answer corpus, thereby efficiently and accurately expanding the knowledge base.

[0097] In some implementations, a semi-automatic semantic optimization process is constructed by combining manual detection solutions to improve the mining efficiency of extended questions.

[0098] In some implementations, the knowledge base can be quickly constructed based on a small amount of seed data, and the effect can be continuously optimized by iterating the above process.

[0099] Please refer to the above examples. Figure 3 The present application also provides a method for training a sentence vector extraction model. The training method includes steps S210 to S260.

[0100] Step S210: Obtain question-answer corpus, where the question-answer corpus includes a question text and an answer text corresponding to the question text, and there is an association between question texts in different question-answer corpora.

[0101] In some implementations, semantic text conversations between customer service representatives are collected to construct semantic question-answer pairs (qa pairs) between the user and customer service representative. Existing question-answer data in the customer service system can also be retrieved, and based on standard questions within the same knowledge point, similar standard question pairs (qq pairs) are formed, i.e., related question texts.

[0102] Step S220: Based on the input layer of the sentence vector extraction model, the character vector representation and the word vector representation of the question and answer corpus are fused to obtain a vector to be processed.

[0103] Step S230: Based on the semantic representation layer of the sentence vector extraction model, semantic features are extracted from the vector to be processed to obtain a semantic feature vector representation of the question and answer corpus.

[0104] Step S240: Based on the output layer of the sentence vector extraction model, self-attention processing is performed on the semantic feature vector to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text.

[0105] Step S250: Determine the loss value of the sentence vector extraction model based on the first similarity between the question vectors corresponding to the associated question texts and the second similarity between the question vector and the answer vector.

[0106] Step S260: Adjust the model parameters of the sentence vector extraction model according to the loss value.

[0107] When training the sentence vector extraction model, the loss value can reflect both the accuracy of the question vector prediction and the accuracy of the answer vector prediction; the vector similarity between the question vector and the question vector extracted by the sentence vector extraction model can be used to indicate the correlation between the question text and the question text, and the vector similarity between the extracted question vector and the answer vector can be used to indicate the correlation between the question text and the answer text, thereby obtaining a sentence vector extraction model with similarity measurement properties.

[0108] In some embodiments, step S250 includes steps S251 to S252.

[0109] Step S251: Determine a first loss value of the sentence vector extraction model based on the similarity between the question vector of the question text in the question and answer corpus and the question vector of the associated question text, and the similarity between the question vector of the question text and the question vector of the unassociated question text.

[0110] By adding the similarity between the question vector of the question text and the question vector corresponding to the unrelated question text into the first loss function, the accuracy of the first loss value can be improved, and the trained model can achieve more accurate data processing results.

[0111] Step S252: Determine a second loss value of the sentence vector extraction model based on the similarity between the question vector of the question text and the answer vector of the answer text, and the similarity between the question vector of the question text and the answer vector corresponding to an unrelated question text.

[0112] By adding the similarity between the question vector of the question text and the answer vector corresponding to the unrelated question text into the second loss function, the accuracy of the second loss value can be improved, and the trained model can achieve more accurate data processing results.

[0113] Exemplarily, adjusting the model parameters of the sentence vector extraction model according to the loss value includes: adjusting the model parameters of the sentence vector extraction model according to the first loss value and the second loss value.

[0114] The methods of the present application can be used in a wide variety of general-purpose or specialized computing system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments that include any of the above.

[0115] For example, the above method can be implemented in the form of a computer program. Figure 4 Runs on the computer device shown.

[0116] See also Figure 4 , Figure 4 1 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a server or a terminal.

[0117] See Figure 4 The computer device includes a processor, a memory, and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.

[0118] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions that, when executed, cause the processor to perform the steps of any knowledge base processing method and / or the steps of any sentence vector extraction model training method.

[0119] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0120] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute the steps of any knowledge base processing method.

[0121] The network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that the structure of the computer device is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0122] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0123] In one embodiment, the processor is configured to execute a computer program stored in the memory to implement the following steps:

[0124] Acquire multiple groups of question-answer corpora, each group of question-answer corpora including a question text and an answer text corresponding to the question text;

[0125] Performing vector extraction on the question and answer corpus to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text;

[0126] Determining a target question-and-answer corpus among the multiple groups of question-and-answer corpora based on a first similarity between the question vector and a knowledge base question vector, and a second similarity between the question vector and a knowledge base answer vector, wherein the knowledge base question vector is a question vector corresponding to a first question text in the knowledge base, and the knowledge base answer vector is an answer vector corresponding to the first question text;

[0127] The question text in the target question-answering corpus is added to the knowledge base as the second question text associated with the first question text.

[0128] In another embodiment, the processor is configured to execute a computer program stored in the memory to implement the following steps:

[0129] Acquire a question-and-answer corpus, wherein the question-and-answer corpus includes a question text and an answer text corresponding to the question text, and there is an association between question texts in different question-and-answer corpora;

[0130] Based on the input layer of the sentence vector extraction model, the character vector representation and the word vector representation of the question and answer corpus are fused to obtain a vector to be processed;

[0131] Based on the semantic representation layer of the sentence vector extraction model, semantic features are extracted from the vector to be processed to obtain a semantic feature vector representation of the question and answer corpus;

[0132] Based on the output layer of the sentence vector extraction model, self-attention processing is performed on the semantic feature vector to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text;

[0133] Determining a loss value of the sentence vector extraction model based on a first similarity between question vectors corresponding to associated question texts and a second similarity between the question vector and the answer vector;

[0134] Adjust model parameters of the sentence vector extraction model according to the loss value.

[0135] Through the description of the above embodiments, it can be seen that those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application or certain parts of the embodiments, such as:

[0136] A computer-readable storage medium storing a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement the steps of any knowledge base processing method provided in the embodiments of the present application; and / or execute the steps of any sentence vector extraction model training method.

[0137] The computer-readable storage medium may be an internal storage unit of the computer device described in the aforementioned embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a SmartMedia Card (SMC), a Secure Digital (SD) card, a flash memory card, etc., equipped on the computer device.

[0138] The specific principles and implementation methods of the computer device and storage medium provided in the embodiments of the present application are similar to those of the aforementioned embodiments and will not be repeated here.

[0139] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A knowledge base processing method, characterized in that: include: Acquire multiple groups of question-answer corpora, each group of question-answer corpora including a question text and an answer text corresponding to the question text; Performing vector extraction on the question and answer corpus to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text; Determining a target question-and-answer corpus among the multiple groups of question-and-answer corpora based on a first similarity between the question vector and a knowledge base question vector, and a second similarity between the question vector and a knowledge base answer vector, wherein the knowledge base question vector is a question vector corresponding to a first question text in the knowledge base, and the knowledge base answer vector is an answer vector corresponding to the first question text; The question text in the target question-answering corpus is added to the knowledge base as the second question text associated with the first question text.

2. The knowledge base processing method according to claim 1, wherein: Determining target question and answer corpora from the multiple groups of question and answer corpora based on a first similarity between the question vector and a knowledge base question vector, and a second similarity between the question vector and a knowledge base answer vector, includes: Determining, based on a first similarity between the question vector and a knowledge base question vector, a question vector having the first similarity greater than or equal to a first preset threshold, and determining the question and answer corpus corresponding to the question vector as a first question and answer corpus; Determining, based on a second similarity between a question vector corresponding to a second question and answer corpus and the answer vector of the knowledge base, a question vector whose second similarity is greater than or equal to a second preset threshold, and determining the second question and answer corpus corresponding to the question vector as a third question and answer corpus, wherein the second question and answer corpus is a question and answer corpus in the multiple groups of question and answer corpora excluding the first question and answer corpus; The target question-answer corpus includes the question text in the first question-answer corpus and the question text in the third question-answer corpus.

3. The knowledge base processing method according to claim 2, wherein: The method further comprises: Clustering the question texts corresponding to the fourth question and answer corpus according to the first similarity between the question vectors corresponding to the fourth question and answer corpus, and determining the fourth question and answer corpus corresponding to the question texts of the same category as the fifth question and answer corpus, where the fourth question and answer corpus is the question and answer corpus in the second question and answer corpus excluding the third question and answer corpus; Determining, based on a second similarity between an answer vector corresponding to the fifth question and answer corpus and a question vector corresponding to the sixth question and answer corpus, a question vector whose second similarity is greater than or equal to a second preset threshold, and determining the sixth question and answer corpus corresponding to the question vector as a seventh question and answer corpus, wherein the sixth question and answer corpus is the question and answer corpus in the fourth question and answer corpus excluding the fifth question and answer corpus; The question text in the fifth question-answer corpus and the question text in the seventh question-answer corpus are added to the knowledge base as third question text.

4. The knowledge base processing method according to any one of claims 1 to 3, characterized in that: The first similarity is text similarity; the second similarity is semantic similarity.

5. The knowledge base processing method according to any one of claims 1 to 3, characterized in that: The step of performing vector extraction on the question-answer corpus to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text includes: Based on the input layer of the sentence vector extraction model, the character vector representation and the word vector representation of the question and answer corpus are fused to obtain a vector to be processed; Based on the semantic representation layer of the sentence vector extraction model, semantic features are extracted from the vector to be processed to obtain a semantic feature vector representation of the question and answer corpus; Based on the output layer of the sentence vector extraction model, self-attention processing is performed on the semantic feature vector to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text.

6. The knowledge base processing method according to claim 5, wherein: The output layer of the sentence vector extraction model performs self-attention processing on the semantic feature vector to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text, including: Based on the first sub-network of the output layer, self-attention processing is performed on the semantic feature vector to obtain a question vector corresponding to the question text; Based on the second sub-network of the output layer, self-attention processing is performed on the semantic feature vector to obtain an answer vector corresponding to the answer text, and the parameters of the second sub-network are different from those of the first sub-network.

7. A training method for a sentence vector extraction model, characterized in that: include: Acquire a question-and-answer corpus, wherein the question-and-answer corpus includes a question text and an answer text corresponding to the question text, and there is an association between question texts in different question-and-answer corpora; Based on the input layer of the sentence vector extraction model, the character vector representation and the word vector representation of the question and answer corpus are fused to obtain a vector to be processed; Based on the semantic representation layer of the sentence vector extraction model, semantic features are extracted from the vector to be processed to obtain a semantic feature vector representation of the question and answer corpus; Based on the output layer of the sentence vector extraction model, self-attention processing is performed on the semantic feature vector to obtain a question vector corresponding to the question text and an answer vector corresponding to the answer text; Determining a loss value of the sentence vector extraction model based on a first similarity between question vectors corresponding to associated question texts and a second similarity between the question vector and the answer vector; Adjust model parameters of the sentence vector extraction model according to the loss value.

8. The training method for a sentence vector extraction model according to claim 7, wherein: The step of determining the loss value of the sentence vector extraction model based on a first similarity between question vectors corresponding to associated question texts and a second similarity between the question vector and the answer vector includes: Determining a first loss value of the sentence vector extraction model according to the similarity between the question vector of the question text in the question and answer corpus and the question vector of the associated question text, and the similarity between the question vector of the question text and the question vector of the unassociated question text; Determining a second loss value of the sentence vector extraction model based on the similarity between the question vector of the question text and the answer vector of the answer text, and the similarity between the question vector of the question text and the answer vector corresponding to an unrelated question text; The adjusting the model parameters of the sentence vector extraction model according to the loss value includes: Adjust the model parameters of the sentence vector extraction model according to the first loss value and the second loss value.

9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, when executing the computer program, to achieve: The steps of the knowledge base processing method according to any one of claims 1 to 6; and / or The steps of the method for training a sentence vector extraction model as described in any one of claims 7 to 8.

10. A computer-readable storage medium storing a computer program, characterized in that: If the computer program is executed by a processor, it implements: The steps of the knowledge base processing method according to any one of claims 1 to 6; and / or The steps of the method for training a sentence vector extraction model as described in any one of claims 7 to 8.

Citation Information

Patent Citations

  • Data processing method and apparatus, computer device and storage medium

    CN108595695A

  • Method and device for automatically expanding question and answer knowledge base

    CN112948561A