Question generation method, device, equipment and storage medium
By extracting the context correlation degree and eigenvector similarity matrix of the session set in the problem generation model, the problem of insufficient eigenvector extraction of eigenvectors is solved, and the accuracy of problem generation is improved.
Patent Information
- Application Number
- CN202111391792.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2041-11-23
AI Technical Summary
The existing problem generation model extracts a small number of useful text feature vectors during the encoding process, resulting in unsatisfactory problem generation results and low accuracy.
By obtaining the session set, encoding process is performed to obtain the text eigenvector matrix, and extract the first eigenvector matrix representing the context correlation degree and the second eigenvector matrix of the eigenvector similarity, thereby filtering out the target session to generate the problem.
Under the same decoding conditions, the representation of eigenvectors is enriched, and the accuracy and effect of problem generation are improved.
Smart Images

Figure CN114090754B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology and provides a question generation method, apparatus, device, and storage medium. Background Art
[0002] With the development of artificial intelligence (AI) and natural language processing (NLP) technologies, semantic retrieval systems such as question-answering systems and intelligent customer service systems based on the above two technologies have emerged to meet people's needs for fast and accurate information acquisition and are gradually being used in people's daily lives.
[0003] In order to transform the semantic retrieval system from a passive service of "user-led dialogue" to an active service of "system-guided dialogue", and to increase the probability that the questions raised by the semantic retrieval system hit the content that the user wants to consult, a question generation model is usually used to build a knowledge base of the semantic retrieval system. The knowledge base contains multiple question-answer text relationship pairs (referred to as question-answer pairs).
[0004] Early question generation models consisted of an encoder and a decoder. The encoder first encoded a collection of conversations to obtain a corresponding text feature vector matrix, and then the decoder decoded this text feature vector matrix to obtain a conversation representing the question. However, during the decoding process, the decoder focused on different content each time it decoded, affecting the final question generation results.
[0005] Therefore, attention mechanisms are often used to identify important text feature vectors that influence question generation results, or conversation classification models are used to assist in training question generation models to address the technical shortcomings of the decoder. However, even these improved question generation models still struggle to generate appropriate questions. This is primarily due to the encoder extracting a small number of useful text feature vectors during the encoding process, resulting in suboptimal question generation results. Summary of the Invention
[0006] The embodiments of the present disclosure provide a question generation method, apparatus, device, and storage medium to solve the problem of low accuracy in question generation.
[0007] The specific technical solutions provided by the embodiments of the present disclosure are as follows:
[0008] In a first aspect, an embodiment of the present disclosure provides a method for generating a question, comprising:
[0009] Obtaining a conversation set, where the conversation set includes a first conversation and at least one second conversation, where the first conversation is an answer to the question to be detected, and the at least one second conversation is determined based on the first conversation;
[0010] Encoding the conversation set to obtain a corresponding text feature vector matrix;
[0011] Performing feature extraction on the text feature vector matrix to obtain a first feature vector matrix and a second feature vector matrix, respectively, wherein the first feature vector matrix represents the contextual association between the text feature vectors, and the second feature vector matrix represents the feature vector similarity between the text feature vector of the at least one second session and the text feature vector of the first session;
[0012] Based on the first eigenvector matrix and the second eigenvector matrix, a target session is screened out from the session set, where the target session is the question to be detected.
[0013] Optionally, also include:
[0014] Deleting the third conversation with the conversation object set in the first conversation group and the third conversation that meets the preset conversation deletion condition to obtain a corresponding second conversation group; wherein the first conversation group is one of the conversation groups obtained by dividing the plurality of third conversations;
[0015] The third conversation in the second conversation group whose sentence length exceeds the preset first sentence length threshold is used as the first conversation.
[0016] Optionally, the setting of the session deletion condition includes at least one of the following:
[0017] A third session contains the set stop words;
[0018] The sentence length of the third conversation exceeds a preset second sentence length threshold.
[0019] Optionally, encoding the conversation set to obtain a corresponding text feature vector matrix includes:
[0020] performing vectorization processing on the first session and the at least one second session in the session set to obtain respective corresponding session feature vectors;
[0021] Each conversation feature vector is encoded by an encoder to obtain a corresponding text feature vector, and the text feature vector matrix is obtained by splicing the text feature vectors.
[0022] Optionally, performing vectorization processing on the first session and the at least one second session in the session set to obtain respective corresponding session feature vectors includes:
[0023] performing vectorization processing on the first session and the at least one second session in the session set to obtain a session object feature vector and a session content feature vector of the first session, and a session object feature vector and a session content feature vector corresponding to each of the at least one second session;
[0024] An addition operation or a concatenation operation is performed on each session object feature vector and the corresponding session content feature vector to obtain a session feature vector of the first session and a session feature vector of each of the at least one second session.
[0025] Optionally, also include:
[0026] obtaining at least one third eigenvector matrix based on eigenvector similarities between the text eigenvectors of the at least one second conversation and the text eigenvector of the first conversation;
[0027] A second eigenvector matrix is obtained based on the at least one third eigenvector matrix and the corresponding weight coefficients.
[0028] Optionally, also include:
[0029] Performing a matrix average operation on a third eigenvector matrix to obtain a corresponding matrix average;
[0030] A weight coefficient of the third eigenvector matrix is obtained by performing a regularization operation on the matrix average value.
[0031] Optionally, the filtering out a target session from the session set based on the first eigenvector matrix and the second eigenvector matrix includes:
[0032] The first eigenvector matrix and the second eigenvector matrix are decoded by a decoder to filter out the target session from the session set.
[0033] In a second aspect, the present disclosure also provides a question generating device, including:
[0034] an acquiring unit, configured to acquire a conversation set, the conversation set including a first conversation and at least one second conversation, the first conversation being an answer corresponding to the question to be detected, and the at least one second conversation being determined based on the first conversation;
[0035] An encoding unit, configured to encode the conversation set to obtain a corresponding text feature vector matrix;
[0036] a processing unit, configured to obtain a first feature vector matrix and a second feature vector matrix by performing feature extraction on the text feature vector matrix, wherein the first feature vector matrix represents the contextual association between the text feature vectors, and the second feature vector matrix represents the feature vector similarity between the text feature vector of the at least one second session and the text feature vector of the first session;
[0037] Based on the first eigenvector matrix and the second eigenvector matrix, a target session is screened out from the session set, where the target session is the question to be detected.
[0038] Optionally, the acquiring unit is further configured to:
[0039] Deleting the third conversation with the conversation object set in the first conversation group and the third conversation that meets the preset conversation deletion condition to obtain a corresponding second conversation group; wherein the first conversation group is one of the conversation groups obtained by dividing the plurality of third conversations;
[0040] The third conversation in the second conversation group whose sentence length exceeds the preset first sentence length threshold is used as the first conversation.
[0041] Optionally, the setting of the session deletion condition includes at least one of the following:
[0042] A third session contains the set stop words;
[0043] The sentence length of the third conversation exceeds a preset second sentence length threshold.
[0044] Optionally, the encoding unit is used to:
[0045] performing vectorization processing on the first session and the at least one second session in the session set to obtain respective corresponding session feature vectors;
[0046] Each conversation feature vector is encoded by an encoder to obtain a corresponding text feature vector, and the text feature vector matrix is obtained by splicing the text feature vectors.
[0047] Optionally, the encoding unit is used to:
[0048] performing vectorization processing on the first session and the at least one second session in the session set to obtain a session object feature vector and a session content feature vector of the first session, and a session object feature vector and a session content feature vector corresponding to each of the at least one second session;
[0049] An addition operation or a concatenation operation is performed on each session object feature vector and the corresponding session content feature vector to obtain a session feature vector of the first session and a session feature vector of each of the at least one second session.
[0050] Optionally, the processing unit is further configured to:
[0051] obtaining at least one third eigenvector matrix based on eigenvector similarities between the text eigenvectors of the at least one second conversation and the text eigenvector of the first conversation;
[0052] A second eigenvector matrix is obtained based on the at least one third eigenvector matrix and the corresponding weight coefficients.
[0053] Optionally, the processing unit is further configured to:
[0054] Performing a matrix average operation on a third eigenvector matrix to obtain a corresponding matrix average;
[0055] A weight coefficient of the third eigenvector matrix is obtained by performing a regularization operation on the matrix average value.
[0056] Optionally, the processing unit is configured to:
[0057] The first eigenvector matrix and the second eigenvector matrix are decoded by a decoder to filter out the target session from the session set.
[0058] In a third aspect, an embodiment of the present disclosure further provides a computer device comprising a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor executes the steps of any one of the above-mentioned question generation methods.
[0059] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which includes a program code. When the program code is run on a computer device, the program code is used to enable the computer device to execute the steps of any one of the above-mentioned question generation methods.
[0060] The beneficial effects of the present disclosure are as follows:
[0061] In an embodiment of the present disclosure, a conversation set including a first conversation and at least one second conversation is obtained, wherein the first conversation is the answer to the question to be detected, and the at least one second conversation is determined based on the first conversation. The conversation set is then encoded to obtain a corresponding text feature vector matrix. Feature extraction is performed on the text feature vector matrix to obtain a first feature vector matrix representing context relevance and a second feature vector matrix representing feature vector similarity. Based on the two obtained feature vector matrices, a target conversation is screened from the conversation set, and the target conversation is the question to be detected. In combination with the characteristics of the conversation scenario, based on the similarity between the time series of the conversation set and the content of the conversations, a first feature vector matrix representing context relevance and a second feature vector matrix representing feature vector similarity are extracted to enrich the representation of the feature vectors, thereby obtaining better question generation results under the same decoding conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 A flowchart of a question generation method provided in an embodiment of the present disclosure;
[0063] Figure 2 A schematic diagram of a process for obtaining a first session provided in an embodiment of the present disclosure;
[0064] Figure 3 A schematic diagram of a process for encoding a session set provided in an embodiment of the present disclosure;
[0065] Figure 4 A schematic diagram of the working logic for obtaining a question generation result provided by an embodiment of the present disclosure;
[0066] Figure 5 A schematic diagram of the structure of a question generating device provided in an embodiment of the present disclosure;
[0067] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present disclosure;
[0068] Figure 7 A schematic diagram of the hardware structure of a computing device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0069] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the technical solutions of the present disclosure, but not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments described in this disclosure without making any creative efforts shall fall within the scope of protection of the technical solutions of the present disclosure.
[0070] Some terms used in the embodiments of the present disclosure are explained below to facilitate understanding by those skilled in the art.
[0071] 1. Artificial Intelligence
[0072] Artificial intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also involves studying the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0073] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning. With the advancement of AI technology, research and application are expanding across a wide range of fields, including smart homes, smart customer service, virtual assistants, smart speakers, smart marketing, driverless and autonomous driving, robotics, and smart healthcare. As technology advances, AI will be applied in even more areas, playing an increasingly important role.
[0074] 2. Deep Learning
[0075] Machine learning is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance.
[0076] Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Deep learning, on the other hand, is the core of machine learning and a technology that enables machine learning. Machine learning generally includes techniques such as deep learning, reinforcement learning, transfer learning, and inductive learning. Deep learning includes technologies such as convolutional neural networks (CNNs), deep belief networks, recurrent neural networks, autoencoders, and generative adversarial networks.
[0077] 3. Natural Language Processing
[0078] Natural language processing is an important direction in the fields of computer science and artificial intelligence. It is a science that integrates linguistics, computer science, and mathematics.
[0079] Natural language processing is closely related to linguistics, but unlike the general research goal of natural language (that is, the language people use in daily life), natural language processing mainly aims to develop computer systems that can realize natural language communication, especially the software systems therein, to achieve the research goal of effective communication between people and computers using natural language.
[0080] 4. Convolutional Neural Network (CNN):
[0081] CNN is a feedforward neural network consisting of an alternating convolutional layer and a pooling layer.
[0082] CNNs, with their unique structure of locally shared weights, offer unique advantages in speech recognition and image processing. Their layout is closer to that of actual biological neural networks, and weight sharing reduces neural network complexity. In particular, directly feeding multidimensional input vectors into the network avoids the complexity of data reconstruction during feature extraction and classification, enabling them to excel at processing large images.
[0083] 5. Recurrent Neural Network (RNN):
[0084] An RNN is an artificial neural network that connects nodes in a circular structure. Processing units have both internal feedback and feedforward connections. The RNN's internal state can exhibit dynamic temporal behavior. Therefore, RNNs can leverage their internal memory to process input sequences of arbitrary temporal order. Compared to feedforward neural networks, RNNs have stronger dynamic behavior and computational power, making them widely used in applications where temporal order is crucial, such as speech recognition, natural language processing, and video analysis.
[0085] 6. Bidirectional Encoder Representation With Transformers (BERT) based on self-attention mechanism:
[0086] BERT is a neural network structure that uses Transformer as a text feature vector extractor. It also comes with training dataset construction methods, model training methods, and task-specific structural modification strategies to support BERT in processing various NLP tasks (such as text classification, sequence labeling, text matching, etc.).
[0087] The Transformer network is a sequence processing network based on the attention mechanism. It abandons the recursive structure and relies entirely on the attention mechanism to explore the relationship between input and output, shifting from "global attention" to "local attention". This allows the feedforward neural network to pay more attention to features with high attention weights during decoding. This not only allows for flexible capture of global and local relationships, but also enables fast parallel computing, reduces network training time, and improves the shortcomings of slow RNN training.
[0088] The following is a brief introduction to the design concept of the embodiment of the present disclosure:
[0089] Current question generation models often use attention mechanisms or conversation classification models to optimize their decoders, overcoming the technical drawback of focusing on different key points during each decoding. However, the encoders of question generation models still extract relatively few useful text feature vectors during the encoding process, making it difficult for the improved question generation models to generate appropriate questions.
[0090] In order to solve the problem of low generation accuracy, the present disclosure proposes a new technical solution. The solution includes:
[0091] A conversation set including a first conversation and at least one second conversation is obtained, where the first conversation is the answer to the question to be detected and the at least one second conversation is determined based on the first conversation. The conversation set is encoded to obtain a corresponding text feature vector matrix. Feature extraction is performed on the text feature vector matrix to obtain a first feature vector matrix representing context relevance and a second feature vector matrix representing feature vector similarity. Based on the two obtained feature vector matrices, a target conversation is screened out from the conversation set, where the target conversation is the question to be detected.
[0092] Combining the characteristics of conversation scenarios, based on the time series of conversation sets and the similarity between conversation contents, we extract the first eigenvector matrix representing the context relevance and the second eigenvector matrix representing the eigenvector similarity to enrich the representation of the eigenvectors, thereby obtaining better question generation results under the same decoding conditions.
[0093] The preferred embodiments of the present disclosure are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present disclosure and are not intended to limit the present disclosure. In addition, the embodiments and features in the embodiments of the present disclosure may be combined with each other if there is no conflict.
[0094] See Figure 1 The flowchart shown introduces the overall process of the question generation method proposed in the embodiment of the present disclosure.
[0095] S101: Acquire a conversation set, where the conversation set includes a first conversation and at least one second conversation, where the first conversation is an answer corresponding to a question to be detected, and the at least one second conversation is determined based on the first conversation.
[0096] S102: Encode the conversation set to obtain a corresponding text feature vector matrix.
[0097] When executing step 102, a common encoder such as a BERT encoder and an RNN encoder is used to encode the conversation set to obtain a corresponding text feature vector matrix.
[0098] S103: Performing feature extraction on the text feature vector matrix to obtain a first feature vector matrix and a second feature vector matrix, wherein the first feature vector matrix represents the contextual association between the text feature vectors, and the second feature vector matrix represents the feature vector similarity between the text feature vector of at least one second session and the text feature vector of the first session.
[0099] S104: Based on the first eigenvector matrix and the second eigenvector matrix, a target session is screened out from the session set, where the target session is the question to be detected.
[0100] When executing step 104 , a common decoder such as a BERT decoder or an RNN decoder is used to decode the conversation set and select target conversations representing the problem to be detected.
[0101] In the process of obtaining the conversation set, it is necessary to first determine the first conversation that represents the answer, and then determine at least one second conversation associated with the first conversation based on the first conversation. Figure 2 The following flowchart shows the process of obtaining the first session:
[0102] S1011: Delete the third conversation with the set conversation object in the first conversation group and the third conversation that meets the preset conversation deletion condition to obtain a corresponding second conversation group; wherein the first conversation group is one of the conversation groups obtained by dividing multiple third conversations.
[0103] The multiple third-party conversations recorded in semantic retrieval systems such as question-answering systems and intelligent customer service systems are mostly interactive conversations of the "one question, one answer" type. In order to extract multiple question-answer pairs from multiple third-party conversations as much as possible, n(n∈N + , and n≥1) third conversations are divided into one group to obtain at least one first conversation group.
[0104] The multiple third conversations recorded in the semantic retrieval system include customer service conversations with customer service representatives and user conversations with users. The knowledge base used to train the semantic retrieval system is generally composed of multiple question-answer pairs, where the user conversation represents the question and the customer service conversation represents the answer. To quickly filter out the first conversation, the disclosed embodiment deletes the user conversations in the first conversation group, retaining only the customer service conversations.
[0105] Afterwards, according to the set conversation deletion conditions, the third conversations such as the automatic reply conversation and the third conversations with too short sentences are deleted to obtain the corresponding second conversation group.
[0106] The session deletion condition includes at least one of the following:
[0107] Session deletion condition 1: A third session contains the specified stop words.
[0108] The stop words in the embodiments of the present disclosure include, but are not limited to, "please choose", "please ask", "for you", "not", "unequal question sentences", and "negative sentences".
[0109] Answers are typically declarative sentences, while stop words like "Please choose" and "Please ask" are often used in interrogative and negative sentences. If the third conversation contains these stop words, the probability of it representing the answer will be relatively low. Therefore, the present embodiment will delete the third conversation containing stop words.
[0110] Session deletion condition 2: the sentence length of a third session exceeds a preset second sentence length threshold.
[0111] Generally speaking, it is difficult to express the meaning of the answer with one or two simple words or one or two short sentences. If the sentences in the third conversation are too short, the probability of them representing the answer will also be relatively low. Therefore, the embodiment of the present disclosure needs to delete the sentences in the third conversation that exceed the preset second sentence length threshold.
[0112] S1012: The third conversation in the second conversation group, whose sentence length is preset to the first sentence length threshold, is used as the first conversation.
[0113] For example, Table 1 shows a complete conversation between an e-commerce customer service representative and a buyer. Each row represents a conversation, and each conversation consists of two parts: a conversation object and a conversation content.
[0114] Table 1
[0115]
[0116]
[0117] Assume n=8, divide the first 8 sessions in Table 1 into one group, and divide the sessions with less than 8 sessions into one group. The division results are shown in Table 2.
[0118] Table 2
[0119]
[0120] In each conversation group, we deleted buyer conversations, conversations containing stop words, and conversations with sentence length less than 5. The screening results are shown in Table 3.
[0121] Table 3
[0122]
[0123] After screening, all conversations in conversation group 1 do not meet the criteria. Only conversations 9 and 10 in conversation group 2 meet the criteria. Since the sentence length of conversation 9 is longer than that of conversation 10, conversation 9 is determined to be the first conversation representing the answer.
[0124] After the first session is determined, at least one third session having a session time earlier than the first session is output as a corresponding second session based on the selected first session.
[0125] Continuing with the previous example, with session 9 as the basis, sessions 1, 3, and 5-8 in Table 1 are considered the second session. However, to better reflect the temporal order of the sessions, a more optimal method for determining the second session is proposed: sessions 5-8, whose session times are earlier than session 9, are output as the second session.
[0126] When executing step 102, the conversation set is encoded using an encoder to obtain the corresponding text feature vector matrix. Figure 3 The flowchart shown introduces the specific encoding process.
[0127] S1021: Perform vectorization processing on the first session and at least one second session in the session set to obtain corresponding session feature vectors.
[0128] First, based on a preset dictionary, an identity document (ID) is performed on the first session and at least one second session in the session set, and each session is converted from a text representation to a digital representation.
[0129] In order to facilitate the subsequent encoding and decoding tasks, before performing ID representation, all sessions are first padded or truncated to ensure that each session contains T(T∈N + , and T ≥ 1) characters.
[0130] The padding operation adds the special character [PAD] to the end of a conversation if the conversation contains fewer than T characters. The truncation operation extracts the first T characters of a conversation from left to right and discards the remaining characters if the conversation contains more than T characters.
[0131] For example, assuming T=5, session 1 is "Not Ha", and session 2 is "For details, please refer to the manual", perform the completion operation on session 1 to obtain a new session 1 "Not Ha [PAD][PAD]", and perform the truncation operation on session 2 to obtain a new session 2 "For details, please refer to the manual";
[0132] Then, the new session 1 is represented by an ID, and the corresponding digital representation is obtained as [3 4 5 0 0]. The new session 2 is represented by an ID, and the corresponding digital representation is obtained as [13 2 7 9 10].
[0133] Then, a preset embedding network is used to vectorize the first conversation represented by ID and at least one second conversation, and the conversation object feature vector and conversation content feature vector of the first conversation, as well as the conversation object feature vector and conversation content feature vector corresponding to at least one second conversation, are obtained respectively.
[0134] Finally, an addition operation or a concatenation operation is performed on each session object feature vector and the corresponding session content feature vector to obtain a session feature vector of the first session and a session feature vector of at least one second session.
[0135] For example, if the session object feature vector of the first session in the session set is [0.2 0.7], and the session content feature vector is The session feature vector obtained after the addition operation is Or perform concatenation to get the session feature vector Any of the above operations is also performed on the session object feature vector and the session content feature vector of at least one second session to obtain the session feature vector of the at least one second session.
[0136] S1022: Encode each conversation feature vector through an encoder to obtain the corresponding text feature vector, and obtain a text feature vector matrix by splicing each text feature vector.
[0137] The session feature vectors of each session in the session set are input into common encoders such as the BERT encoder and the RNN encoder. After encoding, the corresponding text feature vectors are obtained. Then, stacking operations such as horizontal splicing and vertical splicing are performed on the text feature vectors of each session to obtain the text feature vector matrix of the session set.
[0138] Continuing from the above example, the conversation feature vector of the first conversation is After encoding, the corresponding text feature vector is obtained Perform encoding processing on the session feature vector of at least one second session to obtain the text feature vector of at least one second session, and then perform vertical splicing operation on the text feature vectors of each session to obtain the text feature vector matrix of the session set.
[0139] During the execution of step S103 , the following two steps are executed in parallel to obtain a first eigenvector matrix and a second eigenvector matrix.
[0140] In step 1, RNNs are widely used in applications where time sequence is important, such as speech recognition, natural language processing, and video analysis. This disclosed embodiment, taking into account the characteristics of conversational scenarios, uses an RNN to extract features from a text feature vector matrix based on the time sequence between conversations, obtaining a first feature vector matrix representing contextual relevance.
[0141] For example, using RNN to train the text feature vector matrix Perform feature extraction to obtain the corresponding first eigenvector matrix.
[0142] RNN mines the contextual association between sessions from the dimension of time series, while another feature extraction method mines the inter-word similarity between at least one second session and the first session from the dimension of words.
[0143] Step 2: Obtain at least one third eigenvector matrix based on the eigenvector similarity between the text eigenvectors of at least one second conversation and the text eigenvector of the first conversation; and then obtain a second eigenvector matrix based on the at least one third eigenvector matrix and the corresponding weight coefficient.
[0144] In the conversation set, the importance of the third eigenvector matrix of each second conversation is different. In the embodiment of the present disclosure, a weight coefficient is assigned to the third eigenvector matrix of each second conversation by performing the following operations:
[0145] A matrix average operation is performed on the third eigenvector matrix to obtain a corresponding matrix average; and a regularization operation is then performed on the matrix average to obtain a weight coefficient of the third eigenvector matrix.
[0146] Continuing with the above example, session 9 is taken as the first session, and sessions 5 to 8 whose session times are earlier than session 9 are taken as the second session. The selected session set is shown in Table 4.
[0147] Table 4
[0148]
[0149] If the text feature vector of session 5 is The text feature vector of session 9 is Then the third eigenvector matrix between session 5 and session 9 is
[0150] Get the third eigenvector matrix The matrix average value is 25.0. A regularization operation is performed on the matrix average value 25.0 to map it to the interval (0,1), and the corresponding weight coefficient is 0.28.
[0151] The above operation is repeated for the text feature vectors of conversations 6 to 8 to obtain the third feature vector matrix and corresponding weight coefficients of each of conversations 6 to 8.
[0152] After obtaining the third eigenvector matrix and the corresponding weight coefficient of each of sessions 5 to 8, the third eigenvector matrix is multiplied by the corresponding weight coefficient to obtain the fourth eigenvector matrix where [·] represents the third eigenvector matrix of sessions 6 to 8.
[0153] The fourth eigenvector matrix is then input into the convolutional layer and fully connected layer of CNN, and the corresponding second eigenvector matrix is obtained through further feature extraction.
[0154] When step 104 is executed, the first eigenvector matrix and the second eigenvector matrix are decoded by a decoder to filter out a target session from the session set.
[0155] The decoder can only read one eigenvector matrix at a time. Therefore, before decoding, any of the following splicing methods can be used to splice the two eigenvector matrices into a complete eigenvector matrix.
[0156] Splicing method 1: stack the above two eigenvector matrices into a complete eigenvector matrix.
[0157] For example, the first eigenvector matrix is [0.1, 0.2, 0.4], the second eigenvector matrix is [0.3, 0.5, 0.1], and the concatenated eigenvector matrix is [0.1, 0.2, 0.4, 0.3, 0.5, 0.1].
[0158] Splicing method 2: Add the above two eigenvector matrices bit by bit to form a complete eigenvector matrix.
[0159] For example, the first eigenvector matrix is [0.1, 0.2, 0.4], the second eigenvector matrix is [0.3, 0.5, 0.1], and the concatenated eigenvector matrix is [0.4, 0.7, 0.5].
[0160] The question generation method proposed in the embodiment of the present disclosure is not only applicable to the question generation model composed of a codec, but also to the question generation model based on the attention mechanism and the question generation model based on the conversation classification task. It combines the characteristics of the conversation scenario to extract rich feature vectors, thereby obtaining better question generation results under the same decoding conditions.
[0161] For easier understanding, see Figure 4 The working logic diagram shown takes a specific embodiment as an example to introduce the process of applying the question generation method in the specific embodiment to obtain a target conversation representing the question to be detected.
[0162] In the conversation set shown in Table 4, conversation 9 is the first conversation representing the answer, and conversations 5 to 8 are the second conversations associated with it.
[0163] Table 4
[0164]
[0165] Perform ID representation and vectorization on each session in the session set in turn to obtain the corresponding session feature vector
[0166] Then, the conversation feature vectors of each conversation obtained above are input into the BERT encoder for encoding processing to obtain the corresponding text feature vector And vertically splice multiple text feature vectors into a text feature vector matrix
[0167] The text feature vector matrix obtained above While inputting into RNN, obtain the first eigenvector matrix The other side is input into the neural network for extracting feature vector similarity to obtain the second feature vector matrix
[0168] Finally, the concatenated first eigenvector matrix and the second eigenvector matrix are input into the decoder for decoding processing, and the target session representing the problem to be detected is obtained as session 7: "DGD50-05AK-A stew, how to choose fast stew or slow stew?"
[0169] Based on the same inventive concept, the present disclosure also provides a question generating device, see Figure 5 As shown in the structural diagram, the device 500 at least includes an acquisition unit 501, an encoding unit 502, and a processing unit 503, wherein:
[0170] An acquiring unit 501 is configured to acquire a conversation set, where the conversation set includes a first conversation and at least one second conversation, where the first conversation is an answer to a question to be detected, and the at least one second conversation is determined based on the first conversation;
[0171] An encoding unit 502 is configured to encode the conversation set to obtain a corresponding text feature vector matrix;
[0172] Processing unit 503 is used to extract features from the text feature vector matrix to obtain a first feature vector matrix and a second feature vector matrix, wherein the first feature vector matrix represents the contextual association between the text feature vectors, and the second feature vector matrix represents the feature vector similarity between the text feature vector of the at least one second session and the text feature vector of the first session.
[0173] Based on the first eigenvector matrix and the second eigenvector matrix, a target session is screened out from the session set, where the target session is the question to be detected.
[0174] Optionally, the acquiring unit 501 is further configured to:
[0175] Deleting the third conversation with the conversation object set in the first conversation group and the third conversation that meets the preset conversation deletion condition to obtain a corresponding second conversation group; wherein the first conversation group is one of the conversation groups obtained by dividing the plurality of third conversations;
[0176] The third conversation in the second conversation group whose sentence length exceeds the preset first sentence length threshold is used as the first conversation.
[0177] Optionally, the setting of the session deletion condition includes at least one of the following:
[0178] A third session contains the set stop words;
[0179] The sentence length of the third conversation exceeds a preset second sentence length threshold.
[0180] Optionally, the encoding unit 502 is configured to:
[0181] performing vectorization processing on the first session and the at least one second session in the session set to obtain respective corresponding session feature vectors;
[0182] Each conversation feature vector is encoded by an encoder to obtain a corresponding text feature vector, and the text feature vector matrix is obtained by splicing the text feature vectors.
[0183] Optionally, the encoding unit 502 is configured to:
[0184] performing vectorization processing on the first session and the at least one second session in the session set to obtain a session object feature vector and a session content feature vector of the first session, and a session object feature vector and a session content feature vector corresponding to each of the at least one second session;
[0185] An addition operation or a concatenation operation is performed on each session object feature vector and the corresponding session content feature vector to obtain a session feature vector of the first session and a session feature vector of each of the at least one second session.
[0186] Optionally, the processing unit 503 is further configured to:
[0187] obtaining at least one third eigenvector matrix based on eigenvector similarities between the text eigenvectors of the at least one second conversation and the text eigenvector of the first conversation;
[0188] A second eigenvector matrix is obtained based on the at least one third eigenvector matrix and the corresponding weight coefficients.
[0189] Optionally, the processing unit 503 is further configured to:
[0190] Performing a matrix average operation on a third eigenvector matrix to obtain a corresponding matrix average;
[0191] A weight coefficient of the third eigenvector matrix is obtained by performing a regularization operation on the matrix average value.
[0192] Optionally, the processing unit 503 is configured to:
[0193] The first eigenvector matrix and the second eigenvector matrix are decoded by a decoder to filter out the target session from the session set.
[0194] Based on the same inventive concept, the embodiment of the present disclosure also provides a computer device. Figure 6 The structural diagram shown includes at least a memory 601 and at least one processor 602, wherein the memory 601 stores program code, and when the program code is executed by the processor 602, the processor 602 performs the steps of any one of the above-mentioned question generation methods.
[0195] Refer to the following Figure 7 hereinafter, a computing device 700 according to this embodiment of the present disclosure is described. Figure 7 The computing device 700 is merely an example and should not limit the functionality and scope of use of the embodiments of the present disclosure.
[0196] like Figure 7 As shown, computing device 700 is implemented as a general-purpose computing device. Components of computing device 700 may include, but are not limited to, at least one processing unit 701, at least one storage unit 702, and a bus 703 connecting various system components (including storage unit 702 and processing unit 701).
[0197] Bus 703 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, and a processor or local bus using any of a variety of bus architectures.
[0198] The storage unit 702 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 7021 and / or a cache memory unit 7022 , and may further include a read-only memory (ROM) 7023 .
[0199] The storage unit 702 may also include a program / utility 7027 having a set (at least one) of program modules 7024, such program modules 7024 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include an implementation of a network environment.
[0200] Computing device 700 may also communicate with one or more external devices 704 (e.g., a keyboard, pointing device, etc.), one or more devices that enable a user to interact with computing device 700, and / or any device that enables computing device 700 to communicate with one or more other computing devices (e.g., a router, modem, etc.). Such communication may occur via input / output (I / O) interface 705. Furthermore, computing device 700 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via network adapter 706. As shown, network adapter 706 communicates with other modules of computing device 700 via bus 703. It should be understood that, although not shown, other hardware and / or software modules may be used in conjunction with computing device 700, including but not limited to microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0201] Based on the same inventive concept as the above-mentioned method embodiment, various aspects of the question generation method provided by the present disclosure can also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps in the various exemplary embodiments described above in this specification. For example, the computer device can execute the following steps: Figure 1 Follow the steps shown in .
[0202] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0203] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present disclosure.
[0204] Obviously, those skilled in the art may make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is intended to include these modifications and variations.
Claims
1. A question generation method, characterized in that: include: Obtaining a conversation set, the conversation set including a first conversation and at least one second conversation, the first conversation being an answer to a question to be detected, and the at least one second conversation being at least one third conversation whose conversation time is earlier than the first conversation; the first conversation is determined by performing the following operations: deleting a third conversation in which a conversation object is set and a third conversation that meets a preset conversation deletion condition in a first conversation group to obtain a corresponding second conversation group, wherein the first conversation group is one of the conversation groups obtained by dividing a plurality of third conversations; and determining a third conversation in the second conversation group whose sentence length exceeds a preset first sentence length threshold as the first conversation; Encoding the conversation set to obtain a corresponding text feature vector matrix; Performing feature extraction on the text feature vector matrix to obtain a first feature vector matrix and a second feature vector matrix, respectively, wherein the first feature vector matrix represents the contextual association between the text feature vectors, and the second feature vector matrix represents the feature vector similarity between the text feature vector of the at least one second session and the text feature vector of the first session; Based on the first eigenvector matrix and the second eigenvector matrix, a target session is screened out from the session set, where the target session is the question to be detected.
2. The method according to claim 1, wherein The session deletion condition includes at least one of the following: A third session contains the set stop words; The sentence length of the third conversation exceeds a preset second sentence length threshold.
3. The method according to claim 1, wherein The encoding process of the conversation set to obtain a corresponding text feature vector matrix includes: performing vectorization processing on the first session and the at least one second session in the session set to obtain respective corresponding session feature vectors; Each conversation feature vector is encoded by an encoder to obtain a corresponding text feature vector, and the text feature vector matrix is obtained by splicing the text feature vectors.
4. The method according to claim 3, wherein The performing vectorization processing on the first session and the at least one second session in the session set to obtain respective corresponding session feature vectors includes: performing vectorization processing on the first session and the at least one second session in the session set to obtain a session object feature vector and a session content feature vector of the first session, and a session object feature vector and a session content feature vector corresponding to each of the at least one second session; An addition operation or a concatenation operation is performed on each session object feature vector and the corresponding session content feature vector to obtain a session feature vector of the first session and a session feature vector of each of the at least one second session.
5. The method according to claim 1, wherein Also includes: obtaining at least one third eigenvector matrix based on eigenvector similarities between the text eigenvectors of the at least one second conversation and the text eigenvector of the first conversation; A second eigenvector matrix is obtained based on the at least one third eigenvector matrix and the corresponding weight coefficients.
6. The method according to claim 5, wherein Also includes: Performing a matrix average operation on a third eigenvector matrix to obtain a corresponding matrix average; A weight coefficient of the third eigenvector matrix is obtained by performing a regularization operation on the matrix average value.
7. The method according to any one of claims 1 to 6, characterized in that: The filtering out a target session from the session set based on the first eigenvector matrix and the second eigenvector matrix includes: The first eigenvector matrix and the second eigenvector matrix are decoded by a decoder to filter out the target session from the session set.
8. A question generating device, characterized in that: include: An acquisition unit is configured to acquire a conversation set, the conversation set comprising a first conversation and at least one second conversation, the first conversation being an answer to a question to be detected, and the at least one second conversation being at least one third conversation whose conversation time is earlier than that of the first conversation; the first conversation being determined by performing the following operations: deleting a third conversation in which a conversation object is set and a third conversation that meets a preset conversation deletion condition in a first conversation group to obtain a corresponding second conversation group, wherein the first conversation group is one of the conversation groups obtained by dividing a plurality of third conversations; and determining a third conversation in the second conversation group whose sentence length exceeds a preset first sentence length threshold as the first conversation; An encoding unit, configured to encode the conversation set to obtain a corresponding text feature vector matrix; A processing unit is configured to extract features from the text feature vector matrix to obtain a first feature vector matrix and a second feature vector matrix, wherein the first feature vector matrix represents the contextual association between the text feature vectors, and the second feature vector matrix represents the feature vector similarity between the text feature vector of the at least one second session and the text feature vector of the first session. Based on the first eigenvector matrix and the second eigenvector matrix, a target session is screened out from the session set, where the target session is the question to be detected.
9. The device according to claim 8, wherein The session deletion condition includes at least one of the following: A third session contains the set stop words; The sentence length of the third conversation exceeds a preset second sentence length threshold.
10. The device according to claim 8, wherein The encoding unit is used for: performing vectorization processing on the first session and the at least one second session in the session set to obtain respective corresponding session feature vectors; Each conversation feature vector is encoded by an encoder to obtain a corresponding text feature vector, and the text feature vector matrix is obtained by splicing the text feature vectors.
11. The device according to claim 10, wherein The encoding unit is used for: performing vectorization processing on the first session and the at least one second session in the session set to obtain a session object feature vector and a session content feature vector of the first session, and a session object feature vector and a session content feature vector corresponding to each of the at least one second session; An addition operation or a concatenation operation is performed on each session object feature vector and the corresponding session content feature vector to obtain a session feature vector of the first session and a session feature vector of each of the at least one second session.
12. The device according to claim 8, wherein The processing unit is further configured to: obtaining at least one third eigenvector matrix based on eigenvector similarities between the text eigenvectors of the at least one second conversation and the text eigenvector of the first conversation; A second eigenvector matrix is obtained based on the at least one third eigenvector matrix and the corresponding weight coefficients.
13. The device according to claim 12, wherein The processing unit is further configured to: Performing a matrix average operation on a third eigenvector matrix to obtain a corresponding matrix average; A weight coefficient of the third eigenvector matrix is obtained by performing a regularization operation on the matrix average value.
14. The device according to any one of claims 8 to 13, characterized in that: The processing unit is used for: The first eigenvector matrix and the second eigenvector matrix are decoded by a decoder to filter out the target session from the session set.
15. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that The method comprises a program code, and when the program code is run on a computer device, the program code is used to enable the computer device to execute the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Session text intention recognition method, intention recognition device and terminal
CN111401069A
System, method and non-transitory computer readable storage medium for conversation analysis
US20180143968A1