Data query feedback method and device, electronic equipment and storage medium
By automatically analyzing user consultation statements using language models, determining influencing factors and querying databases, the problem of inefficient data analysis in the existing technology is solved, and fast and accurate data analysis and feedback are achieved, reducing costs.
Patent Information
- Application Number
- CN202411334733.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-02-11
AI Technical Summary
The prior art is inefficient in the process of user consulting data analysis and feedback, consumes a lot of manpower, and it is difficult to quickly and accurately analyze various factors affecting data changes.
By using the pre-trained language model, the consultation type judgment is made on the consultation statements entered by the user, the influencing factors are determined, and the corresponding database query statement is generated, the data is queried from the target database, and finally the answer statement is generated.
It realizes automatic data analysis and feedback without manual participation, improves the efficiency of data analysis and response to user consultation questions, and reduces costs.
Smart Images

Figure CN119415734A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data query feedback method, device, electronic device and computer-readable storage medium. Background Art
[0002] In the field of Internet applications, there are many scenarios for user consultation. Some business lines will receive a lot of user feedback related to data. For example, for video playback applications, users are puzzled by the dramatic changes in the number of views, recommendations, revenue, and other data of the created content, so they hope to sort out the factors that affect the changes in various types of data. The existing data analysis methods for user consultations usually require manual investigation and analysis one by one through historical accumulation of troubleshooting experience. In actual application scenarios, there are many factors that affect data changes. At present, it is not only necessary to cultivate in-depth understanding of the business and data analysis capabilities, but also consume a lot of manpower, resulting in low efficiency of data analysis and feedback. Summary of the invention
[0003] In view of this, in order to solve some or all of the above technical problems, the embodiments of the present application provide a data query feedback method, device, electronic device and computer-readable storage medium.
[0004] In a first aspect, an embodiment of the present application provides a data query feedback method, which includes: obtaining a consultation statement input by a user; using a pre-trained language model to determine the consultation type of the consultation statement to obtain the consultation type of the consultation statement; based on the consultation type, determining the influencing factors of the question raised by the consultation statement, and generating a database query statement corresponding to the influencing factors; based on the database query statement, querying data corresponding to the influencing factors from a target database; based on the data, generating an answer statement for the consultation statement.
[0005] In one possible implementation, an answer statement for an inquiry statement is generated based on data, including: determining attribute information of the inquiry statement; assembling the attribute information and data based on a preset prompt statement template corresponding to the inquiry type to obtain an answer prompt statement; and inputting the answer prompt statement into a language model to obtain an answer statement for the inquiry statement.
[0006] In one possible implementation, generating a database query statement corresponding to the influencing factor includes: generating a descriptive statement containing the influencing factor according to a preset descriptive statement template corresponding to the consultation type; and analyzing the descriptive statement using a language model to obtain a database query statement corresponding to the influencing factor.
[0007] In one possible implementation, a language model is used to analyze descriptive statements to obtain database query statements corresponding to influencing factors, including: based on a query statement template pre-configured in the language model, the language model is used to analyze the descriptive statements to obtain database query statements corresponding to the influencing factors.
[0008] In one possible implementation, based on a database query statement, querying data corresponding to the influencing factors from a target database includes: obtaining a database link address pre-configured for the influencing factors; connecting to the target database according to the database link address; and querying data corresponding to the influencing factors from the target database using a database query statement.
[0009] In one possible implementation, a pre-trained language model is used to determine the consultation type of a consultation statement to obtain the consultation type of the consultation statement, including: adding the consultation statement to a preset input statement template to obtain a statement to be input, wherein the input statement template includes a pre-configured consultation type set for limiting the consultation type to be output; inputting the statement to be input into the language model to obtain the consultation type of the consultation statement.
[0010] In the second aspect, an embodiment of the present application provides a data query feedback device, which includes: an acquisition module for acquiring an inquiry statement input by a user; a judgment module for using a pre-trained language model to judge the inquiry type of the inquiry statement, and obtain the inquiry type of the inquiry statement; a first generation module for determining the influencing factors of the question raised by the inquiry statement based on the consultation type, and generating a database query statement corresponding to the influencing factors; a query module for querying data corresponding to the influencing factors from a target database based on the database query statement; and a second generation module for generating an answer statement for the inquiry statement based on the data.
[0011] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory for storing a computer program; a processor for executing the computer program stored in the memory, and when the computer program is executed, the method of any embodiment of the data query feedback method of the first aspect of the present application is implemented.
[0012] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method of any embodiment of the data query feedback method of the first aspect described above is implemented.
[0013] In a fifth aspect, an embodiment of the present application provides a computer program, which includes a computer readable code. When the computer readable code runs on a device, the processor in the device implements a method as in any embodiment of the data query feedback method of the first aspect above.
[0014] The data query feedback method, device, electronic device, and computer-readable storage medium provided in the embodiments of the present application use a pre-trained language model to determine the consultation type of the consultation statement, and then determine the influencing factors of the questions raised in the consultation statement based on the consultation type, and generate a database query statement corresponding to the influencing factors. Based on the database query statement, the data corresponding to the influencing factors are queried from the target database, and finally, based on the data, an answer statement for the consultation statement is generated. The embodiments of the present application realize the use of a model to automatically analyze the questions consulted by users without manual participation, thereby improving the efficiency of providing data analysis and responses to users regarding consultation questions and reducing the cost of data analysis and responses. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0016] In order to more clearly illustrate the embodiments of the present application 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0017] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0018] Figure 1 A flowchart of a data query feedback method provided in an embodiment of the present application;
[0019] Figure 2 A flowchart of another data query feedback method provided in an embodiment of the present application;
[0020] Figure 3 A flowchart of another data query feedback method provided in an embodiment of the present application;
[0021] Figure 4 A flowchart of another data query feedback method provided in an embodiment of the present application;
[0022] Figure 5 A flowchart of another data query feedback method provided in an embodiment of the present application;
[0023] Figure 6 A schematic diagram of the structure of a data query feedback device provided in an embodiment of the present application;
[0024] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. It should be noted that unless otherwise specifically stated, the relative arrangement of the components and steps, the numerical expressions and the numerical values described in these embodiments do not limit the scope of the present application.
[0026] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of the present application are only used to distinguish between different steps, devices, modules and other objects, and do not represent any specific technical meanings, nor do they indicate the logical order between them.
[0027] It should also be understood that in this embodiment, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.
[0028] It should also be understood that any component, data or structure mentioned in the embodiments of the present application can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.
[0029] In addition, the term "and / or" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.
[0030] It should also be understood that the description of the various embodiments in this application focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.
[0031] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present application, its application, or uses.
[0032] Technologies, circuits, and devices known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the above-mentioned technologies, circuits, and devices should be considered as part of the specification.
[0033] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0034] It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. To facilitate the understanding of the embodiments of the present application, the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0035] In order to solve the technical problems of low efficiency and high cost in data analysis and response to user consultation questions in the prior art, the present application provides a data query feedback method that does not require human participation in data analysis and response, thereby improving the efficiency of responding to user consultation questions.
[0036] Figure 1 A flow chart of a data query feedback method provided in an embodiment of the present application. The method can be applied to a server, that is, the server receives an inquiry statement input by a user, generates an answer statement for the inquiry statement by executing the method, and feeds back the answer statement to a terminal used by the user. In addition, the method can also be executed by electronic devices such as desktop computers, laptop computers, portable computers, and smart phones. The electronic devices can communicate with each other and feed back the answer statement to the sending end of the inquiry statement.
[0037] In addition, the execution subject of the present method may be hardware or software. When the execution subject is hardware, the execution subject may be one or more of the electronic devices. For example, a single electronic device may execute the present method, or a plurality of electronic devices may cooperate with each other to execute the present method. When the execution subject is software, the present method may be implemented as a plurality of software or software modules, or as a single software or software module. No specific limitation is made herein.
[0038] like Figure 1 As shown, the method specifically includes:
[0039] Step 101: Obtain a consultation statement input by a user.
[0040] In some embodiments, the inquiry statement may be a question related to some data, which is sent by the terminal device used by the user to the electronic device executing the method. As an example, in the field of video playback application, the inquiry statement input by the user is: Why is my income so low? More than 40,000 views, only three cents.
[0041] Step 102: Use the pre-trained language model to determine the consultation type of the consultation sentence to obtain the consultation type of the consultation sentence.
[0042] In some embodiments, the language model can be trained based on a natural language model related to the art. For example, the language model can be a ChatGPT model. During training, multiple sample consultation sentences can be collected, and the consultation type of each sample consultation sentence can be set. The sample consultation sentence is directly input into the language model, or the format of the sample consultation sentence is adjusted according to a preset template and then input into the language model, and the corresponding consultation type is used as the expected output. According to the error between the actual output and the expected output, the model parameters are adjusted until the model can accurately identify the consultation type.
[0043] As an example, you can input "Why is my income so low? More than 40,000 views, and only three cents" into the language model, and the language model outputs the consultation type "Reasons for low income".
[0044] Step 103, based on the consultation type, determine the influencing factors of the questions raised in the consultation statement, and generate a database query statement corresponding to the influencing factors.
[0045] In some embodiments, the influencing factors corresponding to the consultation type can be pre-configured. For example, when the consultation type is "reasons for low income", the corresponding influencing factors may include playback time, original identity, actual income, etc. Optionally, a database query statement corresponding to each influencing factor can be pre-set, and the electronic device automatically calls the database query statement corresponding to the current influencing factor. The influencing factors can also be added to a preset prompt statement template to generate a prompt statement, and the prompt statement is input into the above-mentioned language model to generate a database query statement.
[0046] As an example, if the influencing factors include the play time, a database query statement for querying the play time of the user in the past 5 days can be generated: select dt, sum (playtime) from video_playtime_tbl where uid = 123 and dt> = date_sub ('2024-8-15', 5) and dt < '2024-8-15' group by uid, dt.
[0047] If the influencing factors include whether the user is an original user, a database query statement for querying whether the user is an original user may be generated: Select is_original from user_info where uid=123.
[0048] If the influencing factors include actual income, a database query statement can be generated to query the user's actual income in the past 5 days: Select sum (income) assume_income from user_income_tbl where uid = 123 and dt > = date_sub ('2024-8-15', 5).
[0049] Step 104: based on the database query statement, query the target database for data corresponding to the influencing factors.
[0050] In some embodiments, a database corresponding to each influencing factor can be pre-set, and the corresponding database can be determined as the target database according to the currently determined influencing factor. Then, the database query statement can be used to query the relevant data from the target database. As an example, if the database query statement shown in the above step 103 is used, the playback time data of the user with id "123" in the past 5 days can be obtained, as well as the data indicating whether the user is an original user and the actual income of the user in the past 5 days.
[0051] Step 105: Generate an answer statement to the inquiry statement based on the data.
[0052] In some embodiments, the queried data may be directly fed back to the user as an answer statement, or the data may be further analyzed based on the queried data, and the analysis results may be fed back to the user as an answer statement.
[0053] Continuing with the above example, the electronic device can calculate the total playback time of the past five days. If the user is determined to be a non-original user, the ratio between the playback volume and the income is obtained, and then the income that the user deserves is calculated based on the ratio. Finally, the calculated income is compared with the actual income to generate an analysis result of whether the low income is reasonable. The above data and analysis results are fed back to the user as a response statement.
[0054] The data query feedback method provided in the embodiment of the present application uses a pre-trained language model to judge the consultation type of the consultation statement, and then determines the influencing factors of the questions raised in the consultation statement based on the consultation type, and generates a database query statement corresponding to the influencing factors. Based on the database query statement, the data corresponding to the influencing factors is queried from the target database, and finally based on the data, the answer statement of the consultation statement is generated. The embodiment of the present application realizes the automatic analysis of the questions consulted by the user using the model without manual participation, improves the efficiency of providing data analysis and replies to the user on the consultation questions, and reduces the cost of data analysis and replies.
[0055] In some optional implementations, such as Figure 2 As shown, step 105 includes:
[0056] Step 1051, determining the attribute information of the inquiry statement.
[0057] The attribute information is information with a fixed meaning related to the consultation statement. As an example, the attribute information may include but is not limited to at least one of the following: the title of the consultation statement, the user identification (UID), the consultation time, and the consultation type.
[0058] Step 1052, based on a preset prompt statement template corresponding to the consultation type, assemble the attribute information and data to obtain an answer prompt statement.
[0059] The prompt statement template may be a pre-configured template for defining the format and content of the prompt statement to be input into the language model. As an example, the prompt statement template is as follows:
[0060] Feedback from user uid = {uid} on {feedbackDate}: {feedbackContent}. The query shows that the user's playback time in the past 5 days is {playtime_datas}, the user {is_original} is original, and the user's actual income in the past 5 days is {sum_income}. Original users earn 0.01 yuan for every 100 playback hours, and non-original users earn 0.01 yuan for every 500 playback hours. Please calculate whether there is a problem with the user feedback.
[0061] The above uid represents the user ID, feedbackDate is the consultation time, feedbackContent is the consultation statement, playtime_datas is the queried play time, is_original is the data for judging the user identity, indicating whether the user is an original user, and sum_income is the total play time.
[0062] Assume that the obtained data and corresponding variables are as follows:
[0063] Query the user's play time in the past five days and store it in the {playtime_datas} variable:
[0064] dt, playtime (seconds)
[0065] 2024-8-15,3000
[0066] 2024-8-14, 4000
[0067] 2024-8-13, 7000
[0068] 2024-8-12,9000
[0069] 2024-8-11, 8000
[0070] The result of querying whether the user's work is original is stored in the {is_original} variable: False (not original).
[0071] The result of querying the user's actual income in the past five days is stored in the {sum_income} variable: 0.1 (yuan).
[0072] After replacing these variables with the above attribute information and query data, the answer prompt statement is as follows:
[0073] User uid=123 gave feedback on 2024-8-15: Why is my income so low? More than 40,000 plays, 0.1 yuan. After checking, the user's play time in the past 5 days was 3,000 on 2024-8-15; 4,000 on 2024-8-14; 7,000 on 2024-8-13; 9,000 on 2024-8-12; 8,000 on 2024-8-11; the user is not original, and the user's actual income in the past 5 days is 0.1 yuan. For every 100 play time of original users, the income is 0.01 yuan, and for every 500 play time of non-original users, the income is 0.01 yuan. Please calculate whether there is a problem with the user feedback.
[0074] Step 1053, input the answer prompt sentence into the language model to obtain the answer sentence of the consultation sentence.
[0075] Specifically, after the answer prompt sentence is input into the language model, the language model can analyze the data included in the answer prompt sentence according to the pre-configured analysis rules to generate the answer sentence.
[0076] As an example, when the ChatGPT-4o model is used as the above language model, the output answer sentence is as follows:
[0077] Based on the feedback and related data of user uid=123, we can verify whether there is a problem with the feedback by calculating the income that the user deserves.
[0078] First, we summarize the user's playback time in the past 5 days:
[0079] -2024-8-15:3000
[0080] -2024-8-14:4000
[0081] -2024-8-13:7000
[0082] -2024-8-12:9000
[0083] -2024-8-11:8000
[0084] The total playback time of users in the past 5 days = 3000+4000+7000+9000+8000=31000.
[0085] According to the given information, non-original users earn 0.01 yuan for every 500 playback hours.
[0086] Therefore, the user's income is calculated as follows:
[0087] -31000 playback time / 500=62.
[0088] -62*0.01 yuan=0.62 yuan.
[0089] Therefore, according to the calculated results, the user's income from 2024-8-11 to 2024-8-15 is 0.62 yuan, while the actual income is 0.1 yuan. It is reasonable for users to report that their income is low, indicating that there is a problem with their income.
[0090] This embodiment sets a prompt statement template, assembles attribute information and query data into the prompt statement template, and uses a language model to analyze the generated answer prompt statement, thereby realizing automated analysis of user consultation-related data and automatically generating answer statements that are fed back to the user, thereby improving the efficiency of user consultation.
[0091] In some optional implementations, such as Figure 3 As shown, step 103 includes:
[0092] Step 1031, generating a descriptive statement including influencing factors according to a preset descriptive statement template corresponding to the consultation type.
[0093] The descriptive sentence template is a pre-configured template for limiting the format and content of the descriptive sentence to be input into the language model. As an example, the descriptive sentence template is as follows:
[0094] When the category is {feedbackType}, the corresponding SQL is generated according to the following description: User uid = {uid} feedback on {feedbackDate}: {feedbackContent}, please query the daily playback time of user uid = {uid} in the past 5 days on {feedbackDate}, query whether user uid = {uid} is the original identity, and determine whether the user's playback time and income match.
[0095] After the attribute information and consulting statements in the above example are brought into the above descriptive statement template, the generated descriptive statement is as follows:
[0096] User uid=123 gave feedback on 2024-8-15: Why is my income so low? I only earned 0.1 cent for more than 40,000 views. Please generate a SQL statement to query the daily playback time and income of user uid=123 in the past five days from 2024-8-15, check whether user uid=123 is the original creator, and determine whether the user's playback time and income match.
[0097] Step 1032: Analyze the descriptive statements using the language model to obtain database query statements corresponding to the influencing factors.
[0098] Specifically, after the descriptive statement is input into the language model, the language model can analyze the descriptive statement according to the pre-configured data query statement generation rule to generate a database query statement.
[0099] As an example, when the consultation type is identified as "reasons for low income", if the reasons affecting income include two factors: playback time and original identity, and if the user does not specify a time interval, the default interval is the last 5 days of the consultation time. Therefore, if the consultation statement hits the "reasons for low income" type, the user's playback time in the last 5 days, whether the user is an original user, and actual income are queried. The database query statements corresponding to the user's playback time in the last 5 days, whether the user is an original user, and actual income can be pre-set or generated according to a preset query statement template.
[0100] This embodiment generates a descriptive statement containing influencing factors, analyzes the descriptive statement by a language model, and generates a database query statement, thereby accurately sorting out the influencing factors related to the consultation statement. The obtained descriptive statement can accurately describe the user's consultation problem, so that the language model can be used to accurately and efficiently generate database query statements, thereby improving the accuracy and efficiency of querying relevant data of user consultation problems.
[0101] In some optional implementations, the above step 1032 may be performed as follows:
[0102] Based on the query statement template pre-configured in the language model, the language model analyzes the descriptive statement to obtain the database query statement corresponding to the influencing factor.
[0103] The query statement template is a pre-configured template for limiting the format and content of the database query statement output by the language model. Generally, before training the language model, the query statement template can be configured, and the language model can generate a database query statement according to the query statement template.
[0104] As an example, the query template is as follows:
[0105] First, query the user's playback time in the past five days, and aggregate and count the daily playback time according to uid (user id) and dt (date).
[0106] The query statement template corresponding to the play time is: select dt, sum (playtime) from video_playtime_tbl where uid = {uid} and dt> = date_sub ({feedbackDate}, 5) and dt < {feedbackDate} group by uid, dt;
[0107] The generated database query statement is: select dt, sum (playtime) from video_playtime_tbl where uid = 123 and dt> = date_sub ('2024-8-15', 5) and dt < '2024-8-15' group by uid, dt.
[0108] Then, check whether the user is an original user.
[0109] The query statement template corresponding to whether the user is the original user is: Select is_original from user_infowhere uid = {uid}.
[0110] The generated database query statement is: Select is_original from user_info where uid=123.
[0111] Finally, query the user’s actual income in the past 5 days.
[0112] The query statement template corresponding to the actual income in the past 5 days is: Select sum(income)assum_incomefrom user_income_tbl where uid={uid}and dt>=date_sub({feedbackDate},5);
[0113] The generated database query statement is: Select sum(income)assum_income from user_income_tbl where uid=123and dt>=date_sub('2024-8-15',5).
[0114] In this embodiment, by setting a query statement template and generating a database query statement according to the template, the format of the query statement generated by the language model can be made to conform to the query rules, thereby improving the accuracy of the generated database query statement.
[0115] In some optional implementations, such as Figure 4 As shown, step 104 includes:
[0116] Step 1041, obtaining a database link address pre-configured for the influencing factors.
[0117] As an example, if the query method for the data corresponding to the influencing factors is SQL, the database link address is:
[0118] "jdbcUrl":"jdbc:mysql: / / test.check.w.dk.db:8888 / conctract","username":"admin","password":"123456".
[0119] Step 1042, connecting to the target database according to the database link address.
[0120] Step 1043, using a database query statement, query the data corresponding to the influencing factor from the target database.
[0121] Optionally, a query service may be set in the electronic device executing the method. When the language model outputs a database query statement, the database query statement may be sent to the query service, which then connects to the target database to perform the query operation.
[0122] This embodiment pre-configures the database link address of the data corresponding to the influencing factors, and can quickly connect to the target database through the database link address, thereby improving the efficiency of data query.
[0123] In some optional implementations, such as Figure 5 As shown, step 102 includes:
[0124] Step 1021, adding the consulting statement to the preset input statement template to obtain the statement to be input.
[0125] The input statement template includes a pre-configured consultation type set for limiting the consultation type to be output. For example, the consultation type set may include types such as playback volume, recommendation volume, and reasons for low income.
[0126] The above-mentioned input sentence template is used to limit the format and content of the sentence input into the language model, so as to facilitate the language model to classify the consulting sentence.
[0127] As an example, the input statement template looks like this:
[0128] The content of user feedback is: {feedbackContent}; the category of user feedback is: {feedbackClass}. Please refer to the user feedback category, determine the real category of the question based on the user feedback content, and select the answer from the question category knowledge base.
[0129] Among them, feedbackContent represents the consultation sentence input by the user, feedbackClass represents the problem category selected by the user, and contains a consultation type set.
[0130] After adding the consulting statement to the target, the sentence to be input is as follows:
[0131] The user feedback is: Why is my income so low? More than 40,000 views, only 3 cents; the user feedback category is: revenue sharing. Please refer to the user feedback category and determine the real category of the question based on the user feedback content. The answer is selected from the question classification knowledge base.
[0132] Step 1022: input the sentence to be input into the language model to obtain the consultation type of the consultation sentence.
[0133] Continuing with the above example, after the sentence to be input is input into the language model, the consultation type obtained is "Reasons for low income".
[0134] This embodiment converts the consultation sentence input by the user into a certain format by setting an input sentence template, thereby helping the language model to classify consultation questions according to the sentences to be input that meet the format requirements, thereby improving the accuracy of determining the consultation type.
[0135] Figure 6 A schematic diagram of the structure of a data query feedback device provided in an embodiment of the present application. Specifically comprising:
[0136] The acquisition module 601 is used to acquire the consultation sentence input by the user;
[0137] The judgment module 602 is used to judge the consultation type of the consultation sentence by using the pre-trained language model to obtain the consultation type of the consultation sentence;
[0138] The first generating module 603 is used to determine the influencing factors of the questions raised in the consulting statement based on the consulting type, and generate a database query statement corresponding to the influencing factors;
[0139] A query module 604 is used to query data corresponding to the influencing factors from a target database based on a database query statement;
[0140] The second generating module 605 is used to generate a reply statement to the inquiry statement based on the data.
[0141] In some optional implementations, the second generation module includes: a determination unit, used to determine the attribute information of the consultation statement; an assembly unit, used to assemble the attribute information and data based on a preset prompt sentence template corresponding to the consultation type to obtain an answer prompt sentence; and a generation unit, used to input the answer prompt sentence into a language model to obtain an answer sentence of the consultation statement.
[0142] In some optional implementations, the first generation module includes: a first generation unit, used to generate a descriptive statement containing influencing factors according to a preset descriptive statement template corresponding to the consultation type; a second generation unit, used to use a language model to analyze the descriptive statement to obtain a database query statement corresponding to the influencing factors.
[0143] In some optional implementations, the second generating unit is further used to: based on a query statement template pre-configured in the language model, analyze the descriptive statement by the language model to obtain a database query statement corresponding to the influencing factor.
[0144] In some optional implementations, the query module includes: an acquisition unit, used to obtain a database link address pre-configured for the influencing factor; a connection unit, used to connect to the target database according to the database link address; and a query unit, used to query the data corresponding to the influencing factor from the target database using a database query statement.
[0145] In some optional implementations, the judgment module includes: a third generation unit, used to add the consultation statement to a preset input statement template to obtain a statement to be input, wherein the input statement template includes a pre-configured consultation type set for limiting the consultation type to be output; a fourth generation unit, used to input the statement to be input into a language model to obtain the consultation type of the consultation statement.
[0146] The data query feedback device provided in this embodiment can be as follows Figure 6 The data query feedback device shown in can execute all the steps of the above data query feedback methods, thereby achieving the technical effects of the above data query feedback methods. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.
[0147] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 7The electronic device 700 shown includes: at least one processor 701, a memory 702, at least one network interface 704 and other user interfaces 703. The various components in the electronic device 700 are coupled together via a bus system 705. It is understood that the bus system 705 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 705 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 705 is not described in detail. Figure 7 Various buses are labeled as bus system 705.
[0148] The user interface 703 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).
[0149] It can be understood that the memory 702 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 702 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0150] In some implementations, the memory 702 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 7021 and an application 7022 .
[0151] The operating system 7021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 7022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present application can be included in the application 7022.
[0152] In this embodiment, by calling the program or instruction stored in the memory 702, specifically, the program or instruction stored in the application 7022, the processor 701 is used to execute the method steps provided by each method embodiment, for example, including:
[0153] Obtain the consultation sentence input by the user; use the pre-trained language model to judge the consultation type of the consultation sentence to obtain the consultation type of the consultation sentence; based on the consultation type, determine the influencing factors of the question raised in the consultation sentence, and generate a database query statement corresponding to the influencing factors; based on the database query statement, query the data corresponding to the influencing factors from the target database; based on the data, generate an answer statement for the consultation sentence.
[0154] The method disclosed in the above embodiment of the present application can be applied to the processor 701, or implemented by the processor 701. The processor 701 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 701 or the instruction in the form of software. The above processor 701 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 702, and the processor 701 reads the information in the memory 702 and completes the steps of the above method in combination with its hardware.
[0155] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the above functions of the present application, or a combination thereof.
[0156] For software implementation, the technology described above in this article can be implemented by a unit that performs the functions described above in this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0157] The electronic device provided in this embodiment may be Figure 7 The electronic device shown in can execute all the steps of the above-mentioned data query feedback methods, thereby achieving the technical effects of the above-mentioned data query feedback methods. Please refer to the above-mentioned relevant description for details. For the sake of concise description, it will not be repeated here.
[0158] The embodiment of the present application also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.
[0159] When one or more programs in the storage medium can be executed by one or more processors, the data query feedback method executed on the electronic device side can be implemented.
[0160] The processor is used to execute the program stored in the memory to implement the following steps of the data query feedback method performed on the electronic device side:
[0161] Obtain the consultation sentence input by the user; use the pre-trained language model to judge the consultation type of the consultation sentence to obtain the consultation type of the consultation sentence; based on the consultation type, determine the influencing factors of the question raised in the consultation sentence, and generate a database query statement corresponding to the influencing factors; based on the database query statement, query the data corresponding to the influencing factors from the target database; based on the data, generate an answer statement for the consultation sentence.
[0162] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different circuits to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0163] The steps of the circuits or algorithms described in conjunction with the embodiments disclosed herein may be implemented using hardware, software modules executed by a processor, or a combination of the two. The software modules may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0164] It should be understood that the terms used in the text are only for the purpose of describing specific example embodiments, and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The steps, processes, and operations described in the text are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0165] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A data query feedback method, characterized in that: The method comprises: Get the consultation statement entered by the user; Using a pre-trained language model, determining the consultation type of the consultation sentence to obtain the consultation type of the consultation sentence; Based on the consultation type, determining the influencing factors of the question raised in the consultation statement, and generating a database query statement corresponding to the influencing factors; Based on the database query statement, query the target database for data corresponding to the influencing factor; Based on the data, a reply sentence to the inquiry sentence is generated.
2. The method according to claim 1, characterized in that: The step of generating a response statement to the inquiry statement based on the data includes: Determining attribute information of the inquiry statement; Based on a preset prompt statement template corresponding to the consultation type, assembling the attribute information and the data to obtain an answer prompt statement; The answer prompt sentence is input into the language model to obtain an answer sentence of the consultation sentence.
3. The method according to claim 1, characterized in that The step of generating a database query statement corresponding to the influencing factor includes: Generate a descriptive statement containing the influencing factors according to a preset descriptive statement template corresponding to the consultation type; The descriptive statement is analyzed by using the language model to obtain a database query statement corresponding to the influencing factor.
4. The method according to claim 3, characterized in that: The using of the language model to analyze the descriptive statement to obtain a database query statement corresponding to the influencing factor includes: Based on the query statement template pre-configured in the language model, the language model analyzes the descriptive statement to obtain a database query statement corresponding to the influencing factor.
5. The method according to claim 1, characterized in that The querying of the data corresponding to the influencing factor from the target database based on the database query statement includes: Obtaining a database link address pre-configured for the influencing factor; Connect to the target database according to the database link address; The database query statement is used to query the target database for data corresponding to the influencing factor.
6. The method according to claim 1, characterized in that The using of the pre-trained language model to determine the consultation type of the consultation statement to obtain the consultation type of the consultation statement includes: Adding the consultation statement to a preset input statement template to obtain a statement to be input, wherein the input statement template includes a pre-configured consultation type set for limiting the consultation type to be output; The sentence to be input is input into the language model to obtain the consultation type of the consultation sentence.
7. A data query feedback device, characterized in that: The device comprises: An acquisition module is used to acquire the consultation sentence input by the user; A judgment module, used to use a pre-trained language model to judge the consultation type of the consultation sentence to obtain the consultation type of the consultation sentence; A first generating module, for determining, based on the consultation type, influencing factors of the questions raised in the consultation statement, and generating a database query statement corresponding to the influencing factors; A query module, used for querying data corresponding to the influencing factors from a target database based on the database query statement; The second generating module is used to generate a reply statement of the consultation statement based on the data.
8. The device according to claim 7, characterized in that The second generation module comprises: A determination unit, configured to determine attribute information of the consultation statement; An assembling unit, configured to assemble the attribute information and the data based on a preset prompt statement template corresponding to the consultation type to obtain an answer prompt statement; A generating unit is used to input the answer prompt sentence into the language model to obtain an answer sentence of the consultation sentence.
9. An electronic device, characterized in that: include: Memory for storing computer programs; The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the data query feedback method described in any one of claims 1 to 6 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data query feedback method described in any one of claims 1 to 6 is implemented.