Training corpus expansion method and device, electronic equipment and storage medium
By segmenting the training corpus of customer service robots in the financial sector into questions and answers and replacing the context, the problem of low efficiency in training corpus generation was solved, achieving efficient and low-cost expansion of training corpus and improving the performance of the intelligent model of customer service robots.
Patent Information
- Application Number
- CN202311317355.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-12
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2043-10-12
AI Technical Summary
In the financial field, existing technologies are inefficient and costly in generating training corpora, making it difficult to meet the needs of large-scale business consultations.
By dividing the original training corpus into questions and answers, a set of derived questions is generated using a pre-trained activation function and semantic model. The context of each answer is used as the replacement object, and questions are randomly replaced to generate an expanded training corpus.
It improves the efficiency of generating training corpora for customer service robots in the financial sector, reduces costs, and enables rapid expansion of the diversity and richness of training corpora.
Smart Images

Figure CN117271709B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of financial technology, and in particular to a method, apparatus, electronic device, and computer-readable storage medium for expanding training corpora. Background Technology
[0002] Financial services such as banking, securities, trust, insurance, funds, and financial leasing provide a wide range of financial services to users. Traditional human customer service cannot meet the ever-increasing volume of inquiries. Therefore, most financial institutions now use online customer service chatbots to provide business assistance to users.
[0003] Online customer service robots are mostly built on artificial intelligence language learning models. They usually require a large amount of training data to train the language learning models in order to improve their learning ability and prediction accuracy.
[0004] Currently, the majority of training data is expanded by maintaining a large corpus knowledge base or collecting historical human-to-human or human-to-machine dialogue data. This approach requires a long period of accumulation to form a large amount of training data, and the cost of manual maintenance and collection is high. Summary of the Invention
[0005] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for expanding training corpus, the main purpose of which is to improve the efficiency of training corpus generation for intelligent models of customer service robots in the financial field.
[0006] To achieve the above objectives, the present invention provides a method for augmenting training corpora, comprising:
[0007] Obtain a set of original training corpora, and divide the original training corpora into question sentences and answer sentences;
[0008] For each of the questions, perform a derivation operation on similar semantic statements to obtain a set of derived questions for the corresponding question;
[0009] In the original training corpus, the context corpus corresponding to each answer sentence is divided;
[0010] By using the set of derived questions corresponding to each question in the context corpus, the corresponding questions are randomly replaced to generate an expanded training corpus set of response sentences;
[0011] The expanded training corpus of all the answers is collected to obtain the expanded training corpus of the original training corpus.
[0012] Optionally, the step of dividing the original training corpus into question and answer sentences includes:
[0013] performing a sentence segmentation operation on the original training corpus to obtain a sentence segmentation set;
[0014] calculating, by using a pre-trained activation function, a probability value of each sentence in the sentence segmentation set with respect to a question sentence and an answer sentence;
[0015] labeling each sentence as a question sentence or an answer sentence according to the size of the probability value.
[0016] Optionally, the deriving operation of a similar semantic sentence for each question sentence comprises:
[0017] outputting, by using a pre-trained semantic model, a candidate set of similar sentences corresponding to each question sentence;
[0018] scoring the similarity of the sentences in the candidate set of similar sentences by using a semantic similarity measurement method;
[0019] selecting a preset number of sentences with the maximum score to form a derived question set corresponding to the corresponding question sentence.
[0020] Optionally, the dividing of the context corpus corresponding to each answer sentence in the original training corpus comprises:
[0021] sorting all answer sentences according to the appearance order of the answer sentences from back to front in the original training corpus;
[0022] selecting an answer sentence in the sorting as a target prediction answer sentence in sequence;
[0023] dividing the maximum sentence range and the minimum sentence range in the original training corpus corresponding to the target prediction answer sentence;
[0024] constructing the maximum sentence range and the minimum sentence range as the context corpus of the target prediction answer sentence, respectively.
[0025] Optionally, after the dividing of the question sentence and the answer sentence in the original training corpus, the method further comprises:
[0026] identifying all question sentences with similar semantics in the question sentences, and labeling the question sentences with similar semantics as the same question sentence;
[0027] identifying all answer sentences with similar semantics in the answer sentences, and labeling the answer sentences with similar semantics as the same answer sentence.
[0028] Optionally, the identifying of all question sentences with similar semantics in the question sentences comprises:
[0029] extracting the keywords of each question sentence, and converting the keywords corresponding to each question sentence into a keyword vector;
[0030] Splicing the keyword vector of each question to obtain a feature vector of the corresponding question;
[0031] Calculate the similarity between the feature vectors of each question;
[0032] Select the question with a similarity greater than a preset similarity threshold as a semantically similar question.
[0033] To solve the above problems, the present application also provides a training corpus expansion device, the device comprises:
[0034] Question and answer division module, for obtaining a set of original training corpus, dividing the original training corpus into questions and answers;
[0035] Question derivation module, for performing similar semantic sentence derivation operation on each question to obtain a set of derived questions corresponding to the question;
[0036] Answer context division module, for dividing the context corpus corresponding to each answer in the original training corpus;
[0037] Question replacement module, for randomly replacing the corresponding question with the derived question set corresponding to each question in the context corpus to generate an expanded training corpus set corresponding to the answer, and collecting the expanded training corpus set of all answers to obtain the expanded training corpus of the original training corpus.
[0038] Optionally, the question division module divides the original training corpus into questions and answers by the following method:
[0039] Performing sentence division operation on the original training corpus to obtain a sentence set;
[0040] Using a pre-trained activation function to calculate the probability value of each sentence in the sentence set with respect to the question and the answer;
[0041] According to the size of the probability value, marking each sentence as a question or an answer.
[0042] To solve the above problems, the present application also provides an electronic device, the electronic device comprises:
[0043] Memory, storing at least one computer program; and
[0044] Processor, executing the program stored in the memory to realize the training corpus expansion method described above.
[0045] To solve the above problems, the application further provides a computer readable storage medium, wherein at least one computer program is stored in the computer readable storage medium, and the at least one computer program is executed by a processor in an electronic device to implement the training corpus expansion method.
[0046] The embodiment of the application takes the content before each answer sentence in the original training corpus of the financial customer robot as the context corpus of the answer sentence, and then randomly replaces the corresponding question in the context corpus with the derived question set corresponding to each question, so that each answer sentence forms a plurality of combined context corpora. In this way, a group of original training corpora can be quickly converted into a plurality of groups of expanded training corpora for predicting different answer sentences. In addition, the context training corpus corresponding to each answer sentence also has a plurality of combination modes. Therefore, the training corpus expansion method provided by the embodiment of the application can improve the generation efficiency of the training corpus of the intelligent model of the financial customer robot. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 A flowchart of the training corpus expansion method provided by an embodiment of the application is shown in the figure.
[0048] Figure 2 A detailed implementation flowchart of one step of the training corpus expansion method provided by an embodiment of the application is shown in the figure.
[0049] Figure 3 A detailed implementation flowchart of one step of the training corpus expansion method provided by an embodiment of the application is shown in the figure.
[0050] Figure 4 A detailed implementation flowchart of one step of the training corpus expansion method provided by an embodiment of the application is shown in the figure.
[0051] Figure 5 A functional module diagram of the training corpus expansion device provided by an embodiment of the application is shown in the figure.
[0052] Figure 6 A structural diagram of the electronic device for implementing the training corpus expansion method provided by an embodiment of the application is shown in the figure.
[0053] The implementation, functional features and advantages of the application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0054] It should be understood that the specific embodiments described herein are only used to explain the application, and are not used to limit the application.
[0055] The embodiment of the application provides a training corpus expansion method. The execution subject of the training corpus expansion method includes but is not limited to at least one of electronic devices such as a server, a terminal and the like which can be configured to execute the method provided by the embodiment of the application. In other words, the training corpus expansion method can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform. The server can be a stand-alone server, or a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content delivery network (CDN), and big data and artificial intelligence platform.
[0056] Referring to Figure 1 FIG. 1 is a flowchart of a training corpus expansion method provided by an embodiment of the application. In this embodiment, the training corpus expansion method includes the following steps.
[0057] S1, a set of original training corpora is obtained, and question sentences and answer sentences of the original training corpora are divided;
[0058] In the embodiment of the application, the application scenario of an online customer service robot in the field of finance and insurance is taken as an example to illustrate the training corpus expansion method. Generally, an online customer service robot is constructed based on natural language processing technology and a machine learning model, and can provide users with consultation services for various insurance businesses, such as insurance renewal procedure query, insurance claim query, insurance product recommendation and the like.
[0059] In the embodiment of the application, the original training corpus is used to train the online customer service robot to answer questions, and the original training corpus generally includes dialogue records between an artificial customer service and a user or dialogue records between an online customer service robot and a user. The original training corpus generally consists of business consultation sentences (question sentences) of a user and business guidance sentences (answer sentences) replied by the robot. The original training corpus can include multiple question sentences and multiple answer sentences, and the multiple question sentences can be directed to multiple or the same business problem. Similarly, the multiple answer sentences can be directed to multiple or the same business solution.
[0060] The purpose of dividing the original training corpus into question sentences and answer sentences in the embodiment of the application is to facilitate subsequent generation of multiple sets of training corpora from a group of original training corpora from the perspectives of questions and answers.
[0061] Referring to Figure 2 The division of the original training corpus into question sentences and answer sentences includes the following steps.
[0062] S11, a sentence division operation is performed on the original training corpus to obtain a sentence set.
[0063] S12, calculating a probability value of each of the sub-sentence set relative to the question sentence and the answer sentence by using the pre-trained activation function;
[0064] S13, marking the question sentence or the answer sentence for each of the sub-sentence according to the size of the probability value.
[0065] In the embodiment of the application, the pre-trained activation function is obtained by classifying and training the activation function by using the pre-labeled training set of the question sentence and the answer sentence. The pre-trained activation function includes but is not limited to a softmax activation function, a sigmoid activation function, and a relu activation function.
[0066] It can be understood that if the probability value of a sub-sentence corresponding to the question sentence is greater than the probability value of the sub-sentence corresponding to the answer sentence, the sub-sentence can be marked as the question sentence. Similarly, if the probability value of a sub-sentence corresponding to the question sentence is less than the probability value of the sub-sentence corresponding to the answer sentence, the sub-sentence can be marked as the answer sentence.
[0067] In the embodiment of the application, a pre-trained machine learning model, such as a Naive Bayes classifier or a support vector machine, can be used to classify each of the sub-sentence set as a question sentence or an answer sentence.
[0068] In another optional embodiment of the application, a dependency syntax analysis or syntax tree parsing technology can be used to analyze the structure and composition of each of the sentence set to determine whether each of the sub-sentence is a question sentence or an answer sentence.
[0069] It can be understood that in actual application, a plurality of question sentences of a user can express the same business problem, for example, how to handle insurance renewal and what needs to be done to handle insurance renewal. Therefore, it is necessary to further identify a type of question sentences expressing the same semantics in all question sentences or a type of answer sentences expressing the same semantics in all answer sentences.
[0070] Further, after the division of the original training corpus into question sentences and answer sentences, the method further includes:
[0071] identifying all question sentences with similar semantics in the marked question sentences, and marking the same question sentence for the question sentences with similar semantics;
[0072] identifying all answer sentences with similar semantics in the marked answer sentences, and marking the same answer sentence for the answer sentences with similar semantics.
[0073] In detail, the identification of all question sentences with similar semantics in the marked question sentences includes:
[0074] extracting a keyword of each of the question sentences, and converting the keyword corresponding to each of the question sentences into a keyword vector;
[0075] Splicing the keyword vectors of each of the question sentences obtains a feature vector of the corresponding question sentence;
[0076] The similarity between the feature vectors of each of the question sentences is calculated;
[0077] The question sentence with a similarity greater than a preset similarity threshold is selected as a semantically similar question sentence.
[0078] In the embodiment of the application, the keyword extraction algorithm can be used to extract the keywords of each of the question sentences. The keywords are converted into keyword vectors by using a word2vec model, an NLP (Natural Language Processing) model or other models having a word vector conversion function.
[0079] In the embodiment of the application, the Euclidean distance formula can be used to calculate the distance value between the feature vectors of any two sub-sentences, and the distance value is used to represent the similarity between the two.
[0080] It should be noted that the method of identifying all the answer sentences marked as semantically similar is the same as the method of identifying all the question sentences marked as semantically similar, which will not be described here.
[0081] In the embodiment of the application, the first marking is the marking of whether the sub-sentence in the original training corpus is a question sentence or an answer sentence, and the second marking is the marking of whether multiple question sentences are the same type of question sentences or multiple answer sentences are the same type of answer sentences.
[0082] S2, performing a similar semantic sentence derivation operation on each of the question sentences to obtain a derived question sentence set corresponding to the question sentence;
[0083] In the embodiment of the application, a semantic model can be trained using machine learning or deep learning technology, such as Word2Vec, GloVe or BERT, etc. The semantic model can represent words or sentences as vectors and capture the semantic relationship between them. Similar sentences to each of the question sentences are derived by using the trained semantic model.
[0084] In detail, referring to Figure 3 As shown in the figure, the S2 includes:
[0085] S21, using a pre-trained semantic model to output a candidate near-synonymous sentence set corresponding to each of the question sentences;
[0086] S22, using a semantic similarity measurement method to score the similarity of the sentences in the candidate near-synonymous sentence set;
[0087] S23, selecting a preset number of sentences with the maximum score to form a derived question sentence set corresponding to the corresponding question sentence.
[0088] In the embodiment of the application, a semantic similarity measurement method such as cosine similarity can be used to evaluate the sentences in the surgery candidate synonymous sentence set.
[0089] In the embodiment of the application, the preset number can be set according to the accuracy and robustness of the trained semantic model.
[0090] In the embodiment of the application, by deriving similar semantics for each question sentence, one question sentence can be converted into multiple alternative derived question sentences, thereby achieving a surge in quantity.
[0091] S3, in the original training corpus, dividing the context corpus corresponding to each answer sentence;
[0092] It can be understood that the training process of an online customer service robot is usually based on the given training corpus to predict the corresponding reply sentence. The training corpus can be understood as the context corpus information of the final reply sentence to be predicted. Based on this situation, the embodiment of the application sequentially takes the original training corpus corresponding to each answer sentence as the context corpus of the corresponding answer sentence, thereby realizing the division of a group of original training corpora into multiple groups of context corpora for predicting different answer sentences.
[0093] In detail, referring to Figure 4 As shown in
[0094] S31, according to the appearance order of the answer sentences from back to front in the original training corpus, all the answer sentences are sorted;
[0095] S32, one answer sentence in the sorting is selected as a target prediction answer sentence;
[0096] S33, the maximum sentence range and the minimum sentence range are divided in the original training corpus corresponding to the target prediction answer sentence;
[0097] S34, the maximum sentence range and the minimum sentence range are respectively constituted as the context corpus of the target prediction answer sentence.
[0098] Exemplarily, the original training corpus includes:
[0099] The first line (question sentence) customer: Are you there
[0100] The second line (answer sentence) customer service: Hello, dear customer, I am your exclusive customer manager, you can consult me about any insurance-related questions
[0101] The third line customer (question sentence): My car insurance is about to expire, how to renew
[0102] Line 4 (answer): Dear customer, you can buy through the good car owner APP, enter my- > insurance- > buy car insurance page, which contains detailed introduction of various insurance
[0103] Line 5 (question): Can you recommend a few car insurance products directly to me
[0104] Line 6 (answer): Dear customer, I can arrange your exclusive customer manager for you, and he will give you one-on-one introduction, can you see it
[0105] According to the above content, the original training corpus includes information from line 1 to line 6, and the method provided by S3 is used, and the original training corpus can be divided into the following 5 groups of context corpus:
[0106] Group 1: The context corpus composed of lines 1 to 5 for the answer of line 6;
[0107] Group 2: The context corpus composed of line 5 for the answer of line 6;
[0108] Group 3: The context corpus composed of lines 1 to 3 for the answer of line 4;
[0109] Group 4: The context corpus composed of line 3 for the answer of line 4;
[0110] Group 5: The context corpus composed of line 1 for the answer of line 2;
[0111] In the embodiment of the application, each group of context corpus can be used as an independent training corpus for answer prediction training of an online customer service robot.
[0112] S4, using the derivative question set corresponding to each question in the context corpus to replace the corresponding question, generating an expanded training corpus set corresponding to the answer, collecting all the expanded training corpus sets of the answers, obtaining the expanded training corpus of the original training corpus.
[0113] In the embodiment of the application, the original training corpus is converted into a plurality of groups of training corpus for predicting different answers, and the questions in each group of subdivided training corpus after conversion can be replaced by using the derivative question set in a permutation and combination manner, and finally each group of subdivided training corpus can generate more new training corpus, thereby realizing the conversion of one group of original training corpus into more groups of expanded training corpus.
[0114] The embodiment of the present application takes the content before each answer sentence in the original training corpus of the financial customer robot as the context corpus of the answer sentence, and then randomly replaces the corresponding question in the context corpus with the derived question set corresponding to each question in the context corpus, so that each answer sentence forms a plurality of combined context corpora. In this way, a group of original training corpora can be quickly converted into a plurality of groups of expanded training corpora for the purpose of predicting different answer sentences. Moreover, the context training corpora corresponding to each answer sentence also have a plurality of combination modes. Therefore, the training corpus expansion method provided by the embodiment of the present application can improve the generation efficiency of the training corpus of the intelligent model of the financial field customer robot.
[0115] As shown in Figure 5 is a functional module diagram of the training corpus expansion device provided by an embodiment of the present application.
[0116] The training corpus expansion device 100 can be installed in an electronic device. According to the functions to be implemented, the training corpus expansion device 100 includes a question and answer division module 101, a question derivation module 102, an answer context division module 103, and a question replacement module 104. The modules of the present application can also be referred to as units, which refer to a series of computer program segments that can be executed by an electronic device processor and can complete a fixed function, and are stored in the memory of the electronic device.
[0117] In the present embodiment, the functions of each module / unit are as follows:
[0118] The question and answer division module 101 is configured to obtain a group of original training corpora, and divide the original training corpora into questions and answers.
[0119] The question derivation module 102 is configured to perform a derivation operation on each question to obtain a derived question set corresponding to the question.
[0120] The answer context division module 103 is configured to divide the context corpus corresponding to each answer in the original training corpus.
[0121] The question replacement module 104 is configured to randomly replace the corresponding question in the context corpus with the derived question set corresponding to each question in the context corpus to generate an expanded training corpus set corresponding to the answer, and then collect the expanded training corpus sets of all answers to obtain the expanded training corpus of the original training corpus.
[0122] In detail, the specific implementation of each module of the training corpus expansion device 100 is as follows:
[0123] Step one, obtaining a group of original training corpora, and dividing the original training corpora into questions and answers.
[0124] The embodiment of the application takes the application scene of an online customer service robot in the field of finance and insurance as an example to illustrate the training corpus expansion method. Generally, the online customer service robot is constructed based on natural language processing technology and a machine learning model, and can provide users with consultation services for various insurance businesses, such as insurance renewal procedure answering, insurance claim answering, insurance product recommendation, and the like.
[0125] In the embodiment of the application, the original training corpus is used to train the online customer service robot for answering and predicting. The original training corpus generally includes dialogue records between an artificial customer service and a user or dialogue records between an online customer service robot and a user. The original training corpus generally consists of business consultation sentences (questions) of the user and business guidance sentences (answers) replied by the robot. The original training corpus can include multiple questions and multiple answers. Multiple questions can be directed to multiple or the same business problem, and multiple answers can be directed to multiple or the same business solution.
[0126] The original training corpus is divided into questions and answers in the embodiment of the application, so as to facilitate subsequent generation of multiple groups of training corpora from a group of original training corpora from the perspectives of questions and answers.
[0127] In detail, the division of the original training corpus into questions and answers includes:
[0128] Performing a sentence division operation on the original training corpus to obtain a sentence set;
[0129] Calculating the probability value of each sentence in the sentence set with respect to the question and the answer by using a pre-trained activation function;
[0130] Labeling each sentence as a question or an answer according to the probability value.
[0131] In the embodiment of the application, the pre-trained activation function is obtained by performing classification training of the activation function on a pre-labeled training set of questions and answers. The pre-trained activation function includes but is not limited to a softmax activation function, a sigmoid activation function, and a relu activation function.
[0132] It can be understood that if the probability value of a sentence corresponding to a question is greater than the probability value of the sentence corresponding to an answer, the sentence can be labeled as a question. Similarly, if the probability value of a sentence corresponding to a question is less than the probability value of the sentence corresponding to an answer, the sentence can be labeled as an answer.
[0133] In the embodiment of the application, a pre-trained machine learning model, such as a Naive Bayes classifier or a support vector machine, can be used to classify each sentence in the sentence set as a question or an answer.
[0134] In another optional embodiment of the present application, the structure and components of each sentence in the sentence set can be analyzed by using dependency syntax analysis or syntax tree parsing technology to determine whether each of the sub-sentences is a question or an answer.
[0135] It can be understood that in actual application, multiple questions of a user can express the same business problem, for example, how to handle insurance renewal and what needs to be done to handle insurance renewal. Therefore, it is necessary to further identify a type of questions expressing the same semantics in all questions or a type of answers expressing the same semantics in all answers.
[0136] Further, after the division of the original training corpus into questions and answers, the method further comprises:
[0137] identifying questions with similar semantics in all questions marked as questions, and marking the questions with similar semantics as the same question;
[0138] identifying answers with similar semantics in all answers marked as answers, and marking the answers with similar semantics as the same answer.
[0139] In detail, the method of identifying questions with similar semantics in all questions marked as questions comprises:
[0140] extracting keywords of each question, and converting the keywords corresponding to each question into a keyword vector;
[0141] splicing the keyword vector of each question to obtain a feature vector of the corresponding question;
[0142] calculating the similarity between the feature vectors of each question;
[0143] selecting questions with a similarity greater than a preset similarity threshold as questions with similar semantics.
[0144] In the embodiment of the present application, the keywords of each question can be extracted by using a keyword extraction algorithm. The keywords can be converted into a keyword vector by using a word2vec model, an NLP (Natural Language Processing) model, or other models with keyword vector conversion function.
[0145] In the embodiment of the present application, the distance value between the feature vectors of any two sub-sentences can be calculated by using the Euclidean distance formula, and the similarity between the two can be represented by using the distance value.
[0146] It should be noted that the method of identifying answers with similar semantics in all answers marked as answers is the same as the method of identifying questions with similar semantics in all questions marked as questions, which will not be described here.
[0147] In the embodiment of the present application, the first labeling is to label whether a sentence in the original training corpus is a question or an answer, and the second labeling is to label whether multiple questions are the same type of questions or multiple answers are the same type of answers.
[0148] Step two, performing a similar semantic sentence derivation operation on each question to obtain a derived question set corresponding to the question;
[0149] In the embodiment of the present application, a semantic model can be trained using machine learning or deep learning techniques, such as Word2Vec, GloVe, or BERT, etc. The semantic model can represent words or sentences as vectors and capture the semantic relationship between them. Similar sentences to each question are derived through the trained semantic model.
[0150] In detail, the derivation operation of similar semantic sentences on each question includes:
[0151] Outputting a candidate set of similar sentences corresponding to each question using a pre-trained semantic model;
[0152] Scoring the similarity of the sentences in the candidate set of similar sentences using a semantic similarity measurement method;
[0153] Selecting a preset number of sentences with the highest scores to form a derived question set corresponding to the corresponding question.
[0154] In the embodiment of the present application, a semantic similarity measurement method such as cosine similarity can be used to evaluate the sentences in the candidate set of similar sentences.
[0155] In the embodiment of the present application, the preset number can be set according to the accuracy and robustness of the trained semantic model.
[0156] In the embodiment of the present application, by deriving similar semantics for each question, a question can be converted into multiple alternative derived questions, thereby achieving a quantitative explosion.
[0157] Step three, dividing the context corpus corresponding to each answer in the original training corpus;
[0158] It can be understood that the training process of an online customer service robot is usually based on the given training corpus to predict the corresponding reply sentence. The training corpus can be understood as the context corpus information of the final reply sentence to be predicted. Based on this situation, the embodiment of the present application sequentially takes the original training corpus corresponding to each answer as the context corpus of the corresponding answer, thereby realizing the division of a group of original training corpora into multiple groups of context corpora for predicting different answers.
[0159] In detail, the dividing the context corpus corresponding to each of the answer sentences in the original training corpus comprises:
[0160] According to the appearance order of the answer sentences in the original training corpus from back to front, all the answer sentences are sorted;
[0161] An answer sentence in the sorting is selected as a target prediction answer sentence in turn;
[0162] The maximum sentence range and the minimum sentence range in the original training corpus corresponding to the target prediction answer sentence are divided;
[0163] The maximum sentence range and the minimum sentence range are respectively constituted as the context corpus of the target prediction answer sentence.
[0164] Exemplarily, the original training corpus comprises:
[0165] The first line (question sentence) customer: Are you there?
[0166] The second line (answer sentence) customer service: Hello, dear customer, I am your exclusive customer manager, and you can consult me about any insurance-related questions
[0167] The third line (question sentence) customer: My car insurance is about to expire, how to renew
[0168] The fourth line (answer sentence) customer service: Dear customer, you can purchase through the Good Car Owner APP, enter My-Insurance-Buy Car Insurance page, which contains detailed introduction of various insurance
[0169] The fifth line (question sentence) customer: Can you directly recommend several car insurance products to me?
[0170] The sixth line (answer sentence) customer service: Dear customer, I can arrange your exclusive customer manager to introduce to you one-on-one, can you see it?
[0171] According to the above content, the original training corpus comprises the first to sixth lines of information, and the original training corpus can be divided into the following five groups of context corpus by using the method provided by S3:
[0172] The first group: the context corpus composed of the first to fifth lines for the sixth line answer sentence;
[0173] The second group: the context corpus composed of the fifth line for the sixth line answer sentence;
[0174] The third group: the context corpus composed of the first to third lines for the fourth line answer sentence;
[0175] The fourth group: the context corpus composed of the third line for the fourth line answer sentence;
[0176] Group 5: Context corpus composed of the 1st row for the 2nd row answer;
[0177] In the embodiment of the application, each of the context corpus can be used as an independent training corpus for the answer prediction training of the online customer service robot.
[0178] Step four, using the corresponding derived question set of each question in the context corpus to replace the corresponding question, generating an expanded training corpus set of the corresponding answer, collecting all the expanded training corpus sets of the answers, and obtaining the expanded training corpus of the original training corpus.
[0179] In the embodiment of the application, the original training corpus is converted into a plurality of groups of training corpus for predicting different answers, and the questions in each subdivided training corpus after conversion can be replaced by using the derived question set in a permutation and combination manner, and finally each subdivided training corpus can be derived into more new training corpus, so as to realize the conversion of one group of original training corpus into more groups of expanded training corpus.
[0180] In the embodiment of the application, the content before each answer in the original training corpus of the financial customer service robot is used as the context corpus of the answer, and the corresponding derived question set of each question in the context corpus is used to randomly replace the corresponding question, so that each answer will form a plurality of combined context corpus, and in this way, one group of original training corpus can be quickly converted into a plurality of groups of expanded training corpus for predicting different answers, and the context training corpus corresponding to each answer also has a plurality of combination modes, therefore, the training corpus expansion device provided by the embodiment of the application can improve the generation efficiency of the training corpus of the intelligent model of the customer service robot in the financial field.
[0181] As shown in FIG. 1, it is a structural schematic diagram of an electronic device for implementing the training corpus expansion method provided by an embodiment of the application. Figure 6
[0182] The electronic device 1 can include a processor 10, a memory 11 and a bus, and can also include a computer program stored in the memory 11 and executable on the processor 10, such as training corpus expansion.
[0183] The memory 11 includes at least one type of readable storage medium, such as a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 11 can also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 11 can include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 can be used to store application software and various data installed in the electronic device 1, such as code for training corpus expansion, etc., and to temporarily store data that has been output or will be output.
[0184] The processor 10 can be composed of an integrated circuit in some embodiments, such as a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more combinations of a central processing unit (CPU), a microprocessor, a digital processing chip, a graphics processor, and various control chips, etc. The processor 10 is the control unit of the electronic device, which connects various components of the entire electronic device through various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules stored in the memory 11 (such as training corpus expansion, etc.) and calling data stored in the memory 11.
[0185] The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize the connection and communication between the memory 11 and at least one processor 10, etc.
[0186] Figure 6 Only an electronic device with components is shown, and those skilled in the art can understand that, Figure 6 The structure shown does not constitute a limitation on the electronic device 1, and can include fewer or more components than shown, or combine certain components, or different component arrangements.
[0187] For example, although not shown, the electronic device 1 can also include a power source (such as a battery) to power the various components, and preferably the power source can be logically connected to the at least one processor 10 through a power management device, so that the power management device can implement functions such as charge management, discharge management, and power consumption management. The power source can also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components. The electronic device 1 can also include various sensors, Bluetooth modules, Wi-Fi modules, and the like, which are not described here.
[0188] Further, the electronic device 1 can also include a network interface, which can optionally include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), and is typically used to establish a communication connection between the electronic device 1 and other electronic devices.
[0189] Optionally, the electronic device 1 can also include a user interface, which can be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally a standard wired interface, a wireless interface. Optionally, in some embodiments, the display can be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch, etc. The display can also be appropriately referred to as a display screen or a display unit, and is used to display information processed in the electronic device 1 and to display a visual user interface.
[0190] It should be understood that the embodiments are only for illustration and are not limited in the scope of the patent application by this structure.
[0191] The training corpus expansion stored in the memory 11 in the electronic device 1 is a combination of a plurality of instructions, which when executed in the processor 10, can achieve:
[0192] Obtain a set of original training corpus, and divide the original training corpus into question sentences and answer sentences;
[0193] Perform a similar semantic sentence derivation operation on each of the question sentences to obtain a set of derived question sentences corresponding to the question sentences;
[0194] In the original training corpus, divide the context corpus corresponding to each of the answer sentences;
[0195] Use the set of derived question sentences corresponding to each question sentence in the context corpus to randomly replace the corresponding question sentence to generate a set of expanded training corpus for the corresponding answer sentence;
[0196] Collecting the expansion training corpus of all answer sentences, to obtain the expansion training corpus of the original training corpus.
[0197] Further, the modules / units integrated in the electronic device 1 are stored in a computer readable storage medium if they are realized in the form of software function units and sold or used as independent products. The computer readable storage medium can be volatile or non-volatile. For example, the computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM).
[0198] The application further provides a computer readable storage medium, which stores a computer program, and the computer program can realize the following when executed by a processor of an electronic device:
[0199] Obtaining a group of original training corpora, and dividing question sentences and answer sentences from the original training corpora;
[0200] Deriving similar semantic sentences for each question sentence to obtain a set of derived question sentences corresponding to the question sentence;
[0201] Dividing context corpora corresponding to each answer sentence from the original training corpora;
[0202] Randomly replacing each question sentence with a set of derived question sentences corresponding to the question sentence in the context corpora to generate an expansion training corpus set of the corresponding answer sentence;
[0203] Collecting the expansion training corpus of all answer sentences, to obtain the expansion training corpus of the original training corpus.
[0204] In addition, each function module in each embodiment of the application can be integrated in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software function module.
[0205] It is obvious for those skilled in the art that the application is not limited to the details of the above exemplary embodiments, and the application can be realized in other specific forms without departing from the spirit or essential characteristics of the application.
[0206] Thus, the embodiments can be regarded as illustrative rather than restrictive, and the scope of the application is defined by the appended claims rather than the description preceding it, so that all changes that come within the meaning and range of equivalency of the claims are to be embraced within the scope of the application. Any reference signs in the claims should not be construed as limiting the scope of the claims.
[0207] The blockchain referred to in the present application is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. The blockchain is essentially a decentralized database, and is a series of data blocks associated using cryptographic methods. Each data block contains information of a batch of network transactions, and is used to verify the validity (anti-fake) of the information and generate the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer.
[0208] Embodiments of the present application can acquire and process related data based on holographic projection technology. Artificial intelligence (AI) is the use of digital computers or computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0209] In addition, it is clear that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claims can also be implemented by one unit or device through software or hardware. The second and subsequent words are used to indicate the name and not any particular order.
[0210] Finally, it should be pointed out that the above embodiments are only used to illustrate the technical solutions of the present application and are not limiting. Although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solutions of the present application can be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.
Claims
1. A training corpus augmentation method, characterized in that, The method comprises: acquiring a set of original training corpus, and performing question and answer division on the original training corpus; deriving similar semantic sentences for each question to obtain a set of derived questions corresponding to the question; sorting all answers in the original training corpus according to the appearance order from back to front, and sequentially selecting an answer in the sorting as a target prediction answer, dividing the maximum sentence range and the minimum sentence range in the original training corpus corresponding to the answers before the target prediction answer in the sorting, and constructing the maximum sentence range and the minimum sentence range as the context corpus of the target prediction answer; using the set of derived questions corresponding to each question in the context corpus to randomly replace the corresponding question to generate an expanded training corpus set corresponding to the answer; collecting the expanded training corpus sets of all answers to obtain an expanded training corpus of the original training corpus.
2. The training corpus augmentation method of claim 1, wherein, The question and answer division on the original training corpus comprises: performing sentence division on the original training corpus to obtain a set of divided sentences; calculating the probability value of each divided sentence with respect to the question and the answer by using a pre-trained activation function; labeling each divided sentence as a question or an answer according to the size of the probability value.
3. The training corpus augmentation method of claim 1, wherein, The derivation of similar semantic sentences for each question comprises: outputting a set of candidate synonymous sentences corresponding to each question by using a pre-trained semantic model; scoring the similarity of the sentences in the set of candidate synonymous sentences by using a semantic similarity measurement method; selecting a preset number of sentences with the maximum score to form a set of derived questions corresponding to the corresponding question.
4. The training corpus augmentation method of claim 2, wherein, After the question and answer division on the original training corpus, the method further comprises: identifying semantically similar questions in all labeled questions, and labeling the semantically similar questions as the same question; identifying semantically similar answers in all labeled answers, and labeling the semantically similar answers as the same answer.
5. The training corpus augmentation method of claim 4, wherein, The identification of semantically similar questions in all labeled questions comprises: extracting the keywords of each question, and converting the keywords corresponding to each question into a keyword vector; splicing the keyword vectors of each question to obtain a feature vector of the corresponding question; calculating the similarity between the feature vectors of each question; selecting the questions with a similarity greater than a preset similarity threshold as semantically similar questions.
6. A training corpus expansion device configured to execute the training corpus expansion method according to any one of claims 1 to 5, characterized by The device comprises: a question and answer division module for acquiring a set of original training corpus, and performing question and answer division on the original training corpus; a question derivation module for deriving similar semantic sentences for each question to obtain a set of derived questions corresponding to the question; an answer context division module for dividing the context corpus corresponding to each answer in the original training corpus; a question replacement module for randomly replacing the corresponding question by using the set of derived questions corresponding to each question in the context corpus to generate an expanded training corpus set corresponding to the answer, and collecting the expanded training corpus sets of all answers to obtain an expanded training corpus of the original training corpus.
7. The training corpus augmentation apparatus of claim 6, wherein, The question sentence division module divides the original training corpus into questions and answers by the following method: performing a sentence division operation on the original training corpus to obtain a sentence set; calculating a probability value of each sentence in the sentence set with respect to a question and an answer using a pre-trained activation function; labeling each sentence as a question or an answer according to the size of the probability value.
8. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the training corpus expansion method according to any one of claims 1 to 5.
9. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the training corpus expansion method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Speech recognition method and speech recognition device for interaction system
CN105161098A
Knowledge base expansion method and device, equipment and medium
CN115525747A