A method and device for constructing a knowledge base
By classifying business categories and calculating similarity of knowledge base data, and splitting and merging redundant data, the redundancy problem in the existing technology is solved, the efficiency and accuracy of knowledge base construction are improved, and automatic review is realized.
Patent Information
- Application Number
- CN202010040923.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-15
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-01-15
AI Technical Summary
Existing knowledge bases are prone to redundancy when the amount of data is large, resulting in low efficiency and difficulty in ensuring accuracy, and require manual review to solve the problem.
By dividing the data in the knowledge base into redundant data sets and non-redundant data sets according to business categories, splitting the redundant data, calculating similarity and merging or updating the data to form new non-redundant data sets, thereby reducing redundancy. redundancy to achieve automatic review.
It improves the efficiency and accuracy of knowledge base construction, avoids manual review errors, and reduces the occurrence of redundancy.
Smart Images

Figure CN111291889B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method and device for constructing a knowledge base. Background Art
[0002] The knowledge base usually contains a set of standard questions, a set of standard answers, and a set of similar questions. Existing customer service robots communicate with users based on the internally constructed knowledge base. The above sets are often constructed manually. Once the amount of data reaches a certain level, there may be redundancy where one question can correspond to multiple different answers, or one answer can answer multiple different questions.
[0003] To address this problem, we currently rely mainly on manual review of the above-mentioned collections in the knowledge base to avoid redundancy as much as possible, but this method is inefficient. Summary of the invention
[0004] The embodiment of the present invention provides a method and device for constructing a knowledge base, which are used to improve the accuracy and efficiency of knowledge base construction.
[0005] In a first aspect, an embodiment of the present invention provides a method for constructing a knowledge base, the method comprising:
[0006] Determine a first redundant data set and a first non-redundant data set from a first knowledge base according to the service category, wherein the first redundant data set includes a plurality of redundant data, any redundant data in the plurality of redundant data corresponds to at least two service categories, and the first non-redundant data set includes a plurality of non-redundant data, any non-redundant data in the plurality of non-redundant data corresponds to one service category;
[0007] Splitting any redundant data to obtain at least two data;
[0008] Determine a second non-redundant data set from the first redundant data set according to the service categories of two adjacent data among the at least two data;
[0009] The first non-redundant data set is updated by using the second non-redundant data set to form a second knowledge base.
[0010] In the embodiment of the present invention, the first knowledge base can be considered as a knowledge base that has been constructed, and the business category can be considered as the functional category of the field where the first knowledge base is located. For example, for the banking field, the business category can be divided into card application business, savings business, loan business and account information modification business. The first knowledge base may include multiple data. Since these data are currently manually established, it is possible that a certain data corresponds to at least two business categories, that is, the data in the first knowledge base may have its own redundancy problem. Therefore, the embodiment of the present invention can classify the multiple data in the first knowledge base according to the business category corresponding to any data, for example, into a first redundant data set and a first non-redundant data set, and then determine the second non-redundant data set from the first redundant data set, so that the data other than the second non-redundant data set in the first redundant data set can be excluded, and redundancy can be avoided as much as possible. The first non-redundant data set can be considered as a non-redundant data set obtained after classification processing, and the second non-redundant data set can be considered as a non-redundant data set obtained from the first redundant data set. Then, by updating the first non-redundant data set through the second non-redundant data set, the redundancy between the two data sets can be further reduced, thereby forming a second knowledge base. Compared with the manual review in the prior art, the present invention can realize automatic review, thereby improving the efficiency of review. In addition, it can avoid possible errors in manual review, thereby improving the accuracy of knowledge base construction.
[0011] In the embodiment of the present invention, there are multiple ways to determine the second non-redundant data set from the first redundant data set according to the service categories of two adjacent data among the at least two data, including any one or more combinations of the following:
[0012] Exemplarily, if the business categories of the two adjacent data are both the first business category, the similarity between the two adjacent data and at least one non-redundant data in the first non-redundant data set is calculated to obtain two first similarities, wherein the type of the at least one non-redundant data is the first business category; if the two first similarities are both greater than or equal to the first threshold, the two data are merged and updated to the second non-redundant data set.
[0013] For example, at least two data obtained by splitting each data in the first redundant set can be regarded as independent data respectively. If the business categories of two adjacent data are the same, then the two adjacent data can be considered to be relatively similar, that is, the similarity between the two is high and relatively redundant. Therefore, when the embodiment of the present invention determines the business category of two adjacent data, for example, when it is the first business category, the first similarity between the two adjacent data and at least one non-redundant data belonging to the first business category in the first non-redundant data set can be calculated respectively, thereby obtaining two first similarities. If both of the two first similarities are greater than or equal to the first threshold value, it can be considered that the two adjacent data have a high similarity with the data in the first non-redundant data set. Then it can be considered to merge the two adjacent data and then update them to the second non-redundant data set, thereby avoiding the formation of redundancy between the data in the second non-redundant data set.
[0014] Exemplarily, if at least one of the two similarities is smaller than a first threshold, the two adjacent data are updated to the second non-redundant data set.
[0015] Different from the above embodiment, if at least one of the two first similarities is less than the first threshold, that is, the similarity between the two adjacent data is low, then it can be considered that the possibility of the two adjacent data forming redundancy in the second non-redundant data set is small, so the two adjacent data can be updated to the second non-redundant data set respectively.
[0016] Exemplarily, if the service categories of the two adjacent data are different, the two adjacent data are updated to the second non-redundant data set.
[0017] Compared with the above two exemplary embodiments, if the business categories of two adjacent data are different, it can be considered that the similarity of the two adjacent data is low, that is, the possibility of the two adjacent data forming redundancy in the second non-redundant data set is small, and the two adjacent data can also be updated to the second non-redundant data set respectively.
[0018] Optionally, if the data set is a question set, updating the first non-redundant data set by using the second non-redundant data set to form a second knowledge base includes:
[0019] Determine a second similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, wherein the second non-redundant data set includes M non-redundant data and the first non-redundant data set includes N non-redundant data;
[0020] If the second similarity is greater than or equal to a second threshold, the i-th non-redundant data in the second non-redundant data set is used as similar data of the j-th non-redundant data in the first non-redundant data set, and updated to the similar data set of the second knowledge base;
[0021] If the second similarity is less than a second threshold, the i-th non-redundant data in the second non-redundant data set is used as standard data and updated to the standard data set of the second knowledge base.
[0022] In an embodiment of the present invention, if the first non-redundant data set and the second non-redundant data set are both problem sets, in order to avoid redundancy, the similarity between any non-redundant data in the first non-redundant data set and any non-redundant data in the second non-redundant data set can be calculated. If the similarity is high, then the non-redundant data in the second non-redundant data set can be considered to be a similar problem of the corresponding non-redundant data in the first non-redundant data set; if the similarity is low, then the non-redundant data in the second non-redundant data set can be considered to be a new standard problem in the first non-redundant data set, thereby further eliminating the redundant problems that may exist between the first non-redundant data set and the second non-redundant data set.
[0023] Optionally, if the data set is an answer set, the first non-redundant data set is updated using the second non-redundant data set to form a second knowledge base, further comprising:
[0024] Determine a third similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, wherein the second non-redundant data set includes M non-redundant data and the first non-redundant data set includes N non-redundant data;
[0025] If the third similarity is greater than or equal to a third threshold, excluding the i-th non-redundant data in the second non-redundant data set as similar data to the j-th non-redundant data in the first non-redundant data set;
[0026] If the third similarity is less than a third threshold, the i-th non-redundant data in the second non-redundant data set is used as standard data and updated to the standard data set of the second knowledge base.
[0027] In an embodiment of the present invention, if the first non-redundant data set and the second non-redundant data set are both answer sets, in order to avoid redundancy, the similarity between any non-redundant data in the first non-redundant data set and any non-redundant data in the second non-redundant data set can be calculated. If the similarity is high, then it can be considered that the non-redundant data in the second non-redundant data set is a similar answer to the corresponding non-redundant data in the first non-redundant data set and should be excluded; if the similarity is low, then the non-redundant data in the second non-redundant data set can be used as a new standard answer in the first non-redundant data set, thereby further eliminating the redundancy problem that may exist between the first non-redundant data set and the second non-redundant data set.
[0028] Optionally, the first knowledge base includes a plurality of pieces of data, and determining a first redundant data set and a first non-redundant data set from the first knowledge base according to a plurality of business categories includes:
[0029] For any data among the multiple data, obtaining the number of business categories of the any data;
[0030] If the number is greater than or equal to a fourth threshold, any of the data is used as redundant data to form the first redundant data set; or,
[0031] If the number is less than a fourth threshold, any of the data is used as non-redundant data to form the first non-redundant data set.
[0032] For example, some or all of the multiple pieces of data included in the first knowledge base may be redundant. If a piece of data has many business categories, it can be considered that the piece of data is redundant data, so the embodiment of the present invention can determine whether the piece of data is redundant data based on the number of business categories of each piece of data.
[0033] In a second aspect, an embodiment of the present invention provides a knowledge base construction device, the device comprising:
[0034] A first determining module is used to determine a first redundant data set and a first non-redundant data set from a first knowledge base according to the business category, wherein the first redundant data set includes a plurality of redundant data, any redundant data in the plurality of redundant data corresponds to at least two business categories, and the first non-redundant data set includes a plurality of non-redundant data, any non-redundant data in the plurality of non-redundant data corresponds to one business category;
[0035] A decomposition module, used for splitting any redundant data to obtain at least two data;
[0036] A second determining module, configured to determine a second non-redundant data set from the first redundant data set according to the service categories of two adjacent data among the at least two data;
[0037] An updating module is used to update the first non-redundant data set by using the second non-redundant data set to form a second knowledge base.
[0038] Optionally, the second determining module is specifically used for:
[0039] If the business types of the two adjacent data are both the first business category, calculating the first similarities between the two adjacent data and at least one non-redundant data in the first non-redundant data set to obtain two first similarities, wherein the type of the at least one non-redundant data is the first business category;
[0040] If the two first similarities are both greater than or equal to the first threshold, the two data are merged and updated to the second non-redundant data set.
[0041] Optionally, the second determining module is further configured to:
[0042] If at least one of the two first similarities is smaller than a first threshold, the two adjacent data are updated to the second non-redundant data set.
[0043] Optionally, the second determining module is further configured to:
[0044] If the service categories of the two adjacent data are different, the two adjacent data are updated to the second non-redundant data set.
[0045] Optionally, if the dataset is a problem set, the update module is specifically used to:
[0046] Determine a second similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, wherein the second non-redundant data set includes M non-redundant data and the first non-redundant data set includes N non-redundant data;
[0047] If the second similarity is greater than or equal to a second threshold, the i-th non-redundant data in the second non-redundant data set is used as similar data of the j-th non-redundant data in the first non-redundant data set, and updated to the similar data set of the second knowledge base;
[0048] If the second similarity is less than a second threshold, the i-th non-redundant data in the second non-redundant data set is used as standard data and updated to the standard data set of the second knowledge base.
[0049] Optionally, if the data set is an answer set, the update module is further used to:
[0050] Determine a third similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, wherein the second non-redundant data set includes M non-redundant data and the first non-redundant data set includes N non-redundant data;
[0051] If the third similarity is greater than or equal to a third threshold, excluding the i-th non-redundant data in the second non-redundant data set as similar data to the j-th non-redundant data in the first non-redundant data set;
[0052] If the third similarity is less than a third threshold, the i-th non-redundant data in the second non-redundant data set is used as standard data and updated to the standard data set of the second knowledge base.
[0053] Optionally, the first knowledge base includes multiple pieces of data, and the first determination module is specifically used to:
[0054] For any data among the multiple data, obtaining the number of business categories of the any data;
[0055] If the number is greater than or equal to a fourth threshold, any of the data is used as redundant data and updated to the first redundant data set; or,
[0056] If the number is less than a fourth threshold, any of the data is taken as non-redundant data and updated to the first non-redundant data set.
[0057] In a third aspect, an embodiment of the present invention provides a device, comprising a processor and a memory, wherein the processor is configured to implement the steps of the method described in the embodiment of the first aspect when executing a computer program stored in the memory.
[0058] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in the embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 A schematic diagram of a process for constructing a knowledge base provided by an embodiment of the present invention;
[0060] Figure 2 A schematic diagram of the structure of a device provided by an embodiment of the present invention;
[0061] Figure 3 A schematic diagram of the structure of a device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.
[0063] For ease of understanding, an application scenario of an embodiment of the present invention is first introduced. The knowledge base established by the knowledge base construction method provided in the embodiment of the present invention can be applied to a customer service robot in a banking system. The customer service robot communicates with the user based on the constructed knowledge base. For example, the customer service robot can determine the question that the user needs to query based on the user's current input information, and then search for the corresponding answer in the knowledge base based on the question, and then feed back the answer to the user. To ensure the normal operation of the customer service robot, the knowledge base usually includes a standard question set, a similar question set, and a standard answer set, so that no matter whether the user inputs a standard question or a similar question, the customer service robot can feedback the corresponding standard answer.
[0064] Since the existing knowledge base is constructed manually, when the amount of data reaches a certain scale, the manually constructed knowledge base may have redundancy problems, that is, one question may correspond to multiple different answers, or one answer may answer multiple questions. To address this problem, currently we can only rely on manual repeated review of the existing knowledge base to find out the redundant questions or answers, but this method requires a lot of manpower costs, has low review efficiency, and is difficult to ensure the accuracy of the review.
[0065] In view of this, an embodiment of the present invention provides a method for constructing a knowledge base, which can divide the knowledge base into a first redundant data set and a first non-redundant data set based on business categories. Any redundant data in the first redundant data set is split and merged to obtain a second non-redundant data set, and the first non-redundant data set is updated by the second non-redundant data set, that is, the data in the first redundant data set except the second non-redundant data set is excluded, so as to obtain a second knowledge base. Compared with the manual review of the knowledge base in the prior art, the present invention can realize automatic review, thereby improving the efficiency of the review. In addition, it can avoid the errors that may occur in manual review, thereby improving the accuracy of knowledge base construction.
[0066] The following is an introduction to the technical solution provided by the embodiment of the present invention in conjunction with the accompanying drawings. In the following description, a customer service robot of a banking system is used as an application scenario. Figure 1 , an embodiment of the present invention provides a method for constructing a knowledge base, and the process of the method is described as follows.
[0067] Step 101: The server determines a first redundant data set and a first non-redundant data set from a first knowledge base according to a service category.
[0068] The first knowledge base can be considered as an existing knowledge base based on manual construction. The first knowledge base includes multiple data. The business categories of these multiple data can be considered as business categories corresponding to the application field where the first knowledge base is located. For example, in a banking system, common business categories may include card application services, savings services, loan services, and account information modification services. The multiple data included in the first knowledge base can be divided into question data and answer data. For the sake of convenience of description, the set formed by the question data is referred to as the question set, and the set formed by the answer data is referred to as the answer set. If a piece of data corresponds to more business categories, then the data can be considered to be redundant data. There may be some redundant data in the multiple data included in the first knowledge base. In order to eliminate these redundant data, it is first necessary to distinguish between redundant data and non-redundant data.
[0069] In a possible implementation manner, the embodiment of the present invention may determine which data is redundant data and which data is non-redundant data from the first knowledge base according to the service category.
[0070] For example, for any data among multiple data in the first knowledge base, the server can obtain the number of business categories corresponding to any data. If the number is greater than or equal to a first threshold, the data can be considered to be redundant data, and a set formed by multiple redundant data is called, for example, a first redundant data set; if the number is less than the first threshold, the data can be considered to be non-redundant data, and a set formed by multiple non-redundant data is called a first non-redundant data set.
[0071] The first threshold value may be a predefined possible value, for example, the first threshold value may be set to 2. If the number of business categories corresponding to a certain data acquired by the server is greater than or equal to 2, it can be considered that the data includes different business categories, and the data is redundant data; if the number of business categories corresponding to a certain data acquired by the server is less than 2, that is, 1, it can be considered that the data includes only one business category, and the data is non-redundant data. Then any redundant data in the first redundant data set corresponds to at least two business categories, and any non-redundant data in the first non-redundant data set corresponds to one business category.
[0072] After the embodiment of the present invention determines the redundant data that may exist in the first knowledge base, the redundant data may be processed to further process the redundant data so as to retain non-redundant questions or non-redundant answers in the redundant data as much as possible.
[0073] Step 102: The server splits any redundant data to obtain at least two data.
[0074] Any redundant data in the first redundant data set corresponds to at least two business categories, and any redundant data may include multiple questions or multiple answers, and these multiple questions or multiple answers may correspond to one business category or multiple business categories, that is, there may be redundancy in these multiple questions or multiple answers. To this end, the embodiment of the present invention can split any redundant data to obtain at least two data, and then further determine the redundant data in the at least two data.
[0075] In a possible implementation, the server may split any redundant data according to a preset identifier. Since any redundant data corresponds to at least two business categories, any redundant data may be split into at least two data according to the business category, and each of the at least two data corresponds to a business category. Each of the at least two data may be considered to be non-redundant data, so the at least two data may be updated to the first non-redundant data set, thereby achieving the purpose of reducing self-redundancy.
[0076] For example, for the first redundant data in the first redundant data set, assuming that the first redundant data is question data, and the question is "how to apply for a savings card, how to modify an account password, and how to make a deposit", then the first preset identifier can be a comma, and the server splits the redundant data according to the first preset identifier to obtain three data. The three data are "how to apply for a savings card", "how to modify an account password", and "how to make a deposit", among which "how to apply for a savings card" corresponds to card application services, "how to modify an account password" corresponds to account information modification services, and "how to make a deposit" corresponds to savings services.
[0077] Step 103: The server determines a second non-redundant data set from the first redundant data set according to the service categories of two adjacent data among the at least two data.
[0078] Each of the at least two data corresponds to a business category and may be similar, so the two data may also be redundant. To this end, before updating the at least two data to the first non-redundant data set, the embodiment of the present invention may first determine the second non-redundant data set from the first redundant data set, that is, determine the non-redundant data in the at least two data. Specifically, there may be the following two situations:
[0079] In the first case, if the business categories corresponding to any two adjacent data among at least two data are different, for example, the first data and the second data are adjacent data, the first data corresponds to the first business category, and the second data corresponds to the second business category, it can be considered that the probability of the first data and the second data being semantically similar is low, then the two adjacent data can be updated as non-redundant data to the second non-redundant data set respectively.
[0080] For example, if two adjacent data are: "Do I need an ID card to apply for a savings card?" and "How to change the password of a savings card?", "Do I need an ID card to apply for a savings card?" corresponds to a card application service, and "How to change the password of a savings card?" corresponds to a modification of account information service, that is, the two adjacent data correspond to different service categories. Since card application services and account information modification services belong to different service categories, it can be considered that the probability of "Do I need an ID card to apply for a savings card?" and "How to change the password of a savings card" being semantically similar is low, so the two adjacent data can be directly updated as non-redundant data to the second non-redundant data set.
[0081] In the second case, considering that two adjacent data among the at least two data may belong to the same business category, if the similarity of the two adjacent data is relatively high, if the two adjacent data are directly updated to the second non-redundant data set, redundancy may be formed again, that is, redundancy is formed between the two data due to the high similarity. Therefore, before updating the at least two data to the second non-redundant data set, if it is determined that the business category of the two adjacent data among the at least two data is the same, the similarity of the two data to at least one non-redundant data belonging to the same business category in the first non-redundant data set can be further determined to determine whether the two data are redundant.
[0082] Specifically, if there are two adjacent data in at least two data, the business categories corresponding to them are the same, for example, both are the first business category. In the first non-redundant data set, there may also be at least one non-redundant data corresponding to the first business category. The embodiment of the present invention can respectively calculate the first similarity of the two adjacent data and at least one non-redundant data, thereby obtaining two first similarities. If both first similarities are greater than or equal to the second threshold, then it can be considered that the similarity between the two adjacent data and a certain non-redundant data belonging to the same business category in the first non-redundant data set is relatively high, and then it can be considered that the similarity between the two adjacent data is relatively high. In order to avoid redundancy, the two adjacent data can be merged to form new data, and then the new data is updated to the second non-redundant data set, thereby avoiding the second non-redundant data set from becoming redundant again. If at least one of the two first similarities is less than the first threshold, then it can be considered that there is a certain data in the two adjacent data and the similarity between at least one non-redundant problem belonging to the same business category in the first non-redundant data set is relatively low, and it can be considered that the similarity between the two adjacent data is relatively low, so that the two adjacent data can be directly updated to the second non-redundant data set as independent non-redundant problems.
[0083] For example, if two adjacent data are: "Do I need an ID card to apply for a savings card" and "Do I need to bring my ID card to apply for a savings card", the two adjacent data correspond to the same business category, that is, they both belong to card-issuing business. The first non-redundant data set includes data such as "What documents are required to apply for a savings card", that is, there is at least one non-redundant question belonging to the card-issuing business. The server can calculate the first similarity between "Do I need an ID card to apply for a savings card" and "What documents are required to apply for a savings card", and the first similarity between "Do I need to bring my ID card to apply for a savings card" and "What documents are required to apply for a savings card". If both first similarities are greater than or equal to the second threshold, for example, the second threshold is 80%, then it can be considered that the two adjacent data are highly similar, that is, "Do I need an ID card to apply for a savings card" and "Do I need to bring my ID card to apply for a savings card" are semantically similar, then the two adjacent data can be merged and then updated to the second non-redundant data set.
[0084] For another example, if two adjacent data are: "Do I need an ID card to apply for a savings card?" and "Where can I apply for a savings card?", the two adjacent data correspond to the same business category, that is, both belong to card-issuing services. The first non-redundant data set includes data such as "What documents are required to apply for a savings card", that is, there is at least one non-redundant question belonging to the card-issuing business. The server can calculate the first similarity between "Do I need an ID card to apply for a savings card?" and "What documents are required to apply for a savings card", as well as the first similarity between "Where can I apply for a savings card" and "What documents are required to apply for a savings card". If at least one of the two first similarities is less than the second threshold, for example, the first first similarity is 85%, the second first similarity is 20%, and the second threshold is 80%, then it can be considered that the first data of the two adjacent data has a higher similarity to the non-redundant question, while the second data has a lower similarity to the non-redundant question, that is, "Do I need an ID card to apply for a savings card" and "What documents do I need to bring to apply for a savings card" have similar semantics, while "Where can I apply for a savings card" and "What documents do I need to bring to apply for a savings card" have large semantic differences, then the two adjacent data can be updated as independent non-redundant questions to the second non-redundant data set respectively.
[0085] Step 104: The server updates the first non-redundant data set by using the second non-redundant data set to form a second knowledge base.
[0086] As can be seen from the above, the first non-redundant data set is a data set formed by non-redundant data obtained by classifying the first knowledge base based on business categories, the first redundant data set is a data set formed by redundant data obtained by classifying the first knowledge base based on business categories, and the second non-redundant data set is a data set formed by the first redundant data set after de-redundancy processing, such as splitting or merging. Therefore, the first non-redundant data set can be updated by the second non-redundant data set to form a second knowledge base. The second knowledge base can be considered as a knowledge base obtained by de-redundancy processing of the first knowledge base. The first knowledge base is divided into a question set and an answer set. The question set includes standard questions and similar questions, and the answer set includes standard answers. Therefore, the update process is different for different types of data sets, which are introduced below.
[0087] Example 1: If the first non-redundant data set and the second non-redundant data set are both question sets, if the first non-redundant data set includes N non-redundant data and the second non-redundant data set includes M non-redundant data, then the server can determine the second similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, and update the first non-redundant data set by the second redundant data set according to the second similarity.
[0088] The value range of i is greater than or equal to 1 and less than or equal to M, that is, i∈[1,M], and the value range of j is greater than or equal to 1 and less than or equal to N, that is, j∈[1,N]. For example, the server calculates the similarity between the first non-redundant data in the second non-redundant data set and the second non-redundant data in the first non-redundant data set. If the second similarity is greater than or equal to the third threshold, it can be considered that the first non-redundant data in the second non-redundant data set and the second non-redundant data in the first non-redundant data set are semantically close, and then the first non-redundant data in the second non-redundant data set can be used as similar data of the second non-redundant data in the first non-redundant data set, and updated to the similar data set of the second knowledge base.
[0089] For another example, the server calculates the second similarity between the first non-redundant data set in the second non-redundant data set and any non-redundant data in the first non-redundant data set, thereby obtaining multiple second similarities. If the multiple second similarities are all less than the third threshold, it can be considered that the first non-redundant data in the second non-redundant data set and any non-redundant data in the first non-redundant data set are semantically different, and the first non-redundant data in the second non-redundant data set can be used as standard data and updated to the standard data set of the second knowledge base.
[0090] For example, the first non-redundant data set includes: the first standard data "how to apply for a savings card", the second standard data "how to change the account password", and the second non-redundant data set includes: the third standard data "what documents are required to apply for a savings card", the fourth standard data "how to apply for a loan", then the server can calculate the similarity between the two standard data included in the first non-redundant data set and the two standard data included in the second non-redundant data set. If the third threshold is 80%, then if the similarity between the first standard data and the third standard data is 90%, that is, greater than the third threshold, it can be considered that the first standard data and the third standard data are semantically similar, then the third standard data can be used as similar data of the first standard data and updated to the similar data set of the second knowledge base. If the similarity between the 4th standard data and the 1st standard data is 30%, and the similarity between the 4th standard data and the 2nd standard data is 15%, both of which are less than the third threshold, then it can be considered that the 4th standard data has a large semantic gap with the 1st standard data and the 2nd standard data, then the 4th standard data can be used as the new standard data and updated to the standard data set of the second knowledge base.
[0091] In the second case, if the first non-redundant data set and the second non-redundant data set are both answer sets, if the first non-redundant data set includes N non-redundant data and the second non-redundant data set includes M non-redundant data, then the server can determine the third similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, and update the first non-redundant data set with the second non-redundant data set according to the third similarity, thereby forming a second knowledge base.
[0092] The value range of i is greater than or equal to 1 and less than or equal to M, that is, i∈[1,M], and the value range of j is greater than or equal to 1 and less than or equal to N, that is, j∈[1,N]. For example, the server calculates the third similarity between the first non-redundant data in the second non-redundant data set and the second non-redundant data in the first non-redundant data set. If the third similarity is greater than or equal to the fourth threshold, it can be considered that the first non-redundant data in the second non-redundant data set and the second non-redundant data in the first non-redundant data set are semantically close, and then the first non-redundant data in the second non-redundant data set can be regarded as similar data of the second non-redundant data in the first non-redundant data set and excluded.
[0093] For another example, the server calculates the third similarity between the first non-redundant data in the second non-redundant data set and any non-redundant data in the first non-redundant data set, thereby obtaining multiple third similarities. If the multiple third similarities are all less than the fourth threshold, it can be considered that the first non-redundant data in the second non-redundant data set and any non-redundant data in the first non-redundant data set have a large semantic difference, and the first non-redundant data in the second non-redundant data set can be used as new standard data and updated to the second knowledge base.
[0094] For example, the first non-redundant data set includes: the first standard data "You can bring your ID card to a nearby business hall to apply for a savings card", the second standard data "You can bring your ID card to a nearby business hall to change your savings card password", and the second non-redundant data set includes: the third standard data "You need to bring your ID card to apply for a savings card", the fourth standard data "You need to bring your ID card to a nearby business hall to apply for a loan", then the server can calculate the similarity between the two standard data included in the first non-redundant data set and the two standard data included in the second non-redundant data set. If the fourth threshold is 80%, then if the similarity between the first standard data and the third standard data is 85%, that is, greater than the fourth threshold, it can be considered that the first standard data and the third standard data are semantically similar. Then the third standard data can be excluded. If the similarity between the 4th standard data and the 1st standard data is 30%, and the similarity between the 4th standard data and the 2nd standard data is 25%, both of which are less than the fourth threshold, then it can be considered that the 4th standard data has a large semantic gap with the 1st standard data and the 2nd standard data, then the 4th standard data can be used as the new standard data and updated to the standard data set of the second knowledge base.
[0095] The server updates the first non-redundant data set through the second non-redundant data set, thereby forming a second knowledge base. The second knowledge base can be considered as a knowledge base obtained by de-redundancy processing of the first knowledge base. Since the second non-redundant data set is determined from the first redundant data set, the data of the first redundant data set other than the second non-redundant data set can be excluded, thereby avoiding redundancy as much as possible. Compared with the manual review in the prior art, the present invention can realize automatic review, thereby improving the efficiency of the review. In addition, it can avoid errors that may occur in manual review, thereby improving the accuracy of knowledge base construction.
[0096] The above describes the method for constructing a knowledge base provided by an embodiment of the present invention. The following describes the device provided by an embodiment of the present invention in conjunction with the accompanying drawings.
[0097] See also Figure 2Based on the same inventive concept, an embodiment of the present invention provides a knowledge base construction device, which includes a first determination module 201, a decomposition module 202, a second determination module 203 and an update module 204. Wherein:
[0098] A first determination module 201 is used to determine a first redundant data set and a first non-redundant data set from a first knowledge base according to a business category, wherein the first redundant data set includes a plurality of redundant data, any redundant data in the plurality of redundant data corresponds to at least two business categories, and the first non-redundant data set includes a plurality of non-redundant data, any non-redundant data in the plurality of non-redundant data corresponds to one business category;
[0099] A decomposition module 202 is used to split any redundant data to obtain at least two data;
[0100] A second determination module 203, configured to determine a second non-redundant data set from the first redundant data set according to the service categories of two adjacent data among the at least two data;
[0101] The updating module 204 is configured to update the first non-redundant data set by using the second non-redundant data set to form a second knowledge base.
[0102] Optionally, the second determining module 203 is specifically configured to:
[0103] If the business types of the two adjacent data are both the first business category, calculating the first similarities between the two adjacent data and at least one non-redundant data in the first non-redundant data set to obtain two first similarities, wherein the type of at least one non-redundant data is the first business category;
[0104] If the two first similarities are both greater than or equal to the first threshold, the two data are merged and updated to the second non-redundant data set.
[0105] Optionally, the second determining module 203 is further configured to:
[0106] If at least one of the two first similarities is smaller than the first threshold, the two adjacent data are updated to the second non-redundant data set.
[0107] Optionally, the second determining module 203 is further configured to:
[0108] If the service categories of the two adjacent data are different, the two adjacent data are updated to the second non-redundant data set.
[0109] Optionally, if the data set is a question set, the updating module 204 is specifically used for:
[0110] Determine a second similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, wherein the second non-redundant data set includes M non-redundant data and the first non-redundant data set includes N non-redundant data;
[0111] If the second similarity is greater than or equal to the second threshold, the i-th non-redundant data in the second non-redundant data set is used as similar data of the j-th non-redundant data in the first non-redundant data set, and updated to the similar data set of the second knowledge base;
[0112] If the second similarity is less than the second threshold, the i-th non-redundant data in the second non-redundant data set is used as standard data and updated to the standard data set of the second knowledge base.
[0113] Optionally, if the data set is an answer set, the updating module 204 is further configured to:
[0114] Determine a third similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, wherein the second non-redundant data set includes M non-redundant data and the first non-redundant data set includes N non-redundant data;
[0115] If the third similarity is greater than or equal to the third threshold, the i-th non-redundant data in the second non-redundant data set is excluded as similar data to the j-th non-redundant data in the first non-redundant data set;
[0116] If the third similarity is less than the third threshold, the i-th non-redundant data in the second non-redundant data set is used as standard data and updated to the standard data set of the second knowledge base.
[0117] Optionally, the first knowledge base includes multiple pieces of data, and the first determination module 201 is specifically used to:
[0118] For any data among the multiple data, obtain the number of business categories of any data;
[0119] If the number is greater than or equal to the fourth threshold, any data is used as redundant data and updated to the first redundant data set; or,
[0120] If the number is less than the fourth threshold, any data is taken as non-redundant data and updated to the first non-redundant data set.
[0121] See also Figure 3 Based on the same inventive concept, an embodiment of the present invention provides a knowledge base construction device, the knowledge base construction device includes at least one processor 301, the processor 301 is used to execute a computer program stored in a memory, and implement the embodiment of the present invention as provided in Figure 1 The steps of the knowledge base construction method are shown.
[0122] Optionally, the processor 301 may specifically be a central processing unit, a specific ASIC, or one or more integrated circuits for controlling program execution.
[0123] Optionally, the knowledge base construction device may further include a memory 302 connected to at least one processor 301, and the memory 302 may include ROM, RAM, and disk storage. The memory 302 is used to store data required by the processor 301 when it is running, that is, it stores instructions that can be executed by at least one processor 301. At least one processor 301 executes the instructions stored in the memory 302 to execute the following steps: Figure 1 The method shown. The number of the memory 302 is one or more. The memory 302 is Figure 3 However, it should be noted that the memory 302 is not a mandatory functional module, so Figure 3 Shown by dotted lines.
[0124] The entity devices corresponding to the first determination module 201, the decomposition module 202, the second determination module 203 and the update module 204 can all be the aforementioned processor 301. The knowledge base construction device can be used to execute Figure 1 Therefore, for the functions that can be realized by each functional module in the device, please refer to Figure 1 The corresponding description in the illustrated embodiment will not be repeated here.
[0125] The embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer executes the following Figure 1 The method described.
[0126] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
Claims
1. A method for constructing a knowledge base, characterized in that: The method comprises: Determine a first redundant data set and a first non-redundant data set from a first knowledge base according to the business category, wherein the first redundant data set includes a plurality of redundant data, any redundant data in the plurality of redundant data corresponds to at least two business categories, and the first non-redundant data set includes a plurality of non-redundant data, any non-redundant data in the plurality of non-redundant data corresponds to one business category; the first knowledge base includes: question data and answer data, and the first knowledge base is applied to a customer service robot to enable the customer service robot to communicate with a user; Splitting any redundant data to obtain at least two data; If the business categories of two adjacent data among the at least two data are both the first business category, respectively calculating the first similarities between the two adjacent data and at least one non-redundant data in the first non-redundant data set to obtain two first similarities, wherein the category of the at least one non-redundant data is the first business category; If the two first similarities are both greater than or equal to the first threshold, the two adjacent data are merged and updated to a second non-redundant data set; The first non-redundant data set is updated by using the second non-redundant data set to form a second knowledge base.
2. The method according to claim 1, characterized in that Also includes: If at least one of the two first similarities is smaller than a first threshold, the two adjacent data are updated to the second non-redundant data set.
3. The method according to claim 1, characterized in that Also includes: If the service categories of the two adjacent data are different, the two adjacent data are updated to the second non-redundant data set.
4. The method according to any one of claims 1 to 3, characterized in that: If the data set is a question set, updating the first non-redundant data set by using the second non-redundant data set to form a second knowledge base includes: Determine a second similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, wherein the second non-redundant data set includes M non-redundant data and the first non-redundant data set includes N non-redundant data; If the second similarity is greater than or equal to a second threshold, the i-th non-redundant data in the second non-redundant data set is used as similar data of the j-th non-redundant data in the first non-redundant data set, and updated to the similar data set of the second knowledge base; If the second similarity is less than a second threshold, the i-th non-redundant data in the second non-redundant data set is used as standard data and updated to the standard data set of the second knowledge base.
5. The method according to any one of claims 1 to 3, characterized in that: If the data set is an answer set, the first non-redundant data set is updated using the second non-redundant data set to form a second knowledge base, including: Determine a third similarity between the i-th non-redundant data in the second non-redundant data set and the j-th non-redundant data in the first non-redundant data set, wherein the second non-redundant data set includes M non-redundant data and the first non-redundant data set includes N non-redundant data; If the third similarity is greater than or equal to a third threshold, excluding the i-th non-redundant data in the second non-redundant data set as similar data to the j-th non-redundant data in the first non-redundant data set; If the third similarity is less than a third threshold, the i-th non-redundant data in the second non-redundant data set is used as standard data and updated to the standard data set of the second knowledge base.
6. The method according to claim 1, characterized in that The first knowledge base includes a plurality of data, and determining a first redundant data set and a first non-redundant data set from the first knowledge base according to a plurality of business categories includes: For any data among the multiple data, obtaining the number of business categories of the any data; If the number is greater than or equal to a fourth threshold, any of the data is used as redundant data and updated to the first redundant data set; or, If the number is less than a fourth threshold, any of the data is taken as non-redundant data and updated to the first non-redundant data set.
7. A knowledge base construction device, characterized in that: The device comprises: A first determination module is used to determine a first redundant data set and a first non-redundant data set from a first knowledge base according to the business category, wherein the first redundant data set includes a plurality of redundant data, any redundant data in the plurality of redundant data corresponds to at least two business categories, and the first non-redundant data set includes a plurality of non-redundant data, any non-redundant data in the plurality of non-redundant data corresponds to one business category; the first knowledge base includes: question data and answer data, and the first knowledge base is applied to a customer service robot to enable the customer service robot to communicate with a user; A decomposition module, used for splitting any redundant data to obtain at least two data; A second determination module is configured to respectively calculate first similarities between the two adjacent data and at least one non-redundant data in the first non-redundant data set if the business categories of the two adjacent data in the at least two data are both the first business category, to obtain two first similarities, wherein the category of the at least one non-redundant data is the first business category; If the two first similarities are both greater than or equal to the first threshold, the two adjacent data are merged and updated to a second non-redundant data set; An updating module is used to update the first non-redundant data set by using the second non-redundant data set to form a second knowledge base.
8. A knowledge base construction device, characterized in that: The device comprises at least one processor and a memory connected to the at least one processor, and the at least one processor is configured to implement the steps of the method according to any one of claims 1 to 6 when executing a computer program stored in the memory.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Module repository, service development method and system based on module repository
CN103135972A
Knowledge base question update method, custom service robot and readable storage medium
CN107562789A
A problem warehousing method and device
CN109918498A
Problem duplicate removal method and device, electronic equipment and computer readable storage medium
CN110134777A
Data processing method and device executed by computing device, medium and computing device
CN110442803A
