Question and answer pair generation method and device, equipment and storage medium
By combining semantic classification and keyword groups, question-answer pairs are automatically generated, solving the problem of low efficiency in question-answer database generation and achieving efficient generation of high-quality question-answer pairs.
Patent Information
- Application Number
- CN202011408985.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-04
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2040-12-04
AI Technical Summary
Existing technologies for building question-answer databases are inefficient in generating question-answer pairs, requiring a lot of manpower and time.
A semantic classification method is used to classify the question set, generating a first question set and a second question set. Candidate question sets are obtained from the database respectively, and two types of question-answer pairs are generated based on keyword groups, realizing fully automated question-answer pair generation.
It improves the efficiency of question-answer pair generation, enabling the rapid creation of new question-answer libraries in any field or the supplementation of existing question-answer libraries, and generates high-quality question-answer pairs.
Smart Images

Figure CN113515601B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and in particular to a question and answer pair generation method and device, equipment and a storage medium. BACKGROUND
[0002] With the development of science and technology, artificial intelligence plays an increasingly important role in many fields. Intelligent interaction is an important field of artificial intelligence, and users can realize question and answer dialogue between intelligent devices with intelligent interaction function. For example, a user inputs text, voice or picture to an intelligent device, asks a question to the intelligent device, and then the intelligent device finds an answer to the user's question from a question and answer database and feeds back the answer to the user in the form of text, voice or picture.
[0003] At present, when constructing a question and answer database, the generation method of question and answer pairs is mainly for a specific field, and the question and answer pair writing work is organized by brainstorming. However, this method requires a large amount of manpower and takes a long time, resulting in low efficiency of generating question and answer pairs. SUMMARY
[0004] The embodiments of the present application provide a question and answer pair generation method, device, equipment and storage medium, which improves the generation efficiency of question and answer pairs. The technical scheme is as follows:
[0005] On the one hand, a question and answer pair generation method is provided, which includes:
[0006] A target question set is obtained, and each question in the target question set is classified in terms of semantics to obtain a first question set and a second question set. The first question set is similar to the question content of an existing question in a database, and the second question set is not similar to the question content of the existing question. The database is used to store question and answer pairs of a target field;
[0007] For a first question in the first question set, a first candidate question set is obtained from the database; a first question and answer pair is generated based on the first candidate question set; wherein the first question is similar to the question content of the first candidate question set;
[0008] For a second question in the second question set, a second candidate question set is obtained from the second question set based on the key words of the target field; and a second question and answer pair is generated based on the second candidate question set.
[0009] On the other hand, a question and answer pair generation device is provided, which includes:
[0010] The acquisition module is configured to acquire a target question set, perform semantic classification on each question in the target question set, and obtain a first question set and a second question set, the first question set being similar to a question content of an existing question in a database, and the second question set being dissimilar to the question content of the existing question, the database being configured to store question and answer pairs in a target field;
[0011] The first question and answer pair generation module is configured to, for a first question in the first question set, acquire a first candidate question set from the database, and generate a first question and answer pair based on the first candidate question set, the first question being similar to a question content of the first candidate question set;
[0012] The second question and answer pair generation module is configured to, for a second question in the second question set, acquire a second candidate question set from the second question set based on a keyword group in the target field, and generate a second question and answer pair based on the second candidate question set.
[0013] In an optional implementation, the first question and answer pair generation module is configured to:
[0014] display a first page, the first page including the first candidate question set;
[0015] in response to a selection operation on a first candidate question in the first candidate question set, acquire a first candidate answer matching the first candidate question from the database;
[0016] generate a first question and answer pair based on the first question and the first candidate answer.
[0017] In an optional implementation, the second question and answer pair generation module is configured to:
[0018] display a second page, the second page including the second candidate question set;
[0019] in response to a selection operation on a second candidate question in the second candidate question set, call a screening interface to acquire a second candidate answer matching the second candidate question from a third party;
[0020] generate the second question and answer pair based on the second candidate question and the second candidate answer.
[0021] In an optional implementation, the second question and answer pair generation module is configured to:
[0022] display a second page, the second page including the first candidate question set;
[0023] in response to a selection operation on a second candidate question in the second candidate question set, input an answer editing content as a second candidate answer matching the second candidate question.
[0024] generate a second question-answer pair based on the second candidate question and the second candidate answer.
[0025] In an optional implementation, the obtaining module is configured to:
[0026] obtain the target question set based on the online log of the target domain;
[0027] for any question in the target question set, obtain a semantic similarity between the any question and the existing question;
[0028] in response to the obtained semantic similarity being in a first interval, add the any question to the first question set;
[0029] in response to the obtained semantic similarity being in a second interval, add the any question to the second question set.
[0030] In an optional implementation, the first question-answer pair generation module is configured to:
[0031] obtain a third candidate question set from the database based on the first question, wherein the first question is similar to the asking content of the third candidate question set;
[0032] obtain a semantic similarity between the first question and each question in the third candidate question set, and sort the obtained semantic similarities in descending order;
[0033] generate the first candidate question set according to the questions in the first N positions of the semantic similarity sorting, N being a positive integer.
[0034] In an optional implementation, the second question-answer pair generation module includes:
[0035] a first obtaining unit configured to obtain a keyword group of the target domain;
[0036] a second obtaining unit configured to obtain a fourth candidate question set from the second question set based on the keyword group;
[0037] a screening unit configured to call a screening interface to screen questions in the fourth candidate question set that meet a target condition;
[0038] a generating unit configured to generate the second candidate question set according to the questions in the fourth candidate question set that meet the target condition.
[0039] In an optional implementation, the first obtaining unit is configured to:
[0040] determine a candidate word group in the database, and obtain word frequencies of each word in the candidate word group;
[0041] determine a candidate word in the candidate word group according to the word frequencies of the each word;
[0042] take the candidate word group including the candidate word in the candidate word group as the keyword group.
[0043] In an optional implementation, for any one question in the fourth candidate question set, the target condition includes any one of the following:
[0044] the any one question appears in a fifth candidate question set, where the fifth candidate question set is obtained based on the screening interface;
[0045] an answer of the any one question is obtained based on the screening interface;
[0046] a sixth candidate question set is obtained based on the screening interface, and the any one question is similar to question content of the sixth candidate question set.
[0047] In an optional implementation, the apparatus further includes:
[0048] a storage module, configured to store the first question-answer pair and the second question-answer pair into the database.
[0049] In an optional implementation, the apparatus further includes:
[0050] a training module, configured to train a question classification model based on training corpus, the training corpus including the first question-answer pair and the second question-answer pair, and the question classification model being used for semantic classification of questions.
[0051] In another aspect, a computer device is provided, which includes a processor and a memory, the memory being configured to store at least one piece of computer program, the at least one piece of computer program being loaded and executed by the processor to implement operations performed in the question-answer pair generation method in the embodiments of the present application.
[0052] In another aspect, a computer readable storage medium is provided, which stores at least one piece of computer program, the at least one piece of computer program being loaded and executed by a processor to implement operations performed in the question-answer pair generation method in the embodiments of the present application.
[0053] In another aspect, a computer program product or computer program is provided, which includes computer program code stored in a computer readable storage medium. A processor of a computer device reads the computer program code from the computer readable storage medium, and the processor executes the computer program code to cause the computer device to perform the question and answer pair generation method provided in various optional implementation manners described above.
[0054] The technical scheme provided by the embodiments of the present application has the following beneficial effects:
[0055] In the embodiments of the present application, an automatic question and answer pair generation method is provided. Specifically, when generating question and answer pairs in a certain field, the collected questions are first classified by semantic classification to obtain two question sets. Then, the questions in the two question sets are processed differently, and finally two types of question and answer pairs matching the two question sets are generated based on the keywords in the field and the database. This way of classifying and processing questions can generate high-quality question and answer pairs in a targeted manner. In addition, since the process of generating question and answer pairs is basically automated, the efficiency of generating question and answer pairs is greatly improved, and the task of building a question and answer library in any field or the task of supplementing and mining an existing question and answer library can be completed quickly. BRIEF DESCRIPTION OF DRAWINGS
[0056] In order to more clearly illustrate the technical schemes in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0057] Figure 1 is a schematic diagram of an implementation environment of a question and answer pair generation method according to an embodiment of the present application;
[0058] Figure 2 is a flowchart of a question and answer pair generation method according to an embodiment of the present application;
[0059] Figure 3 is a flowchart of another question and answer pair generation method according to an embodiment of the present application;
[0060] Figure 4 is a schematic diagram of a question semantic classification in a target question set according to an embodiment of the present application;
[0061] Figure 5 is a schematic diagram of a similar question learning page according to an embodiment of the present application;
[0062] Figure 6 is a flowchart of acquiring a keyword group according to an embodiment of the present application;
[0063] Figure 7 is a schematic diagram of a keyword group according to an embodiment of the present application;
[0064] Figure 8 is a schematic diagram of acquiring a question based on a keyword group according to an embodiment of the present application;
[0065] Figure 9 is a schematic diagram of a possible display page according to an embodiment of the present application;
[0066] Figure 10 is a schematic diagram of another possible display page according to an embodiment of the present application;
[0067] Figure 11 is a schematic diagram of another possible display page according to an embodiment of the present application;
[0068] Figure 12 is a schematic diagram of remote supervision based on a screening interface according to an embodiment of the present application;
[0069] Figure 13 is a schematic diagram of an unknown question learning page according to an embodiment of the present application;
[0070] Figure 14 is a schematic diagram of a question and answer pair generation method according to an embodiment of the present application;
[0071] Figure 15 is a schematic diagram of candidate data processing effect according to an embodiment of the present application;
[0072] Figure 16 is a schematic diagram of online running effect according to an embodiment of the present application;
[0073] Figure 17 is a block diagram of a question and answer pair generation device according to an embodiment of the present application;
[0074] Figure 18 is a structural block diagram of a terminal according to an embodiment of the present application. DETAILED DESCRIPTION
[0075] In order to make the purpose, technical scheme and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0076] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The following description is made with reference to the accompanying drawings in which like reference numerals refer to like elements, and the term "exemplary" is used herein to mean "serving as an example, instance, or illustration." Unless otherwise noted, the description herein is not intended to be complete in every respect. Rather, it is merely illustrative of some aspects of the application consistent with the appended claims.
[0077] The terms "first", "second", and the like, used in the specification, unless otherwise specified, are terms of distinction used to identify one element from another, or to similarly distinguish one element from another. It will be understood that no logic or chronological dependency exists between the terms "first", "second", "third", etc. as such, and that the terms do not delineate a quantity or an order of execution. It will also be understood that, although the terms first, second, etc. are used herein to describe various elements, these elements should not be limited by the terms.
[0078] These terms are used merely for the purpose of distinguishing one element from another. For example, a first problem can be termed a second problem, and, similarly, a second problem can be termed a first problem, without departing from the scope of the various examples. First and second problems are both problems, and can in some cases be separate and distinct problems.
[0079] Wherein at least one refers to one or more than one, for example, at least one problem can be one problem, two problems, three problems, etc. any integer greater than or equal to one. And a plurality refers to two or more than two, for example, a plurality of problems can be two problems, three problems, etc. any integer greater than or equal to two.
[0080] The following briefly introduces the technical solutions that can be used in the question-answer pair generation scheme provided by the embodiments of the present application.
[0081] Artificial intelligence (AI) is the use of digital computers or digital computer-controlled machines 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 of computer science, which aims to understand the essence of intelligence and produce a new intelligent machine that can react 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.
[0082] Natural Language Processing (NLP) is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural Language Processing is a science that integrates linguistics, computer science, and mathematics. Therefore, the research in this field will involve natural language, i.e. the language used in daily life, so it is closely related to the study of linguistics. Natural Language Processing technology usually includes text processing, semantic understanding, machine translation, robot question and answer, knowledge graph, etc.
[0083] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is a subject that studies how computers simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structure to continuously improve their performance. Machine Learning is the core of artificial intelligence and the fundamental approach to making computers intelligent. Its applications are widespread in various fields of artificial intelligence. Machine Learning and Deep Learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
[0084] Deep Learning is a core part of Machine Learning, which usually includes artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning. Among them, Deep Learning is a new research direction in the field of Machine Learning.
[0085] With the research and progress of artificial intelligence technology, artificial intelligence technology has been researched and applied in many fields, such as common smart home, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned vehicles, autonomous vehicles, drones, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0086] Some key terms or abbreviations that may be involved in the embodiments of the present application are introduced below.
[0087] AI product: an artificial intelligence product developed using AI technology, which can interact intelligently with users, for example, the AI product and the user can realize question and answer dialogue, sensory interaction based on the user's instructions, etc. Optionally, the AI product is a smart robot, an intelligent question and answer platform, or an intelligent question and answer system, etc.
[0088] Question and answer: a question and answer with certain knowledge, also known as QA (Question and Answer).
[0089] User search statement (Query): includes the user's voice, text, picture input.
[0090] Recall: based on the input Query, match similar or identical questions in the database.
[0091] Entity: a basic unit used to represent a concept.
[0092] For example, when generating question and answer pairs in the field of "100,000 why", to recall related questions in the existing database, you need to obtain related keywords in the field, that is, entities, such as why, why, why, etc. Then use these keywords to recall questions. Illustratively, the entity "why" can recall all questions containing why, such as "Why is smoking harmful to health?", "Why don't people plant mulberry trees in front of their houses?", "Why do leaves fall?", "Why does red wine need to be decanted?", "Why don't passion fruits bloom?", "Why is the sword of ten thousand jin?", "Why does the head hurt?" and so on.
[0093] Bottom-up: refers to the situation in which the AI product cannot identify the intent of a Query in a task-based dialogue, so it answers in the form of a question and answer or a chat, making the AI product more intelligent. In the construction process of question and answer pairs, the number and quality of question and answer pairs are particularly important. In the process of developing AI products, the construction of bottom-up logic is often the key to determining the degree of intelligence of the product. Because in the user's experience process, questions that are "in the middle of the rules" such as "XX, how is the weather today" cannot fully satisfy the user's curiosity and the desire to communicate with AI. Users often ask some unique questions or knowledge-based questions, such as "XX, why is there a rainbow after the rain", "XX, why does the height increase after getting up in the morning", "XX, why was the Nibuchuo Treaty signed". If such user questions cannot be answered, the AI intelligent product will appear less intelligent, and users will lose interest in AI products and no longer want to interact and experience them. As can be seen, the construction of bottom-up logic is of unparalleled importance to an AI product.
[0094] Chat: refers to the user's non-specific intent to talk, and the AI product needs to be smart and interact with the user.
[0095] BERT (Bidirectional Encoder Representations from Transformers, Bidirectional Encoder Representations from Transformers): a language representation model that uses large-scale unlabeled corpus training to obtain semantic representation of text containing rich semantic information, and then fine-tunes the semantic representation of text in a specific NLP task. Finally, it is applied to the NLP task.
[0096] ES (Elasticsearch): a search server that provides a distributed, multitenant-capable full-text search engine. It is used in cloud computing, and can achieve real-time search, and is stable, reliable, fast, and easy to install and use.
[0097] Hive: a data warehouse tool for data extraction, transformation, and loading, which is a mechanism that can store, query, and analyze large-scale data stored in Hadoop (a distributed system infrastructure).
[0098] TF-IDF (Term Frequency-Inverse Document Frequency): a statistical method for evaluating the importance of a word to a file set or a file in a corpus. The importance of a word increases in direct proportion to the number of times it appears in a file, but decreases in inverse proportion to the frequency of its appearance in the corpus. Various forms of TF-IDF weighting are commonly used by search engines as a measure or rating of the relevance between files and user queries.
[0099] Topmine algorithm: an open-source keyword mining algorithm.
[0100] Alpha-Beta algorithm: a pruning algorithm used to prune unnecessary branches of the search tree that do not need to be searched to improve operation speed.
[0101] Filter: used to filter information, implement directed execution of code, and pre-process.
[0102] The implementation environment of the question and answer pair generation method provided in the embodiments of the present application is introduced as follows.
[0103] The question and answer pair generation method provided in the embodiments of the present application is applied to a computer device. Illustratively, the computer device is a terminal used by a developer.
[0104] Illustratively, Figure 1 is a schematic diagram of an implementation environment of the question and answer pair generation method provided in the embodiments of the present application. The implementation environment includes a terminal 101 and a server 102.
[0105] In the embodiments of the present application, the developer can develop the AI product based on the terminal 101, where the AI product can be applied to a specific field and has the function of intelligent conversation with the user. For example, the developer needs to develop an AI product capable of interacting with the user in the field of "100,000 why" to develop a question and answer interaction function required by the AI product. The developer needs to build a question and answer library matched with the field through the terminal 101.
[0106] In addition, the developer can perform question confirmation operation and answer editing operation on the terminal 101 to optimize the developed AI product. For example, the terminal 101 displays a question confirmation page, which displays the candidate questions with possible answers learned by the AI product, and then the developer confirms the questions with answers in the candidate questions through the click operation. In addition, the developer can also perform answer editing operation on the page to generate answers corresponding to the questions.
[0107] Optionally, the terminal 101 is a smart phone, a tablet computer, a notebook computer, a desktop computer, etc., but is not limited thereto. Optionally, the terminal 101 generally refers to one of a plurality of terminals, and the embodiments of the present application are only exemplified by the terminal 101. Those skilled in the art can know that the number of the above-mentioned terminal 101 can be more. For example, the above-mentioned terminal 101 is tens or hundreds, or more, and the implementation environment of the above-mentioned question and answer pair generation method also includes other terminals. The number and type of the terminal are not limited in the embodiments of the present application.
[0108] Optionally, the server 102 can be a stand-alone physical server, a server cluster or a distributed system composed of a plurality of physical servers, a cloud server providing cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN, and basic cloud computing services such as big data and artificial intelligence platform. The server 102 is used to provide data acquisition, data processing, and data storage services for the terminal 101.
[0109] Optionally, in the question and answer pair generation process, the server 102 undertakes the main computing work, and the terminal 101 undertakes the secondary computing work; or the server 102 undertakes the secondary computing work, and the terminal 101 undertakes the main computing work; or the server 102 or the terminal 101 can undertake the computing work separately.
[0110] In addition, the terminal 101 and the server 102 can be directly or indirectly connected through wired or wireless communication, which is not limited in the present application.
[0111] Optionally, the wireless or wired networks described above use standard communications technologies and / or protocols. The networks typically carry Internet traffic, but can also include private networks, such as local area networks (LANs) or wide area networks (WANs). Such networks can also encompass any combination of the Internet, a LAN, a MAN, a WAN, mobile, wired, or wireless networks, networks of virtual private networks, or any combination thereof. In some embodiments, data exchanged over the one or more networks is represented using technologies and / or formats including, but not limited to, Hypertext Markup Language (HTML), Extensible Markup Language (XML), and others. In addition, all or some links can be encrypted using conventional encryption technologies, such as the Secure Sockets Layer (SSL), Transport Layer Security (TLS), Virtual Private Networks (VPNs), Internet Protocol Security (IPsec), or others. In other embodiments, custom and / or proprietary data communications technologies and / or formats can be employed.
[0112] Exemplarily, the application scenarios of the question-answer pair generation method provided by the embodiments of the present application include, but are not limited to:
[0113] Scenario one, new question-answer library in any field
[0114] When a developer builds a question-answer library in a field, a large number of question-answer pairs conforming to the field are needed. Only when a large number of question-answer pairs exist in the question-answer library, can an AI product better match the qualified answers from the question-answer library and feed back to the user. For example, the developer needs to build a question-answer library for the field of "100,000 whys", and then the developer needs a large number of questions and answers related to "100,000 whys".
[0115] It can be understood that the question-answer pair generation method provided by the embodiments of the present application can be applied to any field, and is not limited to the fields of the above examples. In other words, based on the question-answer pair generation method provided by the embodiments of the present application, a question-answer library in any field can be newly built.
[0116] Scenario two, mining and supplementing the existing question-answer library
[0117] Developers may need to update and expand the question and answer pairs in the existing question and answer library in a timely manner to enable the question and answer library to cover all questions and answers involved in a certain field as much as possible. For example, the existing question and answer library in the sports field stores the following question and answer pair: the question is "What is the host country of the next Olympic Games?", and the answer is "XX country". As time goes by, when the XX country has hosted the Olympic Games, the question needs to be updated in a timely manner to conform to the current facts.
[0118] Figure 2 A flowchart of a question and answer pair generation method according to an embodiment of the present application is shown in FIG. 1. The present embodiment takes a terminal used by a developer as an example for illustration. The method comprises the following steps: Figure 2
[0119] 201. Obtain a target question set, and perform semantic classification on each question in the target question set to obtain a first question set and a second question set. The first question set is similar to the question content of an existing question in a database, and the second question set is not similar to the question content of the existing question.
[0120] In the present embodiment, the questions in the target question set refer to questions received by an AI product in a target field during online operation.
[0121] The target field refers to a field for which a question and answer pair needs to be generated. For example, the target field is an online classroom field, and an AI product developed based on the online classroom field can timely answer academic questions raised by students or teaching questions raised by teachers, etc. For another example, the target field is a knowledge encyclopedia field, and an AI product developed based on the knowledge encyclopedia field can timely answer encyclopedia questions raised by users. The present embodiment does not limit the type of the target field.
[0122] The first question set refers to a type of question for which the AI product in the target field does not output an answer during online operation, and the question content of an existing question in the database is similar to the question. The first question set is also referred to as a similar question set.
[0123] The second question set refers to a type of question for which the AI product in the target field does not output an answer during online operation, and the question content of an existing question in the database is not similar to the question. This type of question is a question that the AI product cannot recognize or belongs to new knowledge in the target field, i.e., this type of question may belong to the target field or may be a question randomly input by a user and irrelevant to the target field. The second question set is also referred to as an unknown question set.
[0124] The database is used to store the question and answer pairs of the target field. Optionally, the database is a question and answer database of the target field, and is used to store only the question and answer pairs of the target field. Optionally, the database can also store question and answer pairs of multiple fields. Embodiments of the present application do not limit the form of the database.
[0125] 202. For a first question in the first question set, a first candidate question set is obtained from the database; a first question and answer pair is generated based on the first candidate question set; wherein the first question is similar to the question content of the first candidate question set.
[0126] In embodiments of the present application, the first candidate question in the first candidate set refers to a type of existing question in the database that is similar in question content to the first question. The first question and answer pair includes the first question and the answer matched thereto.
[0127] 203. For a second question in the second question set, a second candidate question set is obtained from the second question set based on the keyword group of the target field; a second question and answer pair is generated based on the second candidate question set.
[0128] In embodiments of the present application, the keyword group refers to a commonly used word group in the target field or an important word group in the target field. The second candidate question in the second candidate set refers to a type of second question that can belong to the target field. The second question and answer pair includes the second candidate question and the answer matched thereto.
[0129] In embodiments of the present application, an automatic question and answer pair generation method is provided. When generating question and answer pairs of a certain field, the collected questions are first classified using semantic classification to obtain two question sets; then, the questions in the two question sets are processed differently, and finally, two types of question and answer pairs matched to the two question sets are generated based on the keyword group of the field and the database. This way of classifying and processing questions can generate high-quality question and answer pairs in a targeted manner. In addition, since the process of generating question and answer pairs is basically automated, the efficiency of generating question and answer pairs is greatly improved, and the task of building a question and answer database of any field or the task of supplementing and mining an existing question and answer database can be quickly completed.
[0130] Figure 2 The flowchart shown is only a brief flow of the question and answer pair generation method provided by embodiments of the present application. Next, embodiments of the question and answer pair generation method provided by the present application will be described in detail. Figure 3
[0131] Figure 3 is a flowchart of another question and answer pair generation method provided by embodiments of the present application, as shown in Figure 3 The method includes the following steps:
[0132] 301、based on the online log of the target domain, obtain a target question set.
[0133] In the embodiment of the present application, the online log refers to the log information of the AI product in the target domain when the AI product is running online, including the question received by the AI product based on the user input, the answer output based on the question of the user input, and the like. Among them, the input of the user includes but is not limited to text, picture and voice input, and the output of the AI product includes but is not limited to text, picture and voice output, which is not limited in the embodiment of the present application.
[0134] Optionally, the terminal sends an online log acquisition request to the server, the online log acquisition request carrying a domain identifier of the target domain, the server sends the online log belonging to the target domain to the terminal based on the received online log acquisition request, and then the terminal extracts the target question set from the received online log.
[0135] Optionally, the terminal sends a target question set acquisition request to the server, the target question set acquisition request carrying a domain identifier of the target domain, the server extracts the target question set from the online log in the target domain based on the received target question set acquisition request, and then sends the target question set to the terminal.
[0136] The embodiment of the present application does not limit the way the terminal obtains the target question set.
[0137] 302、perform semantic classification on each question in the target question set to obtain a first question set and a second question set, the first question set being similar to the question content of the existing question in the database, and the second question set being not similar to the question content of the existing question, the database being used to store the question and answer pair in the target domain.
[0138] In the embodiment of the present application, the terminal performs semantic classification on each question in the target question set based on the question classification model. Optionally, the question classification model is a BERT similarity scoring model, which is used to score the similarity between two questions.
[0139] The specific implementation of the present step is described below, including the following steps 3021 and 3022:
[0140] 3021、for any one question in the target question set, obtain the semantic similarity between the any one question and the existing question.
[0141] In the embodiment of the present application, the terminal inputs any one question in the target question set into the retrieval engine, the retrieval engine recalls the existing question with the highest similarity in the database based on the received question, and then the terminal inputs the any one question and the recalled existing question into the question classification model, and the question classification model performs semantic analysis on the two questions to obtain the semantic similarity between the two questions. Optionally, the retrieval engine is Hive or ES, and the embodiment of the present application does not limit this.
[0142] Optionally, the semantic similarity is expressed as a score, the BERT similarity scoring model performs semantic analysis on any one question in the target question set and the existing question to score the similarity between the two questions, so as to obtain the semantic similarity between the two questions.
[0143] For example, one question in the target question set is “why is there a rainbow after rain”, and the recalled existing question in the database is “why is there a rainbow after rain”. The BERT similarity scoring model scores the similarity between the two questions, and the semantic similarity is 0.9.
[0144] For another example, one question in the target question set is “why is there a rainbow after rain”, and the recalled existing question in the database is “why is there a rainbow after rain”. The BERT similarity scoring model scores the similarity between the two questions, and the semantic similarity is 0.7.
[0145] For another example, one question in the target question set is “why is there a rainbow after rain”, and the recalled existing question in the database is “why is there a rainbow after rain”. The BERT similarity scoring model scores the similarity between the two questions, and the semantic similarity is 0.7.
[0146] 3022、In response to the obtained semantic similarity being in the first interval, the any one question is added to the first question set; and in response to the obtained semantic similarity being in the second interval, the any one question is added to the second question set.
[0147] In the embodiment of the present application, the first interval and the second interval are two intervals pre-set by the terminal, which are used to distinguish the types of questions based on the semantic similarity. After the terminal obtains the semantic similarity, the interval in which the semantic similarity is located is determined, and the question corresponding to the semantic similarity is added to the corresponding question set based on the interval in which the semantic similarity is located.
[0148] Optionally, the first and second intervals can be represented as score intervals. For example, the first interval is 0.6 to 0.8, including 0.6 and 0.8, and the second interval is less than 0.6. If the terminal obtains a semantic similarity of 0.7, the question corresponding to that semantic similarity is added to the first question set; if the terminal obtains a semantic similarity of 0.5, the question corresponding to that semantic similarity is added to the second question set. It should be noted that the embodiments of this application do not limit the values of the first and second intervals.
[0149] The following is combined Figure 4 The following is an exemplary description of this step, such as... Figure 4 As shown, when an AI product in the target domain runs online, upon receiving a user's input question, the BERT similarity scoring model scores the similarity between that question and existing questions, with the scoring range from 0 to 1. If the score is greater than 0.8, the answer is directly output to the user; if the score is between 0.6 and 0.8, it indicates that a similar question exists in the database, but the semantic similarity between the two questions has not yet reached the requirement for online answer output, and this question is called a similar question; if the score is less than 0.6, it indicates that no similar question exists in the database, and the BERT similarity scoring model cannot identify the question or cannot give it a high score, and this question is called an unknown question.
[0150] 303. For the first question in the first question set, retrieve the first candidate question set from the database, wherein the content of the first question is similar to that of the first candidate question set.
[0151] In this embodiment of the application, as can be seen from the above description, existing questions with similar content to the first question can be found in the database. In this step, the terminal recalls a type of existing questions similar to the first question from the database based on the first question, and obtains a first candidate question set.
[0152] Optionally, this step may include detailed steps 3031 to 3034:
[0153] 3031. Based on the first question, obtain a third set of candidate questions from the database; wherein the content of the first question is similar to that of the third set of candidate questions.
[0154] In the embodiment of the present application, the terminal inputs each first question in the first question set into the retrieval engine respectively, and the retrieval engine respectively recalls a target number of existing questions in the database based on each received first question, to obtain a third candidate question set matched with each first question. When recalling, the retrieval engine scores the similarity between the first question and the existing question according to the character matching between the first question and the existing question, and sorts according to the score.
[0155] Optionally, the terminal pre-sets the target number, for example, sets the target number as 20, that is, the retrieval engine recalls the existing questions with the top 20 similarity scores with the received first question in the database. For example, the first question is “why to list on XXXX”, the retrieval engine recalls 20 existing questions with similar question contents in the database, including “why to list on XXXX”, “why to list on XXXX” … “why to list on XXXX”, and the 20 existing questions are the third candidate question set.
[0156] 3032, obtain the semantic similarity between the first question and each question in the third candidate question set.
[0157] In the embodiment of the present application, the terminal performs semantic analysis on each first question and each question in the third candidate question set matched with the first question based on the question classification model, to obtain the semantic similarity. For example, there are 20 existing questions in a third candidate question set matched with a first question, and the terminal scores the similarity between the first question and the 20 existing questions based on the BERT similarity scoring model, to obtain 20 semantic similarities of the first question.
[0158] 3033, sort the obtained semantic similarities from large to small.
[0159] 3034, generate a first candidate question set according to the questions with the top N positions in the semantic similarity sorting, and N is a positive integer.
[0160] In the embodiment of the present application, the terminal obtains the existing questions corresponding to the top N positions in the semantic similarity sorting based on the semantic similarity sorting of the first question, and generates a first candidate question set from the N existing questions. For example, there are 20 existing questions in the third candidate set, N is 5, the terminal obtains 20 semantic similarities of the first question, sorts from large to small, and finally generates a first candidate question set from the existing questions with the top 5 positions.
[0161] It should be noted that the steps 3031 to 3033 are a possible implementation provided in the step 303, that is, the terminal performs coarse recall on the first question through the search engine to obtain a target number of existing questions, and then obtains semantic similarity between the first question and the existing questions based on the question classification model, and finally screens N existing questions as the first candidate question set.
[0162] In some embodiments, the terminal can perform coarse recall on the first question through the search engine to obtain a target number of existing questions, and directly take the existing questions as the first candidate question set. The embodiments of the present application do not limit the way of obtaining the first candidate question set.
[0163] 304, generating a first question and answer pair based on the first candidate question set.
[0164] In the embodiments of the present application, the first question and the asking content of the first candidate question set are similar, which indicates that the answer to the first question and the answer matched by the set are also similar. The first candidate question set is an existing question obtained from the database, which indicates that there is a matched answer to the existing question in the database. Therefore, the terminal can directly obtain the answer to the first question based on the existing question in the first candidate question set to generate the first question and answer pair.
[0165] The implementation of the present step will be described in detail below, including the following steps 3041 to 3043.
[0166] 3041, displaying a first page including the first candidate question set on the first page.
[0167] In the embodiments of the present application, the terminal displays the first page in response to the clicking operation of the developer on the first page display control on the target page, and the first candidate question set is included on the first page. The target page is used to provide various development functions of the AI product.
[0168] Reference Figure 5 , Figure 5 The similar question learning page, that is, the first page, is shown in FIG. 11. Figure 5 The various function controls shown on the left side of FIG. 11 are used to provide various development functions of the AI product, and the developer can switch pages by clicking different function controls to realize different development functions. Figure 5 The similar question learning page shown in FIG. 11 is obtained by the developer through the clicking operation of the “similar question learning” control.
[0169] On the similar question learning page, the question to be associated is the first question in the embodiment of the application, that is, the similar question, and the recommended standard question is the first candidate question set in the embodiment of the application. The similar questions are sorted according to the online occurrence times.
[0170] It should be noted that, Figure 5 The similar question learning page shown is only illustrative, and in actual application, the layout of the page can be adjusted according to the needs of the developer, and the function controls on the page can also be set according to the needs of the developer. The display form of the similar question learning page is not limited in the embodiment of the application.
[0171] 3042. In response to the selection operation on the first candidate question in the first candidate question set, the first candidate answer matched with the first candidate question is obtained from the database.
[0172] In the embodiment of the application, the terminal obtains the first candidate question in response to the selection operation of the developer on the first candidate question in the first candidate question set on the first page, and then inputs the first candidate question into the search engine, so that the search engine obtains the first candidate answer matched with the first candidate question from the database.
[0173] For example, continuing to refer to Figure 5 , the question to be associated is "Why go public on XXXX", and the recommended standard question has a total of 5, including "Why go public on XXXX", "Why go public on XXXX", "Why go public on XXXX", "Why go public on XXXX", and "Why go public on XXXX". The developer performs the selection operation on the question "Why go public on XXXX" on the similar question learning page, and the terminal obtains the answer "because the AA of XXXX is better" matched with the question in response to the selection operation.
[0174] 3043. The first question and answer pair is generated based on the first question and the first candidate answer.
[0175] In the embodiment of the application, the first question corresponds to the first candidate question set. After the developer selects the first candidate question based on the above step 3042, it is considered that the answer to the first question is the same as the answer to the first candidate question. The terminal generates the first question and answer pair based on the first question and the first candidate answer obtained in the above step 3042.
[0176] For example, continuing to refer to Figure 5 , Figure 5The question to be associated is "why go public on XXXX", the question selected by the developer is "why go public on XXXX", and the first candidate answer obtained by the terminal is "because the AA of XXXX is better". Based on this, the terminal generates a first question-answer pair between "why go public on XXXX" and "because the AA of XXXX is better".
[0177] Through the steps 303 to 304, the terminal mines similar existing questions in the database based on each first question in the first question set, and displays the similar existing questions on the first page for the developer to bind, and the answers of the similar existing questions are all existing, so that the developer can automatically obtain the answer of the first question as long as the developer binds the existing question corresponding to the first question, and the generation efficiency of the question-answer pair is greatly improved.
[0178] 305, obtaining a keyword group of the target field.
[0179] In the embodiment of the present application, the keyword group refers to a commonly used word group in the target field or an important word group in the target field. The specific implementation of obtaining the keyword group of the target field is described below, including the following steps 3051 to 3053:
[0180] 3051, determining a candidate word group based on the existing questions in the database, and obtaining the word frequency of each word in the candidate word group.
[0181] In the embodiment of the present application, the terminal obtains the existing questions of the target field from the database, obtains the candidate word group through a word group mining algorithm, preliminarily screens the candidate word group through a pruning algorithm, and then obtains the word frequency of each word in the candidate word group through a word frequency statistical algorithm based on the candidate word group after the preliminary screening. Optionally, the word group mining algorithm is an open source Topmine algorithm, the pruning algorithm is an Alpha-Beta algorithm, and the word frequency statistical algorithm is a TF-IDF algorithm. The embodiment of the present application does not limit the above-mentioned algorithms.
[0182] 3052, determining a candidate word in the candidate keyword group according to the word frequency of each word.
[0183] In the embodiment of the present application, the terminal determines the word meeting the word frequency threshold as the candidate word based on the word frequency of each word. Optionally, the terminal pre-sets the word frequency threshold. It should be noted that the word frequency threshold can be set according to the needs of the developer for different target fields, and the embodiment of the present application does not limit the value of the word frequency threshold.
[0184] 3053, taking the candidate word group including the candidate word in the candidate word group as the keyword group.
[0185] In this embodiment, the terminal, based on the candidate words obtained in step 3052, performs reverse filtering on the candidate word groups through a filter; that is, it determines the candidate word groups that include the candidate words as keyword groups. Optionally, the filter is a Filter. For example, if the candidate word groups obtained in step 3051 are "students watching", "teachers watching", "student devices", and "device settings", and the candidate words obtained in step 3052 are "students" and "teachers", then the keyword groups obtained in this step 3053 are "students watching", "teachers watching", and "student devices".
[0186] The following is combined Figure 6 and Figure 7 The specific implementation method of this step is explained as follows:
[0187] refer to Figure 6 , Figure 6 This is a flowchart illustrating a process for obtaining keyword phrases according to an embodiment of this application, such as... Figure 6 As shown, for the target domain, existing questions in that domain are retrieved from the database. Then, the Topmine algorithm is used for phrase mining to obtain candidate phrases. After preliminary screening of the candidate phrases using the Alpha-Beta pruning algorithm, the TF-IDF algorithm is used to count the word frequencies of each word in the candidate phrases to obtain candidate words. Finally, a Filter algorithm is used to perform reverse screening of the candidate phrases to obtain the final candidate words. Figure 7 The keyword phrase shown.
[0188] 306. For the second question in the second question set, based on the keyword group of the target domain, obtain a second candidate question set from the second question set.
[0189] In this embodiment, as described above, there are no existing questions in the database with content similar to the second question. These questions may be new knowledge in the target domain, or they may not belong to the target domain at all. In this step, the terminal filters these questions based on keyword groups in the target domain to obtain a second candidate question set. The questions in this second candidate question set are those that may belong to the target domain.
[0190] The specific implementation method of this step is described in detail below, including the following steps 3061 to 3063:
[0191] 3061. Based on the keyword group of the target domain, obtain the fourth candidate question set from the second question set.
[0192] In the embodiment of the present application, the terminal inputs the keyword group into the search engine, the search engine performs matching in the second question set based on the received keyword group, and feeds back the matched second question to the terminal, that is, obtains the fourth candidate question set. The questions in the fourth candidate question set are questions that may belong to the target domain after preliminary screening. For details, refer to Figure 8 As shown in Figure 8 For example, the keyword group is "student watch", and by matching the keyword group in the corpus to be mined, the positive sample "how to view student watch duration" is obtained. For another example, the keyword group is "teacher registration", and by matching the keyword group in the corpus to be mined, the positive sample "how does a teacher complete classroom registration" is obtained. The positive sample refers to the corpus that actually belongs to the target domain.
[0193] 3062. Call the screening interface to screen the questions in the fourth candidate question set that meet the target condition.
[0194] In the embodiment of the present application, the terminal obtains the fourth candidate question set based on the above step 3061, but there may be some questions in this set that are not human's utterances, or there is no corresponding answer. For example, a question in the fourth candidate question set is "to watch the student landscape", which contains the keyword group "student watch", but this sentence is not a smooth human utterance. For another example, a question in the fourth candidate set is "third grade in primary school", which contains the keyword group "primary school grade", but this sentence is not actually a question and there is no answer.
[0195] Therefore, in this step, the terminal calls the screening interface to further screen the questions in the fourth candidate question set to determine whether these questions are human's utterances and whether these questions have answers. The screening interface can intelligently complete, similarly recommend, and obtain answers matching the question input by the user.
[0196] Optionally, the screening interface is an open source interface, for example, the screening interface is a suggestion interface, which is an intelligent completion and suggestion interface for the search statement input by the user.
[0197] The target condition in this step is described in detail below. For any question in the fourth candidate question set, the target condition includes any one of the following conditions:
[0198] Case 1: Any question appears in the fifth candidate question set; wherein the fifth candidate question set is obtained based on the screening interface.
[0199] The terminal inputs the arbitrary question based on the screening interface, and can obtain a fifth candidate question set corresponding to the arbitrary question. If the fifth candidate question set contains the arbitrary question, it is determined that the arbitrary question meets the target condition.
[0200] For a detailed understanding of case one, Figure 9 For a detailed understanding of case one, Figure 9 As shown in FIG. 6, for example, the arbitrary question is "How to deal with the computer without sound", and the fifth candidate question set obtained based on the screening interface includes "Computer without sound", "How to deal with the computer without sound", "What is the reason for the computer without sound", and "What is the matter with the computer without sound". In this case, the arbitrary question appears in the fifth candidate question set, and thus the arbitrary question meets the target condition. Figure 9 Case two: an answer to the arbitrary question is obtained based on the screening interface.
[0201] The terminal inputs the arbitrary question based on the screening interface, and can obtain an answer corresponding to the arbitrary question. It is determined that the arbitrary question meets the target condition.
[0202] For a detailed understanding of case two,
[0203] For a detailed understanding of case two, Figure 10 As shown in FIG. 7, for example, the arbitrary question is "How to deal with the computer without sound", and the answer to the arbitrary question is directly displayed on the page. Figure 10 Figure 10 Case three: a sixth candidate question set is obtained based on the screening interface, and the arbitrary question is similar to the question content of the sixth candidate question set.
[0204] The terminal inputs the arbitrary question based on the screening interface, and can obtain a sixth candidate question set corresponding to the arbitrary question. The terminal obtains semantic similarities between the arbitrary question and questions in the sixth candidate question set based on a question classification model. If an arbitrary semantic similarity obtained meets a similarity threshold, the arbitrary question meets the target condition. For example, the similarity threshold is 0.6, which is not limited in the embodiments of the present application.
[0205] For a detailed understanding of case three, For a detailed understanding of case three,
[0206] As shown in FIG. 8, for example, the arbitrary question is "How to deal with the computer without sound", and the sixth candidate question set obtained based on the screening interface includes "Computer without sound", "How to deal with the computer without sound", "What is the reason for the computer without sound", and "What is the matter with the computer without sound". In this case, the arbitrary question appears in the sixth candidate question set, and thus the arbitrary question meets the target condition. Figure 11 Figure 11 As shown in FIG. 8, for example, the arbitrary question is "How to deal with the computer without sound", and the sixth candidate question set obtained based on the screening interface includes "Computer without sound", "How to deal with the computer without sound", "What is the reason for the computer without sound", and "What is the matter with the computer without sound". In this case, the arbitrary question appears in the sixth candidate question set, and thus the arbitrary question meets the target condition. Figure 11 As shown, for example, if the question is "What should I do if my computer has no sound?", the sixth candidate question set obtained based on the filtering interface includes "How to solve the problem of no sound on the computer", "I don't know why my computer can't make a sound", and "Maybe the computer has no sound". In this case, the terminal obtains the semantic similarity between the question and these three questions. The obtained semantic similarities are 0.8, 0.7 and 0.5 respectively, where the similarity threshold is 0.6. Therefore, the question satisfies the target condition.
[0207] 3063. Generate the second candidate problem set based on the problems in the fourth candidate problem set that satisfy the target conditions.
[0208] Based on steps 3061 and 3062 above, the terminal selects questions that meet the target conditions from the fourth candidate question set to obtain the second candidate question set.
[0209] Additionally, please refer to the following for details. Figure 12 Understand the specific implementation method of this step. For example... Figure 12 As shown, for the fourth candidate question set, the filtering interface is called to filter the questions in the set. "Subset contains" corresponds to case one in step 3062 above, "has an answer or graph answer" corresponds to case two in step 3062 above, and "no to all of the above but similarity threshold > 0.6" corresponds to case three in step 3062 above. If a question in the fourth candidate question set does not meet any of the above three conditions, then the question is filtered out.
[0210] It should be noted that steps 3062 and 3063 described above are one possible implementation of this step. In some embodiments, the terminal only executes step 3061, that is, obtains a fourth candidate question set from the second question set through the search engine. This second candidate question set is also known as the second candidate question set. This application embodiment does not limit the method of obtaining the second candidate question set.
[0211] 307. Generate a second question-answer pair based on the second candidate question set.
[0212] In this embodiment, the terminal filters the questions in the second question set to obtain a second candidate question set. The questions in this second candidate set are those that may belong to the target domain. Some of these second questions can be answered directly through the filtering interface, while others require manual editing to generate answers.
[0213] The implementation method of this step is explained in detail below, including the following steps 3071 to 3073:
[0214] 3071、displaying a second page, the second page including the second candidate question set.
[0215] In the embodiment of the present application, the terminal displays the second page in response to the click operation of the developer on the target page on the second page display control, and the second page includes the second candidate question set.
[0216] Reference Figure 13 , Figure 13 The unknown question learning page shown in FIG. 6 is the second page, that is, the second page that the developer obtains through the click operation on the “unknown question learning” control. Figure 13 The function controls shown in the left of FIG. 6 are used to provide various development functions of the AI product, and the developer can switch pages by clicking different function controls to achieve different development functions. Figure 13 The unknown question learning page shown in FIG. 6 is the second page that the developer obtains through the click operation on the “unknown question learning” control. On the unknown question learning page, the questions displayed in the “unknown question” column are the “second candidate question set”, and each unknown question is sorted according to the number of online occurrences.
[0217] It should be noted that Figure 13 The unknown question learning page shown in FIG. 6 is only illustrative, and in actual application, the layout of the page can be adjusted according to the needs of the developer, and the function controls on the page can be set according to the needs of the developer. The display form of the unknown question learning page is not limited in the embodiment of the present application.
[0218] 3072、in response to a selection operation on a second candidate question in the second candidate question set, calling a screening interface to obtain a second candidate answer matched with the second candidate question from a third party.
[0219] In the embodiment of the present application, the terminal obtains the second candidate question in response to the selection operation of the developer on the second page on the second candidate question set, and calls the screening interface to obtain the second candidate answer matched with the second candidate question from the third party.
[0220] For example, continuing to refer to Figure 13 , the “unknown question” column in the figure includes four unknown questions: “Why is XXXX listed”, “Why is there a rainbow after the rain”, “Why is there no sound on the computer”, and “How do students watch teaching videos”. Assuming that the target field is the “100,000 why” field, the developer performs a selection operation on the first three questions on the unknown question learning page, and the terminal obtains the three unknown questions in response to the selection operation and calls the screening interface to obtain the candidate answers matched with them from the third party.
[0221] In some embodiments, the step 3072 can be replaced by: in response to the selection operation on the second candidate question in the second candidate question set, editing the input answer content as a second candidate answer matched with the second candidate question.
[0222] In these embodiments, the terminal displays an answer editing window of the second candidate question in response to the selection operation of the second candidate question in the second candidate question set by the developer on the second page, and the developer can input an answer in the window. The terminal obtains the second candidate answer in response to the answer editing content input by the developer.
[0223] In other embodiments, the terminal can obtain the second candidate answer in combination with the two implementation manners of the step 3072. For example, the terminal calls the screening interface in response to the selection operation on the second candidate question in the second candidate question set, attempts to obtain the second candidate answer matched with the second candidate question from the third party, and displays the answer editing window for the developer to input the second candidate answer if the second candidate answer cannot be obtained.
[0224] The embodiments of the present application do not limit the manner of obtaining the second candidate answer.
[0225] 3073. Generating a second question and answer pair based on the second candidate question and the second candidate answer.
[0226] In the embodiments of the present application, the terminal generates a second question and answer pair based on the second candidate question and the second candidate answer obtained in the step 3072.
[0227] For example, continuing to refer to the unknown questions selected by the developer in the Figure 13 , Figure 13 terminal obtains candidate answers based on the three unknown questions, and then generates a second question and answer pair corresponding to each of the three unknown questions.
[0228] Through the steps 305 to 307, the terminal performs preliminary screening on each second question in the second question set based on the keyword group of the target domain, and then calls the screening interface for further screening, thereby increasing the number of questions in the unknown question set that belong to the target domain, facilitating the developer to confirm the questions that belong to the target domain, and greatly improving the generation efficiency of the question and answer pair.
[0229] In addition, it should be noted that the steps 303 to 304 and the steps 305 to 307 are performed synchronously. That is, the terminal processes the questions in the first question set and the second question set respectively after obtaining the two question sets to obtain the corresponding question and answer pairs.
[0230] 308、store the first question-answer pair and the second question-answer pair into a database.
[0231] In the embodiment of the present application, the terminal stores the first question-answer pair and the second question-answer pair in the database after generating the question-answer pairs. Alternatively, the terminal sends a question-answer pair storage request to the server, where the question-answer pair storage request carries the field identifier of the target field and the question-answer pairs, and the server stores the question-answer pairs in the database corresponding to the target field based on the received question-answer pair storage request. The embodiment of the present application does not limit the way of storing the question-answer pairs.
[0232] 309、train the question classification model based on a training corpus, where the training corpus includes the first question-answer pair and the second question-answer pair.
[0233] In the embodiment of the present application, the terminal inputs the first question-answer pair and the second question-answer pair as a training corpus into the question classification model, and trains the question classification model to improve the accuracy and learning ability of the question classification model. In this way, an iterative closed-loop mechanism of "model-corpus-model" online learning is formed, which improves the accuracy of the model and the generation efficiency of the question-answer pairs.
[0234] In the embodiment of the present application, an automatic question-answer pair generation method is provided. For a question that needs to generate a question-answer pair, a semantic classification method is used to classify the question to obtain a similar question set and an unknown question set. For the similar question set, similar existing questions are mined in the database, and the existing questions are displayed on a page for a developer to bind. The answers of the existing questions are all existing, and as long as the developer binds an existing question corresponding to a similar question, the answer of the similar question can be automatically obtained. For the unknown question set, the questions in the set are preliminarily screened based on the keywords of the target field, and then further screened by calling a screening interface, which improves the number of questions in the unknown question set that belong to the target field, and facilitates the developer to confirm the questions that belong to the target field. Through this classification processing method, high-quality question-answer pairs can be generated in a targeted manner. Since the process of generating the question-answer pairs is basically automated, the generation efficiency of the question-answer pairs is greatly improved, and the task of building a question-answer library of any field or the task of supplementing and mining an existing question-answer library can be quickly completed. In addition, the question-answer pair generation method provided in the embodiment of the present application can be applied to the development of an AI product, and perfect bottom logic can be achieved to effectively answer any question raised by a user.
[0235] The question-answer pair generation method provided in the embodiment of the present application will be described below in conjunction with Figure 14 Figure 14 is a schematic diagram of a question and answer pair generation method provided by an embodiment of the present application.
[0236] As shown in Figure 14 After the terminal obtains the target question set of the target field, the terminal matches similar existing questions in the database through a Hive data warehouse or an ES; then a BERT similarity scoring model is used to classify the questions in the target question set, and two types of questions are obtained, which are similar questions and unknown questions.
[0237] For similar questions, the terminal recalls similar existing questions from the database through an ES, and then a BERT similarity scoring model is used to sort the recalled existing questions, and candidate existing questions are selected for selection and confirmation by a developer, that is, manual intervention.
[0238] For unknown questions, the terminal obtains keyword groups of the target field, and uses the keyword groups to filter such unknown questions. Further, remote supervision is performed through a filtering interface, and candidate unknown questions are selected for selection and confirmation by a developer, that is, manual intervention.
[0239] By using different processing methods for the two types of questions, question and answer pairs are generated, a final corpus is formed, and the latest corpus is periodically pulled as a training sample to train the BERT similarity scoring model.
[0240] The effects of the question and answer pair generation method provided by the embodiments of the present application will be described schematically below. Figure 15 and Figure 16 The effects of the question and answer pair generation method provided by the embodiments of the present application will be described schematically below.
[0241] Figure 15 is a candidate data processing effect schematic diagram provided by an embodiment of the present application. The results show that the question and answer pair generation method provided by the embodiments of the present application, that is, "keyword group + remote supervision", can greatly reduce the processing amount of candidate data, reduce the amount of artificial unprocessable data from the order of magnitude of millions to the order of magnitude of thousands of artificial processable data. At the same time, the use of the question and answer pair generation method provided by the embodiments of the present application can achieve a candidate data usability rate of 73.03%, greatly improving the generation efficiency of question and answer pairs.
[0242] Figure 16 is a schematic diagram of an online running effect provided by an embodiment of the present application. As shown in the figure, using the question and answer pair generation method provided by the embodiments of the present application, the online data has increased by 188% compared with the previous year in the three months from the beginning of April to the end of June, and the real proportion on the line has also achieved very good results, effectively expanding the number of question and answer pairs.
[0243] Figure 17is a block diagram of a question and answer pair generation apparatus according to an embodiment of the present application. The apparatus is configured to perform the steps of the question and answer pair generation method described above, with reference to Figure 17 The apparatus comprises an acquisition module 1701, a first question and answer pair generation module 1702, and a second question and answer pair generation module 1703.
[0244] The acquisition module 1701 is configured to acquire a target question set, perform semantic classification on each question in the target question set, and obtain a first question set and a second question set. The first question set is similar to the asking content of an existing question in a database, and the second question set is not similar to the asking content of the existing question. The database is configured to store question and answer pairs of a target domain.
[0245] The first question and answer pair generation module 1702 is configured to, for a first question in the first question set, acquire a first candidate question set from the database, and generate a first question and answer pair based on the first candidate question set. The first question is similar to the asking content of the first candidate question set.
[0246] The second question and answer pair generation module 1703 is configured to, for a second question in the second question set, acquire a second candidate question set from the second question set based on a keyword group of the target domain, and generate a second question and answer pair based on the second candidate question set.
[0247] In an optional implementation, the first question and answer pair generation module 1702 is configured to:
[0248] display a first page, the first page comprising the first candidate question set;
[0249] in response to a selection operation on a first candidate question in the first candidate question set, acquire a first candidate answer matching the first candidate question from the database;
[0250] generate a first question and answer pair based on the first question and the first candidate answer.
[0251] In an optional implementation, the second question and answer pair generation module 1703 is configured to:
[0252] display a second page, the second page comprising the second candidate question set;
[0253] in response to a selection operation on a second candidate question in the second candidate question set, call a screening interface to acquire a second candidate answer matching the second candidate question from a third party;
[0254] generate the second question and answer pair based on the second candidate question and the second candidate answer.
[0255] In an optional implementation, the second question-answer pair generation module 1703 is configured to:
[0256] display a second page, the second page including the first candidate question set;
[0257] in response to a selection operation on a second candidate question in the second candidate question set, edit the input answer content as a second candidate answer matching the second candidate question;
[0258] generate a second question-answer pair based on the second candidate question and the second candidate answer.
[0259] In an optional implementation, the acquisition module 1701 is configured to:
[0260] acquire the target question set based on the online log of the target domain;
[0261] for any one question in the target question set, acquire a semantic similarity between the any one question and the existing question;
[0262] in response to the acquired semantic similarity being in a first interval, add the any one question to the first question set;
[0263] in response to the acquired semantic similarity being in a second interval, add the any one question to the second question set.
[0264] In an optional implementation, the first question-answer pair generation module 1702 is configured to:
[0265] acquire a third candidate question set from the database based on the first question, wherein the first question is similar to the asking content of the third candidate question set;
[0266] acquire a semantic similarity between the first question and each question in the third candidate question set, and sort the acquired semantic similarities in descending order;
[0267] generate the first candidate question set according to the questions in the first N positions of the semantic similarity sorting, N being a positive integer.
[0268] In an optional implementation, the second question-answer pair generation module 1702 includes:
[0269] a first acquisition unit configured to acquire a keyword group of the target domain;
[0270] a second acquisition unit configured to acquire a fourth candidate question set from the second question set based on the keyword group;
[0271] The screening unit is configured to invoke a screening interface to screen questions in the fourth candidate question set that meet a target condition.
[0272] The generating unit is configured to generate the second candidate question set according to the questions in the fourth candidate question set that meet the target condition.
[0273] In an optional implementation, the first obtaining unit is configured to:
[0274] determine a candidate word group in the database, and obtain a word frequency of each word in the candidate word group;
[0275] determine a candidate word in the candidate word group according to the word frequency of each word;
[0276] include the candidate word group including the candidate word in the candidate word group as the keyword group.
[0277] In an optional implementation, for any one question in the fourth candidate question set, the target condition includes any one of the following:
[0278] The any one question appears in a fifth candidate question set, where the fifth candidate question set is obtained based on the screening interface;
[0279] an answer of the any one question is obtained based on the screening interface;
[0280] a sixth candidate question set is obtained based on the screening interface, and the any one question is similar to a question content of the sixth candidate question set.
[0281] In an optional implementation, the apparatus further includes:
[0282] The storage module is configured to store the first question-answer pair and the second question-answer pair to the database.
[0283] In an optional implementation, the apparatus further includes:
[0284] The training module is configured to train a question classification model based on a training corpus, the training corpus including the first question-answer pair and the second question-answer pair, and the question classification model being configured to perform semantic classification on questions.
[0285] In the embodiments of the present application, an automatic question and answer pair generation device is provided. When generating question and answer pairs in a certain field, the collected questions are first classified by using semantic classification to obtain two question sets. Then, the questions in the two question sets are respectively processed differently, and finally two types of question and answer pairs matching the two question sets are generated based on the keywords in the field and the database. This way of classifying and processing questions can generate high-quality question and answer pairs in a targeted manner. In addition, since the process of generating question and answer pairs is basically automated, the generation efficiency of question and answer pairs is greatly improved, and the task of building a question and answer library in any field or the task of supplementing and mining an existing question and answer library can be quickly completed.
[0286] It should be noted that the question and answer pair generation device provided in the above embodiments is only used as an example to illustrate the division of the above functional modules. In actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the question and answer pair generation device and the question and answer pair generation method provided in the above embodiments belong to the same concept, and the specific implementation process is described in detail in the method embodiments, which will not be repeated here.
[0287] In the exemplary embodiments, a computer device is also provided. Taking the computer device as an example, Figure 18 The structure block diagram of a terminal 1800 provided in an exemplary embodiment of the present application is shown. The terminal 1800 can be a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a notebook computer or a desktop computer. The terminal 1800 can also be referred to as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, and other names.
[0288] Generally, the terminal 1800 includes a processor 1801 and a memory 1802.
[0289] The processor 1801 can include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 1801 can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), a PLA (Programmable Logic Array). The processor 1801 can also include a main processor and a coprocessor, the main processor being a processor for processing data in an awake state, also known as a CPU (Central Processing Unit), and the coprocessor being a low-power processor for processing data in a standby state. In some embodiments, the processor 1801 can be integrated with a GPU (Graphics Processing Unit) for rendering and drawing content required to be displayed by the display screen. In some embodiments, the processor 1801 can further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
[0290] The memory 1802 can include one or more computer-readable storage media that can be non-transitory. The memory 1802 can also include high-speed random access memory and nonvolatile memory such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1802 is used to store at least one program code for being executed by the processor 1801 to implement the question-answer pair generation method provided by the method embodiments in the present application.
[0291] In some embodiments, the terminal 1800 can also optionally include a peripheral device interface 1803 and at least one peripheral device. The processor 1801, the memory 1802, and the peripheral device interface 1803 can be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 1803 through a bus, a signal line, or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 1804, a display screen 1805, a camera assembly 1806, an audio circuit 1807, a positioning assembly 1808, and a power supply 1809.
[0292] The peripheral interface 1803 can be used to connect at least one I / O (Input / Output) related peripheral device to the processor 1801 and the memory 1802. In some embodiments, the processor 1801, the memory 1802 and the peripheral interface 1803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1801, the memory 1802 and the peripheral interface 1803 can be implemented on a separate chip or circuit board, and the present embodiments are not limited in this regard.
[0293] The radio frequency circuit 1804 is configured to receive and send RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1804 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 1804 converts electrical signals into electromagnetic signals for transmission, or converts electromagnetic signals received into electrical signals. Optionally, the radio frequency circuit 1804 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 1804 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1804 can also include NFC (Near Field Communication) related circuitry, and the present application is not limited in this regard.
[0294] The display screen 1805 is configured to display a UI (User Interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display screen 1805 is a touch display screen, the display screen 1805 is also capable of capturing touch signals on or above the surface of the display screen 1805. The touch signals can be input to the processor 1801 as control signals for processing. At this time, the display screen 1805 can also be configured to provide virtual buttons and / or virtual keyboard, also known as soft buttons and / or soft keyboard. In some embodiments, the display screen 1805 can be one, arranged on the front panel of the terminal 1800; in other embodiments, the display screen 1805 can be at least two, arranged on different surfaces of the terminal 1800 or in a folding design; in other embodiments, the display screen 1805 can be a flexible display screen, arranged on a curved surface or a folding surface of the terminal 1800. Even, the display screen 1805 can also be arranged in an irregular shape, i.e. a special-shaped screen. The display screen 1805 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc.
[0295] The camera assembly 1806 is configured to capture images or videos. Optionally, the camera assembly 1806 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, the rear camera is at least two, which is any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, to realize the background blur function by fusing the main camera and the depth-of-field camera, the panoramic shooting and VR (Virtual Reality) shooting function by fusing the main camera and the wide-angle camera, or other fusion shooting functions. In some embodiments, the camera assembly 1806 can also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. The dual-color temperature flash refers to the combination of a warm light flash and a cold light flash, which can be used for light compensation under different color temperatures.
[0296] The audio circuit 1807 can include a microphone and a speaker. The microphone is used to collect sound waves of a user and an environment, and convert the sound waves into an electrical signal input to the processor 1801 for processing, or input to the radio frequency circuit 1804 to realize voice communication. For the purpose of stereo sound collection or noise reduction, the microphone can be multiple, respectively arranged at different parts of the terminal 1800. The microphone can also be an array microphone or an omnidirectional collection type microphone. The speaker is used to convert an electrical signal from the processor 1801 or the radio frequency circuit 1804 into sound waves. The speaker can be a traditional diaphragm speaker, or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only can the electrical signal be converted into a sound wave audible to humans, but also can be converted into a sound wave inaudible to humans for ranging purposes. In some embodiments, the audio circuit 1807 can also include a headphone jack.
[0297] The positioning component 1808 is used to position the current geographic position of the terminal 1800 to realize navigation or LBS (Location Based Service). The positioning component 1808 can be a positioning component based on the GPS (Global Positioning System) of the United States, the Beidou system of China, the Glonass system of Russia or the Galileo system of the European Union.
[0298] The power supply 1809 is used to supply power to various components in the terminal 1800. The power supply 1809 can be alternating current, direct current, disposable battery or rechargeable battery. When the power supply 1809 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0299] In some embodiments, the terminal 1800 further includes one or more sensors 1810. The one or more sensors 1810 include but are not limited to: an acceleration sensor 1811, a gyroscope sensor 1812, a pressure sensor 1813, a fingerprint sensor 1814, an optical sensor 1815 and a proximity sensor 1816.
[0300] The acceleration sensor 1811 can detect the acceleration magnitude in three coordinate axes of the coordinate system established by the terminal 1800. For example, the acceleration sensor 1811 can be used to detect the components of gravitational acceleration in three coordinate axes. The processor 1801 can control the display screen 1805 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 1811. The acceleration sensor 1811 can also be used for game or user motion data collection.
[0301] The gyroscope sensor 1812 can detect the body direction and rotation angle of the terminal 1800, and can collect 3D motions of a user on the terminal 1800 in cooperation with the acceleration sensor 1811. The processor 1801 can implement the following functions according to data collected by the gyroscope sensor 1812: motion sensing (e.g., changing a UI according to a tilt operation of a user), image stabilization during photographing, game control, and inertial navigation.
[0302] The pressure sensor 1813 can be disposed at a side frame of the terminal 1800 and / or under the display screen 1805. When the pressure sensor 1813 is disposed at the side frame of the terminal 1800, a grip signal of a user on the terminal 1800 can be detected, and left / right hand recognition or a shortcut operation can be performed by the processor 1801 according to the grip signal collected by the pressure sensor 1813. When the pressure sensor 1813 is disposed under the display screen 1805, a pressure operation of a user on the display screen 1805 can be detected by the processor 1801, and an operable control on a UI can be controlled according to the pressure operation. The operable control includes at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0303] The fingerprint sensor 1814 is used to collect a fingerprint of a user, and the processor 1801 can identify an identity of the user according to the fingerprint collected by the fingerprint sensor 1814, or the fingerprint sensor 1814 can identify the identity of the user according to the collected fingerprint. When the identity of the user is identified as a trusted identity, the processor 1801 can authorize the user to perform a related sensitive operation, and the sensitive operation includes unlocking a screen, viewing encrypted information, downloading software, payment, and changing a setting, etc. The fingerprint sensor 1814 can be disposed at a front surface, a back surface, or a side surface of the terminal 1800. When a physical button or a manufacturer's logo is disposed on the terminal 1800, the fingerprint sensor 1814 can be integrated with the physical button or the manufacturer's logo.
[0304] The optical sensor 1815 is used to collect an ambient light intensity. In an embodiment, the processor 1801 can control a display brightness of the display screen 1805 according to the ambient light intensity collected by the optical sensor 1815. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1805 is increased, and when the ambient light intensity is low, the display brightness of the display screen 1805 is decreased. In another embodiment, the processor 1801 can also dynamically adjust a photographing parameter of the camera assembly 1806 according to the ambient light intensity collected by the optical sensor 1815.
[0305] The proximity sensor 1816, also called a distance sensor, is usually arranged on the front panel of the terminal 1800. The proximity sensor 1816 is used to collect the distance between the user and the front of the terminal 1800. In an embodiment, when the proximity sensor 1816 detects that the distance between the user and the front of the terminal 1800 gradually decreases, the display screen 1805 is switched from the bright screen state to the screen-off state under the control of the processor 1801; when the proximity sensor 1816 detects that the distance between the user and the front of the terminal 1800 gradually increases, the display screen 1805 is switched from the screen-off state to the bright screen state under the control of the processor 1801.
[0306] Those skilled in the art can understand that the structure shown in the foregoing embodiments is not a limitation on the terminal 1800, and the terminal 1800 can include more or fewer components than those shown in the drawings, or combine certain components, or adopt a different component arrangement. Figure 18
[0307] The embodiment of the present application further provides a computer readable storage medium applied to a computer device, and at least one computer program is stored in the computer readable storage medium. The at least one computer program is loaded and executed by a processor to realize the operations performed by the computer device in the question and answer pair generation method.
[0308] The embodiment of the present application further provides a computer program product or a computer program, which comprises computer program code stored in a computer readable storage medium. The processor of the computer device reads the computer program code from the computer readable storage medium, and the processor executes the computer program code, so that the computer device executes the question and answer pair generation method provided in the various optional implementation manners.
[0309] Those skilled in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by programs instructing relevant hardware to complete, and the programs can be stored in a computer readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk.
[0310] The above only describes optional embodiments of the present application, and does not limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for generating question-answer pairs, the method comprising: The method comprises: acquiring a target question set, performing semantic classification on each question in the target question set to obtain a first question set and a second question set, the first question set being similar to the question content of an existing question in a database, the second question set being not similar to the question content of the existing question, the database being used to store question and answer pairs in a target field; for a first question in the first question set, acquiring a first candidate question set from the database; generating a first question and answer pair based on the first candidate question set; wherein the first question is similar to the question content of the first candidate question set; for a second question in the second question set, acquiring a second candidate question set from the second question set based on a keyword group in the target field; generating a second question and answer pair based on the second candidate question set.
2. The method of claim 1, wherein, The first question and answer pair is generated based on the first candidate question set, comprising: displaying a first page, the first page including the first candidate question set; in response to a selection operation on a first candidate question in the first candidate question set, acquiring a first candidate answer matching the first candidate question from the database; generating the first question and answer pair based on the first question and the first candidate answer.
3. The method of claim 1, wherein, The second question and answer pair is generated based on the second candidate question set, comprising: displaying a second page, the second page including the second candidate question set; in response to a selection operation on a second candidate question in the second candidate question set, calling a screening interface to acquire a second candidate answer matching the second candidate question from a third party; generating the second question and answer pair based on the second candidate question and the second candidate answer.
4. The method of claim 1, wherein, The second question and answer pair is generated based on the second candidate question set, comprising: displaying a second page, the second page including the second candidate question set; in response to a selection operation on a second candidate question in the second candidate question set, inputting answer editing content as a second candidate answer matching the second candidate question; generating the second question and answer pair based on the second candidate question and the second candidate answer.
5. The method of claim 1, wherein, The target question set is acquired, and each question in the target question set is subjected to semantic classification to obtain a first question set and a second question set, comprising: acquiring the target question set based on online logs in the target field; for any one question in the target question set, acquiring a semantic similarity between the any one question and the existing question; in response to the acquired semantic similarity being in a first interval, adding the any one question to the first question set; in response to the acquired semantic similarity being in a second interval, adding the any one question to the second question set.
6. The method of claim 1, wherein, The first candidate question set is acquired from the database, comprising: based on the first question, acquiring a third candidate question set from the database; wherein the first question is similar to the question content of the third candidate question set; obtaining semantic similarities between the first question and each question in the third candidate question set; and sorting the obtained semantic similarities in descending order; generating the first candidate question set according to the questions in the top N positions in the semantic similarity sorting, where N is a positive integer.
7. The method of claim 1, wherein, The obtaining, from the second question set, the second candidate question set based on the keyword group of the target domain includes: obtaining the keyword group of the target domain; obtaining, from the second question set, a fourth candidate question set based on the keyword group; calling a screening interface to screen questions in the fourth candidate question set that meet a target condition; generating the second candidate question set based on the questions in the fourth candidate question set that meet the target condition.
8. The method of claim 7, wherein, The obtaining the keyword group of the target domain includes: determining candidate word groups in the database, and obtaining word frequencies of each word in the candidate word groups; determining a candidate word in the candidate word groups based on the word frequencies of the each word; including the candidate word group including the candidate word in the candidate word groups as the keyword group.
9. The method of claim 7, wherein, For any one question in the fourth candidate question set, the target condition includes any one of the following: the any one question appears in a fifth candidate question set, where the fifth candidate question set is obtained based on the screening interface; an answer to the any one question is obtained based on the screening interface; a sixth candidate question set is obtained based on the screening interface, and the any one question is similar to a question content of the sixth candidate question set.
10. The method according to any one of claims 1 to 9, characterized in that, The method further includes: storing the first question-answer pair and the second question-answer pair to the database.
11. The method according to any one of claims 1 to 9, characterized in that, The method further includes: training a question classification model based on a training corpus, the training corpus including the first question-answer pair and the second question-answer pair, and the question classification model being used for semantic classification of questions.
12. A question-answer pair generation apparatus, characterized by comprising: The apparatus includes: an obtaining module configured to obtain a target question set, perform semantic classification on each question in the target question set to obtain a first question set and a second question set, the first question set being similar to a question content of an existing question in a database, the second question set being dissimilar to the question content of the existing question, and the database being configured to store question-answer pairs of a target domain; a first question-answer pair generation module configured to, for a first question in the first question set, obtain a first candidate question set from the database, and generate a first question-answer pair based on the first candidate question set, where the first question is similar to a question content of the first candidate question set; a second question-answer pair generation module configured to, for a second question in the second question set, obtain a second candidate question set from the second question set based on a keyword group of the target domain, and generate a second question-answer pair based on the second candidate question set.
13. The apparatus of claim 12, wherein, The first question-answer pair generation module is configured to: display a first page, the first page including the first candidate question set. in response to a selection operation on a first candidate question in the first candidate question set, obtaining a first candidate answer matching the first candidate question from the database; generating the first question-answer pair based on the first candidate question and the first candidate answer.
14. A computer device, comprising: The computer device comprises a processor and a memory, the memory is used to store at least one computer program, the at least one computer program is loaded and executed by the processor to implement the question-answer pair generation method in any one of claims 1 to 11.
15. A computer-readable storage medium, characterized in that, The computer readable storage medium stores at least one computer program, the at least one computer program is loaded and executed by the processor to implement the question-answer pair generation method in any one of claims 1 to 11.
Citation Information
Patent Citations
Question and answer pair data generation method and device, and electronic equipment
CN110532348A
Data processing method and device for questions and answers, equipment and storage medium
CN111274378A