Question and answer statement generation method and device, computer equipment and storage medium

Through dynamic generation of candidate document collections and multiple iteration optimization methods, the problem that chatbots cannot adapt to the rapidly changing information needs is solved, and high accuracy and adaptability of question-and-answer sentence generation is achieved to meet the needs of complex business scenarios in the financial field.

CN119621883APending Publication Date: 2025-03-14PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411542316.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

Existing chatbots rely on static knowledge bases and predefined conversation scripts, cannot adapt to rapidly changing information needs and cannot meet complex and diverse business scenarios in the financial field.

Method used

By receiving user query statements, a query vector is generated, and internal product matching is performed with the document vectors in the pre-built corpus, a collection of candidate documents is dynamically generated, multiple iterations are optimized, and accurate question-and-answer statements are finally generated.

Benefits of technology

It realizes the highly accurate Q&A of chatbots in the financial field, enhances adaptability and real-time update capabilities, and meets complex and diverse business needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621883A_ABST
    Figure CN119621883A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a question and answer statement generation method and device, computer equipment and a storage medium, and the method comprises the steps: obtaining a first word embedding vector corresponding to a query statement sent by a user terminal, and generating a query vector according to the first word embedding vector; obtaining a corpus comprising a plurality of pieces of document information and document vectors corresponding to the document information; obtaining inner product information of the query vector and each document vector, determining candidate document vectors in the plurality of document vectors according to the inner product information, and generating a candidate document set according to the plurality of candidate document vectors; inputting the candidate document set and the query vector into a preset generation model, analyzing the candidate document set and the query vector by the generation model, and outputting a question and answer statement; obtaining a second word embedding vector corresponding to the question and answer statement, and regenerating a candidate document set in the plurality of document vectors according to the second word embedding vector and the query vector; the generation model completes generation of the question and answer statement according to the regenerated candidate document set and the query vector.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning technology, applied in the financial field, and in particular to a method, device, computer equipment and storage medium for generating question and answer statements. Background Art

[0002] In the financial field, building professional chatbots as intelligent customer service to conduct Q&A with users can save labor costs while ensuring the standardization of customer service Q&A statements to ensure user service experience. Most of the chatbots currently built rely on static knowledge bases and predefined dialogue scripts, which limits the adaptability and real-time update capabilities of chatbots in response to rapidly changing information needs, and cannot meet the high standards and diverse needs of chatbots in diverse and complex business scenarios in the financial field.

[0003] Therefore, there is an urgent need for a method for generating question and answer sentences for financial systems, so as to improve the accuracy of sentences generated when applied in chatbots. Summary of the invention

[0004] The present application provides a question-answering statement generation method, device, computer equipment and storage medium, aiming to solve the problem that most of the chatbots currently built rely on static knowledge bases and predefined dialogue scripts, which limits the adaptability and real-time update capabilities of chatbots in response to rapidly changing information needs, and cannot meet the high standards and diversified needs of chatbots in diverse and complex business scenarios in the financial field. When building a chatbot through the provided method, the chatbot built can generate accurate and detailed answers to ensure that users obtain the most reliable information.

[0005] In a first aspect, the present application provides a method for generating a question-answering sentence, comprising:

[0006] When receiving a query statement sent by a preset user terminal, obtaining a first word embedding vector corresponding to the query statement, and generating a query vector according to the first word embedding vector;

[0007] Get a pre-built corpus, which includes multiple document information and the document vector corresponding to each document information;

[0008] Obtain inner product information of the query vector and each document vector, determine a candidate document vector from multiple document vectors based on the inner product information, and generate a candidate document set based on the multiple candidate document vectors;

[0009] The candidate document set and query vector are input into the preset generation model, and the generation model parses the candidate document set and query vector and outputs the question-answer sentence;

[0010] Obtain a second word embedding vector corresponding to the question and answer sentence, and regenerate a candidate document set in multiple document vectors according to the second word embedding vector and the query vector;

[0011] The regenerated candidate document set and query vector are input into the generation model, the generation model parses the candidate document set and query vector, re-outputs the question and answer sentence, and completes the generation of the question and answer sentence.

[0012] In some embodiments, obtaining a first word embedding vector corresponding to a query statement includes: segmenting the query statement to obtain multiple words corresponding to the query statement; matching each word with multiple preset stop words, removing successfully matched words from the multiple words, and completing the update of the multiple words; generating a first word embedding vector based on the updated multiple words.

[0013] In some embodiments, generating a query vector based on the first word embedding vector includes: obtaining multiple word vectors corresponding to the first word embedding vector; calculating a mean vector corresponding to the multiple word vectors; and using the mean vector as the query vector.

[0014] In some embodiments, before obtaining a pre-constructed corpus, it also includes: obtaining the dimension corresponding to the query vector; obtaining a corpus to be constructed, the corpus including multiple document information; inputting each document information and dimension into a pre-trained vector retrieval model, the vector retrieval model converts each document information into a document vector according to the dimension; and completing the construction of the corpus according to the document information and the document vector corresponding to each document information.

[0015] Exemplarily, before inputting each document information and dimension into the pre-trained vector retrieval model, it also includes: obtaining training document information; wherein the training document information includes positive sample documents and negative sample documents; respectively inputting the positive sample documents and the negative sample documents into the vector retrieval model to be trained, and the vector retrieval model parses the positive sample documents and the negative sample documents respectively, and outputs the positive sample vector and the negative sample vector; calculating the first inner product of the query vector and the positive sample vector and the second inner product of the query vector and the negative sample vector; if the first inner product is greater than the second inner product, the training of the vector retrieval model is completed.

[0016] In some embodiments, after re-outputting the question and answer statement, it also includes: calculating the confidence threshold corresponding to the question and answer statement; if the confidence threshold is less than a preset threshold, regenerating a candidate document set in multiple document vectors based on the second question and answer statement and the query vector; updating the question and answer statement based on the regenerated candidate document set and the query vector until the confidence threshold of the question and answer statement is greater than the preset threshold.

[0017] Exemplarily, calculating the confidence threshold corresponding to the question and answer sentence includes: obtaining the generation probability corresponding to each word in the question and answer sentence; calculating the confidence threshold according to multiple generation probabilities; wherein the expression of the confidence threshold includes:

[0018]

[0019] Among them, confidence() is the confidence threshold, y is the question and answer sentence, p() is the generation probability, T is the number of words in the question and answer sentence, and w t is the tth word in the question and answer sentence.

[0020] In a second aspect, the present application provides a question-answer sentence generating device, comprising:

[0021] A query generating unit, configured to, upon receiving a query statement sent by a preset user terminal, obtain a first word embedding vector corresponding to the query statement, and generate a query vector according to the first word embedding vector;

[0022] A vector acquisition unit, used to acquire a pre-built corpus, wherein the corpus includes a plurality of document information and a document vector corresponding to each of the document information;

[0023] an inner product acquisition unit, configured to acquire inner product information of the query vector and each of the document vectors, determine a candidate document vector from the plurality of document vectors according to the inner product information, and generate a candidate document set according to the plurality of candidate document vectors;

[0024] A sentence output unit, configured to input the candidate document set and the query vector into a preset generation model, wherein the generation model parses the candidate document set and the query vector and outputs a question-answering sentence;

[0025] A set updating unit, configured to obtain a second word embedding vector corresponding to the question and answer sentence, and to regenerate the candidate document set from the plurality of document vectors according to the second word embedding vector and the query vector;

[0026] The re-output unit is used to input the regenerated candidate document set and the query vector into the generation model, and the generation model parses the candidate document set and the query vector, re-outputs the question and answer sentence, and completes the generation of the question and answer sentence.

[0027] In a third aspect, the present application further provides a computer device, including:

[0028] Memory and processor;

[0029] The memory is used to store computer programs;

[0030] The processor is used to execute the computer program and implement the steps of the question and answer statement generation method described in the first aspect above when executing the computer program.

[0031] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the steps of the question and answer statement generation method as described in the first aspect above.

[0032] The embodiment of the present application provides a method, device, computer equipment and storage medium for generating question and answer statements. After receiving the query statement sent by the user terminal, the method first converts the query statement into a high-dimensional first word embedding vector using word embedding technology. Then, the query vector is generated by using the embedding vector. This process ensures that the semantic features of the query statement are accurately captured and expressed. Then, the method pre-builds a corpus, which contains multiple document information, and calculates and stores the corresponding document vector for each document. The document vector is generated in a manner similar to the query vector to ensure the effective expression of the document semantics. Then, the method calculates the inner product between the query vector and each document vector in the corpus, and the inner product result reflects the semantic relevance between the query and the document. Then, according to the inner product result, the most relevant documents are selected to form multiple candidate document vectors, and a candidate document set corresponding to multiple candidate document vectors is generated. Further, the method inputs the candidate document set and the query vector into a trained generation model (such as GPT, etc.). The generation model is responsible for parsing the input and generating a first question and answer statement around the semantic content of the input. The first question and answer statement is subjected to word embedding conversion to generate a second word embedding vector. The second word embedding vector is used to recalculate the candidate document selection process in the initial step and update the candidate document set. Finally, the updated document set is input into the generation model again to generate the optimized final question and answer sentence. The accuracy of the final generated question and answer sentence is ensured by dynamically iterating the retrieval and updating of the candidate document set in the corpus.

[0033] The provided method has the following beneficial effects:

[0034] 1. Enhanced adaptability: The dynamic nature of the method enables it to respond to user needs in a timely manner and adapt to rapidly changing situations, especially complex financial business environments.

[0035] 2. Efficiency and accuracy: Through inner product calculation and multiple iterative optimization, the question-answering sentence generation process can be continuously optimized to improve the relevance and semantic accuracy of the output.

[0036] 3. Reduced dependency: Not relying on predefined dialogue scripts and static knowledge bases enables the method to perform real-time knowledge updating and information retrieval, greatly enhancing its flexibility.

[0037] 4. Personalized service support: Based on the queries of different users, personalized question and answer generation is realized to meet the specific needs of users.

[0038] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0040] Figure 1 This is a schematic flow chart of the steps of a method for generating a question and answer sentence provided in one embodiment of the present application;

[0041] Figure 2 is a schematic flowchart of the steps of a first word embedding vector generation method provided in an embodiment of the present application;

[0042] Figure 3 is a schematic flow chart of the steps of a query vector generation method provided in an embodiment of the present application;

[0043] Figure 4 It is a structural diagram of a question-answering sentence generating device provided in an embodiment of the present application;

[0044] Figure 5 It is a schematic block diagram of the structure of a computer device provided in one embodiment of the present application.

[0045] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0047] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0048] It should be understood that, in order to facilitate the clear description of the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, the words "first", "second", etc. are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art can understand that the words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not necessarily limit the difference.

[0049] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0050] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0051] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0052] In the financial field, building professional chatbots as intelligent customer service to answer questions with users can save labor costs while ensuring the standardization of customer service question and answer statements to ensure user service experience. Most of the chatbots currently built rely on static knowledge bases and predefined dialogue scripts, which limits the adaptability and real-time update capabilities of chatbots in response to rapidly changing information needs, and cannot meet the high standards and diverse needs of chatbots in diverse and complex business scenarios in the financial field.

[0053] However, traditional retrieval-enhanced generation models, such as RETRO (Retrieval-Enhanced Transformer) and RAG (Retrieval-Augmented Generation), can improve the accuracy of answers by retrieving external knowledge bases, but they usually use one-time retrieval and cannot be dynamically adjusted to reflect the latest information. This shows obvious limitations when dealing with complex multi-hop question answering and fact verification tasks.

[0054] Therefore, there is an urgent need for a method for generating question and answer sentences for financial systems, so as to improve the accuracy of sentences generated when applied in chatbots.

[0055] To solve the above problems, please refer to Figure 1 , Figure 1This is a schematic flow chart of a question-answering sentence generation method provided in an embodiment of the present application. The question-answering sentence generation method can be implemented by a computer device, which can be deployed on a single server or a server cluster. It can also be deployed on a handheld terminal, a laptop computer, a wearable device, or a robot.

[0056] It should be noted that the acquisition of relevant information involved in the question and answer statement generation process by the provided method complies with relevant regulations and is carried out with the user's consent, and will not infringe on the user's privacy or violate relevant laws and regulations.

[0057] At the same time, in addition to the financial field, the provided method is also applicable to other fields that require high real-time and accuracy of information, such as legal affairs, medical care, education, etc. The embodiments of the present application do not limit the application fields of the provided method.

[0058] Specifically, Figure 1 As shown, the provided question-answer sentence generation method includes steps S101 to S106. The details are as follows:

[0059] Step S101. When a query statement sent by a preset user terminal is received, a first word embedding vector corresponding to the query statement is obtained, and a query vector is generated according to the first word embedding vector.

[0060] Specifically, when the computer device receives the query sentence sent by the user terminal, it obtains the first word embedding vector (word embedding) corresponding to it, and generates a query vector based on these word embeddings. Word embedding is a technology that converts words in natural language into numerical vectors. Common methods include Word2Vec, GloVe, BERT, etc. These vectors capture the semantic relationship and contextual meaning between words. For example, sentence-level embedding can be obtained through models such as BERT. For example, if a user asks "What is the latest stock market trend?" through a user terminal (mobile phone, computer or other arbitrary terminal device), the computer device can convert this sentence into a numerical vector representing the semantics of the query. Then, by obtaining the word embedding of the query and generating a vector, the provided method can effectively capture the context and semantic information of the user's query, which is convenient for matching with the corpus in the subsequent steps.

[0061] In some embodiments, Figure 2 As shown, obtaining the first word embedding vector corresponding to the query statement includes steps S101a to S101c.

[0062] Step S101a: segment the query statement to obtain multiple words corresponding to the query statement.

[0063] The computer device performs word segmentation on the received query statement to obtain multiple words corresponding to the query statement. Word segmentation is a basic step in natural language processing, aiming to split the text into individual words or phrases. Regular expressions, dictionary matching, or machine learning-based tokenizers (such as the tokenizer in NLTK, or more complex tokenization tools like spaCy, CoreNLP, etc.) can be used. For example, for the input query "What is the latest stock market trend?", the tokenizer splits the text into a list of words: ["latest", "of", "stock", "market", "trend", "how"]. After word segmentation, it is easier to process and analyze the components of the text, and it lays a foundation for subsequent word matching and vectorization steps.

[0064] Step S101b. Match each word with a preset list of multiple stop words, and remove the words that match successfully from the multiple words to complete the update of the multiple words.

[0065] By matching each word with a preset list of multiple stop words and removing the successfully matched stop words from the word list, the update of the word list is completed. Stop words are some commonly used words that are removed in text processing because they usually contribute less to the main information of the text. The stop word list can be adjusted according to the actual application, and common words include "of", "is", "has", etc. Continuing with the above word segmentation example, assuming the stop word list contains "of" and "how", after removing these stop words, the word list is updated to: ["latest", "stock", "market", "trend"]. By removing the stop words that contribute less to the semantics, the text is simplified, the noise is reduced, and it helps to improve the accuracy of the word embedding representation.

[0066] Step S101c. Generate the first word embedding vector according to the updated multiple words.

[0067] By generating the first word embedding vector according to the updated word list. Word embedding techniques (such as Word2Vec, GloVe, BERT, etc.) are used to convert each word in the word list into a numerical vector. Then, the word embedding vector representing the entire query statement can be generated in various ways (such as taking the average, performing context processing on the word embeddings, etc.). Assuming the BERT model is used to encode the words, each word will be represented as a vector, and finally a vector representing the entire query is generated through a certain strategy (such as taking the average). The semantic information of the words is captured by the word embedding vector, which can better support the matching with the document vectors in the corpus and improve the efficiency and accuracy of information retrieval. Through steps S101a to S101c, the provided method can more accurately understand the user's query, eliminate unnecessary word interference, and prepare for subsequent information retrieval and generation steps.

[0068] In some embodiments, Figure 3 As shown, generating a query vector according to the first word embedding vector includes steps S101d to S101f.

[0069] Step S101d. Obtain multiple word vectors corresponding to the first word embedding vector.

[0070] By obtaining multiple word vectors corresponding to the first word embedding vector. Use word embedding models (such as Word2Vec, GloVe, BERT, etc.) to generate corresponding word vectors for each word. Each word vector is a high-dimensional numerical representation that captures the semantic information and contextual relationship of the word. If the word list is ["latest", "stock", "market", "trend"], then we will use the word embedding model to generate a vector for each word. By obtaining independent word vectors for each word, it helps to capture more fine-grained semantic information and provide the necessary basic data for subsequent calculations.

[0071] Step S101e. Calculate the mean vector corresponding to multiple word vectors.

[0072] By calculating the mean vector corresponding to multiple word vectors. In order to obtain a single query vector, the word vector set can be averaged. The mean vector can represent the comprehensive semantic information of the entire query statement. The mean is calculated by adding all word vectors element by element and then dividing by the number of word vectors. The mean vector can effectively integrate the semantic information of the entire query, simplifying the information without losing too much semantic details, and facilitating fast matching.

[0073] Step S101f. Use the mean vector as the query vector.

[0074] By using the mean vector as the query vector. The calculated mean vector is used as the query vector representing the entire query statement, and then it is used to match the document vector in the subsequent steps. Once the mean vector is obtained, it will be directly used to retrieve relevant documents in the pre-built corpus. This simplifies the data structure, making the subsequent processing of the query more direct and efficient. Through this mean vector, the matching accuracy with the document vector can be improved, thereby improving the overall performance of the question-answering system in text understanding.

[0075] Through step S101d to step S101f, the provided method can further condense the key information in the user query and generate a vector representation that is simple to calculate and can effectively match the corpus content.

[0076] Step S102: Obtain a pre-built corpus, which includes a plurality of document information and a document vector corresponding to each document information.

[0077] Specifically, the computer device obtains a pre-built corpus, which includes multiple documents, each of which has a corresponding document vector. The semantics of each document is represented by embeddings similar to TF-IDF, Doc2Vec, or generated by a deep learning model (such as BERT for text encoding). For example, the corpus may include documents such as "the latest analysis report on market trends by institutions" and "a summary of recent stock market news." Each document is encoded as a vector to represent its content. After converting the document into a vector, the system can quickly match related documents through vector operations, thereby improving the efficiency and accuracy of information retrieval.

[0078] In some embodiments, before obtaining a pre-constructed corpus, it also includes: obtaining the dimension corresponding to the query vector; obtaining a corpus to be constructed, the corpus including multiple document information; inputting each document information and dimension into a pre-trained vector retrieval model, the vector retrieval model converts each document information into a document vector according to the dimension; and completing the construction of the corpus according to the document information and the document vector corresponding to each document information.

[0079] By determining the vector dimension when generating the query vector. This is usually determined by the number of hidden neural units or the vector length used by the word embedding model. For example, the length of each word embedding generated by BERT-base is 768 dimensions. Then collect multiple document information to be added to the corpus. This document information is the basic data that needs to be retrieved and referenced in the future, and may include texts such as news articles and financial reports. Use pre-trained models (such as TF-IDF, BERT, Sentence Transformers, etc.) to convert each document information into a high-dimensional vector according to the acquired dimension. This step ensures that the document vector and the query vector are in the same vector space. Finally, the generated document vector is stored in the corpus together with the corresponding original document information. In this way, the corpus not only contains text data, but also has vector representations for fast retrieval and matching. For example, given a financial news corpus, the article may have: "XX institution announced interest rate changes", the computer device first determines the dimension of the query vector, such as 768 dimensions. Then the article text is converted into a 768-dimensional document vector through the model, and this vector is associated with the original document information and stored. This ensures that the query vector and document vector operate on the same dimension, which is beneficial for the comparison and accuracy of vector calculations. At the same time, by preprocessing the document into a vector form, the system can quickly complete the similarity matching between the query and the document, improving the response speed of information retrieval. Even when used in a large corpus, the vectorized representation still has good scalability and robustness, and is suitable for complex texts and diverse query scenarios.

[0080] The above embodiments ensure that the infrastructure construction of the corpus is scientific and reasonable, laying a good foundation for subsequent efficient information retrieval and processing.

[0081] Exemplarily, before inputting each document information and dimension into the pre-trained vector retrieval model, it also includes: obtaining training document information; wherein the training document information includes positive sample documents and negative sample documents; respectively inputting the positive sample documents and the negative sample documents into the vector retrieval model to be trained, and the vector retrieval model parses the positive sample documents and the negative sample documents respectively, and outputs the positive sample vector and the negative sample vector; calculating the first inner product of the query vector and the positive sample vector and the second inner product of the query vector and the negative sample vector; if the first inner product is greater than the second inner product, the training of the vector retrieval model is completed.

[0082] By preparing a document dataset for training, including positive sample documents and negative sample documents. Among them, the positive sample documents have a high correlation with certain queries, while the negative sample documents are irrelevant or have a low correlation. The positive sample documents and negative sample documents are respectively input into the vector retrieval model to be trained to generate corresponding positive sample vectors and negative sample vectors. These vectors are used to model the semantic similarity between the document and the query vector. Then the inner product between the query vector and the positive sample vector (first inner product) and the inner product between the query vector and the negative sample vector (second inner product) are calculated. The inner product is used to measure the degree of similarity between vectors, that is, the larger the inner product, the higher the similarity.

[0083] During the model training process, the first inner product and the second inner product are compared. If the first inner product is greater than the second inner product, it means that the model correctly identifies that the positive sample document is more relevant to the query than the negative sample document. If this condition is met multiple times, it means that the training can be terminated. Otherwise, it is necessary to continue to adjust the model parameters to improve the accuracy of identifying relevance.

[0084] Assuming there is a query "How to invest in the stock market", the positive sample document may be "Stock investment guide", while the negative sample document may be "Tourist attraction recommendation". During the model training process, the inner product of the query vector and the vector of "Stock investment guide" should be significantly larger than the inner product with "irrelevant documents". Achieving this result effectively improves the retrieval performance of the model.

[0085] Furthermore, by distinguishing between positive and negative samples, the vector retrieval model can learn a more accurate representation of text similarity, which helps to quickly and accurately retrieve relevant documents from the corpus. At the same time, using these training data to continuously adjust the model parameters can improve the adaptability to different queries and enhance the robustness of the system. This method can be used to automate the training process, thereby reducing the need for manual labeling and intervention and reducing development costs. The above embodiment provides a systematic method for optimizing the model by introducing sample labels and inner product comparisons, which can achieve better content matching and semantic understanding through continuous learning and improvement.

[0086] Step S103: Obtain inner product information between the query vector and each document vector, determine a candidate document vector from multiple document vectors based on the inner product information, and generate a candidate document set based on the multiple candidate document vectors.

[0087] Specifically, the computer device calculates the inner product of the query vector and each document vector, selects several documents with the highest inner product information (i.e., the most relevant documents), and forms a candidate document set. The inner product reflects the similarity of two vectors. The larger the value, the closer the two vectors are. In this way, the documents most relevant to the query can be screened out. If the query is about "stock market", then documents containing similar topics or keywords will be selected. In this way, the content with the highest relevance to the query statement is quickly locked, which reduces the amount of subsequent calculations and improves processing speed.

[0088] Step S104: Input the candidate document set and the query vector into a preset generation model, and the generation model parses the candidate document set and the query vector to output a question-answering statement.

[0089] Specifically, the computer device inputs the candidate document set and query vector selected in the first round into a preset generative model, which parses these inputs and outputs preliminary question-answering statements. The generative model can be a model based on the Transformer architecture such as GPT, T5, etc., which can generate accurate answers by learning the relationship between documents and queries. For example, the generative model may output "According to the latest report, the stock market trend is affected by XXX factors and is expected to show XXX trends." By adopting a generative model, document information and user queries can be combined to generate natural and contextual answers.

[0090] Step S105. Obtain a second word embedding vector corresponding to the question and answer sentence, and regenerate a candidate document set in multiple document vectors based on the second word embedding vector and the query vector.

[0091] Specifically, the computer device obtains the second word embedding vector corresponding to the initially generated question and answer sentence, and then matches the documents in the corpus again based on these vectors and the initial query vector to regenerate the candidate document set. By using the generated question and answer sentence as a new context and considering it comprehensively with the original query, it looks for relevant documents that may have been missed. For example, the initial output question and answer may lead to the retrieval of more documents related to current market dynamics and deeper analysis. Then, by improving the possible omissions in the initial match and through dynamic retrieval updates, the completeness and accuracy of the final answer are improved.

[0092] Step S106. Input the regenerated candidate document set and query vector into the generation model, the generation model parses the candidate document set and query vector, re-outputs the question and answer sentence, and completes the generation of the question and answer sentence.

[0093] Specifically, the computer device re-inputs the updated candidate document set and query vector into the generation model, parses again and outputs the final question and answer statement. Through multiple rounds of generation and correction mechanisms, the model can iteratively generate gradually improved answers to ensure high-quality output. This makes the final output answer more detailed and accurate, and may be supplemented with, for example, the latest comments or predictions on certain specific events. At the same time, the candidate document set can also be iteratively updated more times as needed to continuously update the question and answer statements. This ensures that the question and answer results can answer the user's questions more thoroughly, while adapting to the latest information trends, improving user experience and answer quality.

[0094] Furthermore, steps S101 to S106 achieve the high requirements for information timeliness and accuracy in the financial field through multi-step iteration and dynamic adjustment, while meeting the needs of diversified business scenarios.

[0095] In some embodiments, after re-outputting the question and answer statement, it also includes: calculating the confidence threshold corresponding to the question and answer statement; if the confidence threshold is less than a preset threshold, regenerating a candidate document set in multiple document vectors based on the second question and answer statement and the query vector; updating the question and answer statement based on the regenerated candidate document set and the query vector until the confidence threshold of the question and answer statement is greater than the preset threshold.

[0096] After the question and answer statement is generated, the computer device calculates the confidence of the output. The confidence is usually based on indicators such as the model's confidence score for the answer, the consistency score between the answer and the query or original document, and so on. The calculated confidence is compared with the preset minimum threshold. If the confidence is lower than the threshold, it means that the current question and answer is not reliable enough, and a better answer may need to be regenerated. At the same time, the second question and answer statement and the query vector are used to search again in multiple document vectors to generate a new set of candidate documents. This step uses the updated query strategy to find more relevant or high-quality documents. Finally, the question and answer statement is regenerated based on the new set of candidate documents and the query vector. This process continues until the confidence of the generated question and answer exceeds the preset threshold. At the same time, the maximum number of iterations can also be set, and the update stops when the maximum number of iterations is exceeded.

[0097] Assume that the provided method generates a preliminary question-answering statement, but the confidence score is 65%, which is lower than the preset 80% threshold. The method analyzes the query and candidate documents, readjusts the query strategy, finds data that is more relevant to the question, such as the latest research reports, and iterates continuously, eventually generating a question-answering statement with a confidence score of 85%.

[0098] Then, through repeated adjustments and optimization mechanisms, the quality and reliability of the output questions and answers are ensured to reach the best level, reducing the possibility of wrong answers. Since the question and answer statements provided by the method have been verified and adjusted many times, the user's trust in the output of the method can be significantly improved, thereby improving user experience and satisfaction. The method can adapt to queries of different complexity and ambiguity, and by adjusting the threshold settings and search strategies, it ensures that the system can flexibly respond to changing user needs. At the same time, while ensuring that the documents involved in the generation of candidate answers are as relevant and high-quality as possible, the system resources are effectively utilized to improve the efficiency of retrieval and output.

[0099] The above-mentioned embodiments improve the robustness and accuracy of the question-answering system by introducing an iterative evaluation and optimization mechanism, and help to ensure high-standard quality of output information in an uncertain environment.

[0100] Exemplarily, calculating the confidence threshold corresponding to the question and answer sentence includes: obtaining the generation probability corresponding to each word in the question and answer sentence; calculating the confidence threshold according to multiple generation probabilities; wherein the expression of the confidence threshold includes:

[0101]

[0102] Among them, confidence() is the confidence threshold, y is the question and answer sentence, p() is the generation probability, T is the number of words in the question and answer sentence, and w t is the tth word in the question and answer sentence.

[0103] The method uses a language model, such as GPT or other generative models, to calculate the generation probability of each word in the sentence during the process of generating a question-answering sentence. These probabilities indicate the confidence of the model when generating the word. The overall confidence of the question-answering sentence is calculated by a specific formula using the generation probability of each word. The calculated confidence is used to judge the reliability of the question-answering sentence and decide whether the answer needs to be regenerated. By calculating the generation probability of each word, the overall quality and credibility of the question-answering sentence can be evaluated more accurately, providing a more fine-grained evaluation compared to a single standard score. At the same time, low confidence can prompt the system to dynamically adjust the output, provide additional opportunities for answer refinement and improvement, and improve the final question-answering quality. This provides users and developers with a more transparent model decision-making method, which can analyze the reasons for the uncertainty of the model on certain words and improve model training or strategies. If the generation probability of some words is significantly low, it may indicate that there are potential problems in the context understanding or model training of these words, which can guide further model optimization and data enhancement. Through precise probability analysis and calculation, the quality control mechanism of question-answering generation is enhanced, which helps to improve the reliability of system output and user experience.

[0104] Next, an example is used to illustrate the content of the solution provided by this application:

[0105] 1. Text preprocessing

[0106] The system receives the query q input by the user and uses the pre-trained BERT model to segment the query, filter the stop words, and convert it into a word embedding vector. The mean of the word embedding is taken as the query vector q′∈R d , where d represents the dimension of text embedding. q′=E(q). Here E is the mean of word embedding of BERT model.

[0107] 2. The first stage retrieval system uses the preprocessed query vector q' as input and retrieves relevant documents in a large-scale corpus through vector retrieval. Here we use the BERT-based twin tower model as the vector retrieval model. Similarly, vector retrieval converts each document d i Convert to embedding vector d i ′, where d i The dimension of ′ is d, which represents the document vector dimension, and its dimension size is the same as q'. Then calculate the query vector q' and the document vector d i ′’s inner product score s i . Select the top k documents most relevant to the query based on the scores to form the candidate document set D q . Specific formula:

[0108] d i ′=E(d i );

[0109] s i =q′ T d i ′;

[0110] D q ={d i ′|s i in top_k};

[0111] Here D q is the set of top k candidate documents.

[0112] 3. The first round of generation system sets candidate documents D q and the query vector d i As input, the question-answering sentence y1 is generated through the generative model M (Transformer model). y1=M(q′,D q ).

[0113] 4. Generate an enhanced retrieval system. Use the BERT model to embed the initial question and answer sentence y1 to get y1′, add y1′ to the query vector q' as input, and search again through vector retrieval. New candidate document set It is retrieved based on the concatenated vector.

[0114] y1′=E(y1);

[0115] s i =(q′+y1′) T d i ;

[0116]

[0117] here is a new set of candidate documents.

[0118] 5. The second generation and subsequent iterations system will collect new candidate documents and the query vector d i As input, the improved question-answering sentence y2 is generated through the generative model M (Transformer model). According to the confidence of the generated result and the preset number of iterations, the system performs multiple iterations, and each iteration continuously optimizes the answer quality based on the previous generation result. We set the maximum number of iterations N max and confidence threshold θ to dynamically adjust the iteration process. When the confidence of the generated result exceeds the threshold θ or reaches the maximum number of iterations N max , the iteration is terminated.

[0119]

[0120] Here y2 is the improved question-answer sentence.

[0121] 6. Dynamic Termination Mechanism: The dynamic adjustment iteration process in step 5 is called the dynamic termination mechanism. The iteration is terminated dynamically according to the following conditions: ① Maximum number of iterations N max :If the number of iterations reaches N max , the iteration is terminated. ② Confidence threshold θ: If the confidence of the generated result exceeds the threshold θ, the iteration is terminated. The specific formula is as follows:

[0122] if confidence(y i )≥θor i≥N max ,terminate.

[0123] The confidence calculation can be achieved by the following methods: Probability distribution: Use the output probability distribution of the generative model to calculate the confidence. Assume that the generated y i Composed of multiple words w1, w2, ..., wT Composition, the generation model can give the generation probability p(w t ). The confidence is expressed as the average of the products of all word generation probabilities.

[0124]

[0125] Where T is the number of words generated, p(w t ) is the generation probability of the tth word.

[0126] 7. Retrieve model training process and inference process. The loss function is the sum of the cross entropy loss function and the contrastive learning loss. Cross entropy loss function: The generative model M is trained using the cross entropy loss function.

[0127]

[0128] where y i is the true label, p i is the predicted probability and N is the number of samples. By minimizing the cross entropy loss, the generative model is able to more accurately generate answers relevant to the input query.

[0129] Contrastive Learning: Vector retrieval is trained using contrastive learning, which maximizes the similarity between positive samples and the query vector while minimizing the similarity between negative samples and the query vector.

[0130] Positive and negative sample pairs: corresponding to each i-th iteration training, after the i-1-th training, the query vector q' and the generated result y i-1 After adding ′, the first k candidate document sets and the last k candidate document sets are obtained through the retrieval model.

[0131] Specifically, given a query vector q', it contains multiple positive sample vectors d' + and multiple negative sample vectors d′ - , the training goal is to make the inner product of the positive sample and the query greater than the inner product of the negative sample and the query. The formula is as follows:

[0132]

[0133] Where ∈ is a positive constant boundary value, ensuring that the inner product between the positive sample and the query is larger than the inner product between the negative sample and the query. In this way, vector retrieval can learn better document embedding representations, thereby improving retrieval results.

[0134] Furthermore, the above embodiments mainly have the following improvements: ① Dynamic termination mechanism: dynamically adjust the iteration process according to the confidence of the generated results and the preset number of iterations to ensure termination when the best effect is achieved, reducing unnecessary computing overhead. ② Contrastive learning: Contrastive learning is used for training in the vector retrieval stage to improve the retrieval effect by maximizing the similarity between positive samples and query vectors and minimizing the similarity between negative samples and query vectors. These technical improvements enable the chatbot to respond to user queries more accurately and reflect the latest industry trends and policy changes in real time. For example, when processing inquiries from insurance customers about the latest insurance terms, it is possible to iteratively retrieve the latest regulations and policy documents to generate accurate and detailed answers, ensuring that customers obtain the most reliable information.

[0135] In combination with the above embodiments, the method provided by the present application first converts the query statement into a high-dimensional first word embedding vector by using word embedding technology after receiving the query statement sent by the user terminal. Then, the query vector is generated by using the embedding vector. This process ensures that the semantic features of the query statement are accurately captured and expressed. Then, the method pre-builds a corpus, which contains multiple document information, and calculates and stores the corresponding document vector for each document. The document vector is generated in a manner similar to the query vector to ensure the effective expression of the document semantics. Then, the method calculates the inner product between the query vector and each document vector in the corpus, and the inner product result reflects the semantic relevance between the query and the document. Then, according to the inner product result, the most relevant documents are selected to form multiple candidate document vectors, and a candidate document set corresponding to multiple candidate document vectors is generated. Further, the method inputs the candidate document set and the query vector into a trained generation model (such as GPT, etc.). The generation model is responsible for parsing the input and generating a first question and answer statement around the semantic content of the input. The first question and answer statement is word-embedded and converted to generate a second word embedding vector. The second word embedding vector is used to recalculate the candidate document selection process in the initial step and update the candidate document set. Finally, the updated document set is input into the generation model again to generate the optimized final question and answer sentence. The accuracy of the final generated question and answer sentence is ensured by dynamically iterating the retrieval and updating of the candidate document set in the corpus.

[0136] The provided method has the following beneficial effects:

[0137] 1. Enhanced adaptability: The dynamic nature of the method enables it to respond to user needs in a timely manner and adapt to rapidly changing situations, especially complex financial business environments.

[0138] 2. Efficiency and accuracy: Through inner product calculation and multiple iterative optimization, the question-answering sentence generation process can be continuously optimized to improve the relevance and semantic accuracy of the output.

[0139] 3. Reduced dependency: Not relying on predefined dialogue scripts and static knowledge bases enables the method to perform real-time knowledge updating and information retrieval, greatly enhancing its flexibility.

[0140] 4. Personalized service support: Based on the queries of different users, personalized question and answer generation is realized to meet the specific needs of users.

[0141] See also Figure 4 As shown, Figure 4 1 is a schematic diagram of the structure of the question-answering sentence generating device 200 provided in an embodiment of the present application. The question-answering sentence generating device 200 is used to execute the steps of the question-answering sentence generating method shown in the above embodiments. The question-answering sentence generating device 200 can be a single server or a server cluster, or the question-answering sentence generating device 200 can be a terminal, which can be a handheld terminal, a laptop computer, a wearable device or a robot, etc.

[0142] like Figure 4 As shown, the question-answering sentence generating device 200 includes:

[0143] The query generation unit 201 is used to obtain a first word embedding vector corresponding to the query statement when receiving a query statement sent by a preset user terminal, and generate a query vector according to the first word embedding vector;

[0144] A vector acquisition unit 202 is used to acquire a pre-built corpus, wherein the corpus includes a plurality of document information and a document vector corresponding to each of the document information;

[0145] An inner product acquisition unit 203 is used to acquire inner product information between the query vector and each of the document vectors, determine a candidate document vector from the multiple document vectors according to the inner product information, and generate a candidate document set according to the multiple candidate document vectors;

[0146] A sentence output unit 204, configured to input the candidate document set and the query vector into a preset generation model, wherein the generation model parses the candidate document set and the query vector and outputs a question-answering sentence;

[0147] A set updating unit 205, configured to obtain a second word embedding vector corresponding to the question and answer sentence, and to regenerate the candidate document set from the plurality of document vectors according to the second word embedding vector and the query vector;

[0148] The re-output unit 206 is used to input the regenerated candidate document set and the query vector into the generation model, and the generation model parses the candidate document set and the query vector, re-outputs the question and answer sentence, and completes the generation of the question and answer sentence.

[0149] It should be noted that technical personnel in the relevant field can clearly understand that, for the convenience and conciseness of description, the specific working process of the question and answer sentence generation device and each module described above can refer to the corresponding process in the question and answer sentence generation method embodiments described in the above embodiments, and will not be repeated here.

[0150] The above-mentioned question-answering sentence generation method can be implemented in the form of a computer program. The computer program can be used in Figure 4 Run on the device shown.

[0151] See also Figure 5 , Figure 5 1 is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device includes a processor, a memory and a network interface connected via a device bus, wherein the memory may include a storage medium and an internal memory.

[0152] The storage medium can store an operating device and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any one of the question-answering sentence generation methods.

[0153] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0154] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any one of the question and answer sentence generation methods.

[0155] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present application, and does not constitute a limitation on the terminal to which the scheme of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0156] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0157] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:

[0158] When receiving a query statement sent by a preset user terminal, obtaining a first word embedding vector corresponding to the query statement, and generating a query vector according to the first word embedding vector;

[0159] Get a pre-built corpus, which includes multiple document information and the document vector corresponding to each document information;

[0160] Obtain inner product information of the query vector and each document vector, determine a candidate document vector from multiple document vectors based on the inner product information, and generate a candidate document set based on the multiple candidate document vectors;

[0161] The candidate document set and query vector are input into the preset generation model, and the generation model parses the candidate document set and query vector and outputs the question-answer sentence;

[0162] Obtain a second word embedding vector corresponding to the question and answer sentence, and regenerate a candidate document set in multiple document vectors according to the second word embedding vector and the query vector;

[0163] The regenerated candidate document set and query vector are input into the generation model, the generation model parses the candidate document set and query vector, re-outputs the question and answer sentence, and completes the generation of the question and answer sentence.

[0164] In some embodiments, obtaining a first word embedding vector corresponding to a query statement includes: segmenting the query statement to obtain multiple words corresponding to the query statement; matching each word with multiple preset stop words, removing successfully matched words from the multiple words, and completing the update of the multiple words; generating a first word embedding vector based on the updated multiple words.

[0165] In some embodiments, generating a query vector based on the first word embedding vector includes: obtaining multiple word vectors corresponding to the first word embedding vector; calculating a mean vector corresponding to the multiple word vectors; and using the mean vector as the query vector.

[0166] In some embodiments, before obtaining a pre-constructed corpus, it also includes: obtaining the dimension corresponding to the query vector; obtaining a corpus to be constructed, the corpus including multiple document information; inputting each document information and dimension into a pre-trained vector retrieval model, the vector retrieval model converts each document information into a document vector according to the dimension; and completing the construction of the corpus according to the document information and the document vector corresponding to each document information.

[0167] Exemplarily, before inputting each document information and dimension into the pre-trained vector retrieval model, it also includes: obtaining training document information; wherein the training document information includes positive sample documents and negative sample documents; respectively inputting the positive sample documents and the negative sample documents into the vector retrieval model to be trained, and the vector retrieval model parses the positive sample documents and the negative sample documents respectively, and outputs the positive sample vector and the negative sample vector; calculating the first inner product of the query vector and the positive sample vector and the second inner product of the query vector and the negative sample vector; if the first inner product is greater than the second inner product, the training of the vector retrieval model is completed.

[0168] In some embodiments, after re-outputting the question and answer statement, it also includes: calculating the confidence threshold corresponding to the question and answer statement; if the confidence threshold is less than a preset threshold, regenerating a candidate document set in multiple document vectors based on the second question and answer statement and the query vector; updating the question and answer statement based on the regenerated candidate document set and the query vector until the confidence threshold of the question and answer statement is greater than the preset threshold.

[0169] Exemplarily, calculating the confidence threshold corresponding to the question and answer sentence includes: obtaining the generation probability corresponding to each word in the question and answer sentence; calculating the confidence threshold according to multiple generation probabilities; wherein the expression of the confidence threshold includes:

[0170]

[0171] Among them, confidence() is the confidence threshold, y is the question and answer sentence, p() is the generation probability, T is the number of words in the question and answer sentence, and w t is the tth word in the question and answer sentence.

[0172] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement the steps of the question and answer statement generation method provided in the above embodiments of the present application.

[0173] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.

[0174] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for generating a question-answering sentence, characterized in that: include: When receiving a query statement sent by a preset user terminal, obtaining a first word embedding vector corresponding to the query statement, and generating a query vector according to the first word embedding vector; Obtain a pre-built corpus, wherein the corpus includes a plurality of document information and a document vector corresponding to each of the document information; Obtaining inner product information of the query vector and each of the document vectors, determining a candidate document vector from the plurality of document vectors according to the inner product information, and generating a candidate document set according to the plurality of candidate document vectors; Inputting the candidate document set and the query vector into a preset generation model, wherein the generation model parses the candidate document set and the query vector and outputs a question-answering sentence; Obtaining a second word embedding vector corresponding to the question and answer sentence, and regenerating the candidate document set in the plurality of document vectors according to the second word embedding vector and the query vector; The regenerated candidate document set and the query vector are input into the generation model, and the generation model parses the candidate document set and the query vector, re-outputs the question and answer sentence, and completes the generation of the question and answer sentence.

2. The method according to claim 1, characterized in that The obtaining a first word embedding vector corresponding to the query statement includes: Segmenting the query statement to obtain multiple words corresponding to the query statement; Matching each of the words with a plurality of preset stop words, removing the words that have been successfully matched from the plurality of words, and completing the updating of the plurality of words; The first word embedding vector is generated according to the updated plurality of the words.

3. The method according to claim 1, characterized in that The generating a query vector according to the first word embedding vector includes: Obtain multiple word vectors corresponding to the first word embedding vector; Calculate the mean vector corresponding to the plurality of word vectors; The mean vector is used as the query vector.

4. The method according to claim 1, characterized in that: Before obtaining the pre-built corpus, the method further includes: Obtaining a dimension corresponding to the query vector; Acquire a corpus to be constructed, wherein the corpus includes a plurality of document information; Inputting each of the document information and the dimension into a pre-trained vector retrieval model, wherein the vector retrieval model converts each of the document information into the document vector according to the dimension; The corpus is constructed according to the document information and the document vector corresponding to each piece of document information.

5. The method according to claim 4, characterized in that Before inputting each of the document information and the dimension into the pre-trained vector retrieval model, the method further includes: Acquire training document information; wherein the training document information includes positive sample documents and negative sample documents; The positive sample document and the negative sample document are respectively input into the vector retrieval model to be trained, and the vector retrieval model parses the positive sample document and the negative sample document respectively, and outputs a positive sample vector and a negative sample vector; Calculating a first inner product of the query vector and the positive sample vector and a second inner product of the query vector and the negative sample vector; If the first inner product is greater than the second inner product, the training of the vector retrieval model is completed.

6. The method according to claim 1, characterized in that After re-outputting the question and answer statement, the method further includes: Calculating a confidence threshold corresponding to the question and answer statement; If the confidence threshold is less than a preset threshold, regenerating the candidate document set in the plurality of document vectors according to the second question and answer statement and the query vector; The question and answer statement is updated according to the regenerated candidate document set and the query vector until a confidence threshold of the question and answer statement is greater than a preset threshold.

7. The method according to claim 6, characterized in that The calculating the confidence threshold corresponding to the question and answer statement includes: Obtaining the generation probability corresponding to each word in the question-answer sentence; The confidence threshold is calculated according to the multiple generation probabilities; wherein the expression of the confidence threshold includes: Wherein, confidence( ) is the confidence threshold, y is the question-answering sentence, p( ) is the generation probability, T is the number of words in the question-answering sentence, and w t is the tth word in the question and answer sentence.

8. A question-answering sentence generating device, characterized in that: include: A query generating unit, configured to, upon receiving a query statement sent by a preset user terminal, obtain a first word embedding vector corresponding to the query statement, and generate a query vector according to the first word embedding vector; A vector acquisition unit, used to acquire a pre-built corpus, wherein the corpus includes a plurality of document information and a document vector corresponding to each of the document information; an inner product acquisition unit, configured to acquire inner product information of the query vector and each of the document vectors, determine a candidate document vector from the plurality of document vectors according to the inner product information, and generate a candidate document set according to the plurality of candidate document vectors; A sentence output unit, configured to input the candidate document set and the query vector into a preset generation model, wherein the generation model parses the candidate document set and the query vector and outputs a question-answering sentence; A set updating unit, configured to obtain a second word embedding vector corresponding to the question and answer sentence, and to regenerate the candidate document set from the plurality of document vectors according to the second word embedding vector and the query vector; The re-output unit is used to input the regenerated candidate document set and the query vector into the generation model, and the generation model parses the candidate document set and the query vector, re-outputs the question and answer sentence, and completes the generation of the question and answer sentence.

9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and implement the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to implement the method according to any one of claims 1 to 7.