Virtual customer service automatic question answering method based on NLP technology, storage medium and device
By using NLP technology to automate Q&A with virtual customer service, and leveraging cosine similarity to match answers in a question database, the problem of users asking the same questions repeatedly in a shared R&D platform was solved, improving Q&A accuracy and operational efficiency while reducing operating costs.
Patent Information
- Application Number
- CN202211345058.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-31
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2042-10-31
AI Technical Summary
In shared R&D platforms, repeated user questions increase the workload of operations staff, and existing technologies struggle to efficiently handle repeated answers to the same questions.
The virtual customer service auto-answering method using NLP technology calculates the cosine similarity between newly proposed question text data and question databases, matches standard answers, and achieves automatic question answering, reducing human intervention.
It improved the accuracy of Q&A, reduced the workload of operations staff, lowered operating costs, and increased operational efficiency.
Smart Images

Figure CN115905480B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of natural language processing, and particularly relates to a virtual customer service automatic question answering method of NLP technology, a storage medium and equipment. BACKGROUND
[0002] With more and more enterprises beginning to attach importance to digital transformation, the improvement of the work efficiency of R&D teams is the only way to realize the strategic goals of enterprises. In particular, in large enterprises, each R&D team is integrated according to their own practice and exploration results, and gradually forms the technical service capability of the enterprise, the enterprise standard, etc., and finally becomes an internal shared R&D platform. The platform can open and provide capability resources for all teams in the enterprise, and promote the advanced practical experience of elite teams to all teams.
[0003] In the use process of the shared R&D platform, users will ask questions about use problems in the online customer service module of the platform according to their own use experience, and the staff of the platform will give corresponding answers to different problems. Due to the determinacy of the function points of the shared R&D platform, the types of common problems of users are limited, and the same problems raised by using different questioning methods are repeatedly answered, which seriously increases the workload of the operation personnel of the shared R&D platform. SUMMARY
[0004] In view of the problems in the prior art, the application provides a virtual customer service automatic question answering method of NLP technology, a storage medium and equipment, calculates the cosine similarity of newly raised problem text data and problem text data in a problem database, matches the optimal standard answer according to the cosine similarity, realizes virtual customer service automatic question answering, and greatly reduces the workload of the operation personnel of the shared R&D platform.
[0005] To achieve the above purpose, the application adopts the following technical scheme: a virtual customer service automatic question answering method of NLP technology, specifically comprising the following steps:
[0006] Step 1, collect problem text data raised by users on the shared R&D platform, pre-process the collected problem text data, classify, give the standard answer of each classified problem text data, and store in a problem database;
[0007] Step 2, input each type of problem text data into a bag-of-words model in turn, and output a word frequency matrix;
[0008] Step 3, input the word frequency matrix into a TF-IDF model, output a TF-IDF weight matrix of each type of problem text data, and each row of the TF-IDF weight matrix represents a problem text data;
[0009] Step 4, the user newly proposed question text data is preprocessed and input into a bag-of-words model, a word frequency vector is output, and the word frequency vector is input into a TF-IDF model, and a TF-IDF vector is output;
[0010] Step 5, according to the key words in the newly proposed question text data, find the highest matching TF-IDF vector in the TF-IDF weight matrix of each type of question text data, calculate the cosine similarity between the TF-IDF vector of the newly proposed question text data and the highest matching TF-IDF vector, and select the TF-IDF weight matrix of the type of question text data with the maximum cosine similarity value;
[0011] Step 6, calculate the cosine similarity between the TF-IDF vector of the newly proposed question text data and the TF-IDF weight matrix of the type of question text data with the maximum cosine similarity value, if all the cosine similarity values are less than a threshold value, send a no matching question prompt to the artificial customer service, and the artificial customer service replies; otherwise, the virtual customer service outputs the standard answers corresponding to the five question text data with the maximum cosine similarity.
[0012] Further, the preprocessing of the question text data includes: segmenting and cleaning the question text data; the segmentation process is: segmenting the question text data through a precise mode; the cleaning process is: removing stop words and irregular characters in the question text data, and unifying synonyms in the question text data.
[0013] Further, the parameters of the bag-of-words model include: the maximum number of keywords, the maximum word frequency, and the minimum word frequency.
[0014] Further, the calculation process of the cosine similarity is:
[0015]
[0016] Wherein, c is the dimension of the TF-IDF vector, i is the index of c, is the i-th dimension value of the TF-IDF vector in the TF-IDF weight matrix, is the i-th dimension value of the TF-IDF vector of the newly proposed question text data.
[0017] Further, it also includes: storing the question and reply of the artificial customer service in the question database, repeating steps 2-3, and updating the TF-IDF weight matrix.
[0018] Further, the present application also provides a computer readable storage medium storing a computer program, the computer program enables the computer to execute the virtual customer service automatic question and answer method based on NLP technology.
[0019] Further, the present application also provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the virtual customer service automatic answering method based on NLP technology when executing the computer program.
[0020] Compared with the prior art, the virtual customer service automatic answering method based on NLP technology has the following beneficial effects: the virtual customer service automatic answering method based on NLP technology inputs the question text data in the question database into the bag-of-words model and the TF-IDF model, and then outputs the TF-IDF weight matrix, and then performs cosine similarity calculation on the TF-IDF weight matrix and the TF-IDF vector of the newly proposed question text data, and then matches the corresponding standard answer according to the size of the cosine similarity value, so as to realize the automatic answering of the virtual customer service, and the answering accuracy is high, the user experience is good, the workload of the operation personnel is greatly reduced, the operation cost is reduced, and the investment of computing resources is reduced. In addition, the virtual customer service automatic answering method based on NLP technology can automatically screen out the question text that is not in the question database, supplement the question database, and improve the operation efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 The flowchart of the virtual customer service automatic answering method based on NLP technology of the present application;
[0022] Figure 2 The flowchart of the preprocessing of the question text data in the present application;
[0023] Figure 3 The flowchart of the vectorization of the question text data in the present application. DETAILED DESCRIPTION
[0024] The technical solutions of the present application will be further explained in combination with the drawings.
[0025] As Figure 1 , the present application provides a virtual customer service automatic answering method based on NLP technology, which specifically comprises the following steps:
[0026] Step 1: The operation personnel of the shared R&D platform collects the question text data proposed by the users on the platform through the customer service module or the internal question answering group chat of the platform, pre-processes the collected question text data, classifies the question text data, gives the standard answer of each classified question text data, and stores the question text data in the question database. Figure 2The preprocessing of the question text data in the application includes: word segmentation and cleaning of the question text data; specifically, the process of word segmentation is: the question text data is segmented by accurate mode, so that the words in the question text data can be accurately segmented; the process of cleaning is: when the operation personnel collects the question text data, there may be stop words such as tab character, space, page break character and irregular characters, which will affect the matching result of the question text data in the later period, and the stop words and irregular characters in the question text data need to be removed, at the same time, the synonyms in the question text data will also interfere with the matching process of the question text data, and the synonyms in the question text data need to be unified. The classification process of the question text data in the application is: first, the question text data is clustered, and then the keywords of the question text data are extracted.
[0027] As Figure 3 The question text data vectorization flowchart in the application includes: step 2, sequentially input each type of question text data into the bag-of-words model, output the word frequency matrix, the bag-of-words model is a basic text representation model, each piece of question text data can be regarded as a set of words, the order between the words is ignored, only the number of word occurrences is associated, the number of words is objectively reflected, and interference is avoided. The parameters of the bag-of-words model in the application include: the maximum number of keywords, the maximum word frequency and the minimum word frequency, the maximum number of keywords is arranged in descending order according to the word frequency, only the words less than the maximum number of keywords are considered, and the maximum number of keywords in the application is 700; if the word frequency of a keyword is greater than the maximum word frequency or less than the minimum word frequency, the word will not be regarded as a keyword.
[0028] Step 3, input the word frequency matrix into the TF-IDF model, output the TF-IDF weight matrix, the TF-IDF considers the word frequency of a word in the article and the word frequency in the entire library at the same time, avoids the interference of some commonly used words on the semantic understanding of the text, and has low calculation complexity. Each row of the TF-IDF weight matrix represents a piece of question text data.
[0029] Step 4, input the preprocessed question text data newly proposed by the user into the bag-of-words model, output the word frequency vector, and input the word frequency vector into the TF-IDF model, output the TF-IDF vector;
[0030] Step 5, find the highest matching TF-IDF vector in the TF-IDF weight matrix of each type of problem text data according to the keywords in the newly proposed problem text data, calculate the cosine similarity between the TF-IDF vector of the newly proposed problem text data and the highest matching TF-IDF vector, and select the TF-IDF weight matrix of the type of problem text data with the maximum cosine similarity value. The cosine similarity can well offset the high dimension problem of the Euclidean distance similarity, and the complexity of calculation is low.
[0031] Step 6, calculate the cosine similarity between the TF-IDF vector of the newly proposed problem text data and the TF-IDF weight matrix of the type of problem text data with the maximum cosine similarity value selected, if all the cosine similarity values are less than the threshold value, send a no matching problem prompt to the artificial customer service, the artificial customer service replies, and stores the problem and the reply of the artificial customer service in the problem database, repeats steps 2-3, updates the TF-IDF weight matrix, and is used for matching of the next new problem. Through the above method, when the operator identifies the new problem, it is not necessary to check all the problems to judge whether the problem text needs to be added to the problem database, which can reduce the artificial cost; otherwise, the virtual customer service outputs the standard answer corresponding to the five problem text data with the maximum cosine similarity. Through the above method, the type to which the newly proposed problem text data belongs is found out first, and then the five problem text data with the maximum similarity in the type are found out, which greatly reduces the calculation amount.
[0032] The closer the cosine similarity value is to 1, the more similar the two vectors are; the closer the cosine similarity value is to 0, the less similar the two vectors are. The calculation process of the cosine similarity in the application is as follows:
[0033]
[0034] Wherein, c is the dimension of the TF-IDF vector, i is the index of c, is the i-th dimension value of the TF-IDF vector in the TF-IDF weight matrix, is the i-th dimension value of the TF-IDF vector of the newly proposed problem text data.
[0035] The virtual customer service automatic question and answer method based on NLP technology of the application carries out word segmentation and cleaning on the problem text data, and reduces the calculation complexity and improves the accuracy of the virtual customer service automatic question and answer through two times of cosine similarity calculation. The virtual customer service automatic question and answer method based on NLP technology of the application has a maximum accuracy of 84% under the experimental data of the company's shared research and development platform.
[0036] In the embodiments disclosed in the present application, the computer storage medium can be a tangible medium which can contain or store programs for use by or in connection with an instruction execution system, apparatus or device. The computer storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the above. More specific examples of computer storage medium can include one or more wires, portable computer disks, hard drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), fiber optics, compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0037] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software manner depends on the specific application and design constraints of the technical solutions. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0038] The above is only the preferred embodiment of the present application, and the protection scope of the present application is not limited to the above-mentioned embodiment. Any technical solution falling within the concept of the present application shall fall within the protection scope of the present application. It should be noted that, for ordinary skilled persons in the art, some improvements and refinements without departing from the principles of the present application shall be considered as falling within the protection scope of the present application.
Claims
1. A virtual customer service automatic question answering method of NLP technology, characterized in that, Specifically comprising the following steps: Step 1, collecting question text data proposed by users on a shared R&D platform, pre-processing the collected question text data, classifying, and giving the standard answer of each classified question text data, and storing into a question database; Step 2, inputting each category of question text data into a bag-of-words model in turn, and outputting a word frequency matrix; Step 3, inputting the word frequency matrix into a TF-IDF model, and outputting a TF-IDF weight matrix of each category of question text data, each row of the TF-IDF weight matrix representing a question text data; Step 4, pre-processing the newly proposed question text data and inputting it into the bag-of-words model, outputting a word frequency vector, and inputting the word frequency vector into the TF-IDF model, outputting a TF-IDF vector; Step 5, finding the highest matching TF-IDF vector in the TF-IDF weight matrix of each category of question text data according to the keywords in the newly proposed question text data, calculating the cosine similarity between the TF-IDF vector of the newly proposed question text data and the highest matching TF-IDF vector, and selecting the TF-IDF weight matrix of the category of question text data with the maximum cosine similarity value; Step 6, calculating the cosine similarity between the TF-IDF vector of the newly proposed question text data and the TF-IDF weight matrix of the category of question text data with the maximum cosine similarity value, if all cosine similarity values are less than a threshold value, sending a no-match question prompt to an artificial customer service, and the artificial customer service replies; otherwise, the virtual customer service outputs the standard answers corresponding to the five question text data with the maximum cosine similarity.
2. The virtual customer service automatic question-answering method of an NLP technology according to claim 1, characterized in that, The pre-processing of the question text data includes tokenization and cleaning of the question text data; the tokenization process is to tokenize the question text data by precise mode; the cleaning process is to remove stop words and irregular characters in the question text data, and unify synonyms in the question text data. 3.The virtual customer service automatic question answering method of NLP technology according to claim 1, characterized in that, The parameters of the bag-of-words model include: maximum number of keywords, maximum word frequency, and minimum word frequency.
4. The virtual customer service automatic question and answer method based on NLP technology according to claim 1, characterized in that, The calculation process of the cosine similarity is: where c is the dimension of the TF-IDF vector, i is the index of c, is the i-th dimension value of the TF-IDF vector in the TF-IDF weight matrix, is the i-th dimension value of the TF-IDF vector of the newly proposed question text data.
5. The virtual customer service automatic question-answering method of an NLP technology according to claim 1, characterized in that, Further comprising: Storing the questions and answers of the artificial customer service into the question database, repeating steps 2-3, and updating the TF-IDF weight matrix.
6. A computer readable storage medium storing a computer program, characterized in that, The computer program enables the computer to execute the virtual customer service automatic question answering method of the NLP technology according to any one of claims 1-5.
7. An electronic device, comprising: Comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, when the processor executes the computer program, the virtual customer service automatic question answering method of the NLP technology according to any one of claims 1-5 is implemented.