Knowledge base construction method and related device
By generating generalized questions and clustering, defining representative questions and high-quality answers, the problem of bloated and low coverage of the Q&A knowledge base is solved, and an efficient knowledge base construction is achieved.
Patent Information
- Application Number
- CN202410157435.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-02
- Publication Date
- 2025-08-08
AI Technical Summary
The existing Q&A knowledge base is huge and bloated, lacks representative problems, has low coverage, and is difficult to quickly find matching problems.
Generate generalized questions and cluster them through language models, determine representative questions and high-quality answers, and build a target question-and-answer knowledge base.
Improve the coverage of problem categories, reduce the amount of data storage, and achieve fast and accurate matching of user problems.
Smart Images

Figure CN120448552A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a knowledge base construction method and related devices. Background Art
[0002] Intelligent conversational technology refers to technologies that enable machines to communicate with humans. Specifically, algorithms can be used to enable machines to understand user questions and provide corresponding answers. Currently, intelligent conversational technology relies on a question-and-answer knowledge base that stores corresponding questions and answers. Specifically, the machine can search the Q&A knowledge base for questions that match the user's question and then provide the user with the corresponding answer from the Q&A knowledge base.
[0003] In related technologies, the above-mentioned question-and-answer knowledge base is usually constructed manually, that is, manually setting questions and answers with corresponding relationships based on one's own experience and storing them in the question-and-answer knowledge base. However, the question-and-answer knowledge base constructed by this method is often large and bloated, including a large number of questions with similar content and pointing to the same answer, and lacks representative questions; accordingly, it is difficult to quickly find questions that match the questions raised by users based on this question-and-answer knowledge base. In addition, due to the limited human knowledge, the questions in the question-and-answer knowledge base constructed by this method are often insufficient and the coverage is not high, which easily leads to the situation where no matching questions can be found in the question-and-answer knowledge base. Summary of the Invention
[0004] The embodiments of the present application provide a knowledge base construction method and related devices, which can improve the coverage of the knowledge base, reduce the amount of data stored in the knowledge base, and facilitate rapid and accurate finding of questions in the knowledge base that match questions raised by users in actual business.
[0005] In a first aspect, the present application provides a method for constructing a knowledge base, the method comprising:
[0006] Obtain multiple reference questions and multiple reference answers stored in a reference question and answer knowledge base;
[0007] classifying the plurality of reference questions into a plurality of question categories;
[0008] For each of the question categories, generating a generalized question belonging to the question category based on the reference question belonging to the question category by using a language model;
[0009] For each of the problem categories, clustering is performed based on the reference problems and generalized problems belonging to the problem category, and the problem corresponding to the cluster center is determined as the representative problem of the problem category;
[0010] Determining a high-quality answer corresponding to each of the representative questions according to the representative questions of each of the multiple question categories and the multiple reference answers;
[0011] Based on each of the representative questions and the corresponding high-quality answers, a target question-answering knowledge base is constructed.
[0012] A second aspect of the present application provides a knowledge base construction device, the device comprising:
[0013] An acquisition module is used to acquire multiple reference questions and multiple reference answers stored in a reference question and answer knowledge base;
[0014] A question category classification module, configured to classify the plurality of reference questions into a plurality of question categories;
[0015] a question generalization module, configured to generate, for each question category, a generalized question belonging to the question category based on the reference questions belonging to the question category by using a language model;
[0016] a question clustering module, configured to perform clustering processing on each of the question categories based on the reference questions and generalized questions belonging to the question category, and determine the question corresponding to the cluster center as the representative question of the question category;
[0017] An answer determination module, configured to determine a high-quality answer corresponding to each of the representative questions according to the representative questions of the plurality of question categories and the plurality of reference answers;
[0018] A construction module is used to construct a target question-answering knowledge base based on each of the representative questions and the corresponding high-quality answers.
[0019] Optionally, the problem category classification module is specifically used to:
[0020] Performing feature vector conversion processing on each of the reference questions to obtain a text feature vector corresponding to each of the reference questions;
[0021] Clustering is performed based on the text feature vectors corresponding to each of the multiple reference questions to obtain multiple first clusters; the multiple first clusters respectively correspond to different question categories, and the reference questions corresponding to the text feature vectors included in the first clusters belong to the question category corresponding to the first cluster.
[0022] Optionally, the device further includes a data preprocessing module, configured to:
[0023] The multiple reference questions are preprocessed; the preprocessing includes at least one of the following operations: a deduplication operation for removing reference questions with repeated text or repeated semantics from the multiple reference questions, and an abnormal data elimination operation for removing abnormal questions from the multiple reference questions.
[0024] Optionally, the language model is obtained by fine-tuning a pre-trained language model based on text data of the target business domain; and the problem generalization module is specifically used to:
[0025] For each of the reference questions belonging to the question category, the generalized question related to the reference question and the target business field is generated by the language model according to the text feature vector corresponding to the reference question.
[0026] Optionally, the question clustering module is specifically used to:
[0027] Performing clustering processing based on the text feature vectors corresponding to each of the reference questions and each of the generalized questions belonging to the question category to obtain at least one second cluster;
[0028] For each of the second clusters, determine the cluster center of the second cluster; determine a text feature vector in the second cluster whose distance from the cluster center meets a preset distance condition as a representative feature vector; and determine the question corresponding to the representative feature vector as the representative question.
[0029] Optionally, the answer determination module is specifically configured to:
[0030] Classifying the plurality of reference answers into a plurality of answer categories;
[0031] For each of the answer categories, generating, by the language model, a generalized answer belonging to the answer category and related to the representative question based on the reference answers belonging to the answer category and the representative question;
[0032] For each representative question, a classification model is used to determine whether the candidate answer is a high-quality answer corresponding to the representative question based on the reference features corresponding to the candidate answer; the candidate answer is the reference answer or the generalized answer, and the reference features corresponding to the candidate answer are at least used to characterize the correlation between the candidate answer and the representative question.
[0033] Optionally, the device further includes a model training module, configured to:
[0034] Extracting multiple training answers from each of the reference answers and each of the generalized answers, and determining a label corresponding to each of the training answers; the label is used to characterize the quality of the training answer relative to the corresponding training question;
[0035] Determining, by the classification model to be trained, a classification result corresponding to the training answer based on reference features corresponding to the training answer; the reference features corresponding to the training answer are at least used to characterize the correlation between the training answer and the corresponding training question, and the classification result is used to characterize whether the training answer is a high-quality answer relative to the corresponding training question;
[0036] The classification model is trained according to the classification results and the labels corresponding to the respective training answers.
[0037] Optionally, the reference features corresponding to the candidate answers further include evaluation features corresponding to the candidate answers, and the evaluation features include at least one of a user's emotional evaluation feature of the candidate answers and a user's textual evaluation feature of the candidate answers.
[0038] Optionally, the answer determination module is specifically configured to:
[0039] Performing feature vector conversion processing on each of the reference answers to obtain a text feature vector corresponding to each of the reference answers;
[0040] Clustering is performed based on the text feature vectors corresponding to each of the multiple reference answers to obtain multiple third clusters; the multiple third clusters respectively correspond to different answer categories, and the reference answers corresponding to the text feature vectors included in the third clusters belong to the answer category corresponding to the third cluster.
[0041] Optionally, the device further includes a data preprocessing module, configured to:
[0042] The multiple reference answers are preprocessed; the preprocessing includes at least one of the following operations: a deduplication operation for removing reference answers with repeated text or repeated semantics from the multiple reference answers, and an abnormal data elimination operation for removing abnormal answers from the multiple reference answers.
[0043] Optionally, the language model is obtained by fine-tuning a pre-trained language model based on text data of the target business domain; and the answer determination module is specifically configured to:
[0044] For each of the reference answers belonging to the answer category, the language model is used to generate the generalized answer related to the reference answer and the representative question and related to the target business field based on the text feature vector corresponding to the reference answer and the text feature vector corresponding to the representative question.
[0045] A third aspect of the present application provides a computer device, the device comprising a processor and a memory:
[0046] The memory is used to store computer programs;
[0047] The processor is configured to execute the steps of the method described in the first aspect according to the computer program.
[0048] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the steps of the method described in the first aspect.
[0049] A fifth aspect of the present application provides a computer program product or computer program, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the method described in the first aspect above.
[0050] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0051] An embodiment of the present application provides a method for constructing a knowledge base. First, a plurality of reference questions and a plurality of reference answers are obtained from a reference question and answer knowledge base, and the plurality of reference questions are divided into a plurality of question categories. Secondly, for each question category, a generalized question belonging to the question category is generated based on the reference questions belonging to the question category through a language model; and clustering is performed based on the reference questions and generalized questions belonging to the question category, and the question corresponding to the cluster center is determined as the representative question of the question category. Then, based on the representative questions and the plurality of reference answers of the plurality of question categories, the high-quality answer corresponding to each representative question is determined. Finally, a target question and answer knowledge base is constructed based on each representative question and its corresponding high-quality answer. It can be seen that by using the language model to generate generalized questions based on reference questions in each question category, the number of questions in each question category is expanded, the questions in each question category are richer, and the coverage of questions in the question category is improved; accordingly, the representative questions determined by clustering based on reference questions and generalized questions also have a high coverage, and since the representative question is the question corresponding to the cluster center, the representative question can better represent other questions in the question category and can better reflect the semantic information of each question in the question category, that is, the representative question has a high quality; and in the constructed target question and answer knowledge base, only the representative questions of each question category and the high-quality answers corresponding to the representative questions are saved, which reduces the data storage volume in the target question and answer knowledge base and avoids the problem of bloated knowledge base caused by storing a large amount of similar content; accordingly, it is conducive to quickly and accurately finding questions in the target question and answer knowledge base that match the questions raised by users in actual business. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A schematic diagram of an application scenario of a knowledge base construction method provided in an embodiment of the present application;
[0053] Figure 2 A flow chart of a method for constructing a knowledge base provided in an embodiment of the present application;
[0054] Figure 3 A schematic diagram of a reference question-and-answer knowledge base provided in an embodiment of the present application;
[0055] Figure 4 A flowchart of a representative problem determination method provided for an embodiment of the present application scenario;
[0056] Figure 5 A flowchart of a method for determining a high-quality answer provided in an embodiment of the present application scenario;
[0057] Figure 6 A flowchart for constructing a target question-answering knowledge base provided in an embodiment of the present application scenario;
[0058] Figure 7 A schematic diagram of the structure of a knowledge base construction device provided in an embodiment of the present application;
[0059] Figure 8 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0060] Figure 9 A schematic diagram of the structure of the server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0062] The terms "first," "second," "third," "fourth," etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential sequence. It should be understood that the numbers used in this way are interchangeable where appropriate so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or apparatus.
[0063] Intelligent conversation technology relies on a question-and-answer knowledge base that stores corresponding questions and answers. When a question is received from a user, the corresponding question is searched in the question-and-answer knowledge base, and based on the corresponding relationship between the question and the answer, the corresponding answer is matched to the user's question, thus achieving intelligent conversation. Question-and-answer knowledge bases are usually constructed manually, that is, humans set corresponding questions and answers based on their own experience and store them in the question-and-answer knowledge base. However, manually constructed question-and-answer knowledge bases are often large and bloated, including a large number of questions with similar content and pointing to the same answer, and lack representative questions. Accordingly, it is difficult to quickly find questions that match the questions posed by users based on such question-and-answer knowledge bases. In addition, due to the limited human knowledge, the questions in the manually constructed question-and-answer knowledge base are often insufficient and have low coverage, making it easy for no matching questions to be found in the question-and-answer knowledge base.
[0064] To this end, an embodiment of the present application provides a knowledge base construction method. First, a plurality of reference questions and a plurality of reference answers are obtained from a reference question and answer knowledge base, and the plurality of reference questions are divided into a plurality of question categories. Secondly, for each question category, a generalized question belonging to the question category is generated based on the reference questions belonging to the question category through a language model; and clustering is performed based on the reference questions and generalized questions belonging to the question category, and the question corresponding to the cluster center is determined as the representative question of the question category. Then, based on the representative questions and the plurality of reference answers of the plurality of question categories, the high-quality answers corresponding to the respective representative questions are determined. Finally, a target question and answer knowledge base is constructed based on the respective representative questions and their corresponding high-quality answers.
[0065] It can be seen that by using the language model to generate generalized questions based on reference questions in each question category, the number of questions in each question category is expanded, the questions in each question category are richer, and the coverage of questions in the question category is improved; accordingly, the representative questions determined by clustering based on reference questions and generalized questions also have a high coverage, and since the representative question is the question corresponding to the cluster center, the representative question can better represent other questions in the question category and can better reflect the semantic information of each question in the question category, that is, the representative question has a high quality; and in the constructed target question and answer knowledge base, only the representative questions of each question category and the high-quality answers corresponding to the representative questions are saved, which reduces the data storage volume in the target question and answer knowledge base and avoids the problem of bloated knowledge base caused by storing a large amount of similar content; accordingly, it is conducive to quickly and accurately finding questions in the target question and answer knowledge base that match the questions raised by users in actual business.
[0066] It is understandable that the embodiments of the present application relate to natural language processing (NLP) technology and machine learning (ML) technology based on artificial intelligence (AI). Among them, artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0067] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, pre-trained models, operating / interaction systems, and mechatronics. Pre-trained models, also known as large models or basic models, can be fine-tuned and widely applied to downstream tasks across various AI disciplines. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0068] Natural language processing (NLP) is a key area of research in computer science and artificial intelligence. It studies theories and methods that enable effective communication between humans and computers using natural language. Natural language processing involves natural language, the language we use daily, and is closely related to linguistics. It also involves computer science and mathematics. Pre-trained models, a key technology for model training in artificial intelligence, are derived from large language models (LLMs) in the field of natural language processing (NLP). After fine-tuning, large language models can be widely applied to downstream tasks. Natural language processing technologies typically include text processing, semantic understanding, machine translation, robotic question-answering, knowledge graphs, and other technologies.
[0069] Machine learning is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning. Pretrained models are the latest development in deep learning, integrating these techniques.
[0070] A knowledge base construction method provided in an embodiment of the present application can be implemented by a computer device, which can be a terminal device or a server, wherein the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Terminal devices include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, car terminals, etc. The terminal device and the server can be connected directly or indirectly via wired or wireless communication, which is not limited in this application.
[0071] It should be noted that the information, data, and signals involved in the embodiments of this application are authorized by the relevant objects or fully authorized by all parties, and the collection, use, and processing of relevant data comply with the relevant laws, regulations, and standards of relevant countries and regions.
[0072] In order to facilitate understanding of the knowledge base construction method provided in the embodiment of the present application, the application scenario of the knowledge base construction method is exemplarily introduced below, taking the execution subject of the knowledge base construction method as a terminal device as an example.
[0073] See also Figure 1 , Figure 1 A schematic diagram of an application scenario of a knowledge base construction method provided in an embodiment of the present application. Figure 1 In the scenario shown, the terminal device 100 is taken as an example of a computer device for executing the aforementioned knowledge base construction method.
[0074] When constructing the target Q&A knowledge base, the terminal device 100 first obtains a plurality of reference questions and a plurality of reference answers from a reference Q&A knowledge base. The reference Q&A knowledge base stores a plurality of reference questions, a plurality of reference answers, and the corresponding relationships between the reference questions and the reference answers. The reference Q&A knowledge base may be, for example, a manually constructed Q&A knowledge base, including manually set reference questions and reference answers with corresponding relationships.
[0075] For reference questions, the obtained multiple reference questions are clustered and divided into multiple question categories to obtain multiple question categories corresponding to these reference questions. Generally speaking, the number of question categories is much smaller than the number of reference questions.
[0076] For each question category, the language model is used to generalize the reference questions within the question category and generate generalized questions belonging to the question category, thus forming a question category that includes both reference questions and generalized questions. This expands the number of questions within the question category, making the questions under each question category richer and improving the coverage of questions in the question category.
[0077] Then, in each question category, clustering is performed based on reference questions and generalized questions to determine the cluster center in the question category, and the reference questions and / or generalized questions corresponding to the cluster center are determined as the representative questions of the question category. Since the questions based on which the clustering is performed include both reference questions and generalized questions, the generalized questions are obtained by generalizing the reference questions using a language model and usually have a high coverage. Accordingly, the representative questions obtained by clustering the reference questions and generalized questions under the same question category also have a high coverage. And since the representative question is the question corresponding to the cluster center, the representative question can better represent other questions under the question category and can better reflect the semantic information of each question under the question category, that is, the representative question has a high quality.
[0078] After identifying the representative questions for each question category, high-quality answers are then determined for the representative questions of each question category based on multiple reference answers obtained from the reference question and answer knowledge base, and the corresponding relationship between representative questions and high-quality answers is determined. Finally, a target question and answer knowledge base is constructed based on each representative question and its corresponding high-quality answer. This constructed target question and answer knowledge base only stores the representative questions of each question category and the corresponding high-quality answers. This reduces the data storage volume in the target question and answer knowledge base and avoids the problem of knowledge base bloat caused by storing a large amount of similar content. Accordingly, it facilitates the rapid and accurate identification of questions in the target question and answer knowledge base that match the questions raised by users in actual business operations.
[0079] It should be understood that Figure 1 The application scenarios shown are only examples. In actual applications, the knowledge base construction method provided in the embodiments of the present application can also be applied to other scenarios. No limitation is made to the application scenarios of the knowledge base construction method provided in the embodiments of the present application.
[0080] In combination with the above scenario introduction, the following will introduce a knowledge base construction method in the embodiment of this application. Figure 2 , Figure 2 A flow chart of a method for constructing a knowledge base provided in an embodiment of the present application, the method specifically includes the following steps:
[0081] Step 201: Acquire multiple reference questions and multiple reference answers stored in a reference question and answer knowledge base.
[0082] When constructing a target question and answer knowledge base, first obtain multiple reference questions and multiple reference answers stored in the reference question and answer knowledge base from the reference question and answer knowledge base, where the reference question and answer knowledge base is a currently existing question-answer set that stores the correspondence between questions and answers. In the embodiment of the present application, the questions stored in the reference question and answer knowledge base are referred to as reference questions, and the answers stored in the reference question and answer knowledge base are referred to as reference answers. There is a correspondence between the reference questions and reference answers obtained from the reference question and answer knowledge base.
[0083] In one or more embodiments, the reference question and answer knowledge base can be a knowledge base constructed manually in advance, or it can be a knowledge base constructed by the knowledge base construction method provided by the embodiments of the present application; when the reference question and answer knowledge base is a knowledge base constructed by the knowledge base construction method provided by the embodiments of the present application, the reference question and answer knowledge base can be updated again by the knowledge base construction method provided by the embodiments of the present application.
[0084] See also Figure 3 , Figure 3 A schematic diagram of the reference question-and-answer knowledge base provided in an embodiment of the present application. Figure 3 The reference question and answer knowledge base shown is a Frequently Asked Questions (FAQ) knowledge base corresponding to a certain product. In this reference question and answer knowledge base, one-to-one correspondences between questions and answers are stored. When there are a large number of questions, each question can also be classified for easy searching.
[0085] Step 202: Divide the plurality of reference questions into a plurality of question categories.
[0086] The terminal device may cluster the obtained multiple reference questions using a clustering algorithm and divide the multiple reference questions into multiple question categories. Specifically, in an embodiment of the present application, an algorithm such as K-Nearest Neighbor (KNN) or K-Means Clustering Algorithm (K-Means) may be used to cluster the reference questions. Among the multiple question categories divided from the multiple reference questions, one question category includes at least one reference question. Generally speaking, the number of question categories should be much smaller than the number of reference questions.
[0087] In one or more embodiments, when dividing multiple reference questions, multiple question categories may be pre-set, and each reference question may be classified into a corresponding question category based on the information expressed. Specifically, a classification model such as a decision tree or random forest may be used to classify the reference questions according to the pre-set question categories, thereby determining the question category to which each reference question belongs.
[0088] In a possible implementation, dividing multiple reference questions into multiple question categories may specifically include the following steps:
[0089] Step 11: Perform feature vector conversion on each reference question to obtain the text feature vector corresponding to each reference question.
[0090] After obtaining multiple reference questions from the reference question and answer knowledge base, feature vector conversion is performed on each reference question, word segmentation is performed on the question text corresponding to each reference question, and delimiters are used to separate the words obtained by the word segmentation operation. For example, spaces, punctuation marks, etc. are used as delimiters to separate the words obtained by word segmentation in the question text.
[0091] Then, the word vector corresponding to each word in the reference question is determined by a language model that can generate word vectors, such as the word-vector conversion model Word2Vec; and then, based on the word vectors corresponding to each word in the reference question, the text feature vector corresponding to the reference question is determined. For example, the word vectors corresponding to each word in the reference question can be fused (such as pooling) to determine the text feature vector of the reference question. Of course, in actual applications, the text feature vector corresponding to the reference question can also be determined by other means, for example, by using a text feature conversion model (such as a Bert model, a Transformer model, etc.) to directly determine the corresponding text feature vector based on the reference question. The embodiment of the present application does not impose any restrictions on this.
[0092] Step 22: Perform clustering processing based on the text feature vectors corresponding to the multiple reference questions to obtain multiple first clusters.
[0093] Clustering is the process of dividing multiple objects into clusters of similar objects. Clustering allows similar objects to be grouped into the same cluster, with each cluster corresponding to a specific object category. Objects within the same cluster are similar to each other. In this embodiment of the present application, the multiple first clusters correspond to different question categories, and the reference questions corresponding to the text feature vectors included in the first clusters belong to the question category corresponding to the first cluster.
[0094] After clustering the text feature vectors corresponding to the reference questions, first clusters corresponding to each text feature vector are obtained; based on the correspondence between the text feature vectors and the reference questions, the first cluster corresponding to each reference question is determined. In this embodiment of the present application, a first cluster corresponds to a question category, and reference questions corresponding to the same first cluster belong to the same question category, and the question category corresponds to the first cluster; reference questions corresponding to different first clusters belong to different question categories.
[0095] After constructing the text feature vector for the text in the reference question, when performing subsequent text feature analysis and other operations on the text in each reference question, calculation and analysis can be performed directly based on the text feature vector corresponding to each reference question, thereby improving the processing and analysis efficiency of the reference questions.
[0096] In a possible implementation, before classifying the multiple reference questions into multiple question categories, the following steps may also be included:
[0097] Preprocessing is performed on multiple reference questions; the preprocessing includes at least one of the following operations: a deduplication operation for removing reference questions with repeated text or repeated semantics from the multiple reference questions, and an abnormal data elimination operation for removing abnormal questions from the multiple reference questions.
[0098] After obtaining multiple reference questions from the reference question-and-answer knowledge base, text and semantic analysis are performed on the multiple reference questions to identify reference questions that have textual or semantic duplication with other reference questions, and these reference questions are processed through a deduplication operation. In an embodiment of the present application, the deduplication operation is an operation of retaining one reference question from multiple reference questions that have textual or semantic duplication and deleting the other reference questions.
[0099] Specifically, at the text level, a text analysis is performed on multiple reference questions to determine the text similarity between each reference question. If the text similarity between two or more reference questions is greater than a certain text similarity threshold, the text between the two or more reference questions is determined to be repeated, one of the reference questions is randomly retained, and the other reference questions with repeated text are deleted, thereby achieving deduplication of the reference questions with repeated text. At the semantic level, a semantic analysis is performed on multiple reference questions to determine the semantic similarity between the multiple reference questions. If the semantic similarity between two or more reference questions is greater than a certain semantic similarity threshold, the semantics expressed by the two or more reference questions are determined to be repeated, one of the reference questions is randomly retained, and the other reference questions with repeated semantics are deleted, thereby achieving deduplication of the reference questions with repeated semantics.
[0100] In the embodiments of the present application, abnormal questions are reference questions that contain textual errors and / or semantic errors. For example, abnormal questions may contain textual errors such as typos or repeated fields, or semantic errors such as grammatical errors or incoherent sentences. Of course, abnormal questions may also contain both textual errors and semantic errors. The abnormal data removal operation is an operation to delete abnormal questions from multiple reference questions.
[0101] Through the preprocessing operation provided in the embodiment of the present application, abnormal questions and reference questions with text duplication or semantic duplication can be deleted before clustering multiple reference questions, thereby reducing the number of reference questions that need to be clustered, reducing the amount of calculation in the clustering process, and improving the efficiency of clustering processing.
[0102] Step 203: For each question category, generate a generalized question belonging to the question category based on the reference questions belonging to the question category through the language model.
[0103] In an embodiment of the present application, a language model is a neural network model that can perform semantic analysis on an input text and generate other texts related to the input text, such as a bidirectional encoder representation (Bidirectional Encoder Representation from Transformers, BERT) language model based on a converter, a generative pre-trained transform (Chat Generative Pre-trained Transformer, ChatGPT) model, etc., and the embodiment of the present application does not impose any restrictions on this. Generalization is the process of using a language model to generate new questions belonging to the problem category and related to other reference questions under the problem category based on existing reference questions under the problem category, that is, the process of generating new samples belonging to the problem category by learning old samples under a problem category. The new questions generated under the problem category by generalization are generalized problems under the problem category.
[0104] Through generalization, the number of questions under each question category can be expanded, from a question set that only includes reference questions to a question set that includes both reference questions and generalized questions, thereby improving the coverage of questions under the question category. By increasing the number of questions under the question category, the comprehensiveness of the knowledge covered by the question category is improved.
[0105] In one possible implementation, the language model is obtained by fine-tuning a pre-trained language model based on text data from the target business domain. In this case, step 203 can be implemented as follows:
[0106] For each reference question belonging to the question category, a generalized question related to the reference question and the target business field is generated through the language model based on the text feature vector corresponding to the reference question.
[0107] In one or more embodiments, a method for generating generalization questions is described. The language model used to generate the generalization question is a domain-specific language model obtained by fine-tuning a pre-trained language model based on text data from the target business domain. The pre-trained language model can be a model such as BERT or ChatGPT mentioned above.
[0108] Fine-tuning is the process of further training the pre-trained language model using a specific data set to adapt the model to a specific task or field. In the embodiment of the present application, the data set used to fine-tune the pre-trained language model is the text data of the target business field. The target business field is the specific field that the language model in the embodiment of the present application needs to adapt to. The text data in the target business field includes but is not limited to the business processes, business specifications and other related knowledge in the specific field. After fine-tuning the pre-trained language model using the text data of the target business field, the language model used in the embodiment of the present application is obtained; when generalizing the text feature vector corresponding to the reference question through the language model, it is possible to combine the reference question and the relevant knowledge of the target business field to perform word embedding (Embedding) to obtain the question text corresponding to the generalized question. At the same time, the question text corresponding to the generalized question can also be converted into a feature vector, that is, the text feature vector corresponding to the generalized question, using the Embedding model.
[0109] For example, when the language model is applied to the medical field, that is, the target business field is the medical field, the text data in the medical field, such as diagnostic processes, diagnostic rules, disease characteristics and other related knowledge, is used to fine-tune the pre-trained language model to obtain the language model used in the embodiment of the present application. When the language model outputs text information, it will combine the relevant knowledge in the medical field and output text information related to the medical field. When the language model generalizes based on the text feature vector corresponding to the reference question, it will not only be based on the language features in the reference question, but also combine the knowledge in the medical field to generate a generalized question that is related to the reference question, related to the medical field, and belongs to the question category corresponding to the reference question.
[0110] Through the fine-tuned language model, we can directly generate generalized questions related to the reference questions and the target business field based on the reference questions, which improves the quality and generation efficiency of generalized questions, makes the generated generalized questions match the actual application scenarios, and saves the generation time of generalized questions.
[0111] Step 204: For each question category, clustering is performed based on the reference questions and generalized questions belonging to the question category, and the question corresponding to the cluster center is determined as the representative question of the question category.
[0112] For each problem category, after generating the generalized problems in it, clustering is performed based on the reference problems and generalized problems in the problem category, and the cluster center of the problem category after clustering is determined. The problem in the problem category corresponding to the cluster center is used as the representative problem of the problem category.
[0113] In a problem category, the cluster center can be the sample with the smallest sum of distances from other samples in the problem category. According to the characteristics of small distance within the cluster and large distance outside the cluster, the problem corresponding to the cluster center is the problem closest to all problems in the problem category, that is, the problem that best represents the problem category. Therefore, in an embodiment of the present application, the problem corresponding to the cluster center is determined to be the representative problem of the problem category.
[0114] It is understood that in the embodiments of the present application, the representative question can be the question closest to the cluster center, or the question whose distance from the cluster center is less than a certain distance threshold, and the embodiments of the present application do not specifically limit this. It should be understood that the above distance refers to the distance between the text features corresponding to the question.
[0115] It should be noted that, in an embodiment of the present application, one or more cluster centers can be determined in a problem category, and one or more representative problems can be determined corresponding to a cluster center, that is, one or more representative problems can be determined in a problem category.
[0116] In one possible implementation, clustering is performed based on the reference problems and generalized problems belonging to a problem category, and the problem corresponding to the cluster center is determined as the representative problem of the problem category. This can be specifically implemented as follows:
[0117] Step 21: Perform clustering based on the text feature vectors corresponding to each reference question and each generalized question belonging to the question category to obtain at least one second cluster.
[0118] In one or more embodiments, a method for clustering reference questions and generalization questions is introduced. The text feature vector corresponding to each reference question can be generated by segmenting the question text of the reference question and then constructing a word vector based on the words obtained by the segmentation; the text feature vector corresponding to each generalization question can be obtained by directly converting the question text of the generalization question during the generalization question generation process. It should be understood that the above-mentioned method of generating text feature vectors is only an example. In the embodiments of the present application, other methods can also be used to generate text feature vectors corresponding to reference questions and generalization questions.
[0119] Based on the text feature vectors corresponding to the reference question and the generalized question, a set of question vectors can be constructed. Text clustering is then performed on the set of question vectors to obtain at least one second cluster. Specifically, the text clustering algorithm used for the set of question vectors can be the Density-Based Spatial Clustering of Applications with Noise (DBSCAN) algorithm, the K-Means algorithm, or the like.
[0120] In the embodiment of the present application, for a question category, each second cluster corresponds to a different subcategory under the question category. By clustering the text feature vectors corresponding to each reference question and each generalized question under the question category, the clustering efficiency of the reference questions and generalized questions can be improved.
[0121] Step 22: For each second cluster, determine the cluster center of the second cluster; determine the text feature vector in the second cluster whose distance from the cluster center meets the preset distance condition as the representative feature vector; determine the question corresponding to the representative feature vector as the representative question.
[0122] For a second cluster, the sum of the distances between the cluster center and the text feature vectors in the second cluster is the smallest. Correspondingly, the sum of the distances between the text feature vector corresponding to the cluster center and the text feature vectors in the second cluster is also the smallest. Then the text feature vector corresponding to the cluster center can be determined as the representative feature vector of the second cluster, and the representative feature vector can better represent other text feature vectors in the second cluster.
[0123] In an embodiment of the present application, a representative feature vector corresponding to the second cluster can be determined by a preset distance condition. Specifically, a text feature vector in the second cluster that meets the preset distance condition can be used as the representative feature vector corresponding to the second cluster. For example, the preset distance condition can be set to: the distance to the cluster center of the second cluster is the closest, and accordingly, the representative feature vector of the second cluster is the text feature vector with the closest distance to the cluster center; the preset distance condition can also be set to: the distance from the cluster center of the second cluster is less than a certain distance threshold, and accordingly, the representative feature vector of the second cluster is the text feature vector with a distance from the cluster center less than the distance threshold.
[0124] Next, based on the correspondence between the text feature vectors and questions in the second cluster, the question corresponding to the representative feature vector can be directly determined and used as the representative question of the second cluster. Since the second clusters correspond to various subcategories under the question category, the representative questions corresponding to all second clusters under that question category are also the representative questions of that question category.
[0125] Clustering of generalized questions and reference questions under the question category is performed based on text feature vectors, which improves clustering efficiency compared to direct question text processing. Since the second clusters are obtained by further refining the clustering of reference questions and generalized questions under the same question category, different second clusters correspond to different subcategories under the same question category, so the representative questions of each second cluster also correspond to different subcategories. The representative questions corresponding to each second cluster under the same question category are used as the representative questions corresponding to the question category, which more comprehensively represents all reference questions and generalized questions under the question category, thereby improving the coverage and comprehensiveness of the representative questions.
[0126] Step 205: Determine a high-quality answer corresponding to each representative question based on the representative questions of the multiple question categories and the multiple reference answers.
[0127] In one or more embodiments, there is a correspondence between the multiple reference answers obtained from the reference question and answer knowledge base and the reference questions in each question category, which can be used to determine the correlation, correspondence, degree of association and other information between the reference answers and the representative questions corresponding to each question category. Based on the correlation, correspondence, degree of association and other information between the reference answers and the representative questions, it can be determined whether the reference answers are high-quality answers corresponding to the representative questions. For example, based on the correspondence between the reference answers and the reference questions, and the correspondence between the reference questions and the question categories, the correlation between the reference answers and the representative questions of the question categories is determined; if the correlation between the reference answers and the representative questions is higher than a preset correlation threshold, the reference answer is determined to be a high-quality answer to the representative question.
[0128] It can be understood that in the embodiment of the present application, one or more high-quality answers can be determined for a representative question, and the embodiment of the present application does not specifically limit the number of high-quality answers corresponding to the representative question.
[0129] Step 206: Build a target question-answering knowledge base based on each representative question and its corresponding high-quality answer.
[0130] After determining the representative questions corresponding to each question category and their corresponding high-quality answers, the representative questions, high-quality answers, and the correspondence between the representative questions and high-quality answers are stored in the target question-answer knowledge base, which is a question-answer set that stores multiple representative questions and their corresponding high-quality answers.
[0131] See also Figure 4 , Figure 4 A flowchart of a representative question determination method provided for an embodiment of the scenario of the present application. After obtaining multiple reference questions from a reference question-and-answer knowledge base, the multiple reference questions are first clustered to obtain multiple question categories. Secondly, by using a language model fine-tuned with text data from the target business field, each question category is generalized based on the reference questions under each question category, and generalized questions belonging to the question category and related to the target business field are generated. Next, a question collection corresponding to each question category is generated based on the reference questions and the generalized questions. Then, the reference questions in each question collection are clustered, and representative questions corresponding to each question collection are selected.
[0132] In terms of storage quality, the representative questions in the target question-answering knowledge base are determined not only based on the reference questions already in the reference question-answering knowledge base, but also based on generalized questions generated by the language model. Since the language model expands the number of questions in each question category, improving the coverage of questions, the representative questions determined in this way also have high coverage, improving the quality of questions stored in the target question-answering knowledge base. At the same time, for each representative question, its corresponding high-quality answer is stored, improving the quality of the answers stored in the target question-answering knowledge base. In terms of storage quantity, from the perspective of questions, the target question-answering knowledge base only stores the representative questions corresponding to each question category, reducing the number of questions stored in the target question-answering knowledge base. From the perspective of answers, the target question-answering knowledge base only stores the high-quality answers corresponding to each representative question, also reducing the number of answers stored therein. Therefore, in the target question-answering knowledge base, the number of stored questions and answers is reduced, resulting in a reduction in the amount of data stored in the target question-answering knowledge base and improving data storage efficiency. Since the amount of data stored in the target question-answering knowledge base is reduced, but the coverage of stored questions and the quality of answers are improved, it is beneficial to improve the efficiency and success rate of question searching when calling the target question-answering knowledge base, thereby improving the efficiency of question-answering based on the target question-answering knowledge base.
[0133] In a possible implementation, step 205 may be implemented as follows:
[0134] Step 31: Divide the multiple reference answers into multiple answer categories.
[0135] After obtaining multiple reference answers from the reference question and answer knowledge base, cluster the multiple reference answers using a clustering algorithm and divide them into multiple answer categories. In the multiple answer categories divided by the multiple reference answers, each answer category includes at least one reference answer. Generally speaking, the number of answer categories should be much smaller than the number of reference answers.
[0136] In one or more embodiments, when categorizing multiple reference answers, multiple answer categories may be pre-set, and each reference answer may be categorized into a corresponding answer category based on the information expressed. Specifically, a classification model may be used to categorize the multiple reference answers according to the pre-set answer categories, thereby determining the answer category to which each reference answer belongs.
[0137] In one or more embodiments, since a correspondence exists between reference questions and reference answers in the reference question and answer knowledge base, when grouping multiple reference answers into multiple answer categories, multiple answer categories corresponding to the reference questions can also be generated directly based on the multiple question categories corresponding to the reference questions, that is, the correspondence between the reference questions and the answer categories is determined. Then, based on the existing correspondence between the reference questions and the reference answers in the reference question and answer knowledge base, the reference answers are grouped into the answer categories corresponding to the reference questions. This improves the efficiency of clustering multiple reference answers, thereby improving the efficiency of constructing the target question and answer knowledge base.
[0138] As an embodiment, the above step 31 can be implemented in the following manner:
[0139] Step 41: Perform feature vector conversion processing on each reference answer to obtain the text feature vector corresponding to each reference answer.
[0140] After obtaining multiple reference answers from the reference question and answer knowledge base, each reference answer is subjected to feature vector conversion processing, and a word segmentation operation is performed on the answer text corresponding to each reference answer, and each word obtained by the word segmentation operation is separated by separators such as spaces and punctuation marks; then, the word vector corresponding to each word in the reference answer is determined through a word vector conversion model; further, based on the word vectors corresponding to each word in the reference answer, the text feature vector corresponding to the reference answer is determined. For example, the word vectors corresponding to each word in the reference answer can be fused (such as pooling processing, etc.) to determine the text feature vector of the reference answer. Of course, in actual applications, the text feature vector corresponding to the reference answer can also be determined by other means. For example, the corresponding text feature vector can be directly determined based on the reference answer through a text feature conversion model (such as a Bert model, a Transformer model, etc.). The embodiment of the present application does not impose any restrictions on this.
[0141] Step 42: Perform clustering based on the text feature vectors corresponding to the multiple reference answers to obtain multiple third clusters.
[0142] Among them, the third cluster is a cluster obtained by clustering the text feature vectors corresponding to the reference answers. In an embodiment of the present application, multiple third clusters correspond to different answer categories, and the reference answers corresponding to the text feature vectors included in the third cluster belong to the answer category corresponding to the third cluster.
[0143] After clustering the text feature vectors corresponding to the reference answers, third clusters corresponding to each text feature vector are obtained. Based on the correspondence between the text feature vectors and the reference answers, the third cluster corresponding to each reference answer is determined. Each third cluster corresponds to one answer category. Reference answers corresponding to the same third cluster belong to the same answer category, and the answer category corresponds to the third cluster. Reference answers corresponding to different third clusters belong to different answer categories.
[0144] After constructing a text feature vector for the answer text in the reference answer, when performing subsequent text feature analysis and other operations on the answer text in each reference answer, analysis and calculation can be performed directly based on the text feature vector corresponding to each reference answer, thereby improving the processing and analysis efficiency of the reference answer.
[0145] As an embodiment, before classifying the multiple reference answers into multiple answer categories, the following steps may also be included:
[0146] Preprocessing is performed on multiple reference answers; the preprocessing includes at least one of the following operations: a deduplication operation for removing reference answers with repeated text or repeated semantics from multiple reference answers, and an abnormal data elimination operation for removing abnormal answers from multiple reference answers.
[0147] After obtaining multiple reference answers from the reference question and answer knowledge base, text and semantic analysis are performed on the multiple reference answers to identify reference answers that have textual or semantic duplication with other reference answers. These reference answers are then processed through a deduplication operation. Deduplication involves retaining one reference answer from multiple reference answers that have textual or semantic duplication and deleting the others.
[0148] Specifically, at the text level, a text analysis is performed on multiple reference answers to determine the text similarity between each reference answer. If the text similarity between two or more reference answers is greater than a certain text similarity threshold, the text between the two or more reference answers is determined to be repeated, one of the reference answers is randomly retained, and the other reference answers with repeated text are deleted, thereby achieving deduplication of the reference answers with repeated text. At the semantic level, a semantic analysis is performed on multiple reference answers to determine the semantic similarity between the multiple reference answers. If the semantic similarity between two or more reference answers is greater than a certain semantic similarity threshold, the semantics expressed by the two or more reference answers is determined to be repeated, one reference answer is randomly retained, and the other reference answers with repeated semantics are deleted, thereby achieving deduplication of the reference answers with repeated semantics.
[0149] Abnormal answers are reference answers that contain textual errors and / or semantic errors. For example, they may contain textual errors such as typos and repeated fields, or semantic errors such as grammatical errors and incoherent sentences. Of course, they can also contain both textual errors and semantic errors. Abnormal data removal is the process of removing abnormal answers from multiple reference answers.
[0150] Through the preprocessing operation for reference answers provided in the embodiment of the present application, abnormal answers and reference answers with textual repetition or semantic repetition can be deleted from multiple reference answers before clustering them, thereby reducing the number of reference answers that need to be processed during the clustering process, reducing the amount of calculation during the clustering process, and improving the efficiency of clustering processing.
[0151] Step 32: For each answer category, a generalized answer belonging to the answer category and related to the representative question is generated through a language model based on the reference answers and representative questions belonging to the answer category.
[0152] Since there is a correspondence between the reference questions and reference answers obtained from the reference question and answer knowledge base, there should also be a certain correspondence between the answer categories divided by the reference answers and the question categories divided by the reference questions. In the embodiment described above, representative questions corresponding to each question category are determined. Based on the correspondence between question categories and representative questions, and the correspondence between question categories and answer categories, the representative questions corresponding to each answer category can be determined.
[0153] With reference to the method for generating generalized questions above, the number of answers under each answer category can also be expanded through generalization. For each answer category, a new answer, i.e., a generalized answer, is generated based on the reference answers belonging to the answer category and the representative questions corresponding to the answer category through a language model and belongs to the answer category and is related to other reference answers under the answer category. Moreover, based on the correspondence between the answer category and the representative questions, since the representative questions corresponding to the answer category are used in the process of generating the generalized answer, the generated generalized answer is also related to the representative questions corresponding to the answer category. Thus, the number of answers under each answer category is expanded through generalization, from an answer set that only includes reference answers to an answer set that includes both reference answers and generalized answers, thereby improving the answer coverage under the answer category, and by increasing the number of answers under the answer category, the comprehensiveness of the knowledge covered by the answer category is improved.
[0154] As an embodiment, the language model used to generate the generalized answer is obtained by fine-tuning a pre-trained language model based on text data of the target business domain. In this case, the above step 32 can be specifically implemented as follows:
[0155] For each reference answer belonging to the answer category, a language model is used to generate a generalized answer related to the reference answer and the representative question, and related to the target business field, based on the text feature vector corresponding to the reference answer and the text feature vector corresponding to the representative question.
[0156] In one or more embodiments, a method for generating generalized answers is introduced. Similar to the language model used to generate generalized questions, the language model used to generate generalized answers is also a specific domain language model obtained by fine-tuning a pre-trained language model based on text data from the target business domain. The language model obtained after fine-tuning, when generalized according to the text feature vector corresponding to the reference answer and the representative question of the same answer category as the reference answer, can combine the reference answer, the representative question and the relevant knowledge of the target business domain to perform word embedding on the answer text to obtain the answer text of the generalized answer, which is related to the target business domain, the reference answer corresponding to the answer category and the representative question. At the same time, the word embedding model can also be used to convert the answer text into a feature vector to obtain the text feature vector corresponding to the generalized answer.
[0157] By fine-tuning the pre-trained language model using text data from the target business domain, a language model for generating generalized answers is obtained. This model can directly generate generalized answers related to the reference answers and representative questions, and also to the target business domain, based on the reference answers and representative questions corresponding to the same answer category. This improves the quality and generation efficiency of generalized answers and saves the generation time of generalized answers.
[0158] Step 33: For each representative question, the classification model is used to determine whether the candidate answer is a high-quality answer corresponding to the representative question based on the reference features corresponding to the candidate answer.
[0159] The candidate answer is a reference answer or a generalized answer, and the reference feature corresponding to the candidate answer is at least used to characterize the correlation between the candidate answer and the representative question. In one or more embodiments, since the candidate answer is a reference answer or a generalized answer, each candidate answer has a corresponding answer category. Then, based on the representative questions corresponding to each answer category, the correspondence between the candidate answer and the representative question can be determined, and the reference feature corresponding to the candidate answer can be determined accordingly. The reference feature of the candidate answer that has a corresponding relationship with the representative question characterizes that the correlation between the candidate answer and the representative question is high.
[0160] For example, by performing semantic analysis on candidate answers and representative questions, the semantic relevance between the candidate answers and the representative questions can be determined, and the semantic relevance can be used as a reference feature corresponding to the candidate answers to judge whether the candidate answers are high-quality answers corresponding to the representative questions.
[0161] For another example, for a representative question that is a reference question, when a candidate answer is a reference answer, the reference features corresponding to the reference answer can be determined based on the correspondence between the reference question and the reference answer in the reference question and answer knowledge base. That is, if there is a correspondence between the reference question and the reference answer in the reference question and answer knowledge base, then the reference features corresponding to the reference answer represent that it is related to the representative question. Conversely, if there is no correspondence between the reference question and the reference answer in the reference question and answer knowledge base, then the reference features corresponding to the reference answer represent that it is not related to the representative question. When a candidate answer is a generalized answer, if the generalized answer is generated based on a representative question, that is, the language model generates the generalized answer based on the representative question, then the generalized question can be considered to be related to the representative question. Conversely, if the generalized answer is generated based on other representative questions, then the generalized question can be considered to be unrelated to the representative question.
[0162] Since high-quality answers are determined based on their correlation with representative questions, the high-quality answers have a higher correlation with the representative questions than other candidate answers. Therefore, from the perspective of the response content of the high-quality answers, their responses to the representative questions are more detailed and accurate. From the perspective of the efficiency of high-quality answers in solving representative questions, their efficiency and success rate in solving representative questions are higher than other candidate answers. Therefore, saving representative questions and their corresponding high-quality answers in the target question and answer knowledge base can improve the quality of answers in the target question and answer knowledge base, and thus improve the efficiency of the target question and answer knowledge base in solving representative questions.
[0163] It should be understood that in the embodiment of the present application, the correlation between the candidate answers and the representative questions can be described by abstract text labels, such as text descriptions such as high correlation and low correlation; it can also be described by specific data labels, such as specific data such as a correlation index of 80%; the embodiment of the present application does not make specific limitations on this.
[0164] After clustering the reference answers, generalized answers are generated based on the reference answers under each answer category and the representative questions corresponding to each answer category. The generalized answers not only belong to their corresponding answer categories, but are also related to the representative questions. Since the representative questions have a high coverage, the generalized answers generated based on the representative questions also have a high coverage. Then, the classification model determines whether the reference answer or the generalized answer is a high-quality answer corresponding to the representative question. Since the correlation between the high-quality answers and the representative questions is high, the high-quality answers determined on the basis of the high coverage of the representative questions are more detailed and accurate than other answers. According to the correspondence between the representative questions and the high-quality answers, the accuracy of the answers to the representative questions can be improved, thereby improving the efficiency of solving the representative questions. At the same time, by determining the high-quality answers corresponding to the representative questions, the correspondence between the representative questions and the answers is simplified, and the number of answers stored in the target question and answer knowledge base is reduced when the target question and answer knowledge base is subsequently constructed.
[0165] Specifically, the reference features corresponding to the candidate answers also include evaluation features corresponding to the candidate answers, and the evaluation features include at least one of a user's evaluation sentiment feature for the candidate answers and a user's evaluation text feature for the candidate answers.
[0166] In one or more embodiments, in addition to being used to characterize the correlation between the candidate answer and the representative question, the reference features corresponding to the candidate answer may also include evaluation features corresponding to the candidate answer. The evaluation features are generated based on user experience and are used to characterize the user experience when using the candidate answer to solve the representative question.
[0167] Among them, the evaluation features include at least one of the user's evaluation sentiment features for the candidate answers and the user's evaluation text features for the candidate answers. For example, the evaluation sentiment features can be determined based on the number of likes, favorites, or dislikes triggered by the user for the candidate answer; when the number of likes corresponding to the candidate answer is higher, the corresponding evaluation sentiment feature is more positive, and conversely, when the number of dislikes corresponding to the candidate answer is higher, the corresponding emotional evaluation feature is more negative. The evaluation text features can be the evaluation text posted by the user for the candidate answer, such as "This answer is excellent", "This answer is not very good", etc. The evaluation text features corresponding to the candidate answer are determined by performing semantic analysis on the evaluation text.
[0168] Since the evaluation feature is determined based on the user's experience with the candidate answer, in an embodiment of the present application, the reference feature corresponding to the reference answer obtained from the reference question and answer knowledge base includes the evaluation feature. However, for the generalized answer generated by the language model, since the generalized answer has not yet been used by the user, the evaluation feature does not yet exist in the reference feature corresponding to the generalized answer.
[0169] It should be understood that in the embodiment of the present application, the evaluation features corresponding to the candidate answers may include one or more of the user's evaluation sentiment features and evaluation text features of the candidate answers, and the embodiment of the present application does not make specific limitations on this.
[0170] By adding evaluation features to the reference features corresponding to the candidate answers, the comprehensiveness of the reference features in evaluating the candidate answers can be improved, and then, based on the reference features, it can be more accurately determined whether the candidate answer is a high-quality answer to the representative question.
[0171] In the embodiments of the present application, when determining a high-quality answer for each representative question, all reference answers and generalized answers are referred to as candidate answers. Thus, for each representative question, the reference features corresponding to all candidate answers are analyzed using a classification model, and the reference features are used to determine whether the candidate answer is a high-quality answer to the representative question. The classification model is a machine learning model that classifies candidate answers as high-quality answers or non-high-quality answers corresponding to the representative question based on their reference features.
[0172] As an embodiment, the classification model is trained in the following manner:
[0173] Step 51: Extract multiple training answers from each reference answer and each generalized answer, and determine the label corresponding to each training answer.
[0174] In the embodiments of the present application, labels are used to characterize the quality of training answers relative to the corresponding training questions. For example, the labels corresponding to training answers can include whether the training answers can solve the corresponding training questions, user satisfaction with the training answers, and other labels. These labels can be manually annotated before the classification model is trained. Based on the multiple extracted training answers and the labels corresponding to each training answer, a dataset can be generated for use in the classification model training process.
[0175] It should be noted that when extracting training answers, not only can a random number of reference answers and a random number of generalized answers be extracted from each reference answer and each generalized answer, but training answers can also be randomly extracted according to a preset number ratio between the reference answers and the generalized answers. The embodiments of the present application do not make specific limitations on this.
[0176] Step 52: Determine the classification result corresponding to the training answer through the classification model to be trained and according to the reference features corresponding to the training answer.
[0177] The text feature vectors corresponding to the training answers are input into a classification model to be trained, such as an eXtreme Gradient Boosting (XGBoost) model. The classification model to be trained classifies the training answers according to the reference features corresponding to the training answers to determine the classification results corresponding to each training answer.
[0178] The reference features corresponding to the training answers are used to at least characterize the correlation between the training answers and the corresponding training questions. The method for determining these reference features has been described above, and details can be found in the relevant description above. It should be understood that the training questions here can specifically be representative questions. The classification model to be trained is used to determine a corresponding classification result for the training answers based on the reference features of the input training answers. The classification result is used to indicate whether the training answers are high-quality answers to the corresponding training questions.
[0179] Step 53: Train the classification model based on the classification results and labels corresponding to each training answer.
[0180] Compare the classification results corresponding to the training answers and their corresponding labels. If the classification results have the same meaning as the labels, it can be determined that the training answers are correctly classified. For example, if the classification result corresponding to the training answers is "high-quality answers" and the labels corresponding to the training answers are positive labels such as "capable of solving the corresponding training problems" or "high user satisfaction", then it is considered that the classification results of the training answers have the same meaning as the labels, and the classification model is determined to have correctly classified the training answers. Conversely, if the classification result corresponding to the training answers is "non-high-quality answers" and the labels corresponding to the training answers are positive labels such as "capable of solving the corresponding training problems" or "high user satisfaction", then it is considered that the classification results of the training answers have different meanings than the labels, and the classification model is determined to have incorrectly classified the training answers.
[0181] Accordingly, the classification results and labels corresponding to each training answer are compared to determine the classification loss value of the classification model during the training process, and the parameters of the classification model are adjusted according to the classification loss value. The above training process is then repeated until the classification accuracy of the classification model reaches the ideal accuracy threshold, thereby obtaining a trained classification model, or until the number of training rounds for the classification model reaches a preset number of rounds. It should be noted that in the embodiment of the present application, the ideal accuracy threshold during the classification model training process can be set according to actual application needs, and the embodiment of the present application does not specifically limit this.
[0182] By extracting training answers from reference answers and generalized answers, constructing a data set used in the classification model training process, training the classification model to be trained, and obtaining a classification model for determining high-quality answers, the efficiency of determining high-quality answers for each representative question can be improved, thereby improving the efficiency of constructing the target question-answering knowledge base.
[0183] See also Figure 5 , Figure 5 For the embodiment of this application scenario Figure 4 After obtaining multiple reference questions from the reference question and answer knowledge base, the process of determining representative questions can refer to the above description of Figure 4 Description of the process in [1]. After obtaining multiple reference answers from the reference question and answer knowledge base, the multiple reference answers are first clustered to determine multiple answer categories. Next, using a language model fine-tuned using text data from the target business domain, generalization is performed based on the reference answers under each answer category and the representative questions corresponding to each answer category. Generalized answers belonging to that answer category, relevant to the target business domain, and related to the representative questions are generated. Next, answer collections corresponding to each answer category are generated based on the reference answers and generalized answers. Then, feature vectors and result labels are determined for each reference answer or generalized answer in each answer collection; the feature vectors include semantic relevance, sentiment characteristics of the user's evaluation of the reference answer, and textual characteristics of the user's evaluation of the reference answer; the result label is used to indicate whether the answer can solve the corresponding question. Each reference answer and generalized answer, along with their corresponding feature vectors and result labels, are input into a classification model, which is trained to obtain a classification model capable of identifying high-quality answers. Finally, the classification model determines whether each reference answer or generalized answer is a high-quality answer corresponding to the representative question.
[0184] Based on the above Figure 4 and Figure 5 The representative question determination method and the high-quality answer determination method shown in FIG are used to determine the representative questions and the high-quality answers corresponding to the representative questions, respectively, and construct the target question-answering knowledge base, such as Figure 6 As shown, the question generation module performs the above Figure 4 The representative question determination method shown above is performed by the answer generation module Figure 5 The high-quality answer determination method shown in the figure finally obtains the target question-answer knowledge base corresponding to the embodiment of the scenario of this application.
[0185] As an embodiment, in addition to constructing a target Q&A knowledge base based on the existing reference questions and reference answers in the reference Q&A knowledge base, the target Q&A knowledge base can also be updated regularly or irregularly to enrich its content so that it covers questions and answers related to current hot topics, thereby enabling the target Q&A knowledge base to meet the relevant needs of users and enabling the services supported by the target Q&A knowledge base to provide a better user experience. That is, the current hot text is obtained, and generalized questions and generalized answers related to the current hot text are generated through a language model, and the target Q&A knowledge base is updated based on the generalized questions and generalized answers.
[0186] Exemplarily, current hot texts can be collected from public content on the Internet through data collection tools. For example, Internet hot terms or hot topics can be collected, or keywords can be extracted from hot pictures or hot videos. Then, the collected current hot texts are input into the language model of the embodiment of the present application. The language model can generate a generalized question based on the current hot text, and generate a generalized answer corresponding to the generalized question based on the generated generalized question and the current hot text. Then, the generalized question and the generalized answer are recorded in the target question and answer knowledge base to update the target question and answer knowledge base.
[0187] Specifically, after obtaining the current hot text, for each question category, based on the current hot text and the representative question corresponding to the question category, a generalized question belonging to the question category, related to the current hot text and the representative question can be generated through the language model, and the generated generalized question can be recorded under the question category in the target question-answering knowledge base. It should be understood that in the case where a large number of generalized questions are generated, it is also possible to select representative generalized questions that are closer to the cluster center from multiple generalized questions based on the distance between the text feature vector of the generalized question and the cluster center of the question category and record them in the target question-answering knowledge base, thereby ensuring that the questions related to the current hot text stored in the target question-answering knowledge base are also highly representative.
[0188] Correspondingly, through the language model, based on the current hot text and the high-quality answers corresponding to the representative questions under the question category, a generalized answer related to the current hot text and the high-quality answers can be generated for the representative question, and the newly generated generalized answer can be recorded in the target question and answer knowledge base. It should be understood that in the case of a large number of generalized answers generated, the classification model can also be used to determine whether the generalized answer related to the current hot text is a high-quality generalized answer, and the high-quality generalized answer can be recorded in the target question and answer knowledge base, thereby ensuring that the quality of the answers related to the current hot text stored in the target question and answer knowledge base is also high.
[0189] At this point, the target Q&A knowledge base has been updated by adding generalized questions and their corresponding generalized answers related to the current hot topic text. This process of collecting hot terms or hot topics and updating the target Q&A knowledge base improves the timeliness of the questions and answers in the target Q&A knowledge base, thereby increasing the efficiency of users searching for Q&A related to hot terms in the target Q&A knowledge base and enhancing their query and usage experience.
[0190] In addition, in order to avoid the target question and answer knowledge base from storing more and more data, while the hot text is only maintained for a limited time, when the target question and answer knowledge base is updated based on the current hot text, a storage time limit can be set for the generalized questions and generalized answers related to the current hot text, and the target question and answer knowledge base stores the generalized questions and generalized answers related to the current hot text according to the storage time limit. For example, if the storage time limit is set to one week, then after the generalized questions and generalized answers related to the current hot text are stored in the target question and answer knowledge base for one week, the target question and answer knowledge base will automatically delete the generalized questions and generalized answers related to the current hot text to limit the amount of data stored in the target question and answer knowledge base. In this way, by setting a corresponding storage period for the questions and answers related to the current hot text, the target question and answer knowledge base can maintain a smaller data volume, reduce data storage pressure, and thus maintain higher query efficiency when querying in the target question and answer knowledge base.
[0191] See also Figure 7 , Figure 7 This is a structural diagram of a knowledge base construction device provided in an embodiment of the present application, wherein the device includes: an acquisition module 701, a question category division module 702, a question generalization module 703, a question clustering module 704, an answer determination module 705, and a construction module 706.
[0192] An acquisition module 701 is used to acquire a plurality of reference questions and a plurality of reference answers stored in a reference question and answer knowledge base;
[0193] A question category classification module 702 is configured to classify the plurality of reference questions into a plurality of question categories;
[0194] A question generalization module 703 is configured to generate, for each question category, a generalized question belonging to the question category based on the reference questions belonging to the question category using a language model;
[0195] A question clustering module 704 is configured to perform clustering processing on each question category based on the reference questions and generalized questions belonging to the question category, and determine the question corresponding to the cluster center as the representative question of the question category;
[0196] An answer determination module 705 is configured to determine a high-quality answer corresponding to each representative question according to the representative questions of each of the multiple question categories and the multiple reference answers;
[0197] The construction module 706 is used to construct a target question-answering knowledge base based on each of the representative questions and the corresponding high-quality answers.
[0198] Optionally, the question category classification module 702 is specifically configured to:
[0199] Performing feature vector conversion processing on each of the reference questions to obtain a text feature vector corresponding to each of the reference questions;
[0200] Clustering is performed based on the text feature vectors corresponding to each of the multiple reference questions to obtain multiple first clusters; the multiple first clusters respectively correspond to different question categories, and the reference questions corresponding to the text feature vectors included in the first clusters belong to the question category corresponding to the first cluster.
[0201] Optionally, the device further includes a data preprocessing module, configured to:
[0202] The multiple reference questions are preprocessed; the preprocessing includes at least one of the following operations: a deduplication operation for removing reference questions with repeated text or repeated semantics from the multiple reference questions, and an abnormal data elimination operation for removing abnormal questions from the multiple reference questions.
[0203] Optionally, the language model is obtained by fine-tuning a pre-trained language model based on text data of the target business domain; the question generalization module 703 is specifically used to:
[0204] For each of the reference questions belonging to the question category, the generalized question related to the reference question and the target business field is generated by the language model according to the text feature vector corresponding to the reference question.
[0205] Optionally, the question clustering module 704 is specifically configured to:
[0206] Performing clustering processing based on the text feature vectors corresponding to each of the reference questions and each of the generalized questions belonging to the question category to obtain at least one second cluster;
[0207] For each of the second clusters, determine the cluster center of the second cluster; determine a text feature vector in the second cluster whose distance from the cluster center meets a preset distance condition as a representative feature vector; and determine the question corresponding to the representative feature vector as the representative question.
[0208] Optionally, the answer determination module 705 is specifically configured to:
[0209] Classifying the plurality of reference answers into a plurality of answer categories;
[0210] For each of the answer categories, generating, by the language model, a generalized answer belonging to the answer category and related to the representative question based on the reference answers belonging to the answer category and the representative question;
[0211] For each representative question, a classification model is used to determine whether the candidate answer is a high-quality answer corresponding to the representative question based on the reference features corresponding to the candidate answer; the candidate answer is the reference answer or the generalized answer, and the reference features corresponding to the candidate answer are at least used to characterize the correlation between the candidate answer and the representative question.
[0212] Optionally, the device further includes a model training module, configured to:
[0213] Extracting multiple training answers from each of the reference answers and each of the generalized answers, and determining a label corresponding to each of the training answers; the label is used to characterize the quality of the training answer relative to the corresponding training question;
[0214] Determining, by the classification model to be trained, a classification result corresponding to the training answer based on reference features corresponding to the training answer; the reference features corresponding to the training answer are at least used to characterize the correlation between the training answer and the corresponding training question, and the classification result is used to characterize whether the training answer is a high-quality answer relative to the corresponding training question;
[0215] The classification model is trained according to the classification results and the labels corresponding to the respective training answers.
[0216] Optionally, the reference features corresponding to the candidate answers further include evaluation features corresponding to the candidate answers, and the evaluation features include at least one of a user's emotional evaluation feature of the candidate answers and a user's textual evaluation feature of the candidate answers.
[0217] Optionally, the answer determination module 705 is specifically configured to:
[0218] Performing feature vector conversion processing on each of the reference answers to obtain a text feature vector corresponding to each of the reference answers;
[0219] Clustering is performed based on the text feature vectors corresponding to each of the multiple reference answers to obtain multiple third clusters; the multiple third clusters respectively correspond to different answer categories, and the reference answers corresponding to the text feature vectors included in the third clusters belong to the answer category corresponding to the third cluster.
[0220] Optionally, the device further includes a data preprocessing module, configured to:
[0221] The multiple reference answers are preprocessed; the preprocessing includes at least one of the following operations: a deduplication operation for removing reference answers with repeated text or repeated semantics from the multiple reference answers, and an abnormal data elimination operation for removing abnormal answers from the multiple reference answers.
[0222] Optionally, the language model is obtained by fine-tuning a pre-trained language model based on text data of the target business domain; the answer determination module 705 is specifically configured to:
[0223] For each of the reference answers belonging to the answer category, the language model is used to generate the generalized answer related to the reference answer and the representative question and related to the target business field based on the text feature vector corresponding to the reference answer and the text feature vector corresponding to the representative question.
[0224] The embodiment of the present application also provides a computer device, which may specifically be a terminal device or a server. The terminal device and server provided in the embodiment of the present application will be introduced below from the perspective of hardware entity.
[0225] See also Figure 8 , Figure 8 This is a schematic diagram of the structure of the terminal device provided in the embodiment of the present application. Figure 8 For ease of explanation, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The terminal can be any terminal device including a mobile phone, tablet computer, personal digital assistant (PDA), point of sales (POS), car computer, etc. For example, the terminal is a computer:
[0226] Figure 8 FIG2 is a block diagram showing a partial structure of a computer related to a terminal provided in an embodiment of the present application. Figure 8The computer includes: a radio frequency (RF) circuit 1210, a memory 1220, an input unit 1230 (including a touch panel 1231 and other input devices 1232), a display unit 1240 (including a display panel 1241), a sensor 1250, an audio circuit 1260 (connected to a speaker 1261 and a microphone 1262), a wireless fidelity (WiFi) module 1270, a processor 1280, and a power supply 1290. Those skilled in the art will understand that Figure 8 The computer structure shown in the figure does not constitute a limitation of the computer, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0227] Memory 1220 can be used to store software programs and modules. Processor 1280 executes the various computer functions and data processing by running the software programs and modules stored in memory 1220. Memory 1220 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function or an image playback function). The data storage area may store data generated based on the use of the computer (such as audio data, a phone book, etc.). Memory 1220 may also include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state memory device.
[0228] Processor 1280 is the computer's control center, connecting various computer components using various interfaces and circuits. It executes software programs and / or modules stored in memory 1220 and accesses data stored in memory 1220 to perform various computer functions and process data. Optionally, processor 1280 may include one or more processing units. Preferably, processor 1280 integrates an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 1280.
[0229] In an embodiment of the present application, the processor 1280 included in the terminal is used to execute the steps in the methods described in the aforementioned embodiments.
[0230] See also Figure 9 , Figure 9A structural diagram of a server 1300 provided for an embodiment of the present application. The server 1300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1322 (for example, one or more processors) and a memory 1332, and one or more storage media 1330 (for example, one or more massive storage devices) for storing application programs 1342 or data 1344. Among them, the memory 1332 and the storage medium 1330 may be temporary storage or permanent storage. The program stored in the storage medium 1330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 1322 may be configured to communicate with the storage medium 1330 to execute a series of instruction operations in the storage medium 1330 on the server 1300.
[0231] The server 1300 may also include one or more power supplies 1326, one or more wired or wireless network interfaces 1350, one or more input and output interfaces 1358, and / or one or more operating systems, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.
[0232] The steps performed by the server in the above embodiment can be based on the Figure 9 The server structure shown.
[0233] The CPU 1322 is configured to execute the steps of the methods described in the aforementioned embodiments.
[0234] An embodiment of the present application further provides a computer-readable storage medium for storing a computer program, which is used to execute the steps in the methods described in the aforementioned embodiments.
[0235] The present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the methods described in the aforementioned embodiments.
[0236] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0237] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0238] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0239] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0240] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store computer programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0241] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0242] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A knowledge base construction method, characterized in that: The method comprises: Obtain multiple reference questions and multiple reference answers stored in a reference question and answer knowledge base; classifying the plurality of reference questions into a plurality of question categories; For each of the question categories, generating a generalized question belonging to the question category based on the reference question belonging to the question category by using a language model; For each of the problem categories, clustering is performed based on the reference problems and generalized problems belonging to the problem category, and the problem corresponding to the cluster center is determined as the representative problem of the problem category; Determining a high-quality answer corresponding to each of the representative questions according to the representative questions of each of the multiple question categories and the multiple reference answers; Based on each of the representative questions and the corresponding high-quality answers, a target question-answering knowledge base is constructed.
2. The method according to claim 1, characterized in that The dividing the plurality of reference questions into a plurality of question categories includes: Performing feature vector conversion processing on each of the reference questions to obtain a text feature vector corresponding to each of the reference questions; Clustering is performed based on the text feature vectors corresponding to each of the multiple reference questions to obtain multiple first clusters; the multiple first clusters respectively correspond to different question categories, and the reference questions corresponding to the text feature vectors included in the first clusters belong to the question category corresponding to the first cluster.
3. The method according to claim 1 or 2, characterized in that Before classifying the plurality of reference questions into a plurality of question categories, the method further includes: The multiple reference questions are preprocessed; the preprocessing includes at least one of the following operations: a deduplication operation for removing reference questions with repeated text or repeated semantics from the multiple reference questions, and an abnormal data elimination operation for removing abnormal questions from the multiple reference questions.
4. The method according to claim 1 or 2, characterized in that The language model is obtained by fine-tuning a pre-trained language model based on text data from the target business domain; The generating, using the language model and based on the reference question belonging to the question category, a generalized question belonging to the question category, includes: For each of the reference questions belonging to the question category, the generalized question related to the reference question and the target business field is generated by the language model according to the text feature vector corresponding to the reference question.
5. The method according to claim 1 or 2, characterized in that The step of performing clustering based on the reference questions and the generalized questions belonging to the problem category and determining the question corresponding to the cluster center as the representative question of the problem category includes: Performing clustering processing based on the text feature vectors corresponding to each of the reference questions and each of the generalized questions belonging to the question category to obtain at least one second cluster; For each of the second clusters, determine the cluster center of the second cluster; determine a text feature vector in the second cluster whose distance from the cluster center meets a preset distance condition as a representative feature vector; and determine the question corresponding to the representative feature vector as the representative question.
6. The method according to any one of claims 1 to 5, characterized in that Determining a high-quality answer corresponding to each representative question according to the representative questions of each of the multiple question categories and the multiple reference answers includes: Classifying the plurality of reference answers into a plurality of answer categories; For each of the answer categories, generating, by the language model, a generalized answer belonging to the answer category and related to the representative question based on the reference answers belonging to the answer category and the representative question; For each representative question, a classification model is used to determine whether the candidate answer is a high-quality answer corresponding to the representative question based on the reference features corresponding to the candidate answer; the candidate answer is the reference answer or the generalized answer, and the reference features corresponding to the candidate answer are at least used to characterize the correlation between the candidate answer and the representative question.
7. The method according to claim 6, characterized in that The classification model is trained in the following way: Extracting multiple training answers from each of the reference answers and each of the generalized answers, and determining a label corresponding to each of the training answers; the label is used to characterize the quality of the training answer relative to the corresponding training question; Determining, by the classification model to be trained, a classification result corresponding to the training answer based on reference features corresponding to the training answer; the reference features corresponding to the training answer are at least used to characterize the correlation between the training answer and the corresponding training question, and the classification result is used to characterize whether the training answer is a high-quality answer relative to the corresponding training question; The classification model is trained according to the classification results and the labels corresponding to the respective training answers.
8. The method according to claim 6 or 7, characterized in that The reference features corresponding to the candidate answers also include evaluation features corresponding to the candidate answers, and the evaluation features include at least one of a user's evaluation sentiment feature for the candidate answers and a user's evaluation text feature for the candidate answers.
9. The method according to any one of claims 6 to 8, characterized in that The dividing the plurality of reference answers into a plurality of answer categories includes: Performing feature vector conversion processing on each of the reference answers to obtain a text feature vector corresponding to each of the reference answers; Clustering is performed based on the text feature vectors corresponding to each of the multiple reference answers to obtain multiple third clusters; the multiple third clusters respectively correspond to different answer categories, and the reference answers corresponding to the text feature vectors included in the third clusters belong to the answer category corresponding to the third cluster.
10. The method according to claim 6 or 9, characterized in that Before classifying the plurality of reference answers into a plurality of answer categories, the method further includes: The multiple reference answers are preprocessed; the preprocessing includes at least one of the following operations: a deduplication operation for removing reference answers with repeated text or repeated semantics from the multiple reference answers, and an abnormal data elimination operation for removing abnormal answers from the multiple reference answers.
11. The method according to claim 6 or 9, characterized in that The language model is obtained by fine-tuning a pre-trained language model based on text data of the target business domain; generating, by using the language model, a generalized answer belonging to the answer category and related to the representative question based on the reference answer belonging to the answer category and the representative question, including: For each of the reference answers belonging to the answer category, the language model is used to generate the generalized answer related to the reference answer and the representative question and related to the target business field based on the text feature vector corresponding to the reference answer and the text feature vector corresponding to the representative question.
12. A knowledge base construction device, characterized in that: The device comprises: An acquisition module, used to acquire multiple reference questions and multiple reference answers stored in a reference question and answer knowledge base; A question category classification module, configured to classify the plurality of reference questions into a plurality of question categories; a question generalization module, configured to generate, for each question category, a generalized question belonging to the question category based on the reference questions belonging to the question category by using a language model; a question clustering module, configured to perform clustering processing on each of the question categories based on the reference questions and generalized questions belonging to the question category, and determine the question corresponding to the cluster center as the representative question of the question category; An answer determination module, configured to determine a high-quality answer corresponding to each representative question according to the representative questions of each of the plurality of question categories and the plurality of reference answers; A construction module is used to construct a target question-answering knowledge base based on each of the representative questions and the corresponding high-quality answers.
13. A computer device, characterized in that: The device includes a processor and a memory; The memory is used to store computer programs; The processor is configured to execute the knowledge base construction method according to any one of claims 1 to 11 according to the computer program.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a computer device, the knowledge base construction method according to any one of claims 1 to 11 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the knowledge base construction method according to any one of claims 1 to 11 is implemented.