Question and answer knowledge base construction method and its device, equipment, medium, and product
Through semantic matching and chat records selection, a question-and-answer knowledge base for intelligent customer service systems is automatically built, which solves the problems of low efficiency and high cost in the existing technology, and improves the intelligence level and user experience of intelligent customer service.
Patent Information
- Application Number
- CN202111638989.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2041-12-29
AI Technical Summary
When building a Q&A knowledge base, the existing intelligent customer service system relies on a large number of manual processing and massive chat records, which is inefficient and costly, resulting in insufficient reply accuracy and effectiveness.
By obtaining chat records between the question user and the manual customer service, semantic matching and optimization are carried out, a question-and-answer knowledge base is constructed, a pre-trained text extraction model is used to extract sentence vectors, a similarity distance score is calculated, and a high similarity reply text is selected, and a high similarity is automatically Build a knowledge base.
It realizes efficient and accurate Q&A knowledge base construction, reduces manual processing, improves the intelligence of the intelligent customer service system, saves costs, and is suitable for large-scale customer service scenarios.
Smart Images

Figure CN114265921B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent customer service technology, and in particular to a method for constructing a question-and-answer knowledge base and its corresponding apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] At present, in the e-commerce scenario, due to the large number of customer consultation questions, general merchants will configure corresponding intelligent customer service robots to assist customer service in answering questions. However, intelligent customer service robots are often unable to effectively answer various questions from customers, or customers are not satisfied with the answers of intelligent customer service robots. Therefore, it is particularly important to provide high-quality speech for different problems.
[0003] At present, intelligent customer service systems generally establish corresponding knowledge bases based on the business channels or business scenarios they serve. The knowledge base generally contains standard questions, similar questions, and answers to questions. The answers to questions are generally edited by business personnel through their understanding of business knowledge, or after querying the replies of some excellent manual customer service, and finally stored in the knowledge base. Due to the uneven level of business personnel, there are deviations in the writing of answers to questions. Since the answers to questions will be directly displayed on the front end of intelligent customer service, it is an indispensable part of chatting with customers. If the answers are well written, it is easy to bring merchants an increase in the total transaction amount of goods and service quality.
[0004] In practice, relying on a large number of business personnel to draw materials from massive chat records or refer to historical chat records to write answers to questions is quite inefficient and costly, which has little effect on improving the accuracy and effectiveness of the responses of intelligent customer service systems. Summary of the invention
[0005] The primary purpose of the present application is to solve at least one of the above problems and to provide a method for constructing a question-and-answer knowledge base and its corresponding apparatus, computer device, computer-readable storage medium, and computer program product.
[0006] In order to meet the various objectives of this application, this application adopts the following technical solutions:
[0007] A method for constructing a question-answer knowledge base provided to meet one of the purposes of this application includes the following steps:
[0008] Obtain a corpus database, the corpus database includes multiple chat records, each chat record includes a question text raised by the questioning user and an answer text replied by the manual customer service user to the question text;
[0009] Adding the question text in the corpus database that semantically matches the question text in the question unit in the question-answering knowledge base to the question unit; wherein each of the question units includes one or more question texts, one of which is used as a standard question, and the others are similar questions to the standard question;
[0010] The answer text corresponding to the question text in the corpus database is configured as the reply text in the reply unit corresponding to the question unit in the question-answering knowledge base;
[0011] The construction of the question-answering knowledge base is completed by determining a portion of the reply text in each reply unit that has a relatively high average similarity distance score relative to other reply texts in the reply unit as the target reply text that is ultimately retained by the reply unit.
[0012] In a specific embodiment, obtaining a corpus database includes the following steps:
[0013] Call up all chat records from the preset intelligent customer service system;
[0014] Cleaning the chat records, deleting the chat records automatically answered by the intelligent customer service system, and retaining only the chat records answered by the manual customer service user, so that each retained chat record contains the text of the question raised by the questioning user and the text of the answer given by the manual customer service user to the question text;
[0015] The retained chat records are stored in the corpus database.
[0016] In a specific embodiment, adding the question text in the corpus database that semantically matches the question text in the question unit in the question-answering knowledge base to the question unit includes the following steps:
[0017] Using a first text extraction model that has been pre-trained to a convergent state, extracting a sentence vector of each question text in each question unit in the question-answering knowledge base;
[0018] Using the first text extraction model, extracting sentence vectors of each question text in the corpus database;
[0019] Calculating the data distance between the sentence vector of each question text and the sentence vector of each question text, and determining a similarity distance score corresponding to the data distance;
[0020] A similarity distance score with the highest score is retained for each question text, and a score sequence consisting of similarity distance scores between all question texts and their most similar question texts is obtained;
[0021] The elements whose similarity distance scores in the scoring sequence exceed the preset threshold are screened out, and the question text corresponding to each element is used as the question text that realizes semantic matching with the question text corresponding to the element, and the question text is added to the question unit where the question text is located to form a similar question.
[0022] In an extended embodiment, the training process of the first text extraction model includes the following steps:
[0023] Using a similar question in a question unit in the question-answering knowledge base as a positive sample, or using a similar question in another question unit as a negative sample, inputting the first text extraction model to extract a sentence vector;
[0024] The text is extracted into a first model through a classifier to perform binary classification mapping to obtain corresponding classification labels;
[0025] The standard question corresponding to the similar question of the positive sample is used as the supervision label, and the loss value of the classification label is calculated. If the loss value reaches a preset threshold and reaches a convergence state, the training is terminated; otherwise, a gradient update is implemented and the next sample is used to implement iterative training.
[0026] In a specific embodiment, determining a portion of reply text in each reply unit that has a relatively high average similarity distance score relative to other reply texts in the reply unit as the target reply text finally retained by the reply unit to complete the construction of the question-answering knowledge base includes the following steps:
[0027] Using a second text extraction model that has been pre-trained to a convergent state, extracting a sentence vector of each reply text in each reply unit in the question-answer knowledge base;
[0028] Calculate the similarity distance score representing the numerical distance between the sentence vectors of each reply text in each reply unit, and obtain a similarity distance score sequence consisting of the similarity distance scores between each reply text in the reply unit and each reply text in the reply unit;
[0029] Calculate the average similarity distance score corresponding to each reply text according to the similarity distance score sequence of each reply text in each reply unit;
[0030] In each response unit, the response texts with an average similarity distance score lower than a preset threshold are deleted, and only the response texts with an average similarity distance score higher than the preset threshold are retained to complete the construction of the question-answering knowledge base.
[0031] In the extended embodiment, after the question-answer knowledge base is constructed, the following steps are included:
[0032] The question-and-answer knowledge base is connected to a preset intelligent customer service system, and the intelligent customer service system responds to a question text raised by a questioning user, determines a reply unit that matches the semantics of the question text from the question-and-answer knowledge base, and answers the question text with one of the reply texts in the reply unit.
[0033] A device for constructing a question-and-answer knowledge base provided to meet one of the purposes of the present application comprises: a corpus calling module, a question matching module, an answer configuration module, and a mining construction module, wherein the corpus calling module is used to obtain a corpus database, the corpus database comprising a plurality of chat records, each of which comprises a question text raised by a questioning user and an answer text replied by an artificial customer service user to the question text; the question matching module is used to add the question text in the corpus database that achieves semantic matching with the question text in a question unit in the question-and-answer knowledge base to the question unit; wherein each of the question units comprises one or more of the question texts, one of which is used as a standard question, and the rest are similar questions to the standard question; the answer configuration module is used to configure the answer text corresponding to the question text in the corpus database as the reply text in the reply unit corresponding to the question unit in the question-and-answer knowledge base; the mining construction module is used to determine the part of the reply text in each reply unit that has a relatively high average similarity distance score relative to other reply texts in the reply unit as the target reply text finally retained by the reply unit to complete the construction of the question-and-answer knowledge base.
[0034] In a specific embodiment, the corpus calling module includes: a data acquisition unit, which is used to call the full chat records from a preset intelligent customer service system; a data cleaning unit, which is used to clean the chat records, delete the chat records automatically answered by the intelligent customer service system, and only retain the chat records answered by manual customer service users, so that each retained chat record contains the question text raised by the questioning user and the answer text replied by the manual customer service user to the question text; a data storage unit, which is used to store the retained chat records in a corpus database.
[0035] In a specific embodiment, the question matching module includes: a question extraction unit, which is used to use a first text extraction model pre-trained to a convergent state to extract the sentence vector of each question text in each question unit in the question-answering knowledge base; a question extraction unit, which is used to use the first text extraction model to extract the sentence vector of each question text in the corpus database; a distance scoring unit, which is used to calculate the data distance between the sentence vector of each question text and the sentence vector of each question text, and determine the similarity distance score corresponding to the data distance; an exclusive processing unit, which is used to retain a similarity distance score with the highest score for each question text, and obtain a score sequence composed of similarity distance scores between all question texts and their most similar question texts; a question adding unit, which is used to screen out elements in the score sequence whose similarity distance scores exceed a preset threshold, use the question text corresponding to each element as the question text that realizes semantic matching with the question text corresponding to the element, and add the question text to the question unit where the question text is located to form a similar question.
[0036] In an extended embodiment, the first text extraction model is trained by a training device, which includes: a sample calling module, which is used to use a similar question in a question unit in the question and answer knowledge base as a positive sample, or to use a similar question in another question unit as a negative sample, and input the first text extraction model to extract a sentence vector; a classification mapping module, which is used to perform binary classification mapping on the first text extraction model through a classifier to obtain a corresponding classification label; a supervised iteration module, which is used to use the standard question corresponding to the similar question of the positive sample as a supervised label, calculate the loss value of the classification label, and terminate the training if the loss value reaches a preset threshold and reaches a convergence state; otherwise, implement gradient update, and use the next sample to implement iterative training.
[0037] In a specific embodiment, the answer configuration module includes: a reply extraction unit, which is used to use a second text extraction model pre-trained to a convergent state to extract the sentence vector of each reply text in each reply unit in the question and answer knowledge base; a score quantization unit, which is used to calculate the similarity distance score that characterizes the numerical distance between the sentence vectors of each reply text in each reply unit, and obtain a similarity distance score sequence consisting of the similarity distance scores between each reply text in the reply unit and each reply text in the reply unit; a mean calculation unit, which is used to calculate the average similarity distance score corresponding to each reply text based on the similarity distance score sequence of each reply text in each reply unit; and a reply cleaning unit, which is used to delete the reply texts in each reply unit whose average similarity distance score is lower than a preset threshold, and only retain the reply texts whose average similarity distance score is higher than the preset threshold to complete the construction of the question and answer knowledge base.
[0038] In an extended embodiment, the question and answer knowledge base construction device of the present application also includes: a knowledge base access module, which is used to connect the question and answer knowledge base to a preset intelligent customer service system, and the intelligent customer service system responds to the question text raised by the questioning user, determines a reply unit that matches the semantics of the question text from the question and answer knowledge base, and answers the question text with one of the reply texts in the reply unit.
[0039] A computer device provided to meet one of the purposes of the present application includes a central processing unit and a memory, wherein the central processing unit is used to call and run a computer program stored in the memory to execute the steps of the question-and-answer knowledge base construction method described in the present application.
[0040] A computer-readable storage medium is provided to meet another purpose of the present application, which stores a computer program implemented according to the question-and-answer knowledge base construction method in the form of computer-readable instructions. When the computer program is called and executed by a computer, the steps included in the method are executed.
[0041] A computer program product provided to meet another purpose of the present application includes a computer program / instruction, which, when executed by a processor, implements the steps of the method described in any embodiment of the present application.
[0042] Compared with the prior art, the advantages of this application are as follows:
[0043] First, when constructing a question-and-answer knowledge base that can be used by an intelligent customer service system, the present application uses a chat record formed by a question-and-answer session between a question-asking user and an artificial customer service user as a corpus, matches the question text of the question-asking user that is semantically similar to the question text in the question unit provided in advance in the question-and-answer knowledge base in the chat record, uses the question text as a similar question to the standard question associated with the question text, and uses the answer text of the next sentence corresponding to the question text answered by the artificial customer service user as the reply text in the reply unit corresponding to the standard question, so that the reply text in the reply unit corresponding to the question unit in the question-and-answer knowledge base is filled. On this basis, multiple reply texts in each reply unit are further optimized, and by comparing the average similarity distance score corresponding to the data distance between each reply text and other reply texts, some reply texts with higher scores are selected as the target reply texts to be retained, thereby realizing the optimization of the reply texts mined from the corpus database and realizing the automatic use of the corpus database to construct a question-and-answer knowledge base. Since the answer text in the corpus database is the content replied by manual customer service users, it has the sense of real human expression and is usually more consistent with the question itself. Therefore, when it is used in the intelligent customer service system to reply to users asking related questions, it can make the reply more accurate on the one hand, and improve the user experience on the other.
[0044] Secondly, in the process of using the corpus database to build a question-and-answer knowledge base, the present application uses the semantic correlation between the question text and the question text when matching them. In the subsequent optimization of the reply texts pre-selected into the question-and-answer knowledge base, the data distance algorithm is also used to quantify the similarity between each reply text from a semantic level. Examining the similarity of the texts based on semantics can ensure that the matched objects are more relevant in meaning and meaning, strengthen the correlation between the texts, and make the final results more accurate. Therefore, for massive chat records, the technical solution of the present application can be used to effectively construct a question-and-answer knowledge base without relying on manual processing, which greatly saves construction costs and greatly improves construction efficiency.
[0045] In addition, the question-and-answer knowledge base constructed by this application based on effective corpus optimization and precise semantic matching can comprehensively improve the intelligence level of the intelligent customer service system, so that large-scale customer service scenarios such as e-commerce platforms can avoid a lot of manpower work, save corresponding implementation costs, and achieve economies of scale. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0047] Figure 1 A flowchart of a typical embodiment of the method for constructing a question-answer knowledge base of the present application;
[0048] Figure 2 A flowchart of the process of obtaining a corpus database in an embodiment of the present application;
[0049] Figure 3 A flowchart of the process of selecting a question text from a corpus database and adding it to a question-answering knowledge base in an embodiment of the present application;
[0050] Figure 4 A schematic diagram of a process of training a first model for extracting text features in an embodiment of the present application;
[0051] Figure 5 A flowchart of a process for optimizing the reply text of each reply unit in the question-answer knowledge base in an embodiment of the present application;
[0052] Figure 6 This is a flow chart of an extended embodiment of the question-answer knowledge base construction method of the present application;
[0053] Figure 7 A functional block diagram of a device for constructing a question-answer knowledge base of the present application;
[0054] Figure 8A schematic diagram of the structure of a computer device used in this application. DETAILED DESCRIPTION
[0055] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.
[0056] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0057] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with those in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.
[0058] It will be understood by those skilled in the art that the "client", "terminal" and "terminal device" used herein include both devices with wireless signal receivers, which are devices with only wireless signal receivers without transmission capabilities, and devices with receiving and transmitting hardware, which are devices with receiving and transmitting hardware capable of two-way communication on a two-way communication link. Such devices may include: cellular or other communication devices such as personal computers, tablet computers, which have single-line displays or multi-line displays or cellular or other communication devices without multi-line displays; PCS (Personal Communications Service, personal communication system), which can combine voice, data processing, fax and / or data communication capabilities; PDA (Personal Digital Assistant, personal digital assistant), which may include a radio frequency receiver, pager, Internet / intranet access, web browser, notepad, calendar and / or GPS (Global Positioning System, global positioning system) receiver; conventional laptop and / or palmtop computers or other devices, which have and / or include a conventional laptop and / or palmtop computer or other device with and / or including a radio frequency receiver. The "client", "terminal" and "terminal device" used herein may be portable, transportable, installed in a vehicle (air, sea and / or land), or suitable for and / or configured to run locally, and / or in a distributed form, at any other location on the earth and / or in space. The "client", "terminal" and "terminal device" used herein may also be a communication terminal, an Internet terminal, a music / video playing terminal, for example, a PDA, a MID (Mobile Internet Device) and / or a mobile phone with a music / video playing function, or a smart TV, a set-top box and other devices.
[0059] The hardware referred to by the names such as "server", "client", and "service node" in this application is essentially an electronic device with the equivalent capabilities of a personal computer. It is a hardware device with the necessary components revealed by the von Neumann principle, such as a central processing unit (including an arithmetic unit and a controller), a memory, an input device, and an output device. The computer program is stored in its memory, and the central processing unit calls the program stored in the external memory into the internal memory for execution, executes the instructions in the program, and interacts with the input and output devices to complete specific functions.
[0060] It should be pointed out that the concept of "server" referred to in this application can also be extended to the case of server clusters. According to the network deployment principle understood by those skilled in the art, the servers should be logically divided. In physical space, these servers can be independent of each other but can be called through interfaces, or integrated into a physical computer or a set of computer clusters. Those skilled in the art should understand this flexibility, and should not use it to restrict the implementation of the network deployment method of this application.
[0061] Unless expressly specified, one or more technical features of the present application can be deployed on a server for implementation and accessed by a client through a remote call to obtain an online service interface provided by the server, or can be directly deployed and run on a client for access.
[0062] The neural network models referenced or may be referenced in this application, unless expressly specified, can be deployed on a remote server and remotely called on the client, or can be deployed and directly called on a client with sufficient device capabilities. In some embodiments, when it runs on the client, its corresponding intelligence can be obtained through transfer learning to reduce the requirements for the client's hardware operating resources and avoid excessive occupation of the client's hardware operating resources.
[0063] Unless explicitly specified, the various data involved in this application can be stored remotely on a server or on a local terminal device, as long as it is suitable for being called by the technical solution of this application.
[0064] Those skilled in the art should be aware that, although the various methods of the present application are described based on the same concept and thus present commonality to each other, unless otherwise specified, these methods can be independently executed. Similarly, for each embodiment disclosed in the present application, they are all proposed based on the same inventive concept, therefore, concepts with the same expression, and concepts that are appropriately changed for convenience despite different expressions, should be understood as equivalent.
[0065] Unless the mutually exclusive relationship between the embodiments to be disclosed in this application is explicitly stated, the relevant technical features involved in each embodiment can be cross-combined to flexibly construct a new embodiment, as long as such combination does not deviate from the creative spirit of this application and can meet the needs of the prior art or solve certain deficiencies in the prior art. Those skilled in the art should be aware of this flexibility.
[0066] A question-and-answer knowledge base construction method of the present application can be programmed as a computer program product and deployed in a client or server for execution. For example, in the e-commerce platform application scenario of the present application, it is generally deployed in a server for implementation, whereby the method can be executed by accessing an interface opened after the computer program product is running and performing human-computer interaction with the process of the computer program product through a graphical user interface.
[0067] An exemplary application scenario of the present application is an application in an e-commerce platform based on independent stations. Each independent station is a merchant instance of the e-commerce platform and has an independent access domain name. Its actual owner is responsible for the release and update of products.
[0068] Each merchant instance of an independent site can be configured with the intelligent customer service system provided by the e-commerce platform to introduce an intelligent customer service robot, and use the intelligent customer service system to provide consulting services to relevant consumer users. Consumer users enter the corresponding intelligent customer service interface of the merchant instance and enter the questions they need to consult as question text. After receiving the question text, the intelligent customer service system of the e-commerce platform uses the question text to perform semantic matching with the standard questions in the question unit in the question and answer knowledge base pre-configured for the independent site, and matches the standard questions that are most semantically similar to the question text. Then, a reply text in the pre-stored reply unit mapped to the standard question is called and output to the intelligent customer service interface, so as to meet the consulting needs of consumer users by answering their questions.
[0069] When a consumer user is chatting with an intelligent customer service robot as a questioning user, the questioning user is usually allowed to introduce manual customer service. When the manual customer service is connected, the intelligent customer service system will establish a dialogue channel between the questioning user and the manual customer service user of the independent site, and both parties will continue the manual dialogue. Then, the questioning user inputs the question text and the manual customer service user replies with the answer text, and the chat data is generated alternately.
[0070] The chat records generated based on the intelligent customer service interface chat, including the text of the questions asked by the user and the answer text of the manual reply of the human customer service user or the automatic reply of the robot, will be archived with the speaker's characteristic information and stored in the database, which can be used for data mining. For example, this application will use the chat records in this database as its corpus database.
[0071] In addition, the application scenarios of the intelligent customer service system of this application are certainly not limited to e-commerce platforms. In fact, in theory, any field that requires human-computer dialogue can be processed by the technical solution of this application. Therefore, the examples of application scenarios in this application are only given for the convenience of readers' understanding. Therefore, those skilled in the art should know that the scope of the creative spirit of this application should not be limited by the illustrative application scenarios of this application.
[0072] See also Figure 1 In a typical embodiment, the question-answer knowledge base construction method of the present application includes the following steps:
[0073] Step S1100: Obtain a corpus database, which includes multiple chat records, each of which includes a question text raised by the questioning user and an answer text replied by the manual customer service user to the question text:
[0074] As mentioned above, in the process of serving the user who asks the question, the intelligent customer service system will generate a series of chat records in response to the dialogue between the user who asks the question and the manual customer service user. These chat records can usually be processed into a one-question-one-answer organization. Specifically, if there is a situation where there are multiple answers to one question, or multiple questions and one answer, data cleaning can be performed in advance. In one implementation, multiple consecutive answers can be combined into one sentence, and similarly, multiple consecutive questions can be combined into a single sentence. The questions and answers in the chat records are mainly taken from their text parts, so this application mainly uses the content of the question text and the answer text.
[0075] Based on this, it is not difficult to understand that the chat record of the chat conversation between the user asking questions and the manual customer service user first contains a question text in the form of a question and an answer and its corresponding answer text. Each question text generally has its corresponding answer text. These chat records can be obtained from the chat record database of the intelligent customer service system and further constructed into the corpus database required for this application.
[0076] Step S1200: Add the question text in the corpus database that achieves semantic matching with the question text in the question unit in the question-answering knowledge base to the question unit; wherein each question unit includes one or more question texts, one of which is used as a standard question, and the rest are similar questions to the standard question:
[0077] In order to determine the reference value of the conversation content in the corpus database for the question and answer knowledge base of this application, it is necessary to semantically match the question text in the corpus database with the question text prepared in the question and answer knowledge base, and further improve the question and answer knowledge base on this basis.
[0078] The question-and-answer knowledge base is prepared for the intelligent customer service system. In this step, the question-and-answer knowledge base includes multiple question units and a response unit corresponding to each question unit. Each question unit stores a standard question and similar questions that are semantically similar to the standard question. The standard question and similar questions are stored in the form of question texts, and each response unit contains multiple response texts for answering the standard question or similar questions in its corresponding question unit.
[0079] In order to semantically match the question text with the question text in each question unit, a first deep neural network model that has been pre-trained to a convergent state can be used in advance to perform semantic extraction on all the question texts in the question and answer knowledge base, and obtain sentence vectors representing their deep semantic information. The sentence vector is then associated with the question text corresponding to the sentence vector and stored in the question and answer knowledge base for future reference.
[0080] Similarly, for each question text in the corpus database, the first deep neural network model is also used to extract a sentence vector representing its deep semantic information, which is then associated with the question text and stored in the corpus database for future reference.
[0081] The first deep neural network model is specifically used for the representation learning of the question text and the question text in this application, and can be a convolutional neural network model based on CNN and RNN, including but not limited to TextCNN, LSTM, Transformer, Bert, Albert, Electra, etc., which is suitable for representation learning of text and obtaining the corresponding sentence vector basic model. Those skilled in the art can select a suitable basic model in the prior art as the first deep neural network model of this step according to the principles disclosed in this application.
[0082] When semantically matching each question text with the question text, any data distance algorithm can be used to call their sentence vectors, calculate the data distance between the sentence vector of each question text and the sentence vector of each question text in the question and answer knowledge base, determine the question text that is closest to the question text data distance, that is, the most similar, determine the question text as the question text that matches the question text, and add the question text as a similar question in the question unit where the question text is located and store it in the question unit.
[0083] In an alternative embodiment, in order to ensure the semantic matching degree between the question text and the question sentence text, the data distance between the two or the similarity distance score obtained by quantification thereof can also be identified by a preset threshold. When the data distance or the similarity distance score meets the preset threshold, it is confirmed that the question sentence text matches the question text.
[0084] Here, when calculating the data distance, any distance algorithm such as cosine similarity distance algorithm, Euclidean distance algorithm, Pearson coefficient algorithm, Jaccard index algorithm, Chebyshev distance algorithm, etc. can be used for calculation, and those skilled in the art can implement it flexibly.
[0085] Step S1300: configure the answer text corresponding to the question text in the corpus database as the reply text in the reply unit corresponding to the question unit in the question-answering knowledge base:
[0086] When a question text in the corpus database is added to the question unit where the question text in the question-answering knowledge base that realizes semantic matching is located to form a similar question, the answer text corresponding to the question text in the corpus database is also added to the reply unit corresponding to the question unit, and configured as a reply text in the reply unit. It is not difficult to understand that since the question unit and the reply unit in the question-answering knowledge base have correspondence, and the question text and the answer text in the corpus database are the result of one question and one answer, therefore, storing the latter from the corpus database to the question-answering knowledge base meets the semantic relevance. This means that the question-answering knowledge base has an effective data source for similar questions and their reply texts, and since the answer text is given by a manual customer service user, it is generally more accurate and more friendly.
[0087] Step S1400: Determine the part of the reply text in each reply unit that has a relatively high average similarity distance score relative to other reply texts in the reply unit, and use it as the target reply text finally retained by the reply unit to complete the construction of the question-answering knowledge base:
[0088] Although the previous steps have achieved the goal of storing some question texts and their corresponding answer texts from the corpus database in the question-answering knowledge base, it is still difficult to avoid the appearance of some poor-quality response texts in the question-answering knowledge base due to semantic ambiguity. In particular, it is easy for these response texts to closely correspond to their own question texts, but may not correspond well to other similar questions or standard questions in the question unit where the question text is located. Therefore, on this basis, the response text in each response unit can be further optimized.
[0089] Specifically, for each reply unit, the data distance or similarity distance score obtained by quantification between the reply text and all reply texts in the reply unit, especially all other reply texts except itself, can be determined one by one for each reply text therein, and then, for each reply text, the average similarity distance score between its various similarity distance scores is calculated, so that each reply text in the reply unit obtains an average similarity distance score. For this, a preset threshold can be used to filter the average similarity distance scores of each reply text. Only the reply text that meets the preset threshold constraint is retained in the reply unit as the target reply text, and other reply texts that fail to meet the preset threshold constraint are deleted from the reply unit. Such an operation is performed for each reply unit, and thus, the preferred choice of reply texts in all reply units is realized. The retained reply text is more semantically advantageous and can more appropriately correspond to the standard questions and similar questions in the question unit corresponding to the reply unit to which it belongs.
[0090] In order to calculate the data distance, a pre-trained second deep neural network model can be used in advance to perform representation learning on the various reply texts to obtain sentence vectors representing their deep semantic information, which are associated with the reply texts and stored in the question-and-answer knowledge base for easy reference.
[0091] Here, when calculating the data distance, any distance algorithm such as cosine similarity distance algorithm, Euclidean distance algorithm, Pearson coefficient algorithm, Jaccard index algorithm, Chebyshev distance algorithm, etc. can be used for calculation, and those skilled in the art can implement it flexibly.
[0092] Similarly, the second deep neural network model is specifically used for the representation learning of the reply text in this application, and can be a convolutional neural network model based on CNN and RNN, including but not limited to TextCNN, LSTM, Transformer, Bert, Albert, Electra, etc., which is suitable for representation learning of text and obtaining the corresponding basic model of sentence vector. Those skilled in the art can select a suitable basic model in the prior art as the second deep neural network model of this step according to the principles disclosed in this application.
[0093] The question-answering knowledge base obtained through the above process not only has pre-set standard questions and similar questions, but also expands some question texts as newly added similar questions based on the corpus database as the basic data source, and further fills in the answer text corresponding to the question text as its reply text, and the retained reply text is the result after selection. Therefore, the question-answering knowledge base has a systematic knowledge structure, which is suitable for access to the intelligent customer service system, and is used to match semantically related reply texts based on the question texts raised by the questioning user as the response result to the question text.
[0094] The question-and-answer knowledge base prepared by this application can also be further provided to manual users for further compilation, so as to guide manual users to write reply texts with better speech, and feed back into the question-and-answer knowledge base. This does not affect the embodiment of the creative spirit of this application, and can further ensure the knowledge quality of the question-and-answer knowledge base of this application.
[0095] Through the above description of the typical embodiments of the present application, it can be understood that the present application has many positive advantages, including but not limited to the following aspects:
[0096] First, when constructing a question-and-answer knowledge base that can be used by an intelligent customer service system, the present application uses a chat record formed by a question-and-answer session between a question-asking user and an artificial customer service user as a corpus, matches the question text of the question-asking user that is semantically similar to the question text in the question unit provided in advance in the question-and-answer knowledge base in the chat record, uses the question text as a similar question to the standard question associated with the question text, and uses the answer text of the next sentence corresponding to the question text answered by the artificial customer service user as the reply text in the reply unit corresponding to the standard question, so that the reply text in the reply unit corresponding to the question unit in the question-and-answer knowledge base is filled. On this basis, multiple reply texts in each reply unit are further optimized, and by comparing the average similarity distance score corresponding to the data distance between each reply text and other reply texts, some reply texts with higher scores are selected as the target reply texts to be retained, thereby realizing the optimization of the reply texts mined from the corpus database and realizing the automatic use of the corpus database to construct a question-and-answer knowledge base. Since the answer text in the corpus database is the content replied by manual customer service users, it has the sense of real human expression and is usually more consistent with the question itself. Therefore, when it is used in the intelligent customer service system to reply to users asking related questions, it can make the reply more accurate on the one hand, and improve the user experience on the other.
[0097] Secondly, in the process of using the corpus database to build a question-and-answer knowledge base, the present application uses the semantic correlation between the question text and the question text when matching them. In the subsequent optimization of the reply texts pre-selected into the question-and-answer knowledge base, the data distance algorithm is also used to quantify the similarity between each reply text from a semantic level. Examining the similarity of the texts based on semantics can ensure that the matched objects are more relevant in meaning and meaning, strengthen the correlation between the texts, and make the final results more accurate. Therefore, for massive chat records, the technical solution of the present application can be used to effectively construct a question-and-answer knowledge base without relying on manual processing, which greatly saves construction costs and greatly improves construction efficiency.
[0098] In addition, the question-and-answer knowledge base constructed by this application based on effective corpus optimization and precise semantic matching can comprehensively improve the intelligence level of the intelligent customer service system, so that large-scale customer service scenarios such as e-commerce platforms can avoid a lot of manpower work, save corresponding implementation costs, and achieve economies of scale.
[0099] See also Figure 2 In a specific embodiment, the step S1100, obtaining a corpus database, includes the following steps:
[0100] Step S1110: call the full chat record from the preset intelligent customer service system:
[0101] Taking the intelligent customer service system of the e-commerce platform as the basis for the specific application scenario, the intelligent customer service system itself generates a large number of chat records, including chat records generated by the conversation between the questioning user and the intelligent customer service robot and chat records generated by the conversation between the questioning user and the manual customer service user. In order to prepare the corpus database of this application, these chat records can be fully extracted from the database of the intelligent customer service system.
[0102] It should be noted that if the intelligent customer service system uses the Q&A knowledge base for independent sites and independently maintains the chat records of the independent sites, then obtaining the chat records corresponding to the independent sites in full refers to the chat records corresponding to the independent sites. Similarly, if the intelligent customer service system uses a unified Q&A knowledge base for all sites of the entire e-commerce platform and uniformly maintains the chat records of all sites, then all chat records of the entire e-commerce platform can be obtained in full.
[0103] Step S1120: clean the chat records, delete the chat records automatically answered by the intelligent customer service system, and only keep the chat records answered by the manual customer service user, so that each retained chat record contains the question text raised by the questioning user and the answer text replied by the manual customer service user to the question text:
[0104] The chat records are stored in the database of the intelligent customer service system. Each chat data is marked with the corresponding user, so it is possible to identify whether the corresponding chat data belongs to a robot or a human customer service user according to the user who spoke. The conversation content belonging to the robot, including the answer text replied by the robot itself and the question text corresponding to the answer text, are deleted. Only the chat records generated by the conversation between the human customer service user and the questioning user are retained, so that each retained chat record contains the question text raised by the questioning user and the answer text replied by the human customer service user to the question text.
[0105] Step S1130: storing the retained chat records into the corpus database:
[0106] In order to adapt to the technical solution of this application, the chat records retained after cleaning in the previous steps are stored in the corpus database of this application and can be used for subsequent calls.
[0107] In this embodiment, the chat records of the manual dialogue part generated in the daily service process of the intelligent customer service system are screened to construct the corpus database of this application, so that the corpus database relies on more meaningful conversations in actual application scenarios. The content of these conversations can ensure that when the question and answer knowledge base is put back into use in the intelligent customer service system, it can be more semantically matched with actual needs, so that users can feel the improvement of the intelligent customer service system in expression, affinity, semantic correspondence, etc., which can improve the accuracy of the intelligent customer service system robot in subsequent answers to user questions and improve the user's inquiry answering experience.
[0108] See also Figure 3 In a specific embodiment, the step S1200, adding the question text in the corpus database that semantically matches the question text in the question unit in the question-answering knowledge base to the question unit, comprises the following steps:
[0109] Step S1210: Use a first text extraction model that has been pre-trained to a convergent state to extract sentence vectors of each question text in each question unit in the question-answering knowledge base:
[0110] A dedicated first text extraction model is used. As mentioned above, the first model is implemented based on the first deep neural network model described in the present application, which is trained to a convergence state in advance, so as to learn the ability to extract sentence vectors representing the deep semantic information of the text input therein.
[0111] With the help of the first model, the sentence vectors of each question text in each question unit in the question-answering knowledge base are extracted one by one, and the sentence vectors are associated with their corresponding question texts and stored in the question-answering knowledge base for subsequent calls.
[0112] Step S1220: Use the first text extraction model to extract sentence vectors of each question text in the corpus database:
[0113] Similarly, the first model is still used to extract the sentence vectors of each question text in the corpus database one by one. Since the question text is essentially the content of the user's question, it is the same in nature as the question text in the question and answer knowledge base, and the question text may also be added to the question and answer knowledge base to constitute a similar question therein, therefore, the first model is also competent for the task of extracting sentence vectors for question texts, and each question text is represented and learned one by one to obtain the corresponding sentence vector. Similarly, the sentence vector can be associated with its corresponding question text and stored in the corpus database for future use, and can also be stored in the question and answer knowledge base together with the question text later, so that after the question and answer knowledge base is connected to the intelligent customer service system, it can be called on demand by the intelligent customer service system.
[0114] Step S1230: Calculate the data distance between the sentence vector of each question text and the sentence vector of each question text, and determine the similarity distance score corresponding to the data distance:
[0115] After the previous steps, each question text in the corpus database and each question text in the question-answering knowledge base obtains its own corresponding sentence vector. Based on this, for the sentence vector of each question text in the corpus database, the cosine similarity distance can be calculated one by one with the sentence vector of each question text in the question-answering knowledge base, and the corresponding similarity value is obtained as the similarity distance score. The larger the similarity distance score, the closer the data distance between the two sentence vectors is. Conversely, the smaller the similarity distance score, the farther the data distance between the two sentence vectors is.
[0116] Of course, other data distance algorithms can also be used as mentioned above, such as the Euclidean distance algorithm. It should be noted that the original data calculated by the Euclidean distance algorithm directly represents the distance value. The larger the value, the farther the distance between the two sentence vectors; conversely, the smaller the value, the closer the distance between the two sentence vectors. Therefore, it can be reversely converted into the similarity distance score so that it can be expressed as described above. Based on this, it can be seen that in order to adapt to different similarity distance algorithms, technical personnel in this field should make flexible adjustments in the specific calculation process according to the meaning represented by the calculation results of various algorithms, and can be unified into the similarity distance score for standardized processing as shown in this application.
[0117] Step S1240: retain a similarity distance score with the highest score for each question text, and obtain a score sequence consisting of similarity distance scores between all question texts and their most similar question texts:
[0118] After the previous calculation, a question text may have a high similarity distance score with multiple question texts, for example, 0.92 and 0.85 respectively, both higher than 0.8. In this case, it is shown that the question text seems to be able to constitute the question text corresponding to the two values at the same time, which is semantically matched. If this situation is not handled, it is easy to cause a question text to be incorporated into multiple question units in the question-answering knowledge base, resulting in ambiguity in the application. Therefore, in response, in this embodiment, for each question text, only the similarity distance score corresponding to the question text with the highest score among all question texts with its similarity distance score is retained. Accordingly, each question text only has one similarity distance score left, and the similarity distance score uniquely corresponds to only one question text. Furthermore, the uniquely retained similarity distance scores of all question texts can be constructed as a score sequence for fast calculation. Each element in the sequence stores the similarity distance score between a specific question text and a specific question text.
[0119] Step S1250: Filter out the elements in the scoring sequence whose similarity distance scores exceed a preset threshold, use the question text corresponding to each element as the question text that achieves semantic matching with the question text corresponding to the element, and add the question text to the question unit where the question text is located to form a similar question:
[0120] It is not difficult to understand that the similarity distance score between a question text and a question text can be high or low. If the question text is still included in the question-answering knowledge base when the score is too low, the knowledge quality of the question-answering knowledge base will be easily reduced. Therefore, a preset threshold can be set in advance, and the preset threshold is an experience threshold or an experimental threshold. Then, the similarity distance score in each element in the scoring sequence is compared with the preset threshold. When the similarity distance score between a question text and a question text is higher than the preset threshold, it means that the question text and the question text achieve semantic matching, and the question text can constitute a similar question to the question text. Otherwise, the question text can be discarded and not added to the question-answering knowledge base.
[0121] Through this step, the elements in the scoring sequence are screened, and the question texts corresponding to the elements whose similarity distance scores exceed the preset threshold are added to the question unit where the question text corresponding to the element is located to form similar questions therein.
[0122] In this embodiment, a judgment method for determining the semantic match between the question text and the question text is specifically described in detail, wherein deduplication is achieved by retaining only one question text with the highest similar distance score for each question text, so that a question text will not be added to multiple different question units of the question and answer knowledge base at the same time, which will not cause ambiguity in the question and answer knowledge base, and help improve the accuracy of matching similar questions by the intelligent customer service system.
[0123] See also Figure 4 In an extended embodiment, the training process of the first text extraction model includes the following steps:
[0124] Step S2100: Use a similar question in a question unit in the question-answering knowledge base as a positive sample, or use a similar question in another question unit as a negative sample, and input it into the first text extraction model to extract a sentence vector:
[0125] Since the question-and-answer knowledge base has pre-constructed each question unit therein, each question unit has been set with corresponding standard questions and question texts corresponding to similar questions, and these question texts are easy to extract from the inherent question-and-answer knowledge base of the corresponding intelligent customer service system, therefore, the question texts in the question-and-answer knowledge base can be used as training samples for training the first text extraction model of the present application.
[0126] When the first model is trained, a binary classifier can be connected to assist in training, so that positive and negative samples can be provided for the training process. During each iterative training, a similar question in a question unit in the question-answering knowledge base is used as a positive sample, and the standard question of the question unit is used as a supervisory label of the binary classifier to implement positive supervision on the model training process. Alternatively, the standard question of the question unit is still used as the supervisory label of the classifier, and any similar question of other question units outside the question unit can be used as a negative sample to implement reverse supervision on the model training process.
[0127] The training samples are input into the first model, and representation learning is performed according to the inherent model principle of the first model, so as to extract sentence vectors representing the deep semantic information of the training samples.
[0128] As mentioned above, the first model can be selected from various existing models suitable for text representation learning, which will not be elaborated here.
[0129] Step S2200: Use a classifier to extract the text from the first model and perform binary classification mapping to obtain corresponding classification labels:
[0130] The classifier, as mentioned above, can be a binary classifier. After the sentence vector is fully connected, it enters the binary classifier for classification mapping, mapped to the binary classification space, and obtains the corresponding classification label.
[0131] Step S2300: Take the standard question corresponding to the similar question of the positive sample as the supervision label, calculate the loss value of the classification label, and terminate the training if the loss value reaches the preset threshold and reaches the convergence state; otherwise, implement gradient update and use the next sample to implement iterative training:
[0132] As mentioned above, the standard question used as the supervisory label, here, its supervisory label is used to calculate the cross entropy loss value of the classification label obtained in the previous step, and then the loss value is compared with a preset threshold. If the loss value reaches the preset threshold, it can be judged that the first model has converged, so that the training of the first model can be terminated and put into use to extract the corresponding sentence vector for the question text and question text of this application. If the loss value does not reach the preset threshold, it means that the model has not converged. At this time, the weight of the first model is gradient updated through parameter feedback to promote the model to further approach convergence, and then continue to call the next sample to implement iterative training of the first model until the first model is trained to a converged state.
[0133] In this embodiment, the question-answering knowledge base of the present application is directly used to train the first model used in the present application. By fitting the model with an approximate function between similar questions used as training samples and their standard questions, the first model eventually learns the ability to extract sentence vectors for similar questions, which can be subsequently effectively used to extract sentence vectors for question texts and question texts for the question-answering knowledge base of the present application.
[0134] See also Figure 5 In a specific embodiment, the step S1400, determining the partial reply texts in each reply unit that have a relatively high average similarity distance score relative to other reply texts in the reply unit as the target reply texts finally retained by the reply unit to complete the construction of the question-answering knowledge base, includes the following steps:
[0135] Step S1410: Use a second text extraction model that has been pre-trained to a convergent state to extract a sentence vector of each reply text in each reply unit in the question-answer knowledge base:
[0136] The second model of text feature extraction of the present application is simpler to select. For example, a Bert model with self-supervised learning capability can be used, and the answer text in the corpus database of the present application or the reply text in the question-and-answer knowledge base can be used as its training sample, and it can be fine-tuned and trained to a convergent state. Alternatively, the pre-trained Bert model can be directly used. Similarly, the deep neural network model related to text feature extraction in other prior arts referred to in the present application can also be used for implementation, and those skilled in the art can flexibly apply it to this.
[0137] After the second model is trained to a convergent state, it can be used in the present application to extract the corresponding sentence vectors for the reply texts in the question-and-answer knowledge base one by one, and then each sentence vector is associated with its corresponding reply text and stored in the question-and-answer knowledge base for subsequent calls.
[0138] Step S1420: Calculate the similarity distance score representing the numerical distance between the sentence vectors of each reply text in each reply unit, and obtain a similarity distance score sequence consisting of the similarity distance scores between each reply text in the reply unit and each reply text in the reply unit:
[0139] As mentioned above, there are usually multiple reply texts in each reply unit. These reply texts represent different rhetoric and their information quality varies. Therefore, it is necessary to select the multiple reply texts in each reply unit based on the reply unit.
[0140] Based on this, the data distance between the sentence vectors of the two reply texts in each reply unit can be calculated first. As mentioned above, the numerical distance can be calculated using various optional methods listed above. Here, the cosine similarity distance algorithm is used as an example to calculate the similarity distance score that represents the data distance between the two reply texts. Similarly, the larger the similarity distance score, the closer the data distance between the two reply texts is, and the closer the two are semantically. Conversely, if the similarity distance score is smaller, it means that the data distance between the two reply texts is farther, and the two are farther semantically.
[0141] Based on this, it is not difficult to understand that for each reply text in the same reply unit, it has a corresponding similarity distance score with all reply texts in the entire reply unit, especially with other reply texts except itself, forming a similarity distance score sequence. Correspondingly, each reply text is such a similarity distance score sequence.
[0142] Step S1430: Calculate the average similarity distance score corresponding to each reply text according to the similarity distance score sequence of each reply text in each reply unit:
[0143] For each reply text, the similarity distance scores of all elements in its similarity distance score sequence are summed up and the average is calculated, that is, the average similarity distance score corresponding to the reply text is obtained. The average similarity distance score represents the overall similarity distance between the reply text and all the reply texts in the current reply unit. Similarly, the larger the similarity distance, the higher the semantic value of the reply text. When the similarity distance is smaller, it indicates that the semantic value of the reply text is lower.
[0144] Step S1440: In each reply unit, the reply texts whose average similarity distance score is lower than the preset threshold are deleted, and only the reply texts whose average similarity distance score is higher than the preset threshold are retained to complete the construction of the question-answer knowledge base:
[0145] In order to achieve optimization, for each reply unit, the average similarity distance score of each reply text therein can be screened by a preset threshold, and the reply text with an average similarity distance score lower than the preset threshold will be deleted from its reply unit, while the reply text with an average similarity distance score higher than the preset threshold will be retained in its reply unit. In this way, the optimization and purification of the reply texts in each reply unit is achieved, and the construction process of the question and answer knowledge base is completed.
[0146] In this embodiment, the relative information value of each reply text in the same reply unit is standardizedly measured by obtaining the average similarity distance score of each reply text in the same reply unit. On the basis of the same measurement benchmark, a preset threshold is used to optimize the reply text to eliminate the false and retain the true, thereby ensuring the effectiveness of the information value of the reply text and thus ensuring the knowledge quality of the question and answer knowledge base.
[0147] See also Figure 6 In the extended embodiment, in step S1400, after the question-answer knowledge base is constructed, the following steps are included:
[0148] Step S1500: Connect the question-answer knowledge base to a preset intelligent customer service system, and the intelligent customer service system responds to the question text raised by the questioning user, determines a reply unit that matches the semantics of the question text from the question-answer knowledge base, and responds to the question text with one of the reply texts in the reply unit:
[0149] The question-and-answer knowledge base obtained on the basis of the various embodiments disclosed in the foregoing text of this application has a high knowledge quality, and the semantic correlation between the question text and the reply text is good, so it is more suitable for serving the intelligent customer service system. Accordingly, the question-and-answer knowledge base obtained in this application can be reconnected to the preset intelligent customer service system, such as the intelligent customer service system of the e-commerce platform in the example of this application, to provide intelligent customer service robot services. When the intelligent customer service robot is called by the questioning user, the questioning user sends a question text to it, and then the robot uses the first text extraction model of this application to extract the sentence vector of the question text, and performs similarity matching based on the sentence vector and the sentence vector of each question text in the question-and-answer knowledge base, determines the question text with the highest similarity distance score, and calls any reply text in the reply unit corresponding to the question unit where the question text is located as the answer text to reply to the questioning user.
[0150] In this embodiment, the question and answer knowledge base prepared by this application is used to upgrade the question and answer knowledge base of the existing intelligent customer service system, which can further enhance the intelligence of the intelligent customer service system, allowing the questioning user to obtain a more accurate answer text, thereby improving the user's questioning experience.
[0151] See also Figure 7 , a question-answering knowledge base construction device provided to meet one of the purposes of the present application is a functional embodiment of the question-answering knowledge base construction method of the present application, the device includes: a corpus calling module 1100, a question matching module 1200, an answer configuration module 1300, and a mining construction module 1400, wherein the corpus calling module 1100 is used to obtain a corpus database, the corpus database includes multiple chat records, each chat record includes a question text raised by a questioning user and an answer text replied by an artificial customer service user to the question text; the question matching module 1200 is used to semantically match the corpus database with the question text in the question unit in the question-answering knowledge base The question text in the corpus is added to the question unit; wherein each of the question units includes one or more question texts, one of which is used as a standard question, and the rest are similar questions of the standard question; the answer configuration module 1300 is used to configure the answer text corresponding to the question text in the corpus database as the reply text in the reply unit corresponding to the question unit in the question and answer knowledge base; the mining construction module 1400 is used to determine the part of the reply text in each reply unit that has a relatively high average similarity distance score relative to other reply texts in the reply unit, as the target reply text finally retained by the reply unit to complete the construction of the question and answer knowledge base.
[0152] In a specific embodiment, the corpus calling module 1100 includes: a data acquisition unit, which is used to call the full chat records from a preset intelligent customer service system; a data cleaning unit, which is used to clean the chat records, delete the chat records automatically answered by the intelligent customer service system, and only retain the chat records answered by manual customer service users, so that each retained chat record contains the question text raised by the questioning user and the answer text replied by the manual customer service user to the question text; a data storage unit, which is used to store the retained chat records in a corpus database.
[0153] In a specific embodiment, the question matching module 1200 includes: a question extraction unit, which is used to use a first text extraction model pre-trained to a convergent state to extract the sentence vector of each question text in each question unit in the question-answering knowledge base; a question extraction unit, which is used to use the first text extraction model to extract the sentence vector of each question text in the corpus database; a distance scoring unit, which is used to calculate the data distance between the sentence vector of each question text and the sentence vector of each question text, and determine the similarity distance score corresponding to the data distance; an exclusive processing unit, which is used to retain a similarity distance score with the highest score for each question text, and obtain a scoring sequence composed of similarity distance scores between all question texts and their most similar question texts; a question adding unit, which is used to screen out elements in the scoring sequence whose similarity distance scores exceed a preset threshold, use the question text corresponding to each element as the question text that realizes semantic matching with the question text corresponding to the element, and add the question text to the question unit where the question text is located to form a similar question.
[0154] In an extended embodiment, the first text extraction model is trained by a training device, which includes: a sample calling module, which is used to use a similar question in a question unit in the question and answer knowledge base as a positive sample, or to use a similar question in another question unit as a negative sample, and input the first text extraction model to extract a sentence vector; a classification mapping module, which is used to perform binary classification mapping on the first text extraction model through a classifier to obtain a corresponding classification label; a supervised iteration module, which is used to use the standard question corresponding to the similar question of the positive sample as a supervised label, calculate the loss value of the classification label, and terminate the training if the loss value reaches a preset threshold and reaches a convergence state; otherwise, implement gradient update, and use the next sample to implement iterative training.
[0155] In a specific embodiment, the answer configuration module 1300 includes: a reply extraction unit, which is used to use a second text extraction model pre-trained to a convergent state to extract the sentence vector of each reply text in each reply unit in the question and answer knowledge base; a score quantization unit, which is used to calculate the similarity distance score that represents the numerical distance between the sentence vectors of each reply text in each reply unit, and obtain a similarity distance score sequence consisting of the similarity distance scores between each reply text in the reply unit and each reply text in the reply unit; a mean calculation unit, which is used to calculate the average similarity distance score corresponding to each reply text based on the similarity distance score sequence of each reply text in each reply unit; and a reply cleaning unit, which is used to delete the reply texts in each reply unit whose average similarity distance score is lower than a preset threshold, and only retain the reply texts whose average similarity distance score is higher than the preset threshold to complete the construction of the question and answer knowledge base.
[0156] In an extended embodiment, the question and answer knowledge base construction device of the present application also includes: a knowledge base access module, which is used to connect the question and answer knowledge base to a preset intelligent customer service system, and the intelligent customer service system responds to the question text raised by the questioning user, determines a reply unit that matches the semantics of the question text from the question and answer knowledge base, and answers the question text with one of the reply texts in the reply unit.
[0157] In order to solve the above technical problems, the present application also provides a computer device. Figure 8 As shown, a schematic diagram of the internal structure of a computer device. The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. Among them, the computer-readable storage medium of the computer device stores an operating system, a database, and computer-readable instructions. The database may store a control information sequence. When the computer-readable instructions are executed by the processor, the processor may implement a question-and-answer knowledge base construction method. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor may execute the question-and-answer knowledge base construction method of the present application. The network interface of the computer device is used to connect and communicate with a terminal. Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0158] In this embodiment, the processor is used to execute Figure 7The memory stores the program code and various data required to execute the above modules or submodules. The network interface is used to transmit data between user terminals or servers. The memory in this embodiment stores the program code and data required to execute all modules / submodules in the question-and-answer knowledge base construction device of this application, and the server can call the program code and data of the server to execute the functions of all submodules.
[0159] The present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the question-and-answer knowledge base construction method of any embodiment of the present application.
[0160] The present application also provides a computer program product, including a computer program / instruction, which implements the steps of the method described in any embodiment of the present application when executed by one or more processors.
[0161] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments of the present application can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a computer-readable storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0162] To sum up, the question-and-answer knowledge base constructed by this application based on effective corpus optimization and precise semantic matching can comprehensively improve the intelligence level of the intelligent customer service system, so that large-scale customer service scenarios such as e-commerce platforms can avoid a lot of manpower work, save corresponding implementation costs, achieve economies of scale, and have broad application prospects.
[0163] Those skilled in the art will appreciate that the various operations, methods, steps, measures, and schemes in the processes discussed in this application may be alternated, altered, combined, or deleted. Further, other steps, measures, and schemes in the various operations, methods, and processes discussed in this application may also be alternated, altered, rearranged, decomposed, combined, or deleted. Further, the steps, measures, and schemes in the prior art that are similar to those disclosed in this application may also be alternated, altered, rearranged, decomposed, combined, or deleted.
[0164] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for constructing a question-answer knowledge base, characterized in that: The steps include: A corpus database is obtained, wherein the corpus database includes a plurality of chat records, each of which includes a question text raised by a questioning user and an answer text replied by an artificial customer service user to the question text, including: calling all chat records from an intelligent customer service system preset by an independent website of an e-commerce platform; performing data cleaning on the chat records, deleting the chat records automatically answered by the intelligent customer service system, and retaining only the chat records answered by the artificial customer service user, so that each retained chat record includes the question text raised by the questioning user and the answer text replied by the artificial customer service user to the question text; and storing the retained chat records in the corpus database; Adding the question text in the corpus database that semantically matches the question text in the question unit in the question-answering knowledge base to the question unit; wherein each of the question units includes one or more question texts, one of which is used as a standard question, and the others are similar questions to the standard question; The answer text corresponding to the question text in the corpus database is configured as the reply text in the reply unit corresponding to the question unit in the question-answering knowledge base; Determine the part of the reply text in each reply unit that has a relatively high average similarity distance score relative to other reply texts in the reply unit as the target reply text that is finally retained by the reply unit to complete the construction of the question-answering knowledge base, including the following steps: use the second text extraction model that is pre-trained to a convergent state to extract the sentence vector of each reply text in each reply unit in the question-answering knowledge base; calculate the similarity distance score that characterizes the numerical distance between the sentence vectors of the two reply texts in each reply unit, and obtain a similarity distance score sequence consisting of the similarity distance scores between each reply text in the reply unit and each reply text in the reply unit; calculate the average similarity distance score corresponding to each reply text according to the similarity distance score sequence of each reply text in each reply unit; delete the reply text in each reply unit whose average similarity distance score is lower than a preset threshold, and only retain the reply text whose average similarity distance score is higher than the preset threshold to complete the construction of the question-answering knowledge base; The question-and-answer knowledge base is connected to a preset intelligent customer service system, and the intelligent customer service system responds to the question text raised by the questioning user, determines a reply unit that matches the semantics of the question text from the question-and-answer knowledge base, and answers the question text with one of the reply texts in the reply unit.
2. The method for constructing a question-answer knowledge base according to claim 1, characterized in that: Adding the question text in the corpus database that semantically matches the question text in the question unit in the question-answering knowledge base to the question unit comprises the following steps: Using a first text extraction model that has been pre-trained to a convergent state, extracting a sentence vector of each question text in each question unit in the question-answering knowledge base; Using the first text extraction model, extracting sentence vectors of each question text in the corpus database; Calculating the data distance between the sentence vector of each question text and the sentence vector of each question text, and determining a similarity distance score corresponding to the data distance; A similarity distance score with the highest score is retained for each question text, and a score sequence consisting of similarity distance scores between all question texts and their most similar question texts is obtained; The elements whose similarity distance scores in the scoring sequence exceed the preset threshold are screened out, and the question text corresponding to each element is used as the question text that realizes semantic matching with the question text corresponding to the element, and the question text is added to the question unit where the question text is located to form a similar question.
3. The method for constructing a question-answer knowledge base according to claim 2, characterized in that: The training process of the first text extraction model includes the following steps: Using a similar question in a question unit in the question-answering knowledge base as a positive sample, or using a similar question in another question unit as a negative sample, inputting the first text extraction model to extract a sentence vector; The text is extracted into a first model through a classifier to perform binary classification mapping to obtain corresponding classification labels; The standard question corresponding to the similar question of the positive sample is used as the supervision label, and the loss value of the classification label is calculated. If the loss value reaches a preset threshold and reaches a convergence state, the training is terminated; otherwise, a gradient update is implemented and the next sample is used to implement iterative training.
4. A question-answer knowledge base construction device, characterized in that: include: The corpus calling module is used to obtain a corpus database, which includes multiple chat records, each of which includes a question text raised by a questioning user and an answer text replied by an artificial customer service user to the question text, including: calling all chat records from an intelligent customer service system preset in an independent station of an e-commerce platform; performing data cleaning on the chat records, deleting the chat records automatically answered by the intelligent customer service system, and only retaining the chat records answered by the artificial customer service user, so that each retained chat record includes the question text raised by the questioning user and the answer text replied by the artificial customer service user to the question text; storing the retained chat records in the corpus database; A question matching module is used to add the question text in the corpus database that achieves semantic matching with the question text in the question unit in the question-answering knowledge base to the question unit; wherein each of the question units includes one or more question texts, one of which is used as a standard question, and the others are similar questions to the standard question; An answer configuration module, used to configure the answer text corresponding to the question text in the corpus database as the reply text in the reply unit corresponding to the question unit in the question and answer knowledge base; A mining construction module is used to determine part of the reply texts in each reply unit that have a relatively high average similarity distance score relative to other reply texts in the reply unit, and use them as the target reply texts that are finally retained by the reply unit to complete the construction of the question-answering knowledge base, including the following steps: using a second text extraction model that is pre-trained to a convergent state to extract the sentence vector of each reply text in each reply unit in the question-answering knowledge base; calculating the similarity distance score that characterizes the numerical distance between the sentence vectors of two reply texts in each reply unit, and obtaining a similarity distance score sequence consisting of the similarity distance scores between each reply text in the reply unit and each reply text in the reply unit; calculating the average similarity distance score corresponding to each reply text according to the similarity distance score sequence of each reply text in each reply unit; deleting the reply texts in each reply unit whose average similarity distance score is lower than a preset threshold, and only retaining the reply texts whose average similarity distance score is higher than the preset threshold to complete the construction of the question-answering knowledge base; The question-and-answer knowledge base is connected to a preset intelligent customer service system, and the intelligent customer service system responds to a question text raised by a questioning user, determines a reply unit that matches the semantics of the question text from the question-and-answer knowledge base, and answers the question text with one of the reply texts in the reply unit.
5. A computer device comprising a central processing unit and a memory, characterized in that: The central processing unit is used to call and run the computer program stored in the memory to execute the steps of the method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: It stores a computer program implemented according to the method described in any one of claims 1 to 3 in the form of computer-readable instructions, and when the computer program is called and executed by a computer, the steps included in the corresponding method are executed.
7. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Method and device for automatically expanding question and answer knowledge base
CN112948561A
Method and apparatus for customer service, electronic device, and computer readable storage medium
WO2019114512A1
