Answer acquisition methods, devices, computer equipment, and storage media
By using question vector retrieval in a question-answering system to retrieve target data description vectors for various data types, combined with corresponding retrieval techniques, the problem of mismatch between the database and user needs in traditional question-answering systems is solved, enabling flexible and extensive answer retrieval.
Patent Information
- Application Number
- CN202210425139.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-22
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-04-22
AI Technical Summary
Traditional question-and-answer systems suffer from a mismatch between their databases and user needs, resulting in users being unable to obtain satisfactory answers and lacking flexibility and convenience.
By determining the question vector and performing vector retrieval in the data description vector set, matching data description vectors are obtained. Based on the target data type retrieval technology, answers are retrieved from multiple data types, including text and non-text data.
It improves the compatibility and breadth of the answer acquisition process, realizes unified management and flexible retrieval of different data types, and enhances the standardization and uniformity of the question-and-answer system.
Smart Images

Figure CN114880469B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software technology, and in particular to a method, apparatus, computer device, and storage medium for obtaining answers. Background Technology
[0002] With the popularization of artificial intelligence, question-answering systems have emerged to retrieve answers to questions. These systems typically pre-organize accumulated, unordered corpora into a structured and scientifically structured database or answer database containing the answers. Using question-answering systems to obtain answers to questions can effectively save human resources, improve the automation of information processing, and reduce operating costs.
[0003] However, because question-and-answer systems are built on corresponding databases, the system and the database are interdependent. When users use a question-and-answer system, if the database doesn't match their needs, they often don't receive the expected answer. For example, if a user asks for a "GDP growth rate table," but the system's database only contains text, it might only push a short text, resulting in a unsatisfactory answer. Therefore, traditional question-and-answer systems are not flexible or convenient enough. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, apparatus, computer device, storage medium, and computer program product that can improve the flexibility of answer acquisition in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a method for obtaining answers. The method includes:
[0006] Determine the question vector of the question to be processed;
[0007] The question vector is used to perform vector retrieval in the data description vector set to obtain the data description vector that matches the question vector; the data description vector set includes data description vectors corresponding to multiple candidate data description information; the data described by the multiple candidate data description information has at least two data types.
[0008] Target data is determined based on the matched data description vectors;
[0009] Using the retrieval technology corresponding to the data type of the target data, the answer to the question to be processed is retrieved from the target data.
[0010] Secondly, this application also provides an answer acquisition device. The device includes:
[0011] A vector retrieval module is used to determine the question vector of the question to be processed; to perform vector retrieval in a data description vector set using the question vector to obtain a data description vector that matches the question vector; the data description vector set includes data description vectors corresponding to multiple candidate data description information; the data described by the multiple candidate data description information has at least two data types.
[0012] The data determination module is used to determine the target data based on the matched data description vectors;
[0013] The answer retrieval module is used to retrieve the answer to the question to be processed from the target data using the retrieval technology corresponding to the data type of the target data.
[0014] In one embodiment, the data description vectors in the data description vector set are generated by performing vector transformation on the multiple candidate data description information respectively through a trained vectorization model; the vector retrieval module is also used to input the question to be processed into the trained vectorization model for vector transformation processing to obtain the question vector of the question to be processed.
[0015] In one embodiment, the vector retrieval module is further configured to obtain a training sample set; the training sample set includes sample questions and corresponding data description information of sample data; the sample data is data containing the answers to the sample questions; multiple sample data have at least two data types; the vectorization model is iteratively trained using the training sample set until the trained vectorization model is obtained.
[0016] In one embodiment, the data described by the plurality of candidate data description information includes non-text data belonging to non-text types; the data determination module is further configured to extract question key information of the question to be processed; use the question key information to perform text matching in the target data description set to obtain data description information that matches the question key information; the target data description set is a set of data description information of non-text data; and determine the target data based on the matched data description information and the matched data description vector.
[0017] In one embodiment, the data described by the plurality of candidate data description information also includes a plurality of text data belonging to the text type; the data determination module is further configured to, based on an inverted index, recall at least one text data whose relevance score to the question to be processed is greater than a preset threshold from the plurality of text data; and determine the target data based on the at least one text data, the matched data description information, and the matched data description vector.
[0018] In one embodiment, the data determination module is further configured to: determine a vector matching value between the matched data description vector and the question vector; normalize the relevance scores of the at least one text data to obtain normalized relevance values; select the largest normalized relevance value to be compared with the vector matching value from the normalized relevance values; determine a first text matching value between the matched data description information and the question key information; normalize the first text matching value to obtain a second text matching value to be compared with the vector matching value; confirm the maximum value among the second text matching value, the largest normalized relevance value, and the vector matching value, and use the data corresponding to the maximum value as the target data.
[0019] In one embodiment, the candidate data description information describes data including text paragraphs and tables. The candidate data description information includes at least one of the description information of the text paragraphs, the description information of the tables, and the description information of the columns in the tables. The answer retrieval module is further configured to, if the data type of the target data is text, use reading comprehension technology to retrieve the answer to the question to be processed from the target data; if the data type of the target data is table, convert the question to be processed into a target database query statement, and use the target database query statement to retrieve the answer to the question to be processed from the target data.
[0020] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the steps of the above-described answer acquisition method.
[0021] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, the computer program being executed by a processor using the steps of the above-described answer acquisition method.
[0022] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that is executed by a processor using the steps of the above-described answer acquisition method.
[0023] The above-described answer acquisition method, apparatus, computer equipment, storage medium, and computer program product determine the question vector of the question to be processed. Using the question vector, a vector retrieval is performed in a data description vector set to obtain a target data description vector matching the question vector. The data description vector set includes data description vectors corresponding to multiple candidate data description information; the data described by the multiple candidate data description information contains at least two data types. It is understood that since the data described by the multiple candidate data description information contains at least two data types, the data corresponding to the data description vector set has different data types. Target data is determined based on the target data description vector. Using the retrieval technology corresponding to the data type of the target data, an answer for the question to be processed is retrieved from the target data. Therefore, this method can select and retrieve the answer to the question to be processed from multiple data of different data types, not limited to one data type and one corresponding retrieval technology. That is, this method can be compatible with multiple different retrieval technologies and achieve intelligent selection, thereby improving the compatibility and wide applicability of the answer acquisition process, and thus improving flexibility. Attached Figure Description
[0024] Figure 1 This is a diagram illustrating the application environment of an answer retrieval method in one embodiment.
[0025] Figure 2 This is a flowchart illustrating the answer acquisition method in one embodiment;
[0026] Figure 3 This is a schematic diagram illustrating the principle of an answer acquisition method in one embodiment;
[0027] Figure 4 This is a schematic diagram illustrating the principle of an answer acquisition method in one embodiment;
[0028] Figure 5 This is a structural block diagram of an answer acquisition device in one embodiment;
[0029] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0031] The answer acquisition method provided in this application embodiment can be applied to, for example, Figure 1In the application environment shown, terminal 110 communicates with server 120 via a network. A data storage system can store the data that server 120 needs to process. The data storage system can be integrated onto server 120, or it can be located in the cloud or on other network servers. Terminal 110 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Server 120 can be a standalone server or a server cluster consisting of multiple servers.
[0032] Terminal 110 can transmit the question to be processed to server 120. After obtaining the question, server 120 determines the question vector. Server 120 uses the question vector to perform vector retrieval in a set of data description vectors to obtain data description vectors that match the question vector. The set of data description vectors includes data description vectors corresponding to multiple candidate data description information. The data described by the multiple candidate data description information has at least two data types. Server 120 determines the target data based on the matched data description vectors. Server 120 uses the data type-based retrieval technology of the target data to retrieve the answer to the question to be processed from the target data. Server 120 can transmit the answer to terminal 110.
[0033] In one embodiment, server 120 may also be replaced by a terminal, and there is no limitation thereto.
[0034] In one embodiment, such as Figure 2 As shown, an answer acquisition method is provided. This embodiment illustrates the method applied to a server, but it is understood that the method can also be applied to a terminal, or to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0035] S202, determine the question vector of the question to be processed; use the question vector to perform vector retrieval in the data description vector set to obtain the data description vector that matches the question vector; the data description vector set includes data description vectors corresponding to multiple candidate data description information; the data described by the multiple candidate data description information has at least two data types.
[0036] The data description information is used to describe the data. For example, when the data is an article, the data description information can be the article title; when the data is a table, the data description information can be the table name; when the data is an image, the data description information can be the image title or image name; the data description information can also be a brief introduction to the data, and so on. The data type is used to classify the data. For example, text paragraphs are a data type, images are a data type, audio is a data type, and tables and columns are also data types.
[0037] In one embodiment, the data description information is existing description information appended to the data. It can be understood that when data is acquired, the data description information can be obtained directly without processing the data to obtain the description information, thereby reducing operational complexity and significantly lowering computer resource consumption.
[0038] Specifically, the server determines the question vector of the question to be processed. The server uses the question vector to perform a vector search in the data description vector set to obtain the data description vector that matches the question vector. This data description vector set includes data description vectors corresponding to multiple candidate data description information; the data described by these multiple candidate data description information contains data of at least two data types. It can be understood that the data description vector set includes data description vectors corresponding to multiple different data types. Therefore, during the execution of this method, it is not necessary to classify and store data of different data types; instead, these data can be stored in a mixed manner, thereby reducing the amount of data preprocessing and lowering computer resource consumption.
[0039] In one embodiment, the data description vector and the question vector are obtained using the same trained vectorization model.
[0040] In one embodiment, a trained vectorized model is obtained by training the vectorized model using sample questions and corresponding data descriptions of the sample information.
[0041] In one embodiment, the data corresponding to the data description vector set can be unstructured data or structured data. For example, text is unstructured data, while tables are structured data.
[0042] S204, Determine the target data based on the matched data description vector.
[0043] Specifically, since there is a correspondence between the data description vector, the data description information, and the data, the server can determine the target data based on the matched data description vector.
[0044] In one embodiment, the server can obtain the data description information of the matching non-text data based on the question key information of the question to be processed, and determine the target data based on the data description information of the matching non-text data and the matching data description vector.
[0045] In one embodiment, the non-text data can be at least one of tables or columns.
[0046] In one embodiment, the server can use an inverted index method to screen for at least one text document that meets the relevance requirements of the question to be processed. The server can determine the target document based on at least one text document, the data description information of the matched non-text document, and the matched data description vector.
[0047] In one embodiment, the server can normalize the text matching values corresponding to the data description information of the matched non-text data, normalize the relevance scores of at least one text data to the question to be processed, and compare the normalized text matching values and the maximum normalized relevance value with the vector matching values corresponding to the matched data description vectors to determine the target data. S206, using the retrieval technology corresponding to the data type of the target data, the server retrieves the answer to the question to be processed from the target data.
[0048] Retrieval technology refers to the methods and means of finding answers to questions. Different data types require different retrieval technologies. For example, for text-based data, Machine Reading Comprehension (MRC) might be used. MRC involves reading and understanding the text before answering related questions, and is typically implemented using deep learning techniques based on neural networks. For table-based data, a retrieval technology might be used to pre-translate the question into an SQL statement using NL2SQL (Natural Language to SQL) technology, and then execute the SQL statement to query the database for the answer.
[0049] Specifically, the server determines the corresponding retrieval technology based on the data type of the target data, and uses the retrieval technology to retrieve the answer to the question to be processed from the target data.
[0050] The above-described answer retrieval method determines the question vector of the question to be processed. It then uses the question vector to perform vector retrieval within a set of data description vectors to obtain the target data description vector that matches the question vector. This set of data description vectors includes data description vectors corresponding to multiple candidate data descriptions; the data described by these candidate data descriptions contains at least two data types. It is understood that since the data described by the multiple candidate data descriptions contains at least two data types, the data corresponding to the set of data description vectors has different data types. The target data is determined based on the target data description vector. Using the retrieval technique corresponding to the data type of the target data, the answer to the question to be processed is retrieved from the target data. Therefore, this method can select and retrieve the answer to the question to be processed from multiple data of different data types, not limited to one data type and one corresponding retrieval technique. That is, this method is compatible with multiple different retrieval techniques and can achieve intelligent selection, thereby improving the compatibility and wide applicability of the answer retrieval process, and thus increasing flexibility. Furthermore, it can unify the management of data of different data types and different retrieval techniques, thereby improving the standardization and uniformity of the question-answering system using this method.
[0051] In one embodiment, the data description vectors in the data description vector set are generated by performing vector transformation on multiple candidate data description information respectively through a trained vectorization model; determining the question vector of the question to be processed includes: inputting the question to be processed into the trained vectorization model for vector transformation processing to obtain the question vector of the question to be processed.
[0052] Specifically, the server inputs multiple candidate data descriptions into a trained vectorized model for vector transformation to obtain data description vectors from the data description vector set. The server can also input the question to be processed into the trained vectorized model for vector transformation to obtain the question vector. It is understood that the question vector and the data description vector have the same vector dimension to support vector retrieval within the data description vector set using the question vector.
[0053] In this embodiment, the same trained vectorization model is used to generate question vectors and data description vectors. This reduces the workload of developing and maintaining the vectorization algorithm, thereby reducing computer resource consumption.
[0054] In one embodiment, the trained vectorized model is obtained through the following steps: obtaining a training sample set; the training sample set includes sample questions and corresponding data description information of sample data; the sample data is data containing answers to sample questions; multiple sample data have at least two data types; iteratively training the vectorized model using the training sample set until a trained vectorized model is obtained.
[0055] Specifically, the server acquires a training sample set. This training sample set includes sample questions and corresponding data descriptions of the sample data; the sample data consists of data containing answers to the sample questions; and multiple sample data represent at least two data types, meaning the data descriptions in the training sample set are descriptions of multiple different data types. The server uses the training sample set to iteratively train the vectorized model until a well-trained vectorized model is obtained.
[0056] In this embodiment, a vectorized model is trained by using data description information and sample questions corresponding to data of at least two data types. This enables the vectorized model to identify the data description information corresponding to different data types, thus laying the foundation for obtaining matching data description vectors.
[0057] In one embodiment, the data described by multiple candidate data description information includes non-text data belonging to non-text types; the method further includes: extracting question key information of the question to be processed; using the question key information to perform text matching in the target data description set to obtain data description information that matches the question key information; the target data description set is a set of data description information of non-text data; and determining the target data based on the matched data description information and the matched data description vector.
[0058] Specifically, the server extracts key question information from the question to be processed. The server uses this key question information to perform text matching within the target data description set, obtaining data description information that matches the key question information. The target data description set is a collection of data description information for non-textual data. The server further determines the target data based on the matched non-textual data description information and the matched data description vectors.
[0059] In one embodiment, the server can use an information extraction model to extract key question information from the question to be processed.
[0060] In this embodiment, the server obtains the data description information of the matching non-text data based on the key information of the question to be processed, and determines the target data based on the data description information of the matched non-text data and the matched data description vector. This avoids being limited to identifying the target data solely through the data description vector. Especially for very short data descriptions, text matching methods are more effective than vector retrieval methods. Therefore, in addition to vector retrieval, text matching based on key information is also used as an auxiliary method, further improving the accuracy of the target data. Furthermore, text matching methods offer better controllability and interpretability. During text matching, it can be clearly identified which key information in the question to be processed matches the data description information; for example, it can be clearly identified which key information in the question to be processed matches which table. This provides a process basis for the final identification of the target data, enhancing the controllability and interpretability of the entire system.
[0061] In one embodiment, the data described by the multiple candidate data description information also includes multiple text data belonging to the text type; the method further includes: based on an inverted index, recalling at least one text data whose relevance score to the question to be processed is greater than a preset threshold from the multiple text data; determining the target data based on the matched data description information and the matched data description vector includes: determining the target data based on at least one text data, the matched data description information, and the matched data description vector.
[0062] Specifically, for the question to be processed, the server, based on an inverted index, recalls at least one text document from multiple text documents of the text type whose relevance score to the question is greater than a preset threshold. The server can also simultaneously obtain the relevance scores of at least one text document to the question. The server determines the target document based on at least one text document, the matched document description information, and the matched document description vector.
[0063] In one embodiment, the server can obtain the relevance score using the BM25 calculation method. The BM25 calculation formula is as follows: Q represents the question to be processed, d represents the text data, qi represents the i-th morpheme after Q is parsed (for Chinese, this is usually done by segmenting the text data into words, treating each word as a morpheme), Wi is the i-th speech rate weight, and R(qi,d) represents the relevance of the i-th morpheme to the text data.
[0064]
[0065] The speech rate weight Wi can be calculated using IDF, as shown in the following formula. Here, N is the total number of text data in the index, and n(qi) is the number of text data containing qi.
[0066]
[0067] The relevance R(qi,d) between morphemes and text data can be calculated using the following formula: k1, k2, and b are adjustment factors, usually set empirically, typically k1 = 2 and b = 0.75. fd(qi) is the frequency of qi in d, and fq(qi) is the frequency of qi in the query. l(d) is the length of document d, and lavg(d) is the average length of all text data.
[0068]
[0069]
[0070] In this embodiment, an inverted index is used to recall at least one text document whose relevance score to the question to be processed is greater than a preset threshold from multiple text documents of the same type. The target document is then determined based on this at least one text document, thereby improving the accuracy of the selected text documents and preparing for obtaining an accurate answer. In one embodiment, determining the target document based on the at least one text document, the matched document description information, and the matched document description vector includes: determining the vector matching value between the matched document description vector and the question vector; normalizing the relevance scores of the at least one text document to obtain normalized relevance values; selecting the largest normalized relevance value from the normalized relevance values to be compared with the vector matching value; determining the first text matching value between the matched document description information and the question key information; normalizing the first text matching value to obtain a second text matching value to be compared with the vector matching value; and confirming the maximum value among the second text matching value, the largest normalized relevance value, and the vector matching value, and using the document corresponding to the maximum value as the target document.
[0071] Specifically, the server determines the vector matching value between the matched data description vector and the question vector. The server normalizes the relevance scores of at least one text document to obtain normalized relevance values, and selects the largest normalized relevance value to be compared with the vector matching value. The server determines a first text matching value between the matched data description information and the question key information, and normalizes the first text matching value to obtain a second text matching value to be compared with the vector matching value. The server compares the second text matching value and the vector matching value, confirms the maximum value among the second text matching value, the largest normalized relevance value, and the vector matching value, and uses the data corresponding to the maximum value as the target data.
[0072] In one embodiment, the following formula can be used to normalize the relevance scores of at least one text document. Where S(di) represents the relevance score between the i-th text document and the statement to be processed, i.e., Score(Q, d), and K represents the number of text documents in the at least one text document. Snormalized(di) is the i-th normalized relevance value.
[0073]
[0074] In one embodiment, when the data description information belongs to the table data type, the total number of times the key information of the question appears in the column names of the table can be calculated. The ratio between the total number of occurrences and the total number of column names in the table can then be calculated. Finally, a normalized second text matching value can be calculated based on this ratio. For example, assuming there are 10 columns in the table and the total number of occurrences is 5, the corresponding ratio is 5 / 10 = 50%. Therefore, the normalized second text matching value can be 50%, or it can be further adjusted based on this; there is no limitation on this.
[0075] In one embodiment, the server prepares a sample data set in advance. This sample data set includes sample questions and corresponding sets of sample data description information and sample data description vectors. The server obtains the matching sample data description vectors and matching sample data description information for each sample question, as well as their corresponding first text matching values and vector matching values. The server adjusts the normalization algorithm to normalize the first text matching values, obtaining a second text matching value that meets the expected effect; that is, when the second text matching value is compared with the vector matching value, the expected comparison result is obtained.
[0076] In this embodiment, the server normalizes the text matching value corresponding to the matched data description information, normalizes the relevance score of at least one text data to the question to be processed, and compares it with the vector matching value corresponding to the matched data description vector to determine the target data. In this way, the most matching data description vector or data description information can be identified from at least one text data, the matched data description vector, and the matched data description information, and then the target data can be identified, thereby improving the accuracy of the target data and preparing for obtaining an accurate answer.
[0077] In one embodiment, the data described by the multiple candidate data description information includes text paragraphs and tables. The multiple candidate data description information includes at least one of the following: description information of text paragraphs, description information of tables, and description information of columns in tables. Retrieving the answer to the question to be processed from the target data using the retrieval technology corresponding to the data type of the target data includes: if the data type of the target data is text, then using reading comprehension technology to retrieve the answer to the question to be processed from the target data; if the data type of the target data is table, then converting the question to be processed into a target database query statement, and using the target database query statement to retrieve the answer to the question to be processed from the target data.
[0078] A text paragraph is a segment composed of text; it can be a single paragraph or multiple paragraphs. Generally, a text paragraph has a corresponding title to describe it, and the server can use the text paragraph title as descriptive information for data of type text paragraph. A table is a collection of columns used to store data; it is a structured collection of data. Data of this type can be an existing table in a database, or a table, etc.
[0079] Specifically, the candidate data descriptions include text paragraphs and tables, with tables potentially including columns. The candidate data descriptions include at least one of the following: text paragraph descriptions, table descriptions, and column descriptions. After confirming the target data, if the target data is text-based, the server uses reading comprehension techniques to retrieve the answer to the question from the target data. If the target data is table-based, the server converts the question into a target database query and uses the target database query to retrieve the answer to the question from the target data.
[0080] In this embodiment, if the target data is text-based, reading comprehension techniques are used. If the target data is table-based, the question to be processed is converted into a target database query statement for further retrieval. This allows the method to be compatible with various retrieval techniques and achieve intelligent selection, thereby improving the compatibility, applicability, and processing uniformity of the answer acquisition process, and ultimately enhancing flexibility.
[0081] In one embodiment, such as Figure 3 The diagram illustrates the principle of the vectorization step. Specifically, the server inputs description information of data belonging to different data types into the vectorization model, thereby obtaining multiple corresponding data description vectors, i.e., a set of data description vectors. The description information of different data types can be the names of data belonging to the table data type, such as table name 1, column name 1 of the table specified by table name 1, column name 2 of the table specified by table name 1, and table name 2, or the titles of data belonging to the text paragraph data type, such as text paragraph 1 title and text paragraph 2 title. The server also inputs the question to be processed into the vector model to obtain the question vector, and retrieves the matching data description vector from the set of data description vectors. It can be understood that the matched data description vector is one data description vector in the set of data description vectors. In this embodiment, the set of data description vectors includes description information of various data types, enabling this method to support multiple data types, thereby improving the breadth and compatibility of the method's application.
[0082] In one embodiment, such as Figure 4 The diagram illustrates the principle of the text matching process. Specifically, the server pre-determines a set of data description information. This set can be the names of data belonging to the table data type, such as Table Name 1, Column Name 1 of the table specified by Table Name 1, Column Name 2 of the table specified by Table Name 1, and Table Name 2, or the titles of data belonging to the text paragraph data type, such as the title of Text Paragraph 1 and the title of Text Paragraph 2. The server extracts key information from the question to be processed, obtaining Key Information 1, Key Information 2, etc., which can be understood as, or there may be only one key information. The server matches the obtained key information with the data description information in the data description information set one by one to obtain the matched data description information. The server further filters based on the matched data description information and the matched data description vector, finally determining the target data to improve the accuracy of the selected target data, thereby improving the accuracy of the obtained answer.
[0083] In one embodiment, the server pre-acquires a training sample set. This training sample set includes sample questions and corresponding data descriptions of sample data; the sample data are data containing answers to the sample questions; and multiple sample data have at least two data types. The server iteratively trains a vectorized model using the training sample set until a well-trained vectorized model is obtained. The server inputs the question to be processed into the trained vectorized model for vector transformation processing to obtain a question vector. The server uses the question vector to perform vector retrieval in the data description vector set to obtain a data description vector that matches the question vector. This data description vector set includes data description vectors corresponding to multiple candidate data description information; the data described by the multiple candidate data description information has at least two data types. The data description vector is obtained by inputting the data description information into the trained vectorized model. The server determines the target data based on the matched data description vector. Further, the server can also extract key question information from the question to be processed; use the key question information to perform text matching in the data description set to obtain data description information that matches the key question information. The data description set is the collection of data description information of the data involved in the data description vector set. The server determines the vector matching value between the matched data description vector and the question vector, and determines the first text matching value between the matched data description information and the question's key information. The first text matching value is normalized to obtain a second text matching value to be compared with the vector matching value. The server identifies the maximum value between the second text matching value and the vector matching value, and uses the data corresponding to the maximum value as the target data. The server uses retrieval techniques corresponding to the data type of the target data to retrieve the answer to the question from the target data. Specifically, when multiple candidate data descriptions include text paragraphs and tables, the server determines the data type of the target data. If the target data type is text, reading comprehension techniques are used to retrieve the answer to the question from the target data; if the target data type is table, the question is converted into a target database query statement, and the target database query statement is used to retrieve the answer to the question from the target data.
[0084] It should be understood that although the steps in the flowcharts of some embodiments of this application are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple steps or multiple stages, which are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0085] Based on the same inventive concept, this application also provides an answer acquisition device for implementing the answer acquisition method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more answer acquisition device embodiments provided below can be found in the limitations of the answer acquisition method described above, and will not be repeated here.
[0086] In one embodiment, such as Figure 5 As shown, an answer acquisition device 500 is provided, including: a vector retrieval module 502, a data determination module 504, and an answer retrieval module 506, wherein:
[0087] Vector retrieval module 502 is used to determine the question vector of the question to be processed; to perform vector retrieval in the data description vector set using the question vector to obtain the data description vector that matches the question vector; the data description vector set includes data description vectors corresponding to multiple candidate data description information; the data described by the multiple candidate data description information has at least two data types.
[0088] Data determination module 504 is used to determine target data based on the matched data description vector;
[0089] The answer retrieval module 506 is used to retrieve answers to the questions to be processed from the target data using retrieval techniques corresponding to the data type of the target data.
[0090] In one embodiment, the data description vectors in the data description vector set are generated by performing vector transformation on multiple candidate data description information respectively through a trained vectorization model; the vector retrieval module 502 is also used to input the question to be processed into the trained vectorization model for vector transformation processing to obtain the question vector of the question to be processed.
[0091] In one embodiment, the vector retrieval module 502 is further configured to obtain a training sample set; the training sample set includes sample questions and corresponding data description information of sample data; the sample data is data containing answers to sample questions; multiple sample data have at least two data types; the training sample set is used to iteratively train the vectorization model until a well-trained vectorization model is obtained.
[0092] In one embodiment, the data determination module 504 is further configured to extract key information of the question to be processed; use the key information of the question to perform text matching in the target data description set to obtain data description information that matches the key information of the question; the target data description set is a set of data description information of non-text data involved in the data description vector set; and determine the target data based on the matched data description information and the matched data description vector.
[0093] In one embodiment, the data determination module 504 is further configured to, for the question to be processed, recall at least one text data whose relevance score to the question to be processed is greater than a preset threshold from multiple text data of the text type based on an inverted index; and determine the target data based on the at least one text data, the matched data description information, and the matched data description vector.
[0094] In one embodiment, the data determination module 504 is further configured to: determine the vector matching value between the matched data description vector and the question vector; normalize the relevance scores of at least one text data to obtain normalized relevance values; select the largest normalized relevance value to be compared with the vector matching value from the normalized relevance values; determine the first text matching value between the matched data description information and the question key information; normalize the first text matching value to obtain a second text matching value to be compared with the vector matching value; confirm the maximum value among the second text matching value, the largest normalized relevance value, and the vector matching value, and use the data corresponding to the maximum value as the target data.
[0095] In one embodiment, the candidate data description information includes text paragraphs and tables, and the candidate data description information includes at least one of the following: text paragraph description information, table description information, and column description information in the table; the answer retrieval module 506 is further configured to, if the data type of the target data is text, use reading comprehension technology to retrieve the answer to the question to be processed from the target data; if the data type of the target data is table, convert the question to be processed into a target database query statement, and use the target database query statement to retrieve the answer to the question to be processed from the target data.
[0096] The aforementioned answer acquisition device determines the question vector of the question to be processed. It then uses the question vector to perform vector retrieval in a set of data description vectors to obtain a target data description vector that matches the question vector. The set of data description vectors includes data description vectors corresponding to multiple candidate data description information; the data described by these multiple candidate information contains at least two data types. It is understood that since the data described by the multiple candidate information contains at least two data types, the data corresponding to the set of data description vectors has different data types. The target data is determined based on the target data description vector. Using the retrieval technology corresponding to the data type of the target data, the answer to the question to be processed is retrieved from the target data. Therefore, this method can select and retrieve the answer to the question to be processed from multiple data of different data types, not limited to one data type and one corresponding retrieval technology. That is, this method is compatible with multiple different retrieval technologies and can achieve intelligent selection, thereby improving the compatibility and wide applicability of the answer acquisition process, and thus increasing flexibility.
[0097] For specific limitations regarding the answer acquisition device, please refer to the limitations of the answer acquisition method described above, which will not be repeated here. Each module in the answer acquisition device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0098] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data description vector data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements an answer retrieval method.
[0099] Those skilled in the art will understand that Figure 6The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0100] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0101] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0102] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0103] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0104] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0105] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for obtaining answers, characterized in that, The method includes: Determine the question vector of the question to be processed; The question vector is used to perform vector retrieval in the data description vector set to obtain the data description vector that matches the question vector; the data description vector set includes data description vectors corresponding to multiple candidate data description information of different data types; the data described by the multiple candidate data description information includes non-text data belonging to non-text type and multiple text data belonging to text type. Extract the key information of the question to be processed, and use the key information of the question to perform text matching in the target data description set to obtain data description information that matches the key information of the question; the target data description set is a set of data description information of the non-text data. Based on the inverted index method, at least one text data with a relevance score greater than a preset threshold to the question to be processed is recalled from the multiple text data. The target data is determined based on the at least one text data, the matched data description information, and the matched data description vector; Using the retrieval technology corresponding to the data type of the target data, the answer to the question to be processed is retrieved from the target data.
2. The method according to claim 1, characterized in that, The data description vectors in the data description vector set are generated by performing vector transformations on the multiple candidate data description information using a trained vectorization model; the question vector for determining the question to be processed includes: The question to be processed is input into the trained vectorization model for vector transformation to obtain the question vector of the question to be processed.
3. The method according to claim 2, characterized in that, The trained vectorized model is obtained through the following steps: Obtain a training sample set; the training sample set includes sample questions and corresponding data description information of sample data; the sample data is data containing the answers to the sample questions; multiple sample data have at least two data types; The vectorized model is trained iteratively using the training sample set until the trained vectorized model is obtained.
4. The method according to claim 1, characterized in that, The determination of target data based on the at least one text data, the matched data description information, and the matched data description vector includes: Determine the vector matching value between the matched data description vector and the question vector; Normalize the relevance scores of the at least one text data to obtain normalized relevance values; The maximum normalized correlation value is selected from all the normalized correlation values; Determine the first text matching value between the matched data description information and the key information of the question; The first text matching value is normalized to obtain a second text matching value to be compared with the vector matching value; The maximum value among the second text matching value, the maximum normalized correlation value, and the vector matching value is identified, and the data corresponding to the maximum value is taken as the target data.
5. The method according to claim 1, characterized in that, The candidate data descriptions include text paragraphs and tables, and include at least one of the following: descriptions of text paragraphs, descriptions of tables, and descriptions of columns in the tables; retrieving answers to the question from the target data using the retrieval technology corresponding to the data type of the target data includes: If the target data is of text type, then reading comprehension technology is used to retrieve the answer to the question to be processed from the target data; If the data type of the target data is a table type, then the question to be processed is converted into a target database query statement, and the target database query statement is used to retrieve the answer to the question to be processed from the target data.
6. An answer acquisition device, characterized in that, The device includes: The vector retrieval module is used to determine the question vector of the question to be processed; and to perform vector retrieval in the data description vector set using the question vector to obtain the data description vector that matches the question vector; the data description vector set includes data description vectors corresponding to multiple candidate data description information of different data types; the data described by the multiple candidate data description information includes non-text data belonging to non-text types and multiple text data belonging to text types. The data determination module is used to extract key information of the question to be processed, and use the key information to perform text matching in a target data description set to obtain data description information that matches the key information of the question; the target data description set is a set of data description information of non-text data; based on an inverted index, at least one text data with a relevance score greater than a preset threshold to the question to be processed is recalled from the multiple text data; the target data is determined based on the at least one text data, the matched data description information, and the matched data description vector; The answer retrieval module is used to retrieve the answer to the question to be processed from the target data using the retrieval technology corresponding to the data type of the target data.
7. The apparatus according to claim 6, characterized in that, The data description vectors in the data description vector set are generated by performing vector transformation on the multiple candidate data description information respectively through a trained vectorization model; the vector retrieval module is also used to input the question to be processed into the trained vectorization model for vector transformation processing to obtain the question vector of the question to be processed.
8. The apparatus according to claim 7, characterized in that, The vector retrieval module is further configured to obtain a training sample set; the training sample set includes sample questions and corresponding data description information of sample data; the sample data is data containing the answers to the sample questions; multiple sample data have at least two data types; the vectorization model is iteratively trained using the training sample set until the trained vectorization model is obtained.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Knowledge question and answer method and device, electronic equipment and storage medium
CN114116997A