Question and answer information processing method and device, electronic equipment and storage medium

By using a target language model and database tables to match user question text data in an enterprise's internal question-and-answer system, and generating query statements to output answers, the problem of answer return for non-template questions in the existing system is solved, improving question-and-answer efficiency and reducing maintenance costs.

CN116860940BActive Publication Date: 2026-01-23FUTURE TV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310848778.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-10
Publication Date
2026-01-23
Estimated Expiration
2043-07-10

AI Technical Summary

Technical Problem

Existing internal question-and-answer systems struggle to accurately return answers when faced with queries that do not use pre-set question templates, and dynamic data changes result in high maintenance costs.

Method used

By acquiring user-input question text data, encoding it using a pre-trained target language model, combining it with data tables in a pre-defined database, determining target fields, field values, and variable names, generating query statements, and executing them to output answers.

Benefits of technology

It improves the efficiency of the question-and-answer system, reduces the workload of manually maintaining the database, and is able to better match diverse question text data from users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116860940B_ABST
    Figure CN116860940B_ABST
Patent Text Reader

Abstract

The application provides a question and answer information processing method and device, electronic equipment and storage medium. The method comprises the following steps: inputting question text data into a pre-trained target language model for coding to obtain at least one word vector corresponding to the question text data; determining at least one target field in a target data table corresponding to the question text data, target field values of each target field and variable names of each target field according to each word vector corresponding to the question text data and each word vector stored in a data table of a preset database; generating a query statement for the target data table according to the target field values of each target field in the target data table corresponding to the question text data and the variable names of each target field; and executing the query statement to obtain and output answer data corresponding to the question text data. The word vectors in the database can better match various question text data of the user, and the question and answer efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of data processing, in particular to a question and answer information processing method and device, electronic equipment and storage medium. BACKGROUND

[0002] The enterprise internal question and answer system is mainly used for the internal personnel of an enterprise, and mainly provides a convenient entrance for the daily questions of the employees about the related data of the company.

[0003] In the prior art, the enterprise internal data question and answer is mainly achieved by manually setting questions and matching answers in the background of software in advance, and returning the preset answers of each question by clicking the card connection of the related question and answer.

[0004] However, in the prior art, if the questions are not asked according to the question templates in the question library, the answers cannot be returned correctly. In addition, the related data of the enterprise is dynamically changed, so it is necessary to update the questions and matching answers in the question library in time, otherwise the answers of the questions cannot be returned, which will cause the maintenance cost of the question and answer system to be too high. SUMMARY

[0005] The present application aims at the above-mentioned deficiencies in the prior art, and provides a question and answer information processing method, device, electronic equipment and storage medium to improve the efficiency of question and answer.

[0006] To achieve the above-mentioned purpose, the technical solutions adopted by the embodiments of the present application are as follows:

[0007] In a first aspect, the embodiments of the present application provide a question and answer information processing method, which comprises:

[0008] obtaining question text data input by a user;

[0009] inputting the question text data into a target language model trained in advance for coding to obtain at least one word vector corresponding to the question text data;

[0010] According to the word vectors corresponding to the question text data and the word vectors stored in the data tables of the preset database, at least one target field in a target data table corresponding to the question text data, target field values of each target field, and variable names of each target field are determined, wherein the preset database comprises a first data table, a second data table, and a third data table, the first data table is used to record field names in each original data table and word vectors corresponding to the field names, the second data table is used to record each field in each original data table, field values corresponding to each field, and word vectors corresponding to each field value, and the third data table is used to record each field in each original data table and variable names corresponding to each field, and the target data table is one of the original data tables;

[0011] According to the target field values of each target field in the target data table corresponding to the question text data and the variable names of each target field, a query statement for the target data table is generated.

[0012] The query statement is executed to obtain and output answer data corresponding to the question text data.

[0013] Optionally, the determining, according to the word vectors corresponding to the question text data and the word vectors stored in the data tables of the preset database, at least one target field in a target data table corresponding to the question text data, target field values of each target field, and variable names of each target field comprises:

[0014] Each word vector corresponding to the question text data is matched with each word vector in the first data table to obtain a matching result corresponding to each field in each original data table;

[0015] According to the matching result corresponding to each field in each original data table, the target data table and at least one target field in the target data table are determined;

[0016] Each word vector corresponding to the question text data is matched with each word vector corresponding to each field value of each target field of the target data table in the second data table to determine the target field values of each target field;

[0017] The variable names of each target field are found from the third data table.

[0018] Optionally, the determining, according to the matching result corresponding to each field in each original data table, the target data table and at least one target field in the target data table comprises:

[0019] According to the matching result corresponding to each field in each original data table, at least one target field is determined;

[0020] determine the target data table according to a matching result of each original data table corresponding to at least one target field.

[0021] Optionally, the matching each word vector corresponding to the question text data with each word vector corresponding to each target field of the target data table in the second data table, and determining a target field value of each target field, comprises:

[0022] filtering, from the second data table, a data row corresponding to each target field of the target data table;

[0023] matching each word vector corresponding to the question text data with a word vector in each data row, and obtaining a target field value of each target field according to a matching result.

[0024] Optionally, the generating a query statement for the target data table according to the target field value of each target field in the target data table corresponding to the question text data and a variable name of each target field, comprises:

[0025] if there is a target data row in the second data table, in which a matching result of a word vector corresponding to the question text data meets a preset condition, then taking a field value in the target data row and a variable name of a target field as a query parameter in the query statement;

[0026] if no data row corresponding to a target field of the target data table is filtered from the second data table, then taking a variable name of the target field as a query parameter in the query statement.

[0027] Optionally, before the inputting the question text data into a target language model trained in advance for encoding, the method further comprises:

[0028] obtaining a plurality of sample data, converting each sample data into data in a preset format to obtain converted sample data;

[0029] performing a mask operation on the converted sample data to obtain masked sample data;

[0030] training an initial training model based on the masked sample data to obtain the target language model.

[0031] Optionally, before the determining at least one target field in the target data table corresponding to the question text data, a target field value of each target field and a variable name of each target field according to each word vector corresponding to the question text data and each word vector stored in a data table of a preset database, the method further comprises:

[0032] inputting each field in each original data table into the target language model to obtain a word vector of each field, and saving each field in each original data table and the word vector corresponding to each field into the first data table;

[0033] inputting the field value corresponding to each field in each original data table into the target language model to obtain a word vector of each field value, and saving each field in each original data table, the field value corresponding to each field, and the word vector corresponding to each field value into the second data table;

[0034] saving each field in each original data table and the variable name corresponding to each field into the third data table.

[0035] In a second aspect, the embodiments of the present application further provide a question and answer information processing device, and the device comprises:

[0036] an acquisition module configured to acquire question text data input by a user;

[0037] an encoding module configured to input the question text data into a target language model trained in advance to encode the question text data, and obtain at least one word vector corresponding to the question text data;

[0038] a determination module configured to determine at least one target field in a target data table corresponding to the question text data, a target field value of each target field, and a variable name of each target field according to each word vector corresponding to the question text data and each word vector stored in a data table of a preset database, wherein the preset database comprises a first data table, a second data table, and a third data table, the first data table is configured to record a field name in each original data table and a word vector corresponding to the field name, the second data table is configured to record each field in each original data table, a field value corresponding to each field, and a word vector corresponding to each field value, the third data table is configured to record each field in each original data table and a variable name corresponding to each field, and the target data table is one of the original data tables;

[0039] a generation module configured to generate a query statement for the target data table according to the target field value of each target field in the target data table corresponding to the question text data and the variable name of each target field;

[0040] an execution module configured to execute the query statement to obtain and output answer data corresponding to the question text data.

[0041] Optionally, the determination module is specifically configured to:

[0042] Match each word vector corresponding to the question text data with each word vector in the first data table respectively to obtain a matching result corresponding to each field in each original data table;

[0043] Determine the target data table and at least one target field in the target data table according to the matching result corresponding to each field in each original data table;

[0044] Match each word vector corresponding to the question text data with each word vector corresponding to each field value of each target field of the target data table in the second data table respectively to determine a target field value of each target field;

[0045] Find a variable name of each target field from the third data table.

[0046] Optionally, the determining module is specifically configured to:

[0047] Determine at least one target field according to the matching result corresponding to each field in each original data table;

[0048] Determine the target data table according to the matching result corresponding to at least one target field in each original data table.

[0049] Optionally, the determining module is specifically configured to:

[0050] Filter data rows corresponding to each target field of the target data table from the second data table;

[0051] Match each word vector corresponding to the question text data with each word vector in each data row respectively, and obtain a target field value of each target field according to a matching result.

[0052] Optionally, the generating module is specifically configured to:

[0053] If there is a target data row in the second data table, in which a matching result of a word vector corresponding to the question text data satisfies a preset condition, field values in the target data row and a variable name of a target field are taken as query parameters in a query statement;

[0054] If no data row corresponding to a target field of the target data table is filtered from the second data table, a variable name of the target field is taken as a query parameter in a query statement.

[0055] Optionally, the encoding module is specifically configured to:

[0056] Obtain a plurality of sample data, convert each sample data into data in a preset format, and obtain converted sample data;

[0057] perform a mask operation on the converted sample data to obtain masked sample data;

[0058] train the initial training model based on the masked sample data to obtain the target language model.

[0059] Optionally, the determining module is specifically configured to:

[0060] input each field in each original data table into the target language model to obtain a word vector of each field, and save each field in each original data table and a corresponding word vector of each field into the first data table;

[0061] input a field value corresponding to each field in each original data table into the target language model to obtain a word vector of each field value, and save each field in each original data table, a corresponding field value of each field, and a corresponding word vector of each field value into the second data table;

[0062] save each field in each original data table and a corresponding variable name of each field into the third data table.

[0063] In a third aspect, an electronic device is provided, and the electronic device includes a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When an application program is running, the processor and the storage medium communicate through the bus. The processor executes the program instructions to perform the steps of the question and answer information processing method in the first aspect.

[0064] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is read and executed to perform the steps of the question and answer information processing method in the first aspect.

[0065] The application has the following beneficial effects:

[0066] The question and answer information processing method, device, electronic device, and storage medium provided by the application determine each target field in a target data table corresponding to each word vector of question text data, a target field value of each target field, and a variable name of each target field according to each word vector of the question text data and each word vector stored in a data table in a preset database, and find in the preset database according to a query statement generated according to the determined target field value and the variable name of each target field to output answer data corresponding to the question text data. The word vector in the database can be used to better match various question text data of users, improve the question and answer efficiency, and reduce the workload of manually maintaining the database. BRIEF DESCRIPTION OF DRAWINGS

[0067] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained under the guidance of the content of the present application without creative labor.

[0068] Figure 1 A flowchart of a question and answer information processing method provided in an embodiment of the present application;

[0069] Figure 2 A flowchart of another question and answer information processing method provided in an embodiment of the present application;

[0070] Figure 3 A flowchart of still another question and answer information processing method provided in an embodiment of the present application;

[0071] Figure 4 A flowchart of still another question and answer information processing method provided in an embodiment of the present application;

[0072] Figure 5 A flowchart of training a language model provided in an embodiment of the present application;

[0073] Figure 6 A device schematic diagram of a question and answer information processing method provided in an embodiment of the present application;

[0074] Figure 7 A structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0075] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of illustration and description, and do not limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn according to the actual size. The flowchart shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can not be implemented in sequence, and the steps without logical context relationship can be reversed in sequence or implemented simultaneously. In addition, one or more other operations can be added to the flowchart or one or more operations can be removed from the flowchart under the guidance of the content of the present application.

[0076] In addition, the described embodiments are only some embodiments of the present application, not all embodiments. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0077] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0078] The embodiments of the present application propose a question and answer information processing method, which can be applied to an enterprise internal question and answer system, can be used for a question and answer system used by enterprise internal personnel, and can also be used for a question and answer system in other scenarios, which is not limited here. The present application calculates the matching degree value of the word vector of the problem text data input by the query user and the word vector in the preset database by using the self-attention mechanism, determines the data with the highest matching degree with the word vector of the problem text data, and queries the problem text data and the answer corresponding to the problem text data in the database through the preset query statement template. Based on the self-attention mechanism, the diverse questions of the user can be better matched, the question and answer efficiency is improved, and the burden of manual operation is reduced.

[0079] The method in the embodiments of the present application is applied to an electronic device, which can be, for example, a desktop computer, a notebook computer, or other terminal devices with computing processing capability and display function, or can also be a server.

[0080] Figure 1 A flowchart of a question and answer information processing method provided by the embodiments of the present application is shown, and the execution subject of the method is the electronic device as described above. As shown in Figure 1 The method comprises:

[0081] S101, acquiring problem text data input by a user.

[0082] Optionally, the problem text data can be any question sentence input by the user. After receiving the problem text data input by the user, the received problem text data can be preprocessed, for example, the received problem text data can be segmented, and stop words can be removed, to obtain preprocessed problem text data.

[0083] Exemplarily, the received question text data can be, for example, "today's visiting users in Sichuan Province", "how is the weather today", "how many orders are there this month", and the like. After preprocessing such as word segmentation, the question text data "today's visiting users in Sichuan Province" can obtain the words "today", "Sichuan Province", and "visiting users".

[0084] Optionally, the user can input the question text data in the form of typing, or input the question text data in the form of voice or other forms, which is not limited here.

[0085] S102, input the question text data into the pre-trained target language model for encoding to obtain at least one word vector corresponding to the question text data.

[0086] Optionally, the input into the pre-trained target language model can be the preprocessed question text data, that is, the segmented question text data can be input into the target language model for encoding, that is, each word of the segmented question text data is encoded to obtain a word vector corresponding to each word, and the word vector of each word in the question text is used as each word vector corresponding to the question text data.

[0087] Exemplarily, if the above question text data is segmented to obtain the three words "today", "Sichuan Province", and "visiting users", then the three words "today", "Sichuan Province", and "visiting users" are input into the target language model for encoding, the word vector of "today" can be represented as w1, the word vector of "Sichuan Province" can be represented as w2, and the word vector of "visiting users" can be represented as w3.

[0088] S103, according to each word vector corresponding to the question text data and each word vector stored in the data table of the preset database, determine at least one target field in the target data table corresponding to the question text data, the target field value of each target field, and the variable name of each target field.

[0089] The data table of the preset database can include: a first data table, a second data table, and a third data table. The first data table can be used to record each field in each original data table and the word vector corresponding to each field; the second data table is used to record each field in each original data table, the field value corresponding to each field, and the word vector corresponding to each field value; and the third data table is used to record each field in each original data table and the variable name corresponding to each field.

[0090] The target data table can be any one of the original data tables.

[0091] Optionally, each original data table can refer to any one data table in the database, which can include multiple fields and field values corresponding to each field.

[0092] For example, the data table can include a province table, a channel table, a personnel information table, an order table, and different data table types. The province table can include fields such as province, number of access users, and date. The channel table can include fields such as date, channel, and number of new users. For the province in the province table, different province names such as Shanxi, Shaanxi, Sichuan, and Beijing can be included, and Shanxi, Shaanxi, Sichuan, and Beijing can be different field values corresponding to the province. The date can be 2023-07-01, 2023-07-02, etc., and 2023-07-01 and 2023-07-02 can be different field values corresponding to the date.

[0093] For example, the content of the first data table record can be represented by Table 1 below, which can also record the English names of each field and the data table names of each original data table. The word vector in the table refers to the word vector corresponding to each field. The province table in Table 1 below can refer to the same province table, and the channel table can refer to the same channel table.

[0094] Table name Field English name Field Word vector Province table dt Date [0.01,0.01,0.01,0.02,0.03,0.92] Province table province Province [0.01,0.01,0.01,0.02,0.92,0.03] Province table activeuser Number of access users [0.01,0.01,0.01,0.92,0.02,0.03] Channel table dt Date [0.01,0.01,0.92,0.01,0.02,0.03] Channel table channel Channel [0.01,0.92,0.01,0.01,0.02,0.03] Channel table newuser Number of new users [0.92,0.01,0.01,0.01,0.02,0.03]

[0095] Table 1

[0096] For example, the content of the second data table record can be represented by Table 2 below, which can also record the data table names of each original data table. The word vector in the table refers to the word vector corresponding to each field value.

[0097]

[0098]

[0099] Table 2

[0100] For example, the content of the third data table record can be represented by Table 3 below, which records each field in each original data table and the variable name corresponding to each field. The third data table can also record the query statement template corresponding to each variable name.

[0101] Field Variable name Query statement template Date dt Template 1 Province province Template 1 Access user activeuser Template 1

[0102] Table 3

[0103] S104, according to the target field values of each target field in the target data table corresponding to the question text data and the variable name of each target field, generate a query statement for the target data table.

[0104] Optionally, the target field values of each target field in the target data table corresponding to the question text data and the variable names of each target field can be generated according to the query statement template in the third data table to generate a query statement for the target data table.

[0105] S105, executing the query statement to obtain and output the answer data corresponding to the question text data.

[0106] Specifically, the generated query statement can be executed, the data consistent with the target field values of the target fields in the query statement is found in the preset database according to the target field values of the target fields and the variable names of each target field in the query statement, the found data is taken as the question text data, the answer data in the data is obtained, and the obtained answer data is taken as the answer data corresponding to the question text data.

[0107] In this embodiment, each word vector of the question text data is determined according to each word vector of the question text data and each word vector stored in the data table in the preset database, each target field in the target data table corresponding to the question text data, each target field value of each target field and each variable name of each target field are determined, and the query statement generated according to each target field value and each variable name of each target field is found in the preset database to output the answer data corresponding to the question text data. The word vectors in the database can better match the diverse question text data of the user, improve the efficiency of question and answer, and reduce the workload of manual maintenance of the database.

[0108] Figure 2 Another flowchart of a question and answer information processing method provided by the embodiment of the application is shown in FIG. 2. Figure 2 As shown in FIG. 2, the determination of at least one target field in the target data table corresponding to the question text data, each target field value of each target field and each variable name of each target field according to each word vector of the question text data and each word vector stored in the data table of the preset database in S103 can include:

[0109] S201, matching each word vector of the question text data with each word vector in the first data table respectively to obtain a matching result of each field in each original data table.

[0110] Optionally, the first data table includes a plurality of original data tables, and each original data table can include at least one field. The same field can be included in a plurality of original data tables, for example, for the field of "date", which exists in the province table and can also exist in the channel table, but the word vectors calculated from the same field in different original data tables can be the same or different.

[0111] Optionally, each word vector corresponding to the question text data is matched with each word vector corresponding to each field in the first data table to obtain a matching result of each field in each original data table, wherein each field in each original data table refers to each field, and the matching result can refer to a similarity between each word vector corresponding to each field and each word vector corresponding to the question text data. Specifically, the following formula (I) can be used for calculation.

[0112] sim(w i , v i ) = cos(w i , v i ) = w i , v i / (||w i || | |v i ||) Formula (I)

[0113] wherein w i is each word vector corresponding to the question text data, and v i is each word vector corresponding to each field in each original data table in the first data table.

[0114] For example, the word vector of "today" can be represented as w1, the word vector of "Sichuan Province" can be represented as w2, and the word vector of "user" can be represented as w3. w1 is matched with each word vector in each original data table in the first data table to obtain a matching result 1 of each v i corresponding field in each original data table; w2 is matched with each word vector in each original data table in the first data table to obtain a matching result 2 of each v i corresponding field in each original data table; and w3 is matched with each word vector in each original data table in the first data table to obtain a matching result 3 of each v i corresponding field in each original data table.

[0115] S202, according to the matching result of each field in each original data table, determine the target data table and at least one target field in the target data table.

[0116] For example, continue with the above question text data, the matching result 1 of each v i corresponding field, the matching result 2 of each v i corresponding field, and the matching result 3 of each v iThe matching result 3 of the corresponding field is used to determine the target data table and at least one target field in the target data table using a preset method. The target field refers to a target field in the target data table, for example, the determined target data table can be a province table, and the target fields in the target data table can be date and province.

[0117] S203, match each word vector corresponding to the question text data with each word vector corresponding to each field value of each target field of the target data table in the second data table, to determine the target field value of each target field.

[0118] For example, if the target data table determined in S202 above is a province table, and the target fields are date and province, the word vectors corresponding to the question text data are matched with the word vectors of each field value of the date in the province table and with the word vectors of each field value of the province in the identity table, for example, with the word vector of 2023-07-03 in the province table in Table 2, and with the word vector of Beijing and the word vector of Sichuan in Table 2, so that the target field value of each target field can be determined.

[0119] S204, find the variable name of each target field from the third data table.

[0120] Optionally, the target fields and the variable names corresponding to the target fields are found from Table 3 above, and the variable name of the found target field is added to the query statement template as a query parameter in the query statement.

[0121] In this embodiment, by matching the question text data with each word vector of the first data table, the target data table and the target field can be determined, and by matching each word vector of the question text data with each field value of the target field in the second data table according to the target data table and the target field, the matching efficiency is improved, and the matching accuracy can be further improved by matching each field value of the target field with each word vector of the question text. The existing situation that no corresponding question template data is found in the database, which leads to the failure to return an answer, is avoided, so that the question and answer efficiency can be improved.

[0122] Figure 3 Another flowchart of a question and answer information processing method provided by the embodiment of the application is shown in FIG. 6. Figure 3 As shown in FIG. 6, S202 above can include the following steps:

[0123] S301, determine at least one target field according to the matching result of each field in each original data table.

[0124] Optionally, at least one target field can be determined according to the matching results of each word vector of the question text data and each field in each original data table. For a certain word vector in the question text data, the matching results of each field in each original data table can be the same or different.

[0125] For example, continue with the above question text data "today, Sichuan Province, and visitor", according to the matching results 1 of each field in each original data table, that is, the matching results between w1 and each word vector in Table 1, it can be obtained that w1 matches the word vector v1 of the date field in the province table in Table 1 and the word vector k1 of the date field in the channel table in Table 1, and it can be determined that the date in the province table and the date in the channel table are both target fields matched by w1.

[0126] For example, according to the matching results 2 of each field in each original data table, that is, the matching results between w2 and each word vector in Table 1, it can be obtained that w2 matches the word vector v2 of the province field in the province table in Table 1, and the province in the province table can be determined as the target field matched by w2.

[0127] For example, according to the matching results 3 of each field in each original data table, that is, the matching results between w3 and each word vector in Table 1, it can be obtained that w3 matches the word vector v3 of the visitor field in the province table in Table 1, and the visitor in the province table can be determined as the target field matched by w3.

[0128] Therefore, according to the above method, all target fields corresponding to the above question text can be determined. That is, the field corresponding to v1, the field corresponding to k1, the field corresponding to v2, and the field corresponding to v3.

[0129] S302, determine a target data table according to the matching results of at least one target field in each original data table.

[0130] Optionally, the original data table where each target field is located can be obtained according to the determined target field, that is, the original data table where the field corresponding to v1, the field corresponding to v2, and the field corresponding to v3 are located is the province table, and the original data table where the field corresponding to k1 is located is the channel table. Therefore, the comprehensive score of the province table can be calculated according to the matching results of each target field in the province table, the comprehensive score of the channel table can be calculated according to the matching results of each target field in the channel table, and the target data table can be determined according to the size of the comprehensive scores of each original data table, for example, the original data table with a larger comprehensive score can be selected as the target data table.

[0131] Optionally, when the target data table is determined, only the target field in the target data table needs to be selected as the target field corresponding to the question text data, and no other target field in other data tables needs to be considered. For example, if the comprehensive score of the province table is large, the province table is selected as the target data table, and the date, province, and access user in the province table are the target fields corresponding to the question text. At this time, the date in the channel table is not the target field of the question text.

[0132] The comprehensive score can be the sum of the matching results of the target fields in the original data tables, can be the average weighted value of the matching results of the target fields in the original data tables, or can be obtained by other calculation methods, which is not limited here.

[0133] In this embodiment, the target fields are determined according to the matching results of the fields, and the target data table is determined according to the results of the target fields in the original data tables, which can further reduce the matching amount in the second data table, improve the data matching efficiency and accuracy, and thus improve the question and answer efficiency and accuracy.

[0134] Figure 4 The flowchart of another question and answer information processing method provided in the embodiments of the present application is shown in FIG. 6. Figure 4 The matching of the word vectors corresponding to the question text data with the word vectors corresponding to the field values of the target fields of the target data table in the second data table to determine the target field values of the target fields in S203 can include the following steps.

[0135] S401: Selecting, from the second data table, data rows corresponding to the target fields of the target data table.

[0136] Optionally, the second data table can include multiple original data tables and target fields of the original data tables, and the data rows corresponding to the target fields in the target data table can be selected from the second data table according to the name of the target data table and the target fields.

[0137] S402: Matching the word vectors corresponding to the question text data with the word vectors in the data rows respectively, and obtaining the target field values of the target fields according to the matching results.

[0138] The word vectors in the data rows refer to the word vectors corresponding to the field values of the target fields in the target data table. Specifically, for example, the field values of the province in the province table include Sichuan and Beijing, and the word vectors in the data rows can refer to the word vectors of Sichuan and Beijing respectively.

[0139] Specifically, each word vector in the question text can determine the word vector corresponding to each field value that needs to be matched according to the corresponding target field in the target data table. For example, the word vector w1 of “today” in the question text can determine that the word vector with the field value of 2023-07-03 needs to be matched according to the target field date in the target data table province table; the word vector w2 of “Sichuan Province” can match the word vectors of “Beijing” and “Sichuan” in the province field of the target data table province table respectively to obtain a matching result, and obtain the target field value of each target field according to the matching result, for example, the target field value of “2023-07-03” and “Sichuan” can be obtained according to the matching result.

[0140] Optionally, the generation of the query statement for the target data table according to the target field values of each target field in the target data table corresponding to the question text data and the variable names of each target field in S104 can include:

[0141] Optionally, if the target data row in the second data table has a matching result of the word vector corresponding to the question text data that meets the preset condition, the field value in the target data row and the variable name of the target field are taken as the query parameter in the query statement.

[0142] The target data row that meets the preset condition can refer to the data row in which the word vector in the target data row has the highest similarity with the word vector in the question text data.

[0143] For example, the word vector w1 of “today” in the question text can have a matching field value of 2023-07-03 in the target data table, and the data row in which the field value is located is taken as the target data row, and the variable name of the target field corresponding to the field value is determined as dt according to Table 3, and the field value 2023-07-03 is taken as the parameter value of the query parameter of the target field, for example, dt = 2023-07-03; the word vector w2 of “Sichuan Province” can have a matching “Sichuan” word vector in the target data table province table, and the data row in which the field is located is taken as the target data row, and the variable name of the target field corresponding to the field is determined as province according to Table 3, and the field value “Sichuan” is taken as the parameter value of the query parameter of the target field, for example, province = “Sichuan”.

[0144] Optionally, if the data row corresponding to the target field in the target data table is not filtered out from the second data table, the variable name of the target field is taken as the query parameter in the query statement.

[0145] Specifically, if the data row corresponding to the target field in the target data table is not filtered out from the second data table, that is, the target field does not exist corresponding field value, the variable name of the target field is directly queried from table 3, and the queried variable name is used as the query parameter in the query statement. For example, for the word vector w1 of the "access user number" in the question text data, if there is no word vector matching the field value in the target data table, the variable name of the target field is found in the target data table in table 3, for example, activeuser, which can be directly used as a parameter in the query statement.

[0146] Based on the above description, the query statement of the question text "Today, the number of users visiting Sichuan Province" can be, for example, select dt, province, activeuser; from province table; where province = sichuan and dt = 2023-07-03.

[0147] In this embodiment, the question text corresponding data can be quickly queried from the target data table through the query statement, so that the corresponding answer data can be quickly obtained.

[0148] Figure 5 For the flowchart of training the language model provided in the embodiments of the present application, before the question text data is input into the pre-trained target language model for encoding in S102, the following steps can be included:

[0149] S501, obtain a plurality of sample data, convert each sample data into a preset format data, and obtain each converted sample data.

[0150] The preset format data can refer to the language format accepted by the language model, for example, the sample data is converted into a format stored in a word table by a tokenizer, for example, "Today, Sichuan Province, access user" can be converted into "today" "Sichuan" "access user".

[0151] S502, mask each converted sample data to obtain each masked sample data.

[0152] Specifically, using an initial language model based on a self-attention mechanism, the language masking and next sentence prediction can be performed based on a self-supervised learning method.

[0153] The language masking refers to randomly covering the words in the converted sample data; the next sentence prediction can refer to predicting the next sentence from the previous sentence for a sentence with a previous and next sentence.

[0154] S503, training the initial training model based on each masked sample data to obtain a target language model.

[0155] Optionally, the initial training model is iteratively optimized based on the masked sample data, and the initial training model satisfying the optimization condition is taken as the target language model.

[0156] Optionally, before determining the at least one target field in the target data table corresponding to the question text data, the target field value of each target field, and the variable name of each target field according to the word vector corresponding to the question text data and the word vector stored in the data table of the preset database in S103, the method can further include:

[0157] Optionally, the fields in each original data table are input into the target language model to obtain the word vector of each field, and the fields in each original data table and the word vector corresponding to each field are saved into the first data table.

[0158] Optionally, the first data table can be used to record the fields in each original data table and the word vector corresponding to each field, and the fields in each original data table and the word vector corresponding to each field can be saved using a one-to-one mapping relationship.

[0159] For example, Table 1 in the above is a schematic diagram of a first data table. The fields of province, number of access users, and date in the province table are encoded to obtain the word vector of each field. Specifically, the word vector of "date" is [0.01, 0.01, 0.01, 0.02, 0.03, 0.92], the word vector of "province" is [0.01, 0.01, 0.01, 0.02, 0.92, 0.03], and the word vector of "number of access users" is [0.01, 0.01, 0.01, 0.92, 0.02, 0.03]. The fields of date, channel, and number of new users in the channel table are encoded to obtain the word vector of each field. Specifically, the word vector of "date" is [0.01, 0.01, 0.92, 0.01, 0.02, 0.03], the word vector of "channel" is [0.01, 0.92, 0.01, 0.01, 0.02, 0.03], and the word vector of "number of new users" is [0.92, 0.01, 0.01, 0.01, 0.02, 0.03].

[0160] Optionally, the field values corresponding to the fields in each original data table are input into the target language model to obtain the word vector of each field value, and the fields in each original data table, the field values corresponding to each field, and the word vector corresponding to each field value are saved into the second data table.

[0161] Optionally, the field values corresponding to the fields in each original data table and the word vector corresponding to each field value can be saved using a one-to-one mapping relationship.

[0162] For example, Table 2 in the above is a schematic diagram of a second data table. The field value Sichuan and the field value Beijing of the province in the province table are encoded, and the field value 2023-07-03 is encoded to obtain the word vector of each field value. Specifically, the word vector of "2023-07-03" is [0.01, 0.01, 0.01, 0.02, 0.03, 0.92], the word vector of "Sichuan" is [0.01, 0.01, 0.01, 0.02, 0.92, 0.03], and the word vector of "Beijing" is [0.01, 0.01, 0.01, 0.92, 0.02, 0.03]. The field value 2023-07-03 of the date in the channel table and the field value Changhong and Hisense of the channel are encoded respectively to obtain the word vector of each field value. Specifically, the word vector of "2023-07-03" is [0.01, 0.01, 0.92, 0.01, 0.02, 0.03], the word vector of "Changhong" is [0.01, 0.92, 0.01, 0.01, 0.02, 0.03], and the word vector of "Hisense" is [0.92, 0.01, 0.01, 0.01, 0.02, 0.03].

[0163] Optionally, each field in each original data table and the variable name corresponding to each field are saved into a third data table.

[0164] For example, the variable name of the date in the province table can be dt, the variable name of the province can be province, and the variable name of the active user can be activeuser. Each field and the variable name corresponding to each field can be saved using a one-to-one mapping relationship. For the province table, a query statement template can be corresponded, for example, query statement template 1 in Table 3. For each original data table, a query statement template can be corresponded, and each original data table can be quickly queried through the query statement template.

[0165] Figure 6 A schematic diagram of a device for a question and answer information processing method provided by an embodiment of the present application is shown in FIG. 6. Figure 6 The device includes:

[0166] The acquisition module 601 is configured to acquire user input question text data.

[0167] The encoding module 602 is configured to input the question text data into a target language model trained in advance to encode and obtain at least one word vector corresponding to the question text data.

[0168] The determining module 603 is configured to determine at least one target field in a target data table corresponding to the question text data, target field values of each target field, and variable names of each target field according to each word vector corresponding to the question text data and each word vector stored in a data table of a preset database, wherein the preset database comprises a first data table, a second data table, and a third data table, the first data table is used to record field names in each original data table and word vectors corresponding to the field names, the second data table is used to record each field in each original data table, field values corresponding to each field, and word vectors corresponding to each field value, and the third data table is used to record each field in each original data table and variable names corresponding to each field, and the target data table is one of the original data tables.

[0169] The generating module 604 is configured to generate a query statement for the target data table according to the target field values of each target field in the target data table corresponding to the question text data and the variable names of each target field.

[0170] The executing module 605 is configured to execute the query statement to obtain and output answer data corresponding to the question text data.

[0171] Optionally, the determining module 603 is specifically configured to:

[0172] match each word vector corresponding to the question text data with each word vector in the first data table respectively to obtain a matching result corresponding to each field in each original data table;

[0173] determine the target data table and at least one target field in the target data table according to the matching result corresponding to each field in each original data table;

[0174] match each word vector corresponding to the question text data with each word vector corresponding to each field value of each target field of the target data table in the second data table respectively to determine the target field values of each target field;

[0175] find the variable names of each target field from the third data table.

[0176] Optionally, the determining module 603 is specifically configured to:

[0177] determine at least one target field according to the matching result corresponding to each field in each original data table;

[0178] determine the target data table according to the matching result corresponding to at least one target field in each original data table.

[0179] Optionally, the determining module 603 is specifically configured to:

[0180] filtering, from the second data table, a data row corresponding to each target field of the target data table;

[0181] matching each word vector corresponding to the question text data with a word vector in each data row respectively, and obtaining a target field value of each target field according to a matching result.

[0182] Optionally, the generation module 603 is specifically configured to:

[0183] if there is a target data row in the second data table, in which a matching result of a word vector corresponding to the question text data satisfies a preset condition, then taking a field value in the target data row and a variable name of the target field as a query parameter in the query statement;

[0184] if no data row corresponding to a target field of the target data table is filtered from the second data table, then taking a variable name of the target field as a query parameter in the query statement.

[0185] Optionally, the encoding module 602 is specifically configured to:

[0186] obtain a plurality of sample data, convert each sample data into data in a preset format, and obtain converted sample data;

[0187] perform a mask operation on the converted sample data, and obtain masked sample data;

[0188] train an initial training model based on the masked sample data, and obtain the target language model.

[0189] Optionally, the determination module 603 is specifically configured to:

[0190] input each field in each original data table into the target language model, obtain a word vector of each field, and save each field in each original data table and a word vector corresponding to each field into the first data table;

[0191] input a field value corresponding to each field in each original data table into the target language model, obtain a word vector of each field value, and save each field in each original data table, a field value corresponding to each field, and a word vector corresponding to each field value into the second data table;

[0192] save each field in each original data table and a variable name corresponding to each field into the third data table.

[0193] Figure 7 A structural block diagram of an electronic device 700 is provided in an embodiment of the present application. As shown in FIG. 7, the electronic device 700 includes a processor 701, a memory 702, a communication interface 703, and a bus 704. Figure 7As shown, the electronic device can include a processor 701, a memory 702.

[0194] Optionally, a bus 403 can also be included, wherein the memory 702 is configured to store machine readable instructions executable by the processor 701, and when the electronic device 700 is running, the processor 701 communicates with the memory 702 through the bus 703, and the machine readable instructions are executed by the processor 701 to perform the method steps in the above method embodiments.

[0195] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to perform the method steps in the above question and answer information processing method embodiments.

[0196] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the above-described system and device can refer to the corresponding process in the method embodiments, which will not be described herein. In the several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented by other means. The device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and actual implementation can have another division manner, for example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be indirect coupling or communication connection through some communication interface, device or module, which can be electrical, mechanical or other forms.

[0197] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. If the functions are realized in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or say the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of software products, which are stored in a storage medium and include a number of instructions for making a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0198] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application.

Claims

1. A question-and-answer information processing method, characterized in that, The method includes: Obtain the user's input question text data; The question text data is input into a pre-trained target language model for encoding to obtain at least one word vector corresponding to the question text data; Based on the word vectors corresponding to the question text data and the word vectors stored in the data tables of the preset database, at least one target field, the target field value of each target field, and the variable name of each target field in the target data table corresponding to the question text data are determined. The preset database includes a first data table, a second data table, and a third data table. The first data table is used to record the field names and the word vectors corresponding to the field names in each original data table. The second data table is used to record each field in each original data table, the field value corresponding to each field, and the word vector corresponding to each field value. The third data table is used to record each field in each original data table and the variable name corresponding to each field. The target data table is one of the data tables in the original data table. Based on the target field values ​​and variable names of each target field in the target data table corresponding to the question text data, a query statement is generated for the target data table. Execute the query statement to obtain and output the answer data corresponding to the question text data.

2. The question-and-answer information processing method according to claim 1, characterized in that, The step of determining at least one target field, the target field value, and the variable name of each target field in the target data table corresponding to the question text data based on the word vectors corresponding to the question text data and the word vectors stored in the data table of the preset database includes: The word vectors corresponding to the question text data are matched with the word vectors in the first data table to obtain the matching results for each field in each original data table. Based on the matching results corresponding to each field in each original data table, the target data table and at least one target field in the target data table are determined; The word vectors corresponding to the question text data are matched with the word vectors corresponding to the field values ​​of the target fields in the target data table in the second data table to determine the target field values ​​of each target field. Find the variable names of each target field in the third data table.

3. The question-and-answer information processing method according to claim 2, characterized in that, The step of determining the target data table and at least one target field in the target data table based on the matching results of each field in each original data table includes: Based on the matching results of each field in each original data table, at least one of the target fields is determined; The target data table is determined based on the matching results of at least one of the target fields in each of the original data tables.

4. The question-and-answer information processing method according to claim 2, characterized in that, The step of matching each word vector corresponding to the question text data with each word vector corresponding to each target field of the target data table in the second data table to determine the target field value of each target field includes: Filter the data rows corresponding to each target field of the target data table from the second data table; The word vectors corresponding to the question text data are matched with the word vectors in each of the data rows, and the target field values ​​of each target field are obtained based on the matching results.

5. The question-and-answer information processing method according to claim 4, characterized in that, The step of generating a query statement for the target data table based on the target field values ​​and variable names of each target field in the target data table corresponding to the question text data includes: If there is a target data row in the second data table whose word vector matching result with the question text data meets the preset conditions, then the field value in the target data row and the variable name of the target field will be used as the query parameters in the query statement. If no data row corresponding to the target field of the target data table is found from the second data table, then the variable name of the target field is used as a query parameter in the query statement.

6. The question-and-answer information processing method according to claim 1, characterized in that, Before inputting the question text data into the pre-trained target language model for encoding, the process includes: Acquire multiple sample data, convert each sample data into data in a preset format, and obtain the converted sample data; Perform a masking operation on the transformed sample data to obtain masked sample data. The initial training model is trained based on the masked sample data to obtain the target language model.

7. The question-and-answer information processing method according to claim 1, characterized in that, Before determining at least one target field, the target field value, and the variable name of each target field in the target data table corresponding to the question text data, based on the word vectors corresponding to the question text data and the word vectors stored in the data table of the preset database, the process includes: Each field in each original data table is input into the target language model to obtain the word vector of each field, and each field in each original data table and the word vector corresponding to each field are saved to the first data table; Input the field values ​​corresponding to each field in each original data table into the target language model to obtain the word vectors of each field value, and save each field, the field value corresponding to each field, and the word vectors corresponding to each field value in each original data table to the second data table; Each field in each original data table and the corresponding variable name are saved to the third data table.

8. A question-and-answer information processing device, characterized in that, include: The acquisition module is used to acquire the question text data input by the user; The encoding module is used to input the question text data into a pre-trained target language model for encoding, so as to obtain at least one word vector corresponding to the question text data; The determining module is used to determine at least one target field, the target field value of each target field, and the variable name of each target field in a target data table corresponding to the question text data, based on the word vectors corresponding to the question text data and the word vectors stored in the data tables of a preset database. The preset database includes a first data table, a second data table, and a third data table. The first data table is used to record the field names and the word vectors corresponding to the field names in each original data table. The second data table is used to record each field in each original data table, the field value corresponding to each field, and the word vector corresponding to each field value. The third data table is used to record each field in each original data table and the variable name corresponding to each field. The target data table is one of the data tables in the original data table. The generation module is used to generate a query statement for the target data table based on the target field values ​​and variable names of each target field in the target data table corresponding to the problem text data. The execution module is used to execute the query statement, obtain and output the answer data corresponding to the question text data.

9. An electronic device, characterized in that, The method includes a memory and a processor, wherein the memory stores a computer program executable by the processor, and the processor executes the computer program to implement the steps of the question-and-answer information processing method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the question-and-answer information processing method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Intelligent question answering method, apparatus, computer device and storage medium

    CN109522393A

  • Man-machine interaction method, device and equipment based on table data

    CN114637765A