A method, device and equipment for answering user questions

By analyzing the scene categories, conditional items and query items in the user's question statement, directly searching for data in the target data table, solving the shortcomings of the existing question-and-answer system when handling complex queries, achieving efficient and accurate replies, and improving users Experience.

CN113010651BActive Publication Date: 2025-02-18INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110228114.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-02
Publication Date
2025-02-18
Estimated Expiration
2041-03-02

Smart Images

  • Figure CN113010651B_ABST
    Figure CN113010651B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a method, device and equipment for answering user questions. The method includes: receiving a question statement input by a user; determining at least one scenario category corresponding to the question statement; the scenario category corresponds to a data table category; parsing the condition items and query items in the question statement; the condition items include the data type associated with the question statement; the query items include the data type required to be obtained by the question statement; determining the target data in the target data table according to the scenario category, condition items and query items; the target data table includes a data table corresponding to the data table category; and feeding back the query result corresponding to the question statement to the user based on the target data. The above method ensures the comprehensiveness of the data involved in the answering process, realizes accurate and effective answering to user questions, and guarantees the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of artificial intelligence technology, and more particularly to a method, device and apparatus for answering questions asked by users. Background Art

[0002] With the development of computer technology, more and more work can be done by computers to reduce the consumption of human resources. For example, in some scenarios, the question-answering system can be used to answer questions, ensuring the accuracy of the answers while also ensuring the timeliness of the answers.

[0003] The current question-and-answer system generally constructs a corresponding question-and-answer dataset based on the category of the question in advance, or converts the original data into a knowledge graph. After the user asks a question, a reply is given based on the constructed question-and-answer dataset or knowledge graph. The above reply method not only requires format conversion or preprocessing of the data, but also, since the above question-and-answer system generally only answers questions for one data table, when the user's question involves the content in multiple data tables, it is also difficult to accurately and effectively answer the user's question, thereby affecting the user's experience. Therefore, there is an urgent need for a method that can accurately and effectively answer user questions. Summary of the invention

[0004] The purpose of the embodiments of this specification is to provide a method, device and equipment for answering questions from users, so as to solve the problem of how to accurately and effectively answer questions from users.

[0005] To solve the above technical problems, an embodiment of the present specification provides a method for answering user questions, including: receiving a question statement input by a user; determining at least one scenario category corresponding to the question statement; the scenario category corresponds to a data table category; parsing the condition items and query items in the question statement; the condition items include the data type associated with the question statement; the query items include the data type required to be obtained by the question statement; determining target data in a target data table according to the scenario category, condition items and query items; the target data table includes a data table corresponding to the data table category; and feeding back the query result corresponding to the question statement to the user based on the target data.

[0006] The embodiments of the present specification also propose a device for answering user questions, including: a question statement receiving module, used to receive a question statement input by a user; a scenario category determination module, used to determine at least one scenario category corresponding to the question statement; the scenario category corresponds to a data table category; an item parsing module, used to parse the condition items and query items in the question statement; the condition items include the data type associated with the question statement; the query items include the data type required to be obtained by the question statement; a target data locating module, used to determine the target data in the target data table according to the scenario category, condition items and query items; the target data table includes a data table corresponding to the data table category; a query result feedback module, used to feedback the query result corresponding to the question statement to the user based on the target data.

[0007] The embodiments of the present specification also propose a device for answering user questions, including a memory and a processor; the memory is used to store computer program instructions; the processor is used to execute the computer program instructions to implement the following steps: receiving a question statement input by a user; determining at least one scenario category corresponding to the question statement; the scenario category corresponds to a data table category; parsing the condition items and query items in the question statement; the condition items include the data type associated with the question statement; the query items include the data type required to be obtained by the question statement; determining target data in a target data table based on the scenario category, condition items and query items; the target data table includes a data table corresponding to the data table category; and feeding back the query result corresponding to the question statement to the user based on the target data.

[0008] It can be seen from the technical solutions provided by the above embodiments of this specification that after receiving the question statement input by the user, the embodiments of this specification can first determine the scene category corresponding to the question statement to determine at least one data table corresponding to the question statement. Afterwards, by parsing the condition items and query items in the question statement, the specific data corresponding to the condition items and query items can be found in the data table, and then the target data found can be fed back to the user with the corresponding query results. Through the above method, when answering user questions, there is no need to process the data table in the database in advance, but by directly parsing the user's questions, the relevant data corresponding to the user's questions can be found, ensuring the comprehensiveness of the data involved in the answering process, achieving accurate and effective answers to user questions, and ensuring the user's experience. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0010] Figure 1 This is a flow chart of a method for answering a user's question according to an embodiment of the present specification;

[0011] Figure 2 This is a module diagram of a device for answering questions asked by a user according to an embodiment of this specification;

[0012] Figure 3 This is a structural diagram of a device for answering questions asked by users according to an embodiment of this specification. DETAILED DESCRIPTION

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

[0014] In order to solve the above technical problems, a method for answering user questions in an embodiment of this specification is first introduced. The execution subject of the method for answering user questions can be a device for answering user questions, and the device for answering user questions includes but is not limited to a server, an industrial computer, a PC, etc. Figure 1 As shown, the method for answering user questions may include the following specific implementation steps.

[0015] S110: receiving a question sentence input by a user.

[0016] The question sentence can be a question sentence asked by the user for the information or data that the user wants to obtain. The question sentence can be a question sentence directly composed of natural language. For example, in a financial question-and-answer scenario, when a user needs to handle a corresponding business at a certain business hall, he can directly enter the question sentence "What time does the XX business hall in XX city open?" or "Is the XX branch open on Saturday?" In actual applications, the user can enter any form of question sentence according to needs, which is not limited to the above examples and will not be repeated here.

[0017] S120: Determine at least one scenario category corresponding to the question statement; the scenario category corresponds to a data table category.

[0018] After obtaining the question statement, the scene category corresponding to the question statement can be determined first. Since the data in the database is stored in different data tables based on the scene category, by obtaining the scene category corresponding to the question statement, the data table corresponding to the scene category can be determined, and then the corresponding data can be obtained from these data tables.

[0019] Specifically, the scene category can be different categories such as location category, time category, business category, etc. For example, in the example question "What time does XX business hall in XX city open?" in step S110, it can be determined that the scene corresponds to the business time query category. In actual applications, the division method of scene categories can be set according to needs, and is not limited to the above examples, and will not be repeated here.

[0020] In some embodiments, a classification model may be pre-trained using the BERT algorithm, and the classification model is used to determine the scenario category corresponding to the question statement. Specifically, the classification model may be a mathematical model for classifying unclassified business data into known types. The classification model may be a Bayesian classification model, a support vector machine classification model (SVM), or a convolutional neural network classification model (CNN).

[0021] After the classification model is trained, the classification model can be used to identify the scene category corresponding to the question statement. It should be noted that in actual applications, when the classification model is used to identify the question statement, it may be that only a single table is identified for the question. In this case, the identified data table identifier can be directly displayed, thereby saving corresponding steps.

[0022] After one or more scene categories are identified, all data tables corresponding to the scene categories may be obtained as the identified data tables.

[0023] S130: parsing the condition items and query items in the question statement; the condition items include the data types associated with the question statement; and the query items include the data types required to be obtained by the question statement.

[0024] After obtaining the question statement, in combination with the data table corresponding to the question statement determined in step S120, the question statement can be further parsed for the condition items and query items corresponding to the data table. The condition items include the data types associated with the question statement, and the query items include the data types required to be obtained by the question statement. For example, when the question is "I want to know the business hours of Shanghai Changdao Road Branch", the corresponding condition items can be "Shanghai" and "Changdao Road Branch" in the corresponding data table, and the corresponding query item can be "Business Hours" in the corresponding data table. By parsing the condition items and query items in the question statement, the corresponding data can be more accurately queried from the corresponding data table to feed back to the user.

[0025] In some embodiments, obtaining the conditional items in the question statement may be performed by identifying them using a conditional model. The conditional model is used to analyze the conditional items in the question statement. Before parsing the conditional items in the question statement, a sample conditional statement may be obtained first, and the sample conditional statement corresponds to a query data table identifier, a conditional field identifier, a conditional field operation type, and a conditional link relationship. Afterwards, the conditional model may be trained using the sample conditional statements, so that the trained conditional model may be used to identify the query data table identifier, the conditional field identifier, the conditional field operation type, and the conditional link relationship corresponding to the question statement.

[0026] The query data table identifier can be used to identify the corresponding data table, which is the data table identified in step S120. The condition field identifier can locate the specific field corresponding to the condition item in the data table. The condition field operation type can be used to indicate the specific operation type taken for the condition field, for example, it can include one of no operation, equal to, greater than, less than, close to, greater than or equal to, less than or equal to. The conditional link relationship can be used to indicate the data relationship between different condition fields, specifically, it can include no relationship, and relationship, or one of the relationships, so as to better obtain the data results required by the user.

[0027] Using a specific example to illustrate, construct a conditional data set so that the data of each row is {"query": question; "table_id": the id of the corresponding data table; "header": [Which columns of the current table are used as conditional columns, the corresponding value of the conditional column is 1, and the others are 0]; "operation": [What is the operation on the column in the condition, 0 corresponds to no operation, 1 corresponds to equal, 2 corresponds to greater than, 3 corresponds to less than, 4 corresponds to like, 5 corresponds to greater than or equal to, 6 corresponds to less than or equal to]; "connection": [These columns correspond to the link relationship between the conditions, 0 corresponds to no relationship, 1 corresponds to or, 2 corresponds to and]}. For the question "I want to know the business hours of Shanghai Changdao Road Branch", the corresponding conditional data line is {"query": "I want to know the business hours of Shanghai Changdao Road Branch"; "table_id": "111"; "header": [0,1,1,1,0]; "operation": [0,1,1,1,0]; "connection": [0,2,2,2,0]}.

[0028] Correspondingly, in an example, based on sample conditional statements, the conditional model can also be trained using the BERT algorithm. The specific training process can be set based on the needs of the actual application and will not be repeated here.

[0029] Generally, when locating and searching for data based on conditional items, if the specific attribute value can be determined based on the question statement, and the conditional field operation type corresponding to the conditional item is equal, then the matching can be performed directly in the corresponding column. For example, when it is necessary to find target data corresponding to a specific time, the data with the time of the target time can be directly matched in the data table as the found data.

[0030] However, in some implementations, the column corresponding to the condition item in the data table may contain text. In this case, it may not be possible to match completely corresponding data. For example, when a user wants to know the business hours of the Changdao Road Branch, the question may record "Changdao Branch". If a completely corresponding matching method is adopted, it may not be possible to match "Changdao Road Branch" with "Changdao Branch". In this case, matching can be performed based on the similarity between the text recorded in the column and the text in the question, and the most similar text obtained can be used as the queried text. The specific similarity matching method can be adjusted based on the needs of the actual application, which will not be repeated here.

[0031] In other implementations, it may happen that the obtained conditional column attribute is a numerical value, and the operation on the conditional column is a comparison operation, such as greater than, less than, etc. In this case, the conditional value needs to be identified from the question. For example, when the user asks a question such as "I want to know the branch with more than 20 employees", after the question is input into the model, the conditional column corresponding to the question can be obtained as the number of employees. The contents of the column where the number of employees is located in the data table are all numerical values. At this time, the question is segmented, and each word is matched with the name of the conditional column for similarity. For example, the result of the above conditional statement after word segmentation may be [I, want, to, know, the branch with more than 20 employees]. After the similarity matching is performed between each word and the column number of employees, the most similar word is the number of employees. Then, the word representing the numerical value that is closest to the word (start searching from the right side of the word first) is obtained as the conditional value, which is 20 in this example. The specific operation method can be adjusted based on the needs of the actual application, and will not be repeated here.

[0032] Accordingly, in some implementations, the query items may also be identified and extracted using a query model, and the query model may be used to analyze the query items in the question statement. Before parsing the query items in the question statement, a sample query statement may be obtained first, and the sample query statement corresponds to a query data table identifier, a query field identifier, a query field operation type, and a field grouping situation. Afterwards, the query model may be trained using the sample query statement, so that the query data table identifier, the query field identifier, the query field operation type, and the field grouping situation corresponding to the question statement may be recognized using the trained query model.

[0033] The query data table identifier can be used to identify the found data table. The query field identifier can locate the specific field corresponding to the query item in the data table. The query field operation type can be used to indicate the specific operation type taken for the query field, for example, it can include at least one of no operation, counting operation, sum operation, average operation, minimum operation, and maximum operation. The field grouping situation can be used to indicate that the question has grouped specific data columns in the data table, and the field grouping situation can be used to identify the group situation corresponding to the corresponding field.

[0034] A specific example is used to illustrate. A query data set is established for the log in the case of a single table query. Each row of data is {"query": question; "table_id": the id of the data table corresponding to the question; "select": [which columns of the current table are queried by the question, the corresponding value of the query column is 1, and the others are 0]; "agg": [the aggregation operation of the query column by the question, 0 corresponds to no operation, 1 corresponds to count, 2 corresponds to sum, 3 corresponds to avg, 4 corresponds to min, and 5 corresponds to max]; "group_by": [which column in the table is grouped by the question, the corresponding value of the grouping column is 1, and the others are 0]}. For example, assuming that the id of the branch attribute table is 111, the column names of the table are Id (branch id), province (ProvinceName), city (CityName), branch name (Name), and business hours (WorkTime); the question is "I want to know the business hours of Shanghai Changdao Road Branch", then the corresponding data behavior is {"query": "I want to know the business hours of Shanghai Changdao Road Branch"; "table_id": "111"; "select": [0,0,0,0,1]; "agg": [0,0,0,0,0]; "group_by": [0,0,0,0,0]}.

[0035] Correspondingly, in an example, based on sample query statements, the BERT algorithm can also be used to train the query model. The specific training process can be set based on the needs of the actual application and will not be repeated here.

[0036] In some embodiments, due to the format of the question statement itself or the defects of the system's own recognition method, it may happen that the generated query field identifier or condition field identifier is empty, that is, the query item or condition item cannot be obtained normally. In this case, the question statement can be recorded in the conversion error log, and the conversion error log is used to record the statements that cannot be answered. For the questions in the conversion error log, the model can be incrementally trained as sample data at intervals, so as to optimize the recognition process of the question sentence and improve the effectiveness of question sentence recognition.

[0037] S140: Determine target data in a target data table according to the scenario category, condition items, and query items; the target data table includes a data table corresponding to the data table category.

[0038] After obtaining the scene category, condition item and query item, the data that meets the question statement can be found. Specifically, the target data table can be located by the scene category, and the target data in the target data table can be locked by the condition item and query item. The target data table can be a data table corresponding to the data table category. Since the condition item and query item limit the query conditions and query result requirements, the final target data can be obtained based on the acquisition in the target data table.

[0039] The target data may be data directly found in the target data table, or data obtained by calculation using the data in the target data table. The specific acquisition method may be determined according to the corresponding relationship between the condition item and the query item, which will not be described in detail here.

[0040] In some implementations, when acquiring the target data, a SQL query statement or an HQL query statement may be generated based on the scenario category, condition items, and query items, thereby using the SQL query statement or the HQL query statement to query the target data in the target data table.

[0041] In practical applications, due to the format of the question statement or the limitation of the system function itself, there may be a situation where the sql query statement or hql query statement cannot be generated. In this case, the question statement can also be recorded in the conversion error log. The specific description of the conversion error log and the description of the operation taken for the record in the conversion error log can refer to the description in step S130, which will not be repeated here.

[0042] Correspondingly, when there are more than one target data table, multiple different query statements can be generated for different tables and queried respectively. The specific query method can refer to the above example and will not be described in detail here.

[0043] S150: Feedback a query result corresponding to the question statement to the user based on the target data.

[0044] After the target data is acquired, the corresponding query results can be generated according to the target data and fed back to the user to complete the answer to the question. For example, in response to the user's question "I want to know the business hours of Shanghai Changdao Road Branch", according to the business hours found, the found business hours can be fed back to the user in the form of query results, for example, the feedback statement is "Shanghai Changdao Road Branch business hours are from 8:00 to 17:00". The specific way of feeding back the corresponding results can be adjusted according to the actual application situation, and is not limited to the above example, and will not be repeated here.

[0045] In some embodiments, if the query fails to be performed normally or the query result is empty in step S130 or step S140, an error query message may be fed back to the user to prompt the user that the query cannot be performed for the question statement. For example, the user may be fed back "I'm sorry, no relevant results were found" to inform the user that the query was not successfully completed, and to ensure that a reply can be given to the user to optimize the user experience.

[0046] Based on the introduction of the above embodiments, it can be seen that after receiving the question statement input by the user, the method can first determine the scene category corresponding to the question statement to determine at least one data table corresponding to the question statement. Afterwards, by parsing the condition items and query items in the question statement, the specific data corresponding to the condition items and query items can be found in the data table, and then the target data found is fed back to the user with the corresponding query results. Through the above method, when answering user questions, there is no need to process the data table in the database in advance, but by directly parsing the user's questions, the relevant data corresponding to the user's questions can be found, ensuring the comprehensiveness of the data involved in the answering process, achieving accurate and effective answers to user questions, and ensuring the user's experience.

[0047] In view of the above-mentioned method for answering user questions, a device for answering user questions is introduced in the embodiment of this specification. The device for answering user questions can be set in the device for answering user questions. Figure 2 As shown, the device for answering questions asked by users includes the following modules.

[0048] The question sentence receiving module 210 is used to receive a question sentence input by a user.

[0049] The scenario category determination module 220 is used to determine at least one scenario category corresponding to the question statement; the scenario category corresponds to a data table category.

[0050] The item parsing module 230 is used to parse the condition items and query items in the question statement; the condition items include the data types associated with the question statement; and the query items include the data types required to be obtained by the question statement.

[0051] The target data locating module 240 is used to determine the target data in the target data table according to the scene category, condition items and query items.

[0052] The query result feedback module 250 is used to feed back the query result corresponding to the question statement to the user based on the target data.

[0053] In view of the above-mentioned method for answering questions from users, the embodiments of this specification provide a device for answering questions from users. Figure 3 As shown, the device for answering questions asked by users may include a memory and a processor.

[0054] In this embodiment, the memory may be implemented in any appropriate manner. For example, the memory may be a read-only memory, a mechanical hard disk, a solid-state hard disk, or a USB flash drive, etc. The memory may be used to store computer program instructions.

[0055] In this embodiment, the processor can be implemented in any appropriate manner. For example, the processor can take the form of a computer-readable medium such as a microprocessor or a processor and a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, etc. The processor can execute the computer program instructions to implement the following steps: receiving a question statement input by a user; determining at least one scene category corresponding to the question statement; the scene category corresponds to a data table category; parsing the condition items and query items in the question statement; the condition items include the data type associated with the question statement; the query item includes the data type required to be obtained by the question statement; determining the target data in the target data table according to the scene category, the condition item and the query item; the target data table includes a data table corresponding to the data table category; and feeding back the query result corresponding to the question statement to the user based on the target data.

[0056] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0057] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0058] It can be known from the above description of the implementation mode that the technicians in this field can clearly understand that the present specification can be implemented by means of software plus the necessary first hardware platform. Based on such an understanding, the technical solution of the present specification can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present specification or some parts of the embodiments.

[0059] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0060] This specification can be used in many first or special computer system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.

[0061] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0062] Although the present specification is described through embodiments, those skilled in the art will appreciate that there are many modifications and changes to the present specification without departing from the spirit of the present specification, and it is intended that the appended claims include these modifications and changes without departing from the spirit of the present specification.

Claims

1. A method for answering a user's question, characterized in that: include: Receive a question statement input by a user; Determining at least one scenario category corresponding to the question statement; The scenario category corresponds to the data table category; Parsing the condition items and query items in the question statement; the condition items include the data type associated with the question statement; the query items include the data type required to be obtained by the question statement; Determine the target data in the target data table according to the scenario category, condition item and query item; the target data table includes a data table corresponding to the data table category; Feedback the query result corresponding to the question statement to the user based on the target data; The step of parsing the condition items and query items in the question statement includes: The query data table identifier, condition field identifier, condition field operation type and condition link relationship corresponding to the question statement are obtained by using a pre-trained condition model; wherein the condition field identifier is used to locate the specific field corresponding to the condition item in the data table, the condition field operation type is used to indicate the specific operation type taken for the condition field, and the condition link relationship is used to indicate the data relationship between different condition fields; The query data table identifier, query field identifier, query field operation type and field grouping status corresponding to the question statement are obtained by using a pre-trained query model; wherein the query data table identifier is used to identify the found data table, the query field identifier is used to locate the specific field corresponding to the query item in the data table, the query field operation type is used to indicate the specific operation type taken for the query field, and the field grouping status is used to indicate the group status corresponding to the query field in the target data table; Determining the target data in the target data table according to the scenario category, condition item and query item includes: Generate a SQL query statement or an HQL query statement according to the scenario category, condition items and query items; The target data in the target data table is queried using the sql query statement or hql query statement.

2. The method according to claim 1, characterized in that Before determining at least one scene category corresponding to the question statement, the method further includes: A classification model is trained using the BERT algorithm; the classification model is used to determine the scene category corresponding to the question statement; Accordingly, determining at least one scenario category corresponding to the question statement includes: The classification model is used to obtain at least one scene category corresponding to the question statement.

3. The method according to claim 1, characterized in that Before parsing the condition items and query items in the question statement, the method further includes: Obtain a sample conditional statement; the sample conditional statement corresponds to a query data table identifier, a condition field identifier, a condition field operation type, and a condition link relationship; The conditional model is trained using the sample conditional sentences; the conditional model is used to analyze the conditional items in the question sentence.

4. The method according to claim 3, characterized in that The condition field operation type includes one of no operation, equal to, greater than, less than, close to, greater than or equal to, and less than or equal to.

5. The method according to claim 3, characterized in that The conditional link relationship includes one of no relationship, and relationship, or relationship.

6. The method according to claim 1, characterized in that After parsing the condition items and query items in the question statement, the method further includes: In the case where the determined condition item is text, the text of the condition item is converted into an attribute value based on similarity calculation, so as to be matched in the data table based on the attribute value.

7. The method according to claim 3, characterized in that The step of training the conditional model using the sample conditional statement includes: Based on the sample conditional sentences, the conditional model is trained using the BERT algorithm.

8. The method according to claim 1, characterized in that Before parsing the condition items and query items in the question statement, the method further includes: Obtain a sample query statement; the sample query statement corresponds to a query data table identifier, a query field identifier, a query field operation type, and a field grouping condition; The query model is trained using the sample query sentence; the query model is used to analyze the query items in the question sentence.

9. The method according to claim 8, characterized in that The query field operation type includes at least one of no operation, counting operation, sum operation, average operation, minimum operation, and maximum operation.

10. The method according to claim 8, characterized in that The using the query model to obtain the query item in the question sentence includes: Based on the sample query statements, the query model is trained using the BERT algorithm.

11. The method according to claim 3 or 8, characterized in that: When the generated query field identifier or condition field identifier is empty, the question statement is recorded in a conversion error log; the conversion error log is used to record statements that cannot be asked and answered.

12. The method according to claim 1, characterized in that The generating of a SQL query statement or an HQL query statement according to the scenario category, condition item and query item includes: When a SQL query statement or an HQL query statement cannot be generated, the question statement is recorded in a conversion error log; the conversion error log is used to record statements that cannot be answered.

13. The method according to claim 1, characterized in that Feedback of the query result corresponding to the question statement to the user based on the target data includes: In the case that the target data is empty, error query information is fed back to the user to prompt the user that the query statement cannot be queried.

14. A device for answering questions from users, characterized in that: include: A question sentence receiving module is used to receive a question sentence input by a user; A scene category determination module, used to determine at least one scene category corresponding to the question statement; The scenario category corresponds to the data table category; An item parsing module, used to parse the condition items and query items in the question statement; the condition items include the data types associated with the question statement; the query items include the data types required to be obtained by the question statement; A target data locating module, used for determining target data in a target data table according to the scenario category, condition items and query items; the target data table includes a data table corresponding to the data table category; A query result feedback module, used for feeding back the query result corresponding to the question statement to the user based on the target data; The project analysis module is specifically used for: The query data table identifier, condition field identifier, condition field operation type and condition link relationship corresponding to the question statement are obtained by using a pre-trained condition model; wherein the condition field identifier is used to locate the specific field corresponding to the condition item in the data table, the condition field operation type is used to indicate the specific operation type taken for the condition field, and the condition link relationship is used to indicate the data relationship between different condition fields; The query data table identifier, query field identifier, query field operation type and field grouping status corresponding to the question statement are obtained by using a pre-trained query model; wherein the query data table identifier is used to identify the found data table, the query field identifier is used to locate the specific field corresponding to the query item in the data table, the query field operation type is used to indicate the specific operation type taken for the query field, and the field grouping status is used to indicate the group status corresponding to the query field in the target data table; The target data positioning module is specifically used for: Generate a sql query statement or hql query statement according to the scene category, condition items and query items; and use the sql query statement or hql query statement to query target data in a target data table.

15. A device for answering questions from a user, comprising a memory and a processor; The memory is used to store computer program instructions; The processor is configured to execute the computer program instructions to implement the following steps: receiving a question statement input by a user; determining at least one scene category corresponding to the question statement; The scenario category corresponds to the data table category; the condition item and the query item in the question statement are parsed; the condition item includes the data type associated with the question statement; the query item includes the data type required to be obtained by the question statement; Determine the target data in the target data table according to the scenario category, condition item and query item; the target data table includes a data table corresponding to the data table category; Feedback the query result corresponding to the question statement to the user based on the target data; The step of parsing the condition items and query items in the question statement includes: The query data table identifier, condition field identifier, condition field operation type and condition link relationship corresponding to the question statement are obtained by using a pre-trained condition model; wherein the condition field identifier is used to locate the specific field corresponding to the condition item in the data table, the condition field operation type is used to indicate the specific operation type taken for the condition field, and the condition link relationship is used to indicate the data relationship between different condition fields; The query data table identifier, query field identifier, query field operation type and field grouping status corresponding to the question statement are obtained by using a pre-trained query model; wherein the query data table identifier is used to identify the found data table, the query field identifier is used to locate the specific field corresponding to the query item in the data table, the query field operation type is used to indicate the specific operation type taken for the query field, and the field grouping status is used to indicate the group status corresponding to the query field in the target data table; Determining the target data in the target data table according to the scenario category, condition item and query item includes: Generate a SQL query statement or an HQL query statement according to the scenario category, condition items and query items; The target data in the target data table is queried using the sql query statement or hql query statement.

Citation Information

Patent Citations

  • Question and answer statement processing method, device and equipment and storage medium

    CN111339280A

  • Query statement management method and device, readable storage medium and electronic equipment

    CN111949785A

  • Method and device for determining answers to questions, computer equipment and storage medium

    CN112287095A