Topic model-based question automatic reply method, apparatus and device, and storage medium
Through the automatic problem response method based on the topic model, the problem that traditional automatic reply system cannot effectively deal with complex problems or personalized needs is solved, and more accurate, professional and intelligent automatic reply is achieved, improving the efficiency and customer experience of customer questions.
Patent Information
- Application Number
- CN202411650296.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-14
AI Technical Summary
The traditional automatic reply system based on predefined rules and templates cannot effectively deal with complex problems or personalized needs, and cannot accurately understand the semantic environment of customer problems, resulting in inaccurate service responses and affecting customer experience.
The automatic question response method based on the topic model is adopted, and the conversation text set of customer service in the financial industry is obtained, data processing and text vectorization are performed, the topic classification results are determined using the LDA topic model, and a question-and-answer database is built to achieve intelligent matching and reply to user questions.
It improves the efficiency and accuracy of customer questions processing and reply, reduces the burden on customer service personnel, provides faster response time, and improves customer experience and customer service work efficiency.
Smart Images

Figure CN119621886A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automated business handling, and in particular to a method, device, equipment and storage medium for automatically replying questions based on a topic model. Background Art
[0002] With the development of the Internet, more and more companies are beginning to introduce customer service systems into their business processes to provide a better service experience. However, customer service systems that rely on manual operations cannot quickly and effectively handle a large number of user feedback and questions, and traditional automatic reply systems based on pre-defined rules and templates cannot meet the diverse needs of users, especially for complex questions or personalized needs. They often give inappropriate answers because they cannot understand the semantic environment of customer questions. Not only does it take a long time to respond, but it also cannot accurately understand the expression of ambiguous questions, making it difficult to solve complex problems, resulting in inaccurate service answers and affecting customer experience. Summary of the invention
[0003] In view of this, the present invention provides a method, device, equipment and storage medium for automatic answering of questions based on a topic model, which can improve the efficiency of handling customer questions and the accuracy of answers, reduce the burden on customer service personnel, and provide a faster response time, thereby improving customer satisfaction and business efficiency.
[0004] According to one aspect of the present invention, an embodiment of the present invention provides a method for automatically replying questions based on a topic model, the method comprising:
[0005] Acquire a conversation text set of financial industry customer service, and process the conversation text data contained in the conversation text set to obtain a question-answer data set; wherein the question-answer data set includes a question text set and an answer text set;
[0006] Performing text vectorization on the question-answer dataset based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format; wherein the question-answer pair vector includes: a question text vector and an answer text vector;
[0007] Determine a topic classification result based on the question-answer pair vector and the LDA topic model, and construct a question-answer database according to the topic classification result; wherein the topic classification result includes topics and keywords corresponding to each of the topics;
[0008] The question input by the user is obtained, an answer result matching the question is searched in the question and answer database, and the answer result is replied to the user.
[0009] According to another aspect of the present invention, an embodiment of the present invention further provides a question automatic reply device based on a topic model, the device comprising:
[0010] A data processing module, used to obtain a conversation text set of financial industry customer service, and perform data processing on the conversation text data contained in the conversation text set to obtain a question-answer data set; wherein the question-answer data set includes a question text set and an answer text set;
[0011] A vectorization module, used for performing text vectorization on the question-answer dataset based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format; wherein the question-answer pair vector includes: a question text vector and an answer text vector;
[0012] A database construction module, used to determine a topic classification result based on the question-answer pair vector and the LDA topic model, and to construct a question-answer database according to the topic classification result; wherein the topic classification result includes topics and keywords corresponding to each of the topics;
[0013] The reply module is used to obtain the question input by the user, search the question and answer database for the answer result matching the question, and reply the answer result to the user.
[0014] According to another aspect of the present invention, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the automatic question answering method based on the topic model described in any embodiment of the present invention.
[0018] According to another aspect of the present invention, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the automatic question answering method based on a topic model described in any embodiment of the present invention when executed.
[0019] According to another aspect of the present invention, an embodiment of the present invention further provides a computer program product, characterized in that the computer program product includes a computer program, and when the computer program is executed by a processor, it implements the automatic question answering method based on the topic model described in any embodiment of the present invention.
[0020] The technical effect of the present invention is that a question-answer data set is obtained by performing data processing on the conversation text data in the acquired conversation text set, and the question-answer data set is text-vectorized based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format, and a topic classification result is determined based on the question-answer pair vector and the LDA topic model, and a question-answer database is constructed according to the topic classification result, and the question input by the user is obtained, and the answer result matching the question is searched from the question-answer database and replied to the user, thereby achieving the goal of extracting the topic information of the user's question and reply, and constructing a conversation database with richer semantic information. When a customer asks a question, the question is processed accordingly and the topic is matched, and the most appropriate answer is automatically generated and replied to the customer, so as to achieve more accurate, professional and intelligent automatic replies, while improving the efficiency of customer question processing and reply accuracy, reducing the burden on customer service personnel, and providing faster response time, thereby improving customer experience and customer service work efficiency.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 A flowchart of a method for automatically replying to questions based on a topic model provided by an embodiment of the present invention;
[0024] Figure 2 A flowchart of another method for automatically replying questions based on a topic model provided by an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of another method for automatically replying questions based on a topic model provided by an embodiment of the present invention;
[0026] Figure 4 A structural block diagram of a question automatic reply device based on a topic model provided by an embodiment of the present invention;
[0027] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] In one embodiment, Figure 1 A flowchart of a method for automatically replying to questions based on a topic model is provided for one embodiment of the present invention. This embodiment can be applied to situations when automatically replying to user questions. The method can be executed by an automatic question replying device based on a topic model. The automatic question replying device based on a topic model can be implemented in the form of hardware and / or software. The automatic question replying device based on a topic model can be configured in an electronic device.
[0031] like Figure 1 As shown, the method for automatically replying questions based on the topic model in this embodiment specifically includes the following steps:
[0032] S110, obtaining a dialogue text set of financial industry customer service, and performing data processing on the dialogue text data contained in the dialogue text set to obtain a question-answer data set; wherein the question-answer data set includes a question text set and an answer text set.
[0033] Among them, the dialogue text set can be understood as the dialogue text composed of user questions and customer replies, which may include but is not limited to dialogue texts such as customer consultation, comments, customer satisfaction surveys related to customer service in the financial industry. The dialogue text content involved may include but is not limited to content related to financial product consultation, loan processing, transaction information, complaints and disputes, etc.
[0034] In this embodiment, text data related to customer service in the financial industry can be collected from multiple channels to form a dialogue text set of customer service in the financial industry, and the dialogue text data contained in the dialogue text set is preprocessed, and then the preprocessed dialogue text data is processed into a question-answer data set in a question-answer pair format; wherein the question-answer data set includes a question text set and an answer text set; and the question-answer pair format includes question sentence keywords, answer sentence keywords, and undetermined topics.
[0035] S120. Perform text vectorization on the question-answer dataset based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format; wherein the question-answer pair vector includes: a question text vector and an answer text vector.
[0036] Among them, the word embedding model is a method of representing words as multidimensional vectors, which can reflect the similarities and relationships between words. It can be understood that the word embedding model is a word vector representation method based on a neural network, which is used to map words in a text into a continuous vector space, can capture the semantic relationship between words, and is widely used in natural language processing tasks. The word embedding model in this embodiment can be a Word2vec model.
[0037] In this embodiment, the word embedding model will fully consider the semantic relationship between words in the data set during the training process, can reflect the co-occurrence between words and context, and can grasp the semantic features and internal features of the text. In this embodiment, the question-answer data set is trained using the word embedding model, and the words (keywords in the question sentence and the answer sentence) are first converted into multidimensional vectors, and then the word vectors are composed of question-answer pair vectors. In some embodiments, the question-answer data set can be input into the word embedding model to map the question sentence keywords and the answer sentence keywords in the question-answer data set to the word vector space, obtain the corresponding word vector, and form a question-answer pair vector. By vectorizing the question-answer data set, the text can be mapped to the vector space for subsequent processing.
[0038] S130, determining a topic classification result based on the question-answer pair vector and the LDA topic model, and constructing a question-answer database according to the topic classification result; wherein the topic classification result includes topics and keywords corresponding to each topic.
[0039] Among them, the LDA topic model can be called the Latent Dirichlet Allocation model, which can be understood as an unsupervised probability model based on three-layer Bayesian, which can identify and extract implicit topic information from a large-scale document corpus.
[0040] In this embodiment, the topic classification result can be understood as the classification result obtained by the LDA topic model for the topic classification of each word in the question-answer pair vector, and the topic classification result can include multiple topics and the keywords corresponding to each topic. It can be understood that the keywords of the same topic are clustered under the same topic.
[0041] In this embodiment, the question and answer database includes a question library, an answer library and a question and answer pair library; wherein the question library includes question topics and question word vectors contained in the question topics; the answer library includes answer topics and answer word vectors contained in the answer topics; the question and answer pair library includes question word vectors contained in the question topics, and answer word vectors contained in the answer library, and the question word vectors and the answer word vectors correspond one to one.
[0042] In this embodiment, the question-answer pair vector is used as the document d i Input into the LDA topic model for iterative training until convergence, obtain the number of topic divisions after convergence and the corresponding topic-word distribution matrix, evaluate the number of topic divisions after convergence and the corresponding topic-word distribution matrix through perplexity to obtain the evaluation result, thereby determining the weighted topic vector and the similarity between any two keywords under the weighted topic vector, and determine the topic classification result based on the similarity and the preset similarity threshold. In this embodiment, by setting a threshold as the similarity standard for topic classification, the remaining topics that exceed the similarity threshold between topics are divided into one category, and then a question-answering database is constructed based on the classification of the topics. It can be understood that the sentences in the question text set and the answer text set are processed into a word sequence format and input into the LDA model, and the initial model parameters are set for training, and the training parameters are adjusted through the model iteration until the model converges. The word sequence in this embodiment is a keyword combination obtained after processing the sentence. In this embodiment, the topic classification obtained by the iteration obtained by the model convergence, after obtaining the topic classification, the LDA topic model is evaluated based on the perplexity method and topic classification to obtain the LDA topic model score and confirm the number of topics, and finally the topic-word distribution and question-answer-topic distribution are obtained, and then the topic is mapped to the same vector space by combining the word vector and the topic-word distribution, and the weighted topic vector is obtained for similarity calculation and topic feature matching. Further, the similarity between the topic and the question-answer pair is calculated using the similarity formula, and the topic is divided for each question-answer pair, and a question-answer database based on topic classification is constructed.
[0043] S140: Obtain the question input by the user, search for an answer result matching the question from the question and answer database, and reply the answer result to the user.
[0044] In this embodiment, the customer's input question is obtained, and the customer's question sentence is parsed and processed, and keywords are extracted to obtain a question word sequence which is input into the customer service answer model, so as to obtain the question topic corresponding to the question based on the similarity between each question keyword in the question word sequence and each question word vector in the question library; the question topic is matched in the question and answer library to obtain a matching result, and the answer result that matches the question is determined based on the matching result, and the answer result is replied to the user.
[0045] In this embodiment, relevant technologies in the fields of natural language processing and machine learning are combined to automatically identify different topics in the bank customer service question and answer text, and optimize the bank customer service dialogue model by adding topic semantic features. It can better analyze and understand the semantic environment of customer questions and give the most appropriate answers, providing customers with personalized, precise and professional services, and improving customer satisfaction and business efficiency.
[0046] The technical solution of the embodiment of the present invention processes the conversation text data in the acquired conversation text set to obtain a question-answer data set, performs text vectorization on the question-answer data set based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format, determines a topic classification result based on the question-answer pair vector and an LDA topic model, and constructs a question-answer database according to the topic classification result, obtains the question input by the user, searches the question-answer database for an answer result that matches the question, and replies to the user, thereby extracting the topic information of the user's question and reply, and constructing a conversation database with richer semantic information. When a customer asks a question, the question is processed accordingly and topic matching is performed, and the most appropriate answer is automatically generated and replied to the customer, thereby achieving more accurate, professional and intelligent automatic replies, while improving the efficiency of customer question processing and reply accuracy, reducing the burden on customer service personnel, and providing faster response time, thereby improving customer experience and customer service work efficiency.
[0047] In one embodiment, Figure 2 A flowchart of another automatic question reply method based on a topic model provided by an embodiment of the present invention. Based on the above embodiments, this embodiment processes the dialogue text data contained in the dialogue text set to obtain a question-answer data set, performs text vectorization on the question-answer data set based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format, determines a topic classification result based on the question-answer pair vector and the LDA topic model, constructs a question-answer database based on the topic classification result, and further refines the search for answer results matching the question asked in the question-answer database.
[0048] like Figure 2 As shown, the automatic question reply method based on the topic model in this embodiment may specifically include the following steps:
[0049] S210. Obtain a conversation text set of financial industry customer service, perform data preprocessing on the conversation text data, and convert the preprocessed conversation text data into a question-answer data set in a question-answer pair format; wherein the question-answer pair format includes question sentence keywords, answer sentence keywords, and a pending topic.
[0050] In this embodiment, the collected data is processed using corresponding text processing tools, including text cleaning, part-of-speech tagging, stem restoration and other operations, and the stop word list and custom word list are combined to remove high-frequency meaningless words in the text and reduce the size of the corpus. During the processing, due to the large amount of data, it is necessary to organize the text content of the customer's question-related sentences into multiple documents and save them in the question text set at the same time, organize the customer service answer-related sentences into multiple documents and save them in the answer text set, and organize the questions and their corresponding answer sentences into the question-answer data set, and process them into the question-answer pair format: that is, question sentence-keyword-answer sentence-keyword-undetermined topic.
[0051] S220, input the question-answer data set into the word embedding model to map the question sentence keywords and the answer sentence keywords in the question-answer data set to the word vector space, obtain the corresponding word vectors, and form a question-answer pair vector.
[0052] In this embodiment, the question-answer dataset is input into the word embedding model to map the question sentence keywords and answer sentence keywords in the question-answer dataset to the word vector space, obtain the corresponding word vectors, and form a question-answer pair vector including the question text vector and the answer text vector. Among them, each question-answer pair vector constitutes the document D i , denoted as D i =[d1,d2,d3,...,d M ], where M is the total number of question-answer pair vectors; d i is the i-th question-answer pair vector, expressed as in, It is represented as the question text vector in the i-th question-answer pair vector, m is the number of question text vectors, It is represented as the answer text vector in the i-th question-answer pair vector, n is the number of answer text vectors, where, w represents a keyword, [v1,v2,...,v n ] represents the vector coordinates corresponding to w.
[0053] S230, taking the question-answer pair vector as document d i Input into the LDA topic model for iterative training until convergence, and obtain the number of topic divisions output after convergence and the corresponding topic-word distribution matrix.
[0054] In this embodiment, the question-answer pair vector is used as the document d i Input into the LDA topic model for iterative training until convergence, and obtain the number of topic divisions after convergence and the corresponding topic-word distribution matrix. It can be understood as inputting the sentences in the question text set and the answer text set into the LDA model, setting the initial model parameters for training, and adjusting the training parameters through the model iteration until the model converges. Among them, the topic-word distribution matrix is expressed as: d i =[t1,t2,t3,...,t l ]; where l represents the number of topics, t i =[(p1-w1), (p2-w2),..., (p k -w k )]; where (p k -w k ) indicates that the kth keyword belongs to topic t i probability.
[0055] In one embodiment, the question-answer pair vector is used as the document d i Input into the LDA topic model for iterative training to obtain the number of topic divisions and the corresponding topic-word distribution matrix in each iteration, including: Initialize document d i Corresponding to the topic t1,...,t l The number of keywords corresponding to each topic is taken as a hyperparameter; the hyperparameter is input into the LDA topic model to obtain the document d i A first probability distribution corresponding to each topic and a second probability distribution of each keyword generated by each topic are generated, and a third probability distribution of all keywords in all documents is determined based on the first probability distribution and the second probability distribution; a topic-word probability distribution matrix and the number of topic divisions are obtained based on the third probability distribution and a preset clustering algorithm, and the number of topic divisions is used as a hyperparameter to return the step of inputting the hyperparameter into the LDA topic model until the first probability distribution and the second probability distribution converge, and the converged topic-word probability distribution matrix and the number of topic divisions are obtained. The preset clustering algorithm in this embodiment may include but is not limited to the K-MEANS clustering algorithm, the DBSCAN clustering algorithm, etc.
[0056] S240. Evaluate the number of topic divisions output after convergence and the corresponding topic-word distribution matrix according to a preset perplexity formula to obtain the optimal number of topic divisions and the corresponding optimal topic-word distribution matrix.
[0057] Among them, the preset perplexity formula is expressed as: Among them, N i Represents document d iThe number of word vectors in document d i It consists of a question vector and an answer vector; p(w i ) represents the keyword w in the topic-word distribution matrix i The distribution probability of .
[0058] In this embodiment, perplexity can be used to measure the effectiveness of a probability model in predicting samples. A probability model with low perplexity can better predict samples and is an important indicator for evaluating the effectiveness of language models in natural language processing. In this embodiment, the matrix output by the model is evaluated for perplexity to obtain a value, and the values corresponding to multiple evaluations are selected (for example, the value corresponding to 30 topics is the smallest, so this is used as the final number of topics). The result of the evaluation is a specific value. The smaller the perplexity, the better. Find the minimum value, the number of topic classifications corresponding to the minimum value, and the questions and answers contained in each topic.
[0059] S250. Combine the optimal topic-word distribution matrix with the question-answer pair vector in the question-answer pair format to map each topic into the same vector space to obtain a weighted topic vector.
[0060] Among them, the weighted topic vector is expressed as in, It is represented as the i-th keyword belongs to probability.
[0061] In this embodiment, the optimal topic-word distribution matrix corresponding to the optimal number of topic divisions is determined, and the weighted topic vector is determined based on the optimal topic-word distribution matrix. It can be understood that after obtaining the topic-word distribution matrix according to the output of the model training results, it is combined with the word vector by multiplication, and the topic is mapped to the same vector space to obtain the weighted topic vector for similarity calculation and topic feature matching.
[0062] S260: Determine the similarity between any two keywords under the weighted topic vector, and determine the topic classification result based on the similarity and a preset similarity threshold.
[0063] In this embodiment, the similarity between any two keywords under the weighted topic vector is calculated, and the target topic classification result is determined based on the similarity and the preset similarity threshold. It can be understood that after the topic vector is obtained, the topic can be classified by the similarity algorithm. The calculation formula of the similarity is expressed as: Represented by keyword w i and keyword w j The cosine similarity of the word vectors between The keyword w i The vectorized representation of The keyword w j Vectorized representation of .
[0064] S270. Classify the question word vectors with the same question topic in the topic classification results into the same question topic, and classify the answer word vectors with the same answer topic into the same answer topic.
[0065] In this embodiment, question word vectors with the same question topic are grouped into the same question topic, and answer word vectors with the same answer topic are grouped into the same answer topic.
[0066] S280. Store the question word vector and the corresponding answer word vector into a question-answer pair library to form a question-answer database.
[0067] In this embodiment, the question word vector and the corresponding answer word vector are stored in the question-answer pair library. It can be understood that by setting a threshold as the similarity standard for topic classification, the remaining topics that exceed the similarity threshold are classified into one category, and then a question-answer database is constructed based on the classification of the topics, where the data format of each record is shown in Table 1.
[0068] Table 1: Data format
[0069]
[0070] S290: Obtain the question input by the user, and extract keywords from the question to obtain a question word sequence.
[0071] In this embodiment, the customer inputs a question, and the customer's question sentence is parsed and processed, and the keywords are extracted to obtain a question word sequence which is input into the customer service answer model. The processed question word sequence is: q = [w1, w2, w, ..., w k ].
[0072] S2100, obtaining a question topic corresponding to the question according to the similarity between each question keyword in the question word sequence and each question word vector in the question library.
[0073] In this embodiment, the question word sequence is used to perform the first match in the question library, and the similarity between each question keyword in the question word sequence and the keywords included in the question library is calculated to obtain a similarity result, and the similarity results are sorted to obtain the question topic corresponding to the target question. It can be understood that matching is performed in the question library, the similarity between the customer's question and the sentences in the library is calculated and sorted, and the customer's question topic is confirmed.
[0074] S2110. Match the question and answer pair library according to the question topic to obtain a matching result, and determine the answer result that matches the question according to the matching result.
[0075] In this embodiment, the relevant answers under the corresponding question topic are retrieved in the question and answer database based on the question topic, and a second match is performed in the answer library to obtain the matching result. It can be understood that after obtaining the question topic, the relevant answers under the corresponding question topic are retrieved in the question and answer library; then the match is performed in the answer library, the similarity between the customer's question and the sentences in the library is calculated and sorted, the corresponding answer is generated after comprehensive comparison, and the generated answer is processed and replied to the customer.
[0076] The technical solution of the embodiment of the present invention inputs the question-answer data set into the word embedding model to map the question sentence keywords and the answer sentence keywords in the question-answer data set to the word vector space, obtain the corresponding word vectors, and form a question-answer pair vector, which can mine the dialogue text, increase the semantic features of the customer service model, and facilitate subsequent processing; by using the question-answer pair vector as the document d i Input into the LDA topic model for iterative training until convergence, obtain the number of topic divisions after convergence and the corresponding topic-word distribution matrix, evaluate the number of topic divisions after convergence and the corresponding topic-word distribution matrix according to the preset perplexity formula, and then determine the similarity between any two keywords under the weighted topic vector, and determine the topic classification result according to the similarity and the preset similarity threshold. The customer service system can be optimized using the topic model to automatically classify and categorize user questions into different topics, thereby realizing automated question allocation and transfer. This can improve the efficiency of handling customer questions, reduce the burden on customer service personnel, and provide faster response time.
[0077] For example, to better understand the automatic question reply method based on the topic model, Figure 3 A schematic diagram of another automatic question reply method based on a topic model provided in an embodiment of the present invention. In this embodiment, text data related to bank customer service is collected from multiple channels and preprocessed to generate a data set. The data set is then trained using a topic model and a word embedding model to automatically identify and classify different topics, and to build a dialogue and answer database based on topic classification. When a customer asks a question, the question is processed accordingly and the topic feature is matched, and the most appropriate answer is automatically generated and replied to the customer. By combining relevant technologies in the fields of natural language processing and machine learning, it is possible to automatically identify different topics in the bank customer service question and answer text, and optimize the bank customer service dialogue model by adding topic semantic features, so as to better analyze and understand the semantic environment of customer questions and give the most appropriate answers, providing customers with personalized, precise and professional services, and improving customer satisfaction and business efficiency. Figure 3 As shown, the specific steps are as follows:
[0078] a1. Collect bank customer conversation texts from multiple channels.
[0079] a2. Perform text cleaning (word segmentation, cleaning and part-of-speech tagging).
[0080] a3. Vectorize the words in the text and obtain the corresponding question vector, answer vector and question-answer pair vector.
[0081] a4. Input the question and answer dataset text into the value topic model.
[0082] a5. Output the topics and classify them.
[0083] a6. Label the topics according to the similarity between question and answer pairs and build a question and answer database based on topic classification.
[0084] a7. Obtain user question input and process it.
[0085] a8. Match the data in the question and answer database with topic features and generate answers based on the matching structure.
[0086] a9. Process the generated answers and reply to the customers.
[0087] In one embodiment, Figure 4 This is a structural block diagram of a device for automatically replying questions based on a topic model provided in one embodiment of the present invention. The device is suitable for automatically replying to user questions. The device can be implemented by hardware / software. It can be configured in an electronic device to implement a method for automatically replying questions based on a topic model in an embodiment of the present invention.
[0088] like Figure 4 As shown, the device includes: a data processing module 410, a vectorization module 420, a question-answer library construction module 430 and a result determination module 440;
[0089] The data processing module 410 is used to obtain a conversation text set of financial industry customer service, and to process the conversation text data contained in the conversation text set to obtain a question-answer data set; wherein the question-answer data set includes a question text set and an answer text set;
[0090] A vectorization module 420 is used to perform text vectorization on the question-answer dataset based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format; wherein the question-answer pair vector includes: a question text vector and an answer text vector;
[0091] A construction module 430 is used to determine a topic classification result based on the question-answer pair vector and the LDA topic model, and to construct a question-answer database according to the topic classification result; wherein the topic classification result includes topics and keywords corresponding to each of the topics;
[0092] The result determination module 440 is used to obtain the question input by the user, search the question and answer database for the answer that matches the question, and reply the answer to the user.
[0093] The embodiment of the present invention uses the LDA topic model and the word embedding model to process the question-answer data set through a vectorization module and a construction module, automatically identifies different topics and classifies them, thereby constructing a question-answer database based on topic classification. When a customer asks a question, the question is processed accordingly and topic matching is performed, and the most appropriate answer is automatically generated and replied to the customer. This can improve the efficiency of handling customer questions and the accuracy of responses, reduce the burden on customer service personnel, provide faster response times, and improve customer satisfaction and business efficiency.
[0094] In one embodiment, the data processing module 410 includes:
[0095] A processing unit is used to perform data preprocessing on the dialogue text data and convert the preprocessed dialogue text data into a question-answer data set in a question-answer pair format; wherein the question-answer pair format includes question sentence keywords, answer sentence keywords and a pending topic.
[0096] In one embodiment, the vectorization module 420 includes:
[0097] A vectorization unit, used to input the question-answer dataset into the word embedding model to map the question sentence keywords and the answer sentence keywords in the question-answer dataset to the word vector space, obtain corresponding word vectors, and form a question-answer pair vector;
[0098] Among them, each question-answer pair vector constitutes a document D i , denoted as D i =[d1,d2,d3,...,d M ], where M is the total number of question-answer pair vectors; d i is the i-th question-answer pair vector, expressed as in, It is represented as the question text vector in the i-th question-answer pair vector, m is the number of question text vectors, It is represented as the answer text vector in the i-th question-answer pair vector, n is the number of answer text vectors, where, w represents a keyword, [v1,v2,...,v n ] represents the vector coordinates corresponding to w.
[0099] In one embodiment, the building block 430 includes:
[0100] A module training unit is used to take the question-answer pair vector as a document d i Input into the LDA topic model for iterative training until convergence, and obtain the number of topic divisions after convergence and the corresponding topic-word distribution matrix;
[0101] A model evaluation unit, used to evaluate the number of topic divisions after convergence and the corresponding topic-word distribution matrix according to a preset perplexity formula to obtain an optimal number of topic divisions and a corresponding optimal topic-word distribution matrix;
[0102] A topic vector determination unit, used to combine the optimal topic-word distribution matrix with the question-answer pair vector in the question-answer pair format to map each of the topics into the same vector space to obtain a weighted topic vector;
[0103] The classification structure determination unit is used to determine the similarity between any two keywords under the weighted topic vector, and determine the topic classification result according to the similarity and a preset similarity threshold.
[0104] In one embodiment, the module training unit includes:
[0105] Initialization subunit, used to initialize document d i Corresponding to the topic t1,...,t l The number of keywords corresponding to each topic is taken as a hyperparameter;
[0106] A probability determination subunit is used to input the hyperparameters into the LDA topic model to obtain the document d i A first probability distribution corresponding to each topic, and a second probability distribution of each keyword generated by each topic, and a third probability distribution of all keywords in all documents is determined based on the first probability distribution and the second probability distribution;
[0107] An iterative subunit is used to obtain a topic-word probability distribution matrix and a number of topic divisions according to the third probability distribution and a preset clustering algorithm, and to return the number of topic divisions as the hyperparameter to the step of inputting the hyperparameter into the LDA topic model until the first probability distribution and the second probability distribution converge, thereby obtaining a converged topic-word probability distribution matrix and a number of topic divisions.
[0108] In one embodiment, the question-answer database includes a question library, an answer library, and a question-answer pair library; the question library includes question topics and question word vectors contained in the question topics; the answer library includes answer topics and answer word vectors contained in the answer topics; the question-answer pair library includes question word vectors contained in the question topics and answer word vectors contained in the answer library, and the question word vectors correspond to the answer word vectors one by one;
[0109] Accordingly, the construction module 430 includes:
[0110] A division unit, used to divide question word vectors with the same question topic into the same question topic, and divide answer word vectors with the same answer topic into the same answer topic;
[0111] The question-answer library determination unit is used to store the question word vector and the corresponding answer word vector into the question-answer pair library.
[0112] In one embodiment, the structure determination module 440 includes:
[0113] An extraction unit, used for extracting keywords from the question to obtain a question word sequence;
[0114] A question topic determination unit, used to obtain the question topic corresponding to the question according to the similarity between each question keyword in the question word sequence and each question word vector in the question library;
[0115] The answer determination unit is used to match the question and answer pair library according to the question subject to obtain a matching result, and determine the answer result matching the question according to the matching result.
[0116] The automatic question-answering device based on a topic model provided in an embodiment of the present invention can execute the automatic question-answering method based on a topic model provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0117] In one embodiment, Figure 5 A schematic diagram of the structure of an electronic device provided for an embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0118] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0119] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0120] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as the automatic question reply method based on the topic model.
[0121] In some embodiments, the method for automatically replying questions based on a topic model may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the method for automatically replying questions based on the topic model described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the method for automatically replying questions based on the topic model in any other appropriate manner (e.g., by means of firmware).
[0122] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0123] The computer program for implementing the method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable automatic answering device for questions based on a topic model, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine as an independent software package and partially on a remote machine, or entirely on a remote machine or server.
[0124] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0125] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0126] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0127] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0128] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0129] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for automatically replying questions based on a topic model, characterized in that: The method comprises: Acquire a conversation text set of financial industry customer service, and process the conversation text data contained in the conversation text set to obtain a question-answer data set; wherein the question-answer data set includes a question text set and an answer text set; Performing text vectorization on the question-answer dataset based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format; wherein the question-answer pair vector includes: a question text vector and an answer text vector; Determine a topic classification result based on the question-answer pair vector and the LDA topic model, and construct a question-answer database according to the topic classification result; wherein the topic classification result includes topics and keywords corresponding to each of the topics; The question input by the user is obtained, an answer result matching the question is searched in the question and answer database, and the answer result is replied to the user.
2. The method according to claim 1, characterized in that The step of processing the dialogue text data contained in the dialogue text set to obtain a question-answer data set includes: The dialogue text data is preprocessed, and the preprocessed dialogue text data is converted into a question-answer data set in a question-answer pair format; wherein the question-answer pair format includes question sentence keywords, answer sentence keywords and a pending topic.
3. The method according to claim 1, characterized in that The step of performing text vectorization on the question-answer dataset based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format includes: Inputting the question-answer dataset into the word embedding model to map the question sentence keywords and the answer sentence keywords in the question-answer dataset to the word vector space, obtain corresponding word vectors, and form a question-answer pair vector; Among them, each question-answer pair vector constitutes a document set D i , denoted as D i =[d1,d2,d3,...,d M ], where M is the total number of question-answer pair vectors; d i is the i-th question-answer pair vector, expressed as in, It is represented as the question text vector in the i-th question-answer pair vector, m is the number of question text vectors, It is represented as the answer text vector in the i-th question-answer pair vector, n is the number of answer text vectors, where, w represents a keyword, [v1,v2,...,v n ] represents the vector coordinates corresponding to w.
4. The method according to claim 1, characterized in that The determining of the topic classification result based on the question-answer pair vector and the LDA topic model includes: The question-answer pair vector is used as document d i Input into the LDA topic model for iterative training until convergence, and obtain the number of topic divisions output after convergence and the corresponding topic-word distribution matrix; The number of topic divisions output after the convergence and the corresponding topic-word distribution matrix are evaluated according to a preset perplexity formula to obtain the optimal number of topic divisions and the corresponding optimal topic-word distribution matrix; Combining the optimal topic-word distribution matrix with the question-answer pair vector in the question-answer pair format to map each of the topics into the same vector space to obtain a weighted topic vector; The similarity between any two keywords under the weighted topic vector is determined, and a topic classification result is determined based on the similarity and a preset similarity threshold.
5. The method according to claim 4, characterized in that The question-answer pair vector is used as document d i Input into the LDA topic model for iterative training to obtain the number of topic divisions and the corresponding topic-word distribution matrix in each iteration, including: Initialize Document i Corresponding to the topic t1,...,t l The number of keywords corresponding to each topic is taken as a hyperparameter; The hyperparameters are input into the LDA topic model to obtain the document d i A first probability distribution corresponding to each topic, and a second probability distribution of each keyword generated by each topic, and a third probability distribution of all keywords in all documents is determined based on the first probability distribution and the second probability distribution; Based on the third probability distribution and the preset clustering algorithm, a topic-word probability distribution matrix and the number of topic divisions are obtained, and the number of topic divisions is used as the hyperparameter to return to the step of inputting the hyperparameter into the LDA topic model until the first probability distribution and the second probability distribution converge, thereby obtaining the converged topic-word probability distribution matrix and the number of topic divisions.
6. The method according to claim 1, characterized in that The question-answer database includes a question library, an answer library, and a question-answer pair library; the question library includes question topics and question word vectors contained in the question topics; the answer library includes answer topics and answer word vectors contained in the answer topics; the question-answer pair library includes question word vectors contained in the question topics and answer word vectors contained in the answer library, and the question word vectors correspond to the answer word vectors one by one; Accordingly, constructing a question-answer database according to the topic classification results includes: Classify the question word vectors with the same question topic in the topic classification results into the same question topic, and classify the answer word vectors with the same answer topic into the same answer topic; The question word vector and the corresponding answer word vector are stored in a question-answer pair library.
7. The method according to claim 1, characterized in that The step of searching the question-answer database for an answer result that matches the question includes: Extracting keywords from the question to obtain a question word sequence; Obtaining the question topic corresponding to the question according to the similarity between each question keyword in the question word sequence and each question word vector in the question library; The question and answer pair library is matched according to the question topic to obtain a matching result, and the answer result matching the question is determined according to the matching result.
8. A question automatic reply device based on a topic model, characterized in that: The device comprises: A data processing module, used to obtain a conversation text set of financial industry customer service, and perform data processing on the conversation text data contained in the conversation text set to obtain a question-answer data set; wherein the question-answer data set includes a question text set and an answer text set; A vectorization module, used for performing text vectorization on the question-answer dataset based on a word embedding model to obtain a question-answer pair vector in a question-answer pair format; wherein the question-answer pair vector includes: a question text vector and an answer text vector; A database construction module, used to determine a topic classification result based on the question-answer pair vector and the LDA topic model, and to construct a question-answer database according to the topic classification result; wherein the topic classification result includes topics and keywords corresponding to each of the topics; The reply module is used to obtain the question input by the user, search the question and answer database for the answer result matching the question, and reply the answer result to the user.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to 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 so that the at least one processor can execute the topic model-based automatic answering method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the automatic question answering method based on a topic model according to any one of claims 1 to 7 when executed.