Database retrieval method, device, electronic device and medium
By extracting and correcting key elements in database retrieval, the search accuracy and efficiency problems caused by relying on basic large models in the prior art are solved, and more efficient and accurate database retrieval is achieved.
Patent Information
- Application Number
- CN202411375703.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-09-30
AI Technical Summary
Existing database search methods rely on basic large models to create clarification problems, resulting in low retrieval accuracy and reduced efficiency.
By entering the target instruction and the corresponding guide to different types of feature extraction models, the first type of element that needs to be supplemented and the second type of element that needs to be clarified intent respectively are extracted, and candidate clarification options are generated based on these elements and the target instruction is corrected.
Reduce dependence on basic large models, improve the accuracy and efficiency of database retrieval, and avoid the need to interact with users multiple times.
Smart Images

Figure CN118885646B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data retrieval, and in particular to a database retrieval method, device, electronic device and medium. Background Art
[0002] In the database search process, the target instruction for database search needs to be input into the target database to perform database search. For example, in a business intelligence (BI) database, a business statistics instruction is input into the business intelligence database to obtain statistical business results.
[0003] Since the instructions input by users may be unclear and have ambiguous business domain knowledge, this will affect the accuracy of database queries. In the prior art, when the system cannot fully understand the target instruction, it generally generates some clarifying questions through the basic large model and interacts with the user to determine the exact intention of the target instruction. This method is highly dependent on the ability of the basic large model to understand instructions and generate clarifying questions, resulting in low retrieval accuracy. In addition, interacting with users takes a lot of time, which reduces the efficiency of database retrieval. Summary of the invention
[0004] The embodiments of the present disclosure provide a database retrieval method, device, electronic device and medium, which can reduce the dependence on the basic large model and improve the accuracy and efficiency of database retrieval.
[0005] According to one aspect of the present disclosure, there is provided a database retrieval method, comprising:
[0006] Acquire a target database and a target instruction for searching the target database;
[0007] Inputting the target instruction and the first guide language corresponding to the target instruction into a first type element extraction model to obtain extracted first type elements, wherein the first type elements are elements that need to be supplemented in the target instruction;
[0008] Inputting the target instruction and the second guide language corresponding to the target instruction into a second type element extraction model to obtain extracted second type elements, wherein the second type elements are elements in the target instruction that need to be clarified;
[0009] Based on the second type of elements and the target database, determining a plurality of candidate clarification options corresponding to the second type of elements;
[0010] Based on the element supplementary information for the first type of element and the selection command for the plurality of candidate clarification options, the target instruction is modified to obtain a modified instruction, and a search is performed in the target database based on the modified instruction.
[0011] According to one aspect of the present disclosure, there is provided a database retrieval device, comprising:
[0012] an acquisition unit, used for acquiring a target database and a target instruction for searching the target database;
[0013] A first input unit is used to input the target instruction and a first guide word corresponding to the target instruction into a first type element extraction model to obtain extracted first type elements, wherein the first type elements are elements that need to be supplemented in the target instruction;
[0014] A second input unit is used to input the target instruction and a second guide word corresponding to the target instruction into a second type element extraction model to obtain extracted second type elements, wherein the second type elements are elements in the target instruction that need to be clarified;
[0015] A first determining unit, configured to determine, based on the second type of elements and the target database, a plurality of candidate clarification options corresponding to the second type of elements;
[0016] The modifying unit is configured to modify the target instruction based on the element supplementary information for the first type of element and the selection command for the plurality of candidate clarification options to obtain a modified instruction, and perform a search in the target database based on the modified instruction.
[0017] Optionally, the database retrieval device further includes a correlation analysis unit, and the correlation analysis unit is specifically used to:
[0018] Based on the target instruction, searching the target database to obtain a preliminary database inspection result;
[0019] Inputting the target instruction, the database initial inspection result, and a third guide word corresponding to the target instruction and the database initial inspection result into a data analysis correlation prediction model to obtain a predicted data analysis correlation result;
[0020] If the data analysis dependency result indicates that the target instruction is not relevant to data analysis, retrieval based on the target instruction is stopped.
[0021] Optionally, the correlation analysis unit is specifically used for:
[0022] Get keyword recognition rules;
[0023] Based on the keyword recognition rule, recognize keywords from the target instruction;
[0024] The keywords are input into the target database, and the target search algorithm is used to obtain the initial search result of the database.
[0025] Optionally, the correlation analysis unit is specifically used for:
[0026] Determining the word frequency of the candidate data segment relative to the keyword based on the number of times the keyword appears in each candidate data segment in the target database;
[0027] determining an inverse document frequency of the candidate data segment relative to the keyword based on the number of candidate data segments in the target database that contain the keyword;
[0028] Based on the word frequency and the inverse document frequency, a target data segment is determined from each candidate data segment in the target database as the database initial inspection result.
[0029] Optionally, the correlation analysis unit is specifically used for:
[0030] obtaining a first hypothesis condition for data analysis correlation;
[0031] Based on the first assumption condition, generating a first clause, the first clause being used to indicate whether the target instruction is related to data analysis based on the first assumption condition;
[0032] generating a first branch processing clause and a second branch processing clause, wherein the first branch processing clause indicates processing when the target instruction is related to data analysis, and the second branch processing clause indicates processing when the target instruction is not related to data analysis;
[0033] The third introduction is generated based on the first clause, the first branch processing clause, and the second branch processing clause.
[0034] Optionally, the first input unit is specifically used for:
[0035] Obtaining a first definition and a first example of each first type element;
[0036] Based on the first definition and the first example, generate a second clause, where the second clause is used to indicate whether the target instruction contains the first type of element based on the first definition and the first example;
[0037] generating a third branch processing clause and a fourth branch processing clause, wherein the third branch processing clause indicates display content when the target instruction includes the first type of element, and the fourth branch processing clause indicates display content when the target instruction does not include the first type of element;
[0038] The first introduction is generated based on the second clause, the third branch processing clause and the fourth branch processing clause.
[0039] Optionally, the first input unit is specifically used for:
[0040] Acquire a first analysis process, a first mark, and a first text description, wherein the first analysis process is an analysis process in which the target instruction includes the first type of element, the first mark indicates that the target instruction includes the first type of element, and the first text description is a text description in which the target instruction includes the first type of element;
[0041] Generate the third branch processing clause based on the first analysis process, the first tag, and the first text description;
[0042] Acquire a second analysis process, a second mark, and a second text description, wherein the second analysis process is an analysis process in which the target instruction does not include the first type of element, the second mark indicates that the target instruction does not include the first type of element, and the second text indicates the first type of element missing from the target instruction;
[0043] The fourth branch processing clause is generated based on the second analysis process, the second tag, and the second text description.
[0044] Optionally, the second input unit is specifically used for:
[0045] Obtain a second definition and a second example of each second type element;
[0046] Based on the second definition and the second example, generate a third clause, the third clause being used to instruct to extract the second type element from the target instruction based on the second definition and the second example;
[0047] generating a fourth clause based on the extraction principle for extracting the second type of elements;
[0048] The second introduction is generated based on the third clause and the fourth clause.
[0049] Optionally, the target database includes a business knowledge sub-base, and the business knowledge sub-base includes multiple knowledge items;
[0050] The first determining unit is specifically configured to:
[0051] For each of the second-type elements, searching the plurality of knowledge items for a first matching knowledge item that matches the second-type element;
[0052] If the retrieved first matching knowledge items are multiple, adding the multiple first matching knowledge items to the word segmentation expansion dictionary;
[0053] Referring to the segmentation expansion dictionary, segmenting the second type of elements to obtain segmented elements;
[0054] A plurality of candidate clarification options corresponding to the post-segmentation elements are determined.
[0055] Optionally, the business knowledge sub-base further includes a plurality of knowledge sub-items corresponding to the knowledge item;
[0056] The first determining unit is specifically configured to:
[0057] Based on the post-segmentation elements, searching the business knowledge sub-base;
[0058] If a second matching knowledge item matching the segmented element is obtained by searching the business knowledge sub-base, and in the business knowledge sub-base, the second matching knowledge item corresponds to a plurality of second knowledge sub-items, then the plurality of candidate clarification options are generated based on the plurality of second knowledge sub-items.
[0059] Optionally, the first determining unit is specifically configured to:
[0060] Determine to retrieve the business knowledge sub-base to obtain a second matching knowledge item that matches the post-segmentation element, and in the business knowledge sub-base, the second matching knowledge item corresponds to a plurality of second knowledge sub-items;
[0061] Inputting the post-segmentation element and the fifth guide word corresponding to the post-segmentation element into a knowledge sub-item prediction model to obtain at least one predicted supplementary knowledge sub-item corresponding to the post-segmentation element;
[0062] The plurality of candidate clarification options are generated based on the plurality of second knowledge sub-items and the at least one supplemental knowledge sub-item.
[0063] Optionally, the first determining unit is specifically configured to:
[0064] If no second matching knowledge item matching the post-segmentation element is obtained by searching the business knowledge sub-base, the post-segmentation element and a fourth guide word corresponding to the post-segmentation element are input into a common sense element recognition model;
[0065] If the common sense element recognition model recognizes that the post-segmentation element is not a common sense element, a supplement request is generated, where the supplement request is used to request supplementation of the post-segmentation element.
[0066] Optionally, the first determining unit is specifically configured to:
[0067] Based on the definition of the common sense element, generating a fifth clause, the fifth clause being used to indicate whether the post-participle element is the common sense element based on the definition of the common sense element;
[0068] Based on the recognition rules of the common sense elements, generating recognition rule clauses;
[0069] The fourth guide is generated based on the fifth clause and the recognition rule clause.
[0070] Optionally, the correction unit is specifically used for:
[0071] receiving the element supplementary information for the first type of element input by a target user and the selection command for selecting a target clarification option from among the plurality of candidate clarification options;
[0072] Supplementing the first type of elements in the target instruction based on the element supplement information;
[0073] Based on the target clarification option, the second type element in the target instruction is modified, and the target instruction after the first type element is supplemented and the second type element is modified is used as the modified instruction.
[0074] Optionally, the correction unit is specifically used for:
[0075] Acquire a first type and first context information of the target instruction;
[0076] Acquire a historical instruction set of a target user, where the target user is a user who issues the target instruction;
[0077] For each historical instruction in the historical instruction set, obtaining a second type and a second context information of the historical instruction;
[0078] If the second type of a historical instruction in the historical instruction set matches the first type, and the second context information of the historical instruction matches the first context information, obtaining a first historical type element and a second historical type element in the historical instruction;
[0079] generating the element supplementary information based on the first history type element, and generating the selection command based on the second history type element;
[0080] Based on the element supplementary information and the selection command, the target instruction is modified to obtain the modified instruction.
[0081] According to one aspect of the present disclosure, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned database retrieval method when executing the computer program.
[0082] According to one aspect of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the database retrieval method described above is implemented.
[0083] According to one aspect of the present disclosure, a computer program product is provided. The computer program product includes a computer program. The computer program is read and executed by a processor of a computer device, so that the computer device executes the database retrieval method as described above.
[0084] The disclosed embodiment does not rely on the basic large model to generate clarification problems. On the contrary, the disclosed embodiment notes that the situation where the target instruction is unclear or ambiguous, resulting in inaccurate database retrieval, is generally caused by the lack or ambiguity of certain types of elements in the target instruction. The disclosed embodiment divides these elements into first-type elements and second-type elements. The first-type element is the element that needs to be supplemented in the target instruction. The second-type element is the element that is ambiguous in the target instruction and needs to be clarified. The target instruction and the first guide corresponding to the target instruction are input into the first-type element extraction model to obtain the extracted first-type element. The target instruction and the second guide corresponding to the target instruction are input into the second-type element extraction model to obtain the extracted second-type element. For the first-type element, a prompt is given to supplement. For the second-type element, multiple candidate clarification options are determined, and corrections are made based on the selection of the candidate clarification options. After the target instruction is supplemented and corrected, it becomes a clear and unambiguous revised instruction, which can be retrieved in the target database based on the revised instruction. The whole process does not require the basic large model to generate clarification problems, but adopts different rules or models according to the first-type element and the second-type element, reducing the dependence on the basic large model and improving the accuracy of retrieval. At the same time, the entire process does not require multiple interactions with the user, which improves retrieval efficiency.
[0085] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] The accompanying drawings are used to provide further understanding of the technical solution of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the technical solution of the present disclosure and do not constitute a limitation on the technical solution of the present disclosure.
[0087] Figure 1 is a system architecture diagram of a system to which the database retrieval method according to an embodiment of the present disclosure is applied;
[0088] Figure 2 is a schematic diagram of applying the database retrieval method according to an embodiment of the present disclosure to business intelligence analysis software;
[0089] Figure 3 is a main flow chart of a database retrieval method according to an embodiment of the present disclosure;
[0090] Figure 4 is a schematic diagram of extracting first type elements and extracting second type elements according to an embodiment of the present disclosure;
[0091] Figure 5A is a schematic diagram of obtaining element supplementary information of a first type element according to an embodiment of the present disclosure;
[0092] Figure 5B is a schematic diagram of correcting a target instruction based on element supplementary information to obtain a corrected instruction according to an embodiment of the present disclosure;
[0093] Fig. 6A is a schematic diagram of multiple candidate clarification options corresponding to the second type element of the database search method according to an embodiment of the present disclosure;
[0094] Figure 6B is a schematic diagram of obtaining a corrected instruction by correcting a target instruction based on a selection command of a plurality of candidate clarification options according to an embodiment of the present disclosure;
[0095] Figure 7 is a flow chart of determining whether a target instruction is related to data analysis according to an embodiment of the present disclosure;
[0096] Figure 8 It is a flowchart of retrieving a target database based on a target instruction and obtaining a preliminary database inspection result according to an embodiment of the present disclosure;
[0097] Fig. 9 is a schematic diagram of identifying keywords from a target instruction according to an embodiment of the present disclosure;
[0098] Fig.10 It is a flowchart of inputting keywords into a target database and obtaining a preliminary database search result using a target search algorithm according to an embodiment of the present disclosure;
[0099] Fig.11 is a schematic diagram of determining a preliminary check result of a database according to an embodiment of the present disclosure;
[0100] Fig.12is a flow chart of generating a third introductory phrase according to an embodiment of the present disclosure;
[0101] Fig.13 is a schematic diagram of generating a third introductory phrase according to an embodiment of the present disclosure;
[0102] Fig.14 is a schematic diagram of generating a third introductory phrase according to another embodiment of the present disclosure;
[0103] Fig.15 is a flow chart of generating a first guide word according to an embodiment of the present disclosure;
[0104] Fig.16 is a schematic diagram of generating a first guide word according to an embodiment of the present disclosure;
[0105] Fig.17 is a flowchart of generating a third branch processing clause and a fourth branch processing clause according to an embodiment of the present disclosure;
[0106] Fig.18 is a schematic diagram of generating a third branch processing clause according to an embodiment of the present disclosure;
[0107] Fig.19 is a schematic diagram of generating a fourth branch processing clause according to an embodiment of the present disclosure;
[0108] Fig. 20 is a flow chart of generating a second guide word according to an embodiment of the present disclosure;
[0109] Fig.21 is a schematic diagram of generating a second guide word according to an embodiment of the present disclosure;
[0110] Fig. 22 is a flowchart of determining a plurality of candidate clarification options corresponding to a second type element based on a second type element and a target database according to an embodiment of the present disclosure;
[0111] Fig.23 is a schematic diagram of a business knowledge sub-base according to an embodiment of the present disclosure;
[0112] Fig.24 It is a schematic diagram of performing word segmentation on the second type element to obtain the segmented elements according to an embodiment of the present disclosure;
[0113] Fig.25 is a flowchart of determining multiple candidate clarification options corresponding to post-segmentation elements according to an embodiment of the present disclosure;
[0114] Fig.26 is a schematic diagram showing that the knowledge sub-base according to an embodiment of the present disclosure further includes a plurality of knowledge sub-items corresponding to the knowledge item;
[0115] Fig. 27 is a schematic diagram of retrieving a business knowledge sub-base based on post-word segmentation elements according to an embodiment of the present disclosure;
[0116] Fig.28 is a schematic diagram of generating multiple candidate clarification options based on multiple second knowledge sub-items according to an embodiment of the present disclosure;
[0117] Fig.29 is a flowchart of generating a plurality of candidate clarification options based on a plurality of second knowledge sub-items and at least one supplementary knowledge sub-item according to an embodiment of the present disclosure;
[0118] Fig.30 A schematic diagram of inputting a post-segmentation element and a fifth guide word corresponding to the post-segmentation element into a knowledge sub-item prediction model to obtain at least one predicted supplementary knowledge sub-item corresponding to the post-segmentation element according to an embodiment of the present disclosure;
[0119] Fig.31 is a flow chart of generating a supplemental request according to an embodiment of the present disclosure;
[0120] Fig.32A is a schematic diagram of generating a supplemental request according to an embodiment of the present disclosure;
[0121] Fig.32B is a schematic diagram of obtaining post-segmentation elements according to an embodiment of the present disclosure;
[0122] Fig.33 is a flow chart of generating a fourth introductory phrase according to an embodiment of the present disclosure;
[0123] Fig.34 is a schematic diagram of generating a fourth introductory phrase according to an embodiment of the present disclosure;
[0124] Fig.35 A flowchart of modifying the second type of elements in a target instruction based on a target clarification option according to an embodiment of the present disclosure, and using the target instruction after supplementing the first type of elements and modifying the second type of elements as a modified instruction;
[0125] Fig.36 It is a flowchart of modifying a target instruction based on element supplementary information and a selection command to obtain a modified instruction according to an embodiment of the present disclosure;
[0126] Fig.37 It is a schematic diagram of correcting a target instruction based on element supplementary information and a selection command to obtain a corrected instruction according to an embodiment of the present disclosure;
[0127] Fig.38 is a module block diagram of a database retrieval device according to an embodiment of the present disclosure;
[0128] Fig.39 is a structural diagram of a terminal for executing a database retrieval method according to an embodiment of the present disclosure;
[0129] Fig.40 It is a structural diagram of a server for executing a database retrieval method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0130] In order to make the purpose, technical solution and advantages of the present disclosure more clear, the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.
[0131] Before further describing the embodiments of the present disclosure in detail, the nouns and terms involved in the embodiments of the present disclosure are described. The nouns and terms involved in the embodiments of the present disclosure are subject to the following interpretations:
[0132] Business Intelligence (BI): Business intelligence is a set of solutions that use modern data warehouse technology, online analytical processing technology, data mining and data presentation technology to analyze data to achieve business value. Its core purpose is to transform the existing data in the enterprise into knowledge and help the enterprise make wise business decisions.
[0133] Large Language Model (LLM), also known as Large Language Model, is an artificial intelligence model designed to understand and generate human language. They are trained on large amounts of text data and can perform a wide range of tasks, including text summarization, translation, sentiment analysis, and more. LLMs are characterized by their large size and contain billions of parameters, which help them learn complex patterns in language data. These models are usually based on deep learning architectures such as Transformers, which helps them achieve impressive performance on various NLP tasks.
[0134] Intent clarification: Intent clarification is a technology used in intelligent dialogue systems to optimize user experience and improve robot response capabilities. Its main purpose is to identify the user's vague or unclear queries, ask targeted questions to further understand the user's real needs, and adjust the recommended questions in the knowledge base accordingly, thereby improving the accuracy and efficiency of the robot's response.
[0135] In the database search process, the target instruction for database search needs to be input into the target database to perform database search. For example, in a business intelligence database, a business statistics instruction is input into the business intelligence database to obtain statistical business results.
[0136] Since the instructions input by users may be unclear and have ambiguous business domain knowledge, this will affect the accuracy of database queries. In the prior art, when the system cannot fully understand the target instruction, it generally generates some clarifying questions through the basic large model and interacts with the user to determine the exact intention of the target instruction. This method is highly dependent on the ability of the basic large model to understand instructions and generate clarifying questions, resulting in low retrieval accuracy. In addition, interacting with users takes a lot of time, which reduces the efficiency of database retrieval.
[0137] Based on this, the embodiments of the present disclosure provide a database search method, device, electronic device and medium. The embodiments of the present disclosure provide a database search method, which does not require the basic large model to generate clarification questions in the process of determining the revised instructions, but adopts different rules or models according to the first type of elements and the second type of elements, thereby reducing the dependence on the basic large model and improving the accuracy of the search. At the same time, in the process of determining the revised instructions, it is not necessary to interact with the user multiple times, thereby improving the search efficiency.
[0138] System architecture and scenario description of the application of the embodiments of the present disclosure
[0139] Figure 1 1 is a system architecture diagram used by the database retrieval method according to an embodiment of the present disclosure, which includes a terminal 140, the Internet 130, a gateway 120, a server 110, and the like.
[0140] The terminal 140 includes various forms such as desktop computers, laptop computers, PDAs (personal digital assistants), mobile phones, vehicle-mounted terminals, home theater terminals, and dedicated terminals. In addition, it can be a single device or a collection of multiple devices. The terminal 140 can communicate with the Internet 130 in a wired or wireless manner to exchange data.
[0141] The server 110 refers to a computer system that can provide certain services to the terminal 140. Compared with the ordinary terminal 140, the server 110 has higher requirements in terms of stability, security, performance, etc. The server 110 can be a high-performance computer in a network platform, a cluster of multiple high-performance computers, a part of a high-performance computer (such as a virtual machine), a combination of parts of multiple high-performance computers (such as virtual machines), etc.
[0142] The gateway 120 is also called an internetwork connector or a protocol converter. The gateway realizes network interconnection at the transport layer and is a computer system or device that acts as a converter. The gateway is a translator between two systems that use different communication protocols, data formats or languages, or even completely different architectures. At the same time, the gateway can also provide filtering and security functions. The message sent by the terminal 140 to the server 110 must be sent to the corresponding server 110 through the gateway 120. The message sent by the server 110 to the terminal 140 must also be sent to the corresponding terminal 140 through the gateway 120.
[0143] The database retrieval method of the embodiment of the present disclosure can be completely implemented in the terminal 140. Exemplarily, when the terminal 140 is installed with business intelligence analysis software or online analysis processing software, the target user can type in questions or chart requirements on the terminal 140, and the business intelligence analysis software or online analysis processing software installed in the terminal 140 will search the database in response to the questions typed by the target user and visualize the corresponding data.
[0144] The embodiments of the present disclosure can be applied in various scenarios, such as business intelligence analysis software, online analysis and processing, etc. Figure 2 , Figure 2 This is a schematic diagram of the application of the database retrieval method according to an embodiment of the present disclosure in business intelligence analysis software. When using the business intelligence analysis software, the target user can type questions or chart requirements in the input box at the bottom of the interface. The question typed by the target user may be "What is the sales distribution of each product category of Company B in 2023?". After receiving the question entered by the user, the BI (business intelligence) assistant will generate a structured query statement based on the statement entered by the user, and extract data from the database of the business intelligence analysis software based on the structured query statement, and analyze and visualize the data. Among them, the structured query statement is a standard language for managing and operating relational databases, and the structured query statement can facilitate the business intelligence analysis software to extract data from the database. Figure 2 It can be seen that the structured query statement generated by BI Assistant based on "What is the sales distribution of each product category of Company B in 2023?" is "Query the sales distribution of each product category of Company B in 2023, group and aggregate by product category.". Figure 2The pie chart is a visualization of the distribution of sales limits for each product category of Company B generated based on the structured query statement. From the pie chart, we can see that in 2023, the sales of personal care and beauty products of Company B will be 37.21 million yuan, accounting for 4.96% of the total sales limit; the sales of wine and beverage products will be 111.4 million yuan, accounting for 14.85% of the total sales limit; the sales limit of imported food products will be 279.5 million yuan, accounting for 37.24% of the total sales limit; the sales of grain, oil and seasoning products will be 16.32 million yuan, accounting for 2.17% of the total sales limit; the sales of daily cleaning products will be 31.75 million yuan, accounting for 4.23% of the total sales limit; the sales of snack food products will be 104.2 million yuan, accounting for 13.88% of the total sales limit; the sales of dairy products will be 170.1 million yuan, accounting for 22.67% of the total sales limit.
[0145] Furthermore, Figure 2 The "Product Sales Data A" above refers to the database that the target user can currently access. In the current interface, the questions typed by the target user are all questions for the "Product Sales Data A" database. In addition, the target user can click Figure 2 Click the arrow on the right of "Commodity Sales Data A" above to switch between different databases to ask questions about different databases. For example, assume that there are multiple databases saved in the business intelligence analysis software, including "Chongqing City A Company Business Data", "Chongqing City B Company Business Data" and "Chongqing City C Company Business Data". Based on this, the target user can ask questions about the business data of company a, company b and company c respectively by switching databases.
[0146] It should be understood that the above content only illustrates some application scenarios of the present disclosure. The business scenarios to which the present disclosure can be applied may include but are not limited to the specific embodiments listed above.
[0147] General description of the disclosed embodiments
[0148] It should be emphasized that the embodiments of the present disclosure can be applied to a variety of application scenarios, such as business intelligence analysis software, online analysis and processing, database management and other scenarios. In the related art, since the instructions input by the user may have problems such as unclear instructions and ambiguous business domain knowledge, this will affect the accuracy of database queries. In the prior art, when the system cannot fully understand the target instruction, it generally generates some clarification questions through the basic large model and interacts with the user to determine the exact intention of the target instruction. This method is highly dependent on the ability of the basic large model to understand instructions and generate clarification questions, resulting in low retrieval accuracy. In addition, it takes a lot of time to interact with the user, which reduces the efficiency of database retrieval.
[0149] Database retrieval refers to the process of searching, screening, and obtaining data records, information, or documents related to the instructions input by the target user in a large-scale database. Database retrieval methods can provide target users with an efficient and fast way to obtain data information.
[0150] The database search method of the embodiment of the present disclosure may be implemented on the terminal 140 to search the database in response to the instruction entered by the target user and to visually display the corresponding data.
[0151] like Figure 3 As shown, according to one embodiment of the present disclosure, the database retrieval method includes:
[0152] Step 310: Acquire a target database and a target instruction for searching the target database;
[0153] Step 320: input the target instruction and the first guide corresponding to the target instruction into a first type element extraction model to obtain extracted first type elements, wherein the first type elements are elements that need to be supplemented in the target instruction;
[0154] Step 330: input the target instruction and the second guide language corresponding to the target instruction into a second type element extraction model to obtain extracted second type elements, wherein the second type elements are elements in the target instruction that need to be clarified;
[0155] Step 340: Determine a plurality of candidate clarification options corresponding to the second type of elements based on the second type of elements and the target database;
[0156] Step 350: based on the element supplementary information for the first type of element and the selection command for the plurality of candidate clarification options, modify the target instruction to obtain a modified instruction, and perform a search in the target database based on the modified instruction.
[0157] The above steps 310 - 350 are briefly described below.
[0158] In step 310, a target database and a target instruction for searching the target database are obtained.
[0159] According to an embodiment of the present disclosure, the target database refers to the database that the current target user wants to query. The target database organizes data through tables and associates data in different tables through join operations. The join operation can be based on common fields between multiple tables and realizes the combination of data through specified connection conditions. When the database retrieval method of the embodiment of the present disclosure is applied to business intelligence analysis software, the target database refers to the database that the target user selects to query among multiple databases of the business intelligence analysis software. The target instruction refers to the question or chart requirement typed by the target user. The target instruction is used to instruct the business intelligence analysis software to search the target database to obtain a response that meets the requirements of the target instruction.
[0160] For example, assume that there are currently multiple databases, including "Company A Business Data", "Company B Business Data" and "Company C Business Data". If the database that the target user currently wants to query is "Company A Business Data", then "Company A Business Data" is the target database. Assume that the target user types in the target instruction "Query the total operating amount of Department K of Company A in 2021". After receiving the target instruction, the business intelligence analysis software will search the database "Company A Business Data" to obtain the total operating amount of Department K of Company A, and visualize the total operating amount of Department K of Company A.
[0161] In step 320, the target instruction and the first guide language corresponding to the target instruction are input into a first type element extraction model to obtain extracted first type elements, wherein the first type elements are elements that need to be supplemented in the target instruction.
[0162] According to the embodiments of the present disclosure, the first type of elements refers to the elements that need to be supplemented in the target instruction, such as subject and time. Among them, subject refers to the focus object of data analysis, which can be a person, an organization, a company, or a device. Time refers to the timestamp or time period in the data set, which can be a specific date or a time period. For example, refer to Figure 2 , assuming that the target instruction is "What is the monthly revenue of Company A in 2023?", in this target instruction, "2023" is the time, and "Company A" is the subject. The first type of element extraction model refers to a large language model used to extract the first type of elements from the target instruction. Compared with the conventional large language model (i.e., the basic large model), the first type of element extraction model of the embodiment of the present disclosure only requires a small amount of pre-training data during pre-training to achieve the purpose of accurately extracting the first type of elements. At the same time, the embodiment of the present disclosure extracts the first type of elements in the target instruction through the first type of element extraction model, reducing the dependence on the basic large model.
[0163] It is understandable that in order to facilitate the first type element extraction model to extract the first type element in the target instruction more quickly, when the target instruction is input into the first type element extraction model, the first guide word is also input into the first type element extraction model. The first guide word is used to guide the first type element extraction model to output the first type element in the target instruction.
[0164] For example, refer to Figure 4 , assuming that the target instruction is "Which university in Changsha, Hunan Province has the highest college entrance examination admission score in 2022". After the target instruction and the first guide corresponding to the target instruction are input into the trained first-type feature extraction model, the first-type feature extraction model will extract and output the subject and time in the target instruction. It can be determined that the subject in the target instruction is "university" and the time is "2022".
[0165] It is understandable that, when the target user inputs a target instruction lacking a subject or time, the first type of elements extracted by the first type of element extraction model will also lack a subject or time. At this time, the target user also needs to supplement the first type of elements missing in the target instruction to complete the target instruction. Figure 5A and Figure 5B , assuming that the target instruction is "Which university in Changsha, Hunan Province has the highest college entrance examination admission score", after the target instruction and the first guide corresponding to the target instruction are input into the trained first type element extraction model, the first type element extraction model only extracts the subject "university" and lacks time. At this time, the business intelligence analysis software will prompt the target user that the "time" field is missing in the target instruction to guide the target user to supplement the missing field in the target instruction.
[0166] In step 330, the target instruction and the second guide language corresponding to the target instruction are input into the second type element extraction model to obtain extracted second type elements, wherein the second type elements are elements in the target instruction that need to be clarified.
[0167] According to the embodiments of the present disclosure, the second type of elements refers to the elements that need to be supplemented in the target instruction, such as the subject, dimension and indicator. Among them, the subject has been described above and will not be repeated here. Dimension refers to the attribute used to classify, segment or describe data. The dimension can be a geographic location, a product category, a field name, etc. Indicator refers to the quantitative measurement in data analysis. The indicator can be sales, click-through rate, or customer satisfaction, etc. For example, refer to Figure 2, assuming that the target instruction is "What is the monthly revenue of Company A in 2023?", in this target instruction, "Company A" is the subject, "each month" is the dimension, and "revenue" is the indicator. The second type of element extraction model refers to a large language model used to extract the second type of elements from the target instruction. Compared with the basic large model, the second type of element extraction model of the embodiment of the present disclosure only requires a small amount of pre-training data during pre-training to achieve the purpose of accurately extracting the second type of elements. At the same time, the embodiment of the present disclosure extracts the second type of elements in the target instruction through the second type of element extraction model, reducing the dependence on the basic large model.
[0168] It can be understood that in order to facilitate the second type element extraction model to extract the second type elements in the target instruction more quickly, while inputting the target instruction into the second type element extraction model, it is also necessary to input the second guide words used to guide the second type element extraction model to output the second type elements into the second type element extraction model to assist the second type element extraction model in extracting the second type elements.
[0169] For example, refer to Figure 4 , assuming that the target instruction is "Which university in Changsha, Hunan Province has the highest college entrance examination admission score in 2022". After the target instruction and the second guide corresponding to the target instruction are input into the trained second-type feature extraction model, the second-type feature extraction model will extract and output the subject, dimension and indicator in the target instruction. It can be determined that the subject in the target instruction is "university", the dimension is "Changsha, Hunan Province", and the indicator is "college entrance examination admission score".
[0170] It can be understood that intent clarification means that a certain word may have multiple meanings or be ambiguous, and it is necessary to guide the target user to clarify his real needs through specific words or questions. The second type of elements includes subject, dimension and indicator. When the target instruction input by the target user is unclear, these three fields are more likely to be ambiguous than time, thus affecting the accuracy of the final generated result. Based on this, after the target instruction and the second guide corresponding to the target instruction are input into the trained second type element extraction model to obtain the second type of elements, the second type of elements need to be clarified. For example, assuming that the target instruction is "Which school in Changsha, Hunan Province has the highest score in 2022", the extracted second type of elements are the subject "school", the dimension "Changsha, Hunan Province" and the indicator "score". It can be determined that the meaning of "school" includes "primary school", "middle school" and "university", etc., and the meaning of "score" includes "graduate admission score", "college entrance examination admission score" and "middle school entrance examination admission score". At this time, the specific meaning of "school" and "score" cannot be determined, and the intention needs to be clarified.
[0171] In step 340 , a plurality of candidate clarification options corresponding to the second type of elements are determined based on the second type of elements and the target database.
[0172] According to an embodiment of the present disclosure, when a second type element has multiple meanings or is ambiguous, the second type element can be searched in the target database to determine the multiple meanings contained in the second type element and the possible ambiguities of the second type element, and multiple candidate clarification options are generated based on the multiple meanings contained in the second type element or the possible ambiguities of the second type element. Among them, the candidate clarification options refer to multiple options generated for intent clarification for a second type element with multiple meanings or ambiguities. The target user can select a candidate clarification option from the multiple candidate clarification options to clarify the specific meaning of the second type element with multiple meanings or ambiguities. In this process, there is no need for the basic large language model to generate clarification questions, nor is there any need to interact with the user multiple times. The target user only needs to select the intended candidate clarification options to clarify the specific meaning of the second type element with multiple meanings or ambiguities, thereby improving the retrieval efficiency.
[0173] For example, refer to Fig. 6A and Figure 6B , assuming that the target instruction is "Which school in Changsha, Hunan Province has the highest admission score in 2022". It is certain that "school" and "admission score" obviously have multiple meanings, but the machine cannot directly determine that "school" and "admission score" have multiple meanings. In order for the machine to determine whether each field in the target instruction is ambiguous or includes multiple meanings, the target instruction must first be input into the second-type element extraction model to extract the second-type elements, which are the subject "school", the dimension "Changsha, Hunan Province" and the indicator "admission score". Then, "school", "Changsha, Hunan Province" and "admission score" are searched in the target database respectively. If a field of the second-type element corresponds to multiple candidate clarification options, then this field is ambiguous or includes multiple meanings. It can be obtained from the target database that the multiple candidate clarification options corresponding to "school" are "university", "middle school" and "primary school", and the multiple candidate clarification options corresponding to "admission score" are "admission score for postgraduate examination", "college entrance examination admission score" and "middle school entrance examination admission score". As shown in the example Fig. 6A As shown, the business intelligence analysis software will display multiple candidate clarification options corresponding to "school" and multiple candidate clarification options corresponding to "admission score", so that the target user can select the candidate clarification options to clarify the intention of "school" and "admission score".
[0174] In step 350 , based on the element supplementary information for the first type element and the selection command for the plurality of candidate clarification options, the target instruction is modified to obtain a modified instruction, and a search is performed in the target database based on the modified instruction.
[0175] According to an embodiment of the present disclosure, element supplementary information refers to the target user's supplementary information for the missing fields in the first type of element. Figure 5B , assuming that the target instruction is "Which university in Changsha, Hunan Province has the highest college entrance examination admission score", the missing field in the first type of element is time, and the time field supplemented by the target user is "2022", and this "2022" is the element supplementary information. The selection command refers to the operation of the target user selecting one of multiple candidate clarification options. The revised instruction refers to an instruction that is accurate and unambiguous after the target instruction is modified based on the element supplementary information of the first type of element and the selection command of multiple candidate clarification options.
[0176] Reference Fig. 6A and Figure 6B , step 350 is explained by taking an example here: assuming that the target instruction is "Which school in Changsha City, Hunan Province has the highest admission score in 2022". Based on the target instruction, the multiple candidate clarification options corresponding to "school" are "university", "middle school" and "primary school", and the multiple candidate clarification options corresponding to "admission score" are "admission score for postgraduate examination", "college entrance examination admission score" and "middle school entrance examination admission score". Assuming that the target user selects "university" and "college entrance examination admission score", the target instruction can be modified by "university" and "college entrance examination admission score" to obtain the modified instruction "Which university in Changsha City, Hunan Province has the highest college entrance examination admission score in 2022".
[0177] For example, suppose the target instruction is "Which department of Company A has the lowest profit". Based on the target instruction, it can be found that the time field is missing in the first type of element. Assuming that the time field supplemented by the target user is "2020", the element supplement information of the first type of element is "2020". On the other hand, the multiple candidate clarification options corresponding to "profit" are "operating profit", "total profit" and "net profit". Assuming that the target user selects "net profit", the target instruction can be corrected by "2020" and "net profit". The corrected instruction is "Which department of Company A has the lowest net profit in 2020".
[0178] It is understandable that after obtaining the revised instructions, a structured query statement can also be generated based on the revised instructions to perform retrieval in the target database through the structured query statement, find data related to the revised instructions, and analyze and calculate the data to generate a visual chart to display to the target user.
[0179] The above-mentioned embodiments of steps 310 to 350 do not rely on the basic large model to generate clarification problems. On the contrary, the disclosed embodiments note that the situation in which the target instruction is unclear or ambiguous, resulting in inaccurate database retrieval, is generally caused by the lack or ambiguity of certain types of elements in the target instruction. The disclosed embodiments divide these elements into first-type elements and second-type elements. The first-type element is the element that needs to be supplemented in the target instruction. The second-type element is the element that is ambiguous in the target instruction and needs to be clarified. The target instruction and the first guide corresponding to the target instruction are input into the first-type element extraction model to obtain the extracted first-type element. The target instruction and the second guide corresponding to the target instruction are input into the second-type element extraction model to obtain the extracted second-type element. For the first-type element, a prompt is given to supplement. For the second-type element, multiple candidate clarification options are determined, and corrections are made based on the selection of the candidate clarification options. After the target instruction is supplemented and corrected, it becomes a clear and unambiguous revised instruction, which can be retrieved in the target database based on the revised instruction. The whole process does not require the basic large model to generate clarification questions, but adopts different rules or models according to the first type of elements and the second type of elements, which reduces the dependence on the basic large model and improves the accuracy of retrieval. At the same time, the whole process does not require multiple interactions with users, which improves the efficiency of retrieval.
[0180] The above is a general description of step 310 to step 350. Since step 310 has been described in sufficient detail above, only the specific implementation process of the steps before step 310 and step 320 to step 350 will be described in detail below.
[0181] Detailed description of whether the target instruction is related to data analysis
[0182] Step 310: Obtain a target database and a target instruction for searching the target database.
[0183] In one embodiment, referring to Figure 7 Before step 310, the database search method further includes:
[0184] Step 710: based on the target instruction, search the target database to obtain the initial database inspection result;
[0185] Step 720: input the target instruction, the database initial inspection result, and the third guide word corresponding to the target instruction and the database initial inspection result into the data analysis correlation prediction model to obtain the predicted data analysis correlation result;
[0186] Step 730: If the data analysis correlation result indicates that the target instruction is not relevant to the data analysis, stop the retrieval based on the target instruction.
[0187] Steps 710 to 730 are described in detail below:
[0188] In step 710, based on the target instruction, the target database is searched to obtain the initial database inspection result.
[0189] It is understandable that the database initial inspection result refers to the result obtained by searching the target database for the first time based on the target instruction. Among them, the database initial inspection result can be a document related to the target instruction, or it can be a field related to the target instruction. For example, assuming that the target instruction is "the distribution of the total operating volume of each department of Company B in 2020", the target database is searched based on the target instruction, and the database initial inspection results obtained include the relevant fields of "Company B", the relevant fields of "total operating volume" and the relevant fields of "department", etc.
[0190] The specific method of "searching the target database based on the target instruction and obtaining the initial database inspection result" will be described in detail below.
[0191] In step 720, the target instruction, the database initial inspection result, and the third guide word corresponding to the target instruction and the database initial inspection result are input into the data analysis correlation prediction model to obtain the predicted data analysis correlation result.
[0192] It is understandable that the database retrieval method of the disclosed embodiment is applied to business intelligence analysis software, which is highly professional and requires the target user to type in a target instruction with a clear purpose. In order to avoid possible risks, it is necessary to standardize the target instructions typed by the target user to intercept some instructions that are not related to data analysis. Based on this, a data analysis relevance prediction model can be used to comprehensively analyze the target instructions and the initial inspection results of the database to obtain data analysis relevance results. Among them, the data analysis relevance result is used to indicate whether the target instruction is related to data analysis, and the data analysis relevance prediction model refers to a large language model used to analyze whether the target instruction is related to data analysis.
[0193] It can be understood that in order to facilitate the data analysis relevance prediction model to determine the data analysis relevance results more quickly, while inputting the target instructions and the initial inspection results of the database into the data analysis relevance prediction model, it is also necessary to input the third guide language used to guide the data analysis relevance prediction model to output the data analysis relevance results into the data analysis relevance prediction model to assist the data analysis relevance prediction model in generating the data analysis relevance results.
[0194] The specific method of generating the third guide word will be described in detail below.
[0195] In step 730 , if the data analysis dependency result indicates that the target instruction is not relevant to the data analysis, the retrieval based on the target instruction is stopped.
[0196] According to an embodiment of the present disclosure, in order to intercept questions that are not related to data analysis and avoid wasting resources in responding to questions that are not related to data analysis, if the data analysis correlation result indicates that the target instruction is not related to data analysis, the retrieval based on the target instruction will be stopped. Similarly, if the data analysis correlation result indicates that the target instruction is related to data analysis, step 310 and steps after step 310 are executed thereafter.
[0197] For example, assuming that the target instruction is "What will the weather be like tomorrow?", after searching the target database based on the target instruction, multiple database preliminary search results related to "What will the weather be like tomorrow" can be obtained. After the target instruction, the database preliminary search results, and the third guide corresponding to the target instruction and the database preliminary search results are input into the data analysis relevance prediction model, the data analysis relevance result output by the data analysis relevance prediction model indicates that the target instruction is irrelevant to the data analysis, and the search based on the target instruction is stopped at this time.
[0198] For example, assuming that the target instruction is "What is the average monthly revenue of Company B in 2018?", after searching the target database based on the target instruction, multiple database preliminary inspection results related to "What is the average monthly revenue of Company B in 2018" can be obtained. After the target instruction, the database preliminary inspection result, and the third guide corresponding to the target instruction and the database preliminary inspection result are input into the data analysis relevance prediction model, the data analysis relevance result output by the data analysis relevance prediction model indicates that the target instruction is related to data analysis, and then step 310 will be executed.
[0199] It is understandable that if the data analysis correlation result indicates that the target instruction involves a sensitive topic, the retrieval based on the target instruction will also be stopped.
[0200] The above-mentioned embodiments of steps 710 to 730 can retrieve the target database based on the target instruction to obtain the database preliminary inspection result related to the target instruction. The target instruction, the database preliminary inspection result, and the third guide corresponding to the target instruction and the database preliminary inspection result are input into the data analysis relevance prediction model to determine whether the target instruction is related to the data analysis. If the target instruction is not related to the data analysis, the search based on the target instruction is stopped, and the questions that are not related to the data analysis are accurately intercepted, avoiding the subsequent waste of computing resources to respond to questions that are not related to the data analysis.
[0201] In one embodiment, referring to Figure 8 , step 710 includes:
[0202] Step 810: Obtain keyword recognition rules;
[0203] Step 820: Identify keywords from the target instruction based on the keyword identification rule;
[0204] Step 830: Input the keywords into the target database and use the target search algorithm to obtain the initial database search results.
[0205] Steps 810 to 830 are described in detail below:
[0206] In step 810, keyword recognition rules are obtained.
[0207] According to an embodiment of the present disclosure, a keyword recognition rule refers to a rule for recognizing and extracting keywords from a target instruction, and the keyword recognition rule can automatically recognize the most representative and important words and phrases from the target instruction.
[0208] Exemplarily, the keyword recognition rule may be: recognize the part of speech of each word in the target instruction, remove function words, interjections, adjectives and other words, and retain only the main words. The keyword recognition rule may also be: determine the importance of each word in the target instruction based on the large language model, remove words with an importance lower than a preset importance threshold, and retain only words with an importance greater than or equal to the preset importance threshold.
[0209] In step 820 , keywords are identified from the target instruction based on keyword identification rules.
[0210] It is understandable that based on the keyword recognition rule, keywords can be quickly identified from the target instruction, so as to facilitate the subsequent determination of the initial database inspection results based on the keywords, thereby judging whether the target instruction is related to the data analysis. Furthermore, the keywords identified from the target instruction will change as the keyword recognition rule changes. If the keyword recognition rule is to retain only the main words, the keywords identified from the target instruction are the main words. If the keyword recognition rule is to retain only the words whose importance is greater than or equal to the preset importance threshold, the keywords identified from the target instruction are the words whose importance is greater than or equal to the importance threshold.
[0211] For example, refer to Fig. 9 , assuming that the current keyword recognition rule is: identify the part of speech of each word in the target instruction, remove function words, pronouns, interjections and adjectives, and only retain the main words. When the target instruction typed by the target user is "Uh, which company in Guangzhou, Guangdong Province has the highest profit in 2022?", after identifying the part of speech of each word in the target instruction, it is found that "uh" and "ne" are both interjections, and "2022", "Guangdong Province", "Guangzhou City", "company", and "profit" are all main words. After removing the function words and retaining only the main words, the keywords obtained are "2022", "Guangdong Province", "Guangzhou City", "company", and "profit".
[0212] In step 830, the keywords are input into the target database, and the target search algorithm is used to obtain the initial database search results.
[0213] According to an embodiment of the present disclosure, there are a large number of texts in the target database. In order to quickly determine the texts related to the keywords in the target database, the target retrieval algorithm can be used to calculate the keywords and the various texts in the target database. Among them, the target retrieval algorithm refers to an algorithm used to evaluate the relevance between each text and the keywords in the target database. Exemplarily, the target retrieval algorithm can be the built-in relevance algorithm BM25 of the search engine Elasticsearch. BM25 is a document similarity evaluation algorithm widely used in the fields of information retrieval and text mining. The target retrieval algorithm can also be a cosine similarity algorithm, an edit distance algorithm, a Jaccard coefficient algorithm, etc.
[0214] The specific method of "inputting keywords into the target database and using the target retrieval algorithm to obtain the initial database search results" will be described in detail below.
[0215] The above-mentioned embodiment of step 810 to step 830 can identify keywords from the target instruction based on the keyword recognition rule, input the keywords into the target database, and determine the database initial inspection result using the target search algorithm. The target search algorithm can quickly and accurately determine each text in the target database that is relevant to the keyword, thereby improving the accuracy of the subsequent data analysis relevance result.
[0216] In one embodiment, referring to Fig.10 , step 830 includes:
[0217] Step 1010: Determine the word frequency of the candidate data segment relative to the keyword based on the number of times the keyword appears in each candidate data segment in the target database;
[0218] Step 1020: determining the inverse document frequency of the candidate data segments relative to the keyword based on the number of candidate data segments containing the keyword in the target database;
[0219] Step 1030: Based on the word frequency and the inverse document frequency, determine the target data segment from the candidate data segments in the target database as the database initial inspection result.
[0220] Steps 1010 to 1030 are described in detail below:
[0221] In step 1010, based on the number of times the keyword appears in each candidate data segment in the target database, the word frequency of the candidate data segment relative to the keyword is determined.
[0222] According to an embodiment of the present disclosure, the candidate data segment can be understood as a vocabulary or a field in the target database. For example, assuming that the target database stores the operation and maintenance data of each workshop of Company A, the candidate data segment in the target database can be the operation and maintenance data of a workshop of Company A. Word frequency refers to the number of times a word appears in a text. Based on the number of times the keyword appears in each candidate data segment in the target database, the word frequency of the candidate data segment relative to the keyword can be determined. The greater the word frequency, the more important the keyword is in this candidate data segment.
[0223] For example, assuming that the target database has candidate data segment A, candidate data segment B, and candidate data segment C, assuming that the word frequency of candidate data segment A relative to keyword 1 is 2 times / 1000 words, the word frequency of candidate data segment B relative to keyword 1 is 4 times / 1000 words, and the word frequency of candidate data segment C relative to keyword 1 is 5 times / 1000 words. It can be determined that the importance of keyword 1 in candidate data segment C>the importance of keyword 1 in candidate data segment B>the importance of keyword 1 in candidate data segment A.
[0224] In step 1020, based on the number of candidate data segments containing the keyword in the target database, the inverse document frequency of the candidate data segments relative to the keyword is determined.
[0225] According to the embodiments of the present disclosure, the inverse document frequency refers to the inverse of the frequency of a keyword appearing in each candidate data segment, and the inverse document frequency can measure the importance of a keyword in the candidate data segment. Determining the inverse document frequency of a candidate data segment relative to the keyword based on the number of candidate data segments containing the keyword in the target database can reduce the weight of high-frequency but meaningless words and improve the relevance of the subsequent database initial inspection results and the keyword. The smaller the inverse document frequency, the more important the keyword is in this candidate data segment.
[0226] For example, assuming that the target database has candidate data segment A, candidate data segment B, and candidate data segment C, assuming that the inverse document frequency of candidate data segment A relative to keyword 1 is 2, the inverse document frequency of candidate data segment B relative to keyword 1 is 4, and the inverse document frequency of candidate data segment C relative to keyword 1 is 5. It can be determined that the importance of keyword 1 in candidate data segment A>the importance of keyword 1 in candidate data segment B>the importance of keyword 1 in candidate data segment C.
[0227] In step 1030, based on the word frequency and the inverse document frequency, a target data segment is determined from each candidate data segment in the target database as a database initial inspection result.
[0228] According to an embodiment of the present disclosure, for a single keyword, the product of the word frequency and the inverse document frequency of the candidate data segment relative to the keyword can be determined as the keyword score. Then, the keyword total score corresponding to each candidate data segment is calculated based on the keyword scores of all keywords. The candidate data segments are sorted in descending order based on the keyword total score, and the candidate data segment ranked at the front is used as the target data segment, that is, the candidate data segment ranked at the front is used as the initial inspection result of the database. Among them, the number of target data segments can be determined according to the number of candidate data segments in actual situations.
[0229] According to an embodiment of the present disclosure, for a certain keyword, different weights can also be assigned to the word frequency and inverse document frequency of the candidate data segment relative to the keyword, and the weighted sum of the word frequency and inverse document frequency is determined as the keyword score. Then, the keyword total score corresponding to each candidate data segment is calculated based on the keyword scores of all keywords. The candidate data segments are sorted in descending order based on the keyword total score, and the candidate data segment ranked first is used as the target data segment, that is, the candidate data segment ranked first is used as the initial inspection result of the database.
[0230] For example, here combined Fig.11Explanation of step 1030: Assuming the target instruction is "Which school in Changsha City, Hunan Province has the highest admission score in 2022", the keywords corresponding to the target instruction are "2022", "Changsha City, Hunan Province", "school" and "admission score" respectively.
[0231] In the case where the target database includes candidate data segment 1, candidate data segment 2, candidate data segment 3, and candidate data segment 4, for the keyword "2022", the word frequency of candidate data segment 1 relative to the keyword is 2 times / 1000 words, and the inverse document frequency of candidate data segment 1 relative to the keyword is 2. The word frequency of candidate data segment 2 relative to the keyword is 3 times / 1000 words, and the inverse document frequency of candidate data segment 2 relative to the keyword is 3. The word frequency of candidate data segment 3 relative to the keyword is 6 times / 1000 words, and the inverse document frequency of candidate data segment 3 relative to the keyword is 1. The word frequency of candidate data segment 4 relative to the keyword is 1 time / 1000 words, and the inverse document frequency of candidate data segment 4 relative to the keyword is 4.
[0232] For the keyword "Changsha, Hunan Province", the word frequency of candidate data segment 1 relative to the keyword is 6 times / 1000 words, and the inverse document frequency of candidate data segment 1 relative to the keyword is 1. The word frequency of candidate data segment 2 relative to the keyword is 7 times / 1000 words, and the inverse document frequency of candidate data segment 2 relative to the keyword is 2. The word frequency of candidate data segment 3 relative to the keyword is 5 times / 1000 words, and the inverse document frequency of candidate data segment 3 relative to the keyword is 3. The word frequency of candidate data segment 4 relative to the keyword is 2 times / 1000 words, and the inverse document frequency of candidate data segment 4 relative to the keyword is 4.
[0233] For the keyword "school", the word frequency of candidate data segment 1 relative to the keyword is 2 times / 1000 words, and the inverse document frequency of candidate data segment 1 relative to the keyword is 2. The word frequency of candidate data segment 2 relative to the keyword is 3 times / 1000 words, and the inverse document frequency of candidate data segment 2 relative to the keyword is 1. The word frequency of candidate data segment 3 relative to the keyword is 8 times / 1000 words, and the inverse document frequency of candidate data segment 3 relative to the keyword is 3. The word frequency of candidate data segment 4 relative to the keyword is 4 times / 1000 words, and the inverse document frequency of candidate data segment 4 relative to the keyword is 4.
[0234] For the keyword "admission score", the word frequency of candidate data segment 1 relative to the keyword is 2 times / 1000 words, and the inverse document frequency of candidate data segment 1 relative to the keyword is 2. The word frequency of candidate data segment 2 relative to the keyword is 4 times / 1000 words, and the inverse document frequency of candidate data segment 2 relative to the keyword is 3. The word frequency of candidate data segment 3 relative to the keyword is 5 times / 1000 words, and the inverse document frequency of candidate data segment 3 relative to the keyword is 2. The word frequency of candidate data segment 4 relative to the keyword is 6 times / 1000 words, and the inverse document frequency of candidate data segment 4 relative to the keyword is 6.
[0235] Assumptions Fig.11 The method for determining the keyword score in is: for a certain keyword, the product of the word frequency and the inverse document frequency of the candidate data segment relative to the keyword is determined as the keyword score. Based on this, it can be calculated that for the keyword "2022", the keyword score of candidate data segment 1 relative to the keyword is 4, the keyword score of candidate data segment 2 relative to the keyword is 9, the keyword score of candidate data segment 3 relative to the keyword is 6, and the keyword score of candidate data segment 4 relative to the keyword is 4. For the keyword "Changsha City, Hunan Province", the keyword score of candidate data segment 1 relative to the keyword is 6, the keyword score of candidate data segment 2 relative to the keyword is 14, the keyword score of candidate data segment 3 relative to the keyword is 15, and the keyword score of candidate data segment 4 relative to the keyword is 8. For the keyword "school", the keyword score of candidate data segment 1 relative to the keyword is 4, the keyword score of candidate data segment 2 relative to the keyword is 3, the keyword score of candidate data segment 3 relative to the keyword is 24, and the keyword score of candidate data segment 4 relative to the keyword is 16. For the keyword "admission score", the keyword score of candidate data segment 1 relative to the keyword is 4, the keyword score of candidate data segment 2 relative to the keyword is 12, the keyword score of candidate data segment 3 relative to the keyword is 10, and the keyword score of candidate data segment 4 relative to the keyword is 36.
[0236] Furthermore, the keyword total score corresponding to each candidate data segment is calculated based on the keyword scores of all keywords, and it can be obtained that the keyword total score corresponding to candidate data segment 1 is 18, the keyword total score corresponding to candidate data segment 2 is 38, the keyword total score corresponding to candidate data segment 3 is 55, and the keyword total score corresponding to candidate data segment 4 is 64. The candidate data segments are sorted in descending order based on the keyword total score, and the order of sorting is candidate data segment 4, candidate data segment 3, candidate data segment 2, and candidate data segment 1. Assuming that the embodiment of the present disclosure uses the top two candidate data segments as the target data segments, the initial inspection results of the database are candidate data segment 4 and candidate data segment 3.
[0237] The embodiment of the above steps 1010 to 1030 determines the word frequency of the candidate data segment relative to the keyword based on the number of times the keyword appears in each candidate data segment in the target database, and determines the inverse document frequency of the candidate data segment relative to the keyword based on the number of candidate data segments containing the keyword in the target database. By evaluating the degree of match between each candidate data segment and the target instruction through word frequency and inverse document frequency, the candidate data segment in the target database that best matches the target instruction can be quickly and accurately determined, thereby determining it as the initial database inspection result, thereby improving the accuracy of the subsequent data analysis correlation results.
[0238] In one embodiment, referring to Fig.12 The third guide word of step 720 is generated in the following manner:
[0239] Step 1210, obtaining a first assumption condition for data analysis correlation;
[0240] Step 1220: Generate a first clause based on the first assumption, where the first clause is used to indicate whether the target instruction is related to data analysis based on the first assumption;
[0241] Step 1230: Generate a first branch processing clause and a second branch processing clause, the first branch processing clause indicating processing when the target instruction is related to data analysis, and the second branch processing clause indicating processing when the target instruction is not related to data analysis;
[0242] Step 1240: Generate a third introductory statement based on the first clause, the first branch processing clause, and the second branch processing clause.
[0243] Steps 1210 to 1240 are described in detail below:
[0244] In step 1210, a first hypothesis for data analysis correlation is obtained.
[0245] It is understandable that, since the data analysis correlation prediction model is trained based on a general base model, the base model does not know what operation to perform on the data at the beginning of training. In order to guide the base model, it is necessary to input a hypothesis condition for guiding the base model to analyze the data correlation of the target instruction, namely, the first hypothesis condition. Fig.13 , the first assumption can be: your task is to serve as a professional problem analysis expert, focusing on the fields of data query and data analysis.
[0246] In step 1220 , based on the first assumption, a first clause is generated, where the first clause is used to indicate whether the target instruction is related to data analysis based on the first assumption.
[0247] According to an embodiment of the present disclosure, the first clause includes a first assumption condition, and the first clause also plays a role in guiding the base model to analyze the data dependency of the target instruction. Fig.13, assuming that the target instruction is "Which middle school in Wushan County, Chongqing has the highest score for the high school entrance examination in 2023". When the first assumption condition is "Your task is to be a professional problem analysis expert, focusing on the fields of data query and data analysis", the first clause generated based on the first assumption condition is "Your task is to be a professional problem analysis expert, focusing on the fields of data query and data analysis. The question raised by the user is: Which middle school in Wushan County, Chongqing has the highest score for the high school entrance examination in 2023. You need to analyze the question raised by the user according to the following criteria to determine whether the question is related to data analysis;". The first clause can indicate whether the target instruction is related to data analysis based on the first assumption condition.
[0248] It is understandable that, in addition to the first assumption, the first clause may also include supplementary knowledge to assist the base model in more accurately analyzing the data dependency of the target instruction. Fig.14 The supplementary knowledge may be the last question asked by the target user and the third guide word corresponding to the last question. The supplementary knowledge may also be multiple questions asked by the target user in the past period of time and the third guide word corresponding to each question.
[0249] In step 1230 , a first branch processing clause and a second branch processing clause are generated, wherein the first branch processing clause indicates processing when the target instruction is related to data analysis, and the second branch processing clause indicates processing when the target instruction is not related to data analysis.
[0250] According to an embodiment of the present disclosure, the first branch processing clause may indicate the processing when the target instruction is related to data analysis. Fig.13 , the first branch processing clause can be "If the question is not related to data analysis, or involves sensitive topics, return: {"Analysis process": "Describe the thinking process", "Flag": "0", "Reply": "None"}". Among them, the statement in "{}" refers to the format and content of the reply returned by the business intelligence analysis software to the target user. The analysis process of "Describe the thinking process" means that the specific process of analyzing the data relevance of the target instruction needs to be given. The flag bit of 0 indicates that the target instruction is not related to data analysis, or involves sensitive topics. The reply of None indicates that no reply can be given.
[0251] The second branch handling clause may indicate the processing when the target instruction is not related to data analysis. Fig.13 , the second branch processing clause can be "If the problem is related to data analysis, input the target instruction and the first guide corresponding to the target instruction into the first type of element extraction model.".
[0252] In step 1240, a third introductory clause is generated based on the first clause, the first branch processing clause, and the second branch processing clause.
[0253] According to an embodiment of the present disclosure, the third introductory clause can be obtained by concatenating the first clause, the first branch processing clause and the second branch processing clause. Fig.13 , in the first clause "Your task is to be a professional problem analysis expert, focusing on the fields of data query and data analysis. The question raised by the user is: Which middle school in Wushan County, Chongqing has the highest admission score for the high school entrance examination in 2023. You need to analyze the question raised by the user according to the following criteria to determine whether the question is related to data analysis;", the first branch processing clause is "If the question is not related to data analysis, or involves sensitive topics, return: {"Analysis process": "Describe the thinking process", "Flag": "0", "Reply": "None"}", and the second branch processing clause is "If the question is related to data analysis, input the target instruction and the first guide corresponding to the target instruction into the first type of feature extraction model.", Based on the first clause, the first branch processing clause and the second branch processing clause, the generated third guide is "Your task is to serve as a professional problem analysis expert, focusing on the fields of data query and data analysis. The question raised by the user is: Which middle school in Wushan County, Chongqing has the highest high school entrance examination admission score in 2023. You need to analyze the question raised by the user according to the following criteria to determine whether the question is related to data analysis; if the question is not related to data analysis or involves sensitive topics, return: {"Analysis process": "Describe the thinking process", "Flag": "0", "Reply": "None"}; If the question is related to data analysis, input the target instruction and the first guide corresponding to the target instruction into the first type of feature extraction model.".
[0254] According to another embodiment of the present disclosure, referring to Fig.14, here is the process of generating the third guide based on the first clause, the first branch processing clause and the second branch processing clause when the first clause contains supplementary knowledge: assuming that the question raised by the user is "Which middle school in Wushan County, Chongqing has the highest admission score for the high school entrance examination in 2023", the first assumption is "Your task is to be a professional problem analysis expert, focusing on the field of data query and data analysis", and the supplementary knowledge is "the previous question raised by the user, and the third guide corresponding to the previous question". Based on this, the first clause can be obtained as "Your task is to serve as a professional problem analysis expert, focusing on the fields of data query and data analysis. The question raised by the user is: Which middle school in Wushan County, Chongqing has the highest high school entrance examination admission score in 2023. Supplementary knowledge is: the previous question raised by the user and the third guide corresponding to the previous question. You need to analyze the questions raised by the user according to the following criteria to determine whether the questions are related to data analysis;"; The first branch processing clause is "If the question is not related to data analysis, or involves sensitive topics, return: {"Analysis process": "Describe the thinking process", "Flag": "0", "Reply": "None"}"; The second branch processing clause is "If the question is related to data analysis, input the target instruction and the first guide corresponding to the target instruction into the first type of feature extraction model.".
[0255] Based on the first clause, the first branch processing clause, and the second branch processing clause, the generated third guide is "Your task is to be a professional problem analysis expert, focusing on the field of data query and data analysis", and the supplementary knowledge is "the previous question raised by the user, and the third guide corresponding to the previous question". Based on this, the first clause can be obtained as "Your task is to be a professional problem analysis expert, focusing on the field of data query and data analysis. The question raised by the user is: Which middle school in Wushan County, Chongqing has the highest admission score for the high school entrance examination in 2023. The supplementary knowledge is: the previous question raised by the user, and the third guide corresponding to the previous question. You need to analyze the question raised by the user according to the following criteria to determine whether the question is related to data analysis; if the question is not related to data analysis, or involves sensitive topics, return: {"Analysis process": "Describe the thinking process", "Flag": "0", "Reply": "None"}; if the question is related to data analysis, input the target instruction and the first guide corresponding to the target instruction into the first type of feature extraction model."
[0256] The above-mentioned embodiments of steps 1210 to 1240 can generate a third guide statement based on the first clause, the first branch processing clause and the second branch processing clause, effectively assisting the base model to more accurately analyze the data relevance of the target instruction, thereby training it into a data analysis relevance prediction model.
[0257] Detailed description of step 320
[0258] Step 320: Input the target instruction and the first guide language corresponding to the target instruction into the first type element extraction model to obtain the extracted first type elements, wherein the first type elements are the elements that need to be supplemented in the target instruction.
[0259] In one embodiment, referring to Fig.15 The first guide in step 320 is generated in the following manner:
[0260] Step 1510: Obtain a first definition and a first example of each first type element;
[0261] Step 1520: Generate a second clause based on the first definition and the first example, where the second clause is used to indicate whether the target instruction contains a first type of element based on the first definition and the first example;
[0262] Step 1530: Generate a third branch processing clause and a fourth branch processing clause, wherein the third branch processing clause indicates display content when the target instruction includes the first type of element, and the fourth branch processing clause indicates display content when the target instruction does not include the first type of element;
[0263] Step 1540: Generate a first introductory statement based on the second clause, the third branch processing clause, and the fourth branch processing clause.
[0264] Steps 1510 to 1540 are described in detail below:
[0265] In step 1510 , a first definition and a first example of each first type element are obtained.
[0266] According to an embodiment of the present disclosure, the first type of element includes a "time" field and a "subject" field, the first definition refers to the concept of time and subject, and the first example refers to a specific example of time and subject. Therefore, it can be determined that the first definition of time is: a timestamp or time period in a data set, and the first example of time is: a specific year (for example: "2023", "this year"), quarter, month, date, fuzzy time (for example: "During the Spring Festival", "Recently"). The first definition of subject is: the focus object of data analysis, and the first example of subject is: individuals, companies, devices, etc.
[0267] In step 1520 , based on the first definition and the first example, a second clause is generated, where the second clause is used to indicate whether the target instruction contains a first type of element based on the first definition and the first example.
[0268] According to the embodiment of the present disclosure, since the first type of element extraction model is trained based on the general base model, the base model does not know what operation to perform on the data at the beginning of training. In order to guide the base model, it is also necessary to input a sentence for guiding the base model to extract the first type of elements of the target instruction, that is, the second clause, into the base model. The second clause is composed of the first definition and the first example of time, and the first definition and the first example of subject.
[0269] For example, refer to Fig.16 , the second clause generated based on the first definition and the first example of time, the first definition and the first example of the subject is "Confirm whether the question explicitly contains the following elements: Time: "Timestamp or time period in the dataset"; for example: specific year (for example: "2023", "this year"), quarter, month, date, fuzzy time (for example: "During the Spring Festival", "Recently"); Subject: "Focus object of data analysis"; for example: individuals, companies, devices, etc. ". The second clause can indicate whether the target instruction contains subject and time based on the first definition and the first example of time, the first definition and the first example of the subject.
[0270] In step 1530, a third branch processing clause and a fourth branch processing clause are generated, wherein the third branch processing clause indicates the display content when the target instruction includes the first type of element, and the fourth branch processing clause indicates the display content when the target instruction does not include the first type of element.
[0271] According to an embodiment of the present disclosure, the third branch processing clause may indicate the display content when the target instruction contains the first type of element. Fig.16 , the third branch processing clause can be "If the question contains time and subject and is clearly expressed, return: {"Analysis process": "First analysis process", "Flag": "First mark", "Reply": "First text description"}". Among them, the statement in "{}" refers to the format and content of the reply returned by the business intelligence analysis software to the target user, the analysis process refers to the specific process of analyzing whether the target instruction contains the first type of elements and the specific process of analyzing whether the target instruction is clearly expressed, the flag is used to reflect the execution result of the first type of element extraction model, and the reply refers to the content returned to the target user.
[0272] The fourth branch processing clause may indicate the display content when the target instruction does not contain the first type of element. Fig.16 , the fourth branch processing clause can be "If the question lacks time and subject, or is not clearly expressed, return: {"analysis process": "second analysis process", "flag": "second mark", "reply": "second text description"}".
[0273] The specific method of "generating the third branch processing clause and the fourth branch processing clause" will be described in detail below.
[0274] In step 1540, a first introduction is generated based on the second clause, the third branch processing clause, and the fourth branch processing clause.
[0275] According to an embodiment of the present disclosure, the first introductory clause can be obtained by concatenating the second clause, the third branch processing clause, and the fourth branch processing clause. Fig.16 , it can be obtained that the second clause is "Confirm whether the question clearly contains the following elements: Time: "Timestamp or time period in the dataset"; for example: specific year (for example: "2023", "this year"), quarter, month, date, fuzzy time (for example: "During the Spring Festival", "Recently"); Subject: "Focus object of data analysis"; for example: individuals, companies, equipment, etc."; The third branch processing clause is "If the question contains time and subject and the expression is clear, return: {"Analysis process": "First analysis process", "Flag": "First mark", "Reply": "First text description"}"; The fourth branch processing clause is "If the question lacks time and subject, or the expression is unclear, return: {"Analysis process": "Second analysis process", "Flag": "Second mark", "Reply": "Second text description"}".
[0276] Assume that the target instruction typed by the user is "Which middle school in Wushan County, Chongqing has the highest admission score for the high school entrance examination in 2023". Based on the second clause, the third branch processing clause and the fourth branch processing clause, the first guide sentence generated is "Confirm whether the question clearly contains the following elements: Time: "Timestamp or time period in the data set"; for example: specific year (for example: "2023", "this year"), quarter, month, date, fuzzy time (for example: "During the Spring Festival", "Recently"); Subject: "Focus object of data analysis"; for example: individuals, companies, equipment, etc.; If the question contains time and subject and the expression is clear, return: {"Analysis process": "First analysis process", "Flag": "First mark", "Reply": "First text description"}; If the question lacks time and subject, or the expression is unclear, return: {"Analysis process": "Second analysis process", "Flag": "Second mark", "Reply": "Second text description"}; Question: Which middle school in Wushan County, Chongqing has the highest admission score for the high school entrance examination in 2023; Reply:......". Among them, the "reply" in the first guide sentence refers to "{"analysis process":"first analysis process","flag":"first mark","reply":"first text description"}" or "{"analysis process":"second analysis process","flag":"second mark","reply":"second text description"}".
[0277] The above-mentioned embodiments of steps 1510 to 1540 can generate a first guide statement based on the second clause, the third branch processing clause and the fourth branch processing clause, effectively assisting the base model to more accurately extract the first type of elements from the target instructions, thereby training it to become a first type of element extraction model.
[0278] In one embodiment, referring to Fig.17 , step 1530 includes:
[0279] Step 1710: Obtain a first analysis process, a first mark, and a first text description, wherein the first analysis process is an analysis process in which a target instruction includes a first type of element, the first mark indicates that the target instruction includes a first type of element, and the first text description is a text description of the target instruction including the first type of element;
[0280] Step 1720: Generate a third branch processing clause based on the first analysis process, the first tag, and the first text description;
[0281] Step 1730: Obtain a second analysis process, a second mark, and a second text description, wherein the second analysis process is an analysis process in which the target instruction does not contain the first type of element, the second mark indicates that the target instruction does not contain the first type of element, and the second text indicates that the target instruction lacks the first type of element;
[0282] Step 1740: Generate a fourth branch processing clause based on the second analysis process, the second tag, and the second text description.
[0283] Steps 1710 to 1740 are described in detail below:
[0284] In step 1710, a first analysis process, a first mark and a first text description are obtained, wherein the first analysis process is an analysis process in which a target instruction includes a first type of element, the first mark indicates that the target instruction includes a first type of element, and the first text description is a text description in which the target instruction includes the first type of element.
[0285] According to an embodiment of the present disclosure, the first analysis process refers to a specific process of analyzing whether the target instruction contains a first type of element. The first mark is used to reflect that the target instruction contains a first type of element. Generally, if the target instruction contains a first type of element, the first mark is 1. The first text description refers to the text content returned to the target user when the target instruction contains a first type of element. Exemplarily, if the target instruction contains a first type of element, the first text description is "there is no missing information."
[0286] In step 1720, a third branch processing clause is generated based on the first analysis process, the first tag, and the first text description.
[0287] It is understandable that the third branch processing clause can be obtained by concatenating the first analysis process, the first tag, and the first text description. Fig.18 , if the target instruction contains the first type of elements, the first analysis process is "the analysis process of describing time and subject", the first mark is "1", and the first text description is "there is no missing information". The third branch processing clause generated based on the first analysis process, the first mark, and the first text description is "If the question contains time and subject and the statement is clear, return: {"Analysis process": "Describe the analysis process of time and subject", "Flag": "1", "Reply": "There is no missing information"}." The generated third branch processing clause indicates the display content displayed to the target user when the target instruction contains the first type of elements.
[0288] In step 1730, a second analysis process, a second mark, and a second text description are obtained, the second analysis process is an analysis process in which the target instruction does not contain the first type of element, the second mark indicates that the target instruction does not contain the first type of element, and the second text indicates that the target instruction is missing the first type of element.
[0289] According to an embodiment of the present disclosure, the second analysis process refers to a specific process of analyzing whether there is a missing first type element in the target instruction. The second mark is used to reflect that there is a missing first type element in the target instruction. Generally, if there is a missing first type element in the target instruction, the first mark is 2. The second text description refers to the text content returned to the target user when there is a missing first type element in the target instruction, which is used to indicate the missing first type element of the target instruction. Exemplarily, assuming that the time field is missing in the target instruction, the second text description is "missing time field" to facilitate the target user to supplement the missing time field.
[0290] In step 1740, a fourth branch processing clause is generated based on the second analysis process, the second tag, and the second text description.
[0291] It is understandable that the fourth branch processing clause can be obtained by splicing the second analysis process, the second tag, and the second text description. Fig.19, if the first type of element is missing in the target instruction, the second analysis process is "the analysis process of describing the time and subject", the second mark is "2", and the second text description is "point out the missing information". The fourth branch processing clause generated based on the second analysis process, the second mark, and the second text description is "If the question lacks time or subject, or the statement is unclear, return: {"Analysis process": "Describe the analysis process of time and subject", "Flag": "2", "Reply": "Point out the missing information"}." The generated fourth branch processing clause indicates the display content displayed to the target user when the target instruction does not contain the first type of element.
[0292] The embodiments of the above-mentioned steps 1710 to 1740 can not only generate a third branch processing clause based on the first analysis process, the first mark and the first text description to indicate that the target instruction contains the first type of elements, but can also generate a fourth branch processing clause based on the second analysis process, the second mark and the second text description to indicate that the target instruction does not contain the first type of elements, prompting the target user to supplement the missing time field to facilitate subsequent correction of the target instruction.
[0293] Detailed description of step 330
[0294] Step 330: Input the target instruction and the second guide language corresponding to the target instruction into the second type element extraction model to obtain extracted second type elements, wherein the second type elements are elements in the target instruction that need to be clarified.
[0295] In one embodiment, referring to Fig. 20 The second guide word of step 330 is generated in the following manner:
[0296] Step 2010: obtaining a second definition and a second example of each second type element;
[0297] Step 2020: Generate a third clause based on the second definition and the second example, where the third clause is used to instruct to extract a second type of element from the target instruction based on the second definition and the second example;
[0298] Step 2030: Generate a fourth clause based on the extraction principle of extracting the second type of elements;
[0299] Step 2040: Generate a second introduction based on the third clause and the fourth clause.
[0300] Steps 2010 to 2040 are described in detail below:
[0301] In step 2010, a second definition and a second example of each second type element are obtained.
[0302] According to an embodiment of the present disclosure, the second type of elements includes a "subject" field, a "dimension" field, and an "indicator" field. The second definition refers to the concepts of subject, dimension, and indicator, and the second example refers to specific examples and precautions for subject, dimension, and indicator. Therefore, it can be determined that the second definition of subject is the focus object of data analysis, and the second example of subject is "individual, company, equipment, etc., pronouns such as "we" and "they" should not be extracted". The second definition of dimension is an attribute used to classify, segment or describe data. The second example of dimension is "geographic location, product category, field name, etc., avoid extracting general classification terms (for example: quarter, month, 2020, etc.)". The second definition of indicator is quantitative measurement in data analysis, and the second example of indicator is "sales, click-through rate, customer satisfaction, etc., avoid extracting derivative terms of indicators (for example: growth, trend, ranking, etc.) unless these terms are the direct focus of the query."
[0303] In step 2020, based on the second definition and the second example, a third clause is generated, where the third clause is used to instruct to extract the second type of elements from the target instruction based on the second definition and the second example.
[0304] According to the embodiments of the present disclosure, since the second type of element extraction model is trained based on the general base model, the base model does not know what operation to perform on the data at the beginning of training. In order to guide the base model, it is also necessary to input a sentence for guiding the base model to extract the second type of elements of the target instruction, that is, the third clause, into the base model. The third clause is composed of the second definition and the second example of the subject, the second definition and the second example of the dimension, and the second definition and the second example of the indicator.
[0305] For example, refer to Fig.21, the third clause generated based on the second definition and second example of the subject, the second definition and second example of the dimension, and the second definition and second example of the indicator is "Your task is to serve as a professional keyword extraction expert, focusing on the fields of data query and data analysis. Your goal is to accurately identify and extract core concepts related to data analysis from the user's query questions. Please extract keywords according to the following categories: Subject: the focus object of data analysis, such as: individuals, companies, devices, etc., pronouns such as "we" and "they" should not be extracted; Dimension: attributes used to classify, segment or describe data, such as: geographic location, product category, field name, etc., avoid extracting general classification terms (for example: quarter, month, 2020, etc.); Indicator: quantitative measurement in data analysis, such as: sales, click-through rate, customer satisfaction, etc., avoid extracting derivative terms of indicators (for example: growth, trend, ranking, etc.) unless these terms are the direct focus of the query." The third clause can indicate whether the target instruction contains subject, dimension and indicator based on the second definition and second example of the subject, the second definition and second example of the dimension, and the second definition and second example of the indicator.
[0306] In step 2030, a fourth clause is generated based on the extraction principle of extracting the second type of elements.
[0307] According to an embodiment of the present disclosure, the extraction principle refers to matters to be followed when extracting the second type of elements from the target instruction. Extracting the second type of elements in the target instruction based on the extraction principle can effectively avoid extracting non-core concept words such as function words, pronouns, and adjectives. The fourth clause is spliced by the extraction principle of the second type of elements, and the fourth clause can indicate matters to be followed when extracting the second type of elements.
[0308] For example, refer to Fig.21 , assuming that the extraction principle of the second type of elements is "Use English commas to separate multiple keywords. Avoid extracting non-core concept words such as function words, pronouns, time, and general classification words. If there is no keyword, return: No keyword exists.". The fourth clause generated based on the extraction principle of extracting the second type of elements is "When extracting keywords, please follow the following rules: Use English commas to separate multiple keywords. Avoid extracting non-core concept words such as function words, pronouns, time, and general classification words. If there is no keyword, return: No keyword exists.".
[0309] In step 2040, a second introduction is generated based on the third clause and the fourth clause.
[0310] According to an embodiment of the present disclosure, the second introduction can be obtained by concatenating the third clause and the fourth clause. Fig.21, we can get that the third clause is "Your task is to serve as a professional keyword extraction expert, focusing on the fields of data query and data analysis. Your goal is to accurately identify and extract core concepts related to data analysis from the user's query questions. Please extract keywords according to the following categories: Subject: The focus object of data analysis, such as individuals, companies, equipment, etc. Pronouns such as "we" and "they" should not be extracted; Dimension: Attributes used to classify, segment or describe data, such as geographic location, product category, field name, etc. Avoid extracting general classification terms (for example, quarter, month, 2020, etc.); Indicator: Quantitative measurement in data analysis, such as sales, click-through rate, customer satisfaction, etc. Avoid extracting derivative terms of indicators (for example, growth, trend, ranking, etc.) unless these terms are the direct focus of the query." The fourth clause is "When extracting keywords, please follow the following rules: Use English commas to separate multiple keywords. Avoid extracting non-core concept terms such as function words, pronouns, time and general classification terms. If there is no keyword, return: No keyword exists.".
[0311] Suppose the target instruction entered by the target user is "Which middle school in Wushan County, Chongqing has the highest admission score for the 2023 high school entrance examination." The second guide sentence generated based on the third and fourth clauses is "Your task is to serve as a professional keyword extraction expert, focusing on the fields of data query and data analysis. Your goal is to accurately identify and extract core concepts related to data analysis from the user's query questions. Please extract keywords according to the following categories: Subject: the focus object of data analysis, such as individuals, companies, equipment, etc. Pronouns such as "we" and "they" should not be extracted; Dimension: an attribute used to classify, segment or describe data, such as geographic location, product category, field name, etc. Avoid extracting general classification terms (for example: quarterly , month, 2020, etc.); indicators: quantitative measures in data analysis, such as sales, click-through rate, customer satisfaction, etc. Avoid extracting derivative words of indicators (such as growth, trend, ranking, etc.) unless these words are the direct focus of the query. When extracting keywords, please follow the following rules: Use English commas to separate multiple keywords. Avoid extracting non-core concept words such as function words, pronouns, time, and general classification words. If there is no keyword, return: No keyword exists. Question: Which middle school in Wushan County, Chongqing has the highest high school entrance examination admission score in 2023; Keywords: ......". Among them, the "Keywords" column is used to indicate the second type of elements extracted from the target instruction. The reason for setting the "Keywords" column in the second guide is to assist the second type of element extraction model (ie, the base model) that has not yet been trained to understand the data to be output.
[0312] The embodiment of the above steps 2010 to 2040 can generate a third clause based on the second definition and the second example, generate a fourth clause based on the extraction principle of extracting the second type of elements, and generate a second guide from the third clause and the fourth clause. The above steps effectively assist the base model to more accurately extract the second type of elements from the target instruction, thereby training it to become a second type of element extraction model.
[0313] Detailed description of step 340
[0314] Step 340: Determine a plurality of candidate clarification options corresponding to the second type of elements based on the second type of elements and the target database.
[0315] In one embodiment, the target database includes a business knowledge sub-base, and the business knowledge sub-base includes multiple knowledge items; Fig. 22 , step 340 includes:
[0316] Step 2210: for each second type element, searching for a first matching knowledge item that matches the second type element from a plurality of knowledge items;
[0317] Step 2220: if there are multiple first matching knowledge items retrieved, add the multiple first matching knowledge items to the word segmentation expansion dictionary;
[0318] Step 2230: refer to the word segmentation expansion dictionary to segment the second type of elements to obtain segmented elements;
[0319] Step 2240: Determine multiple candidate clarification options corresponding to the post-segmentation elements.
[0320] Steps 2210 to 2240 are described in detail below:
[0321] In step 2210, for each second type element, a first matching knowledge item matching the second type element is retrieved from a plurality of knowledge items.
[0322] According to the embodiments of the present disclosure, referring to Fig.23 , the target database includes a business knowledge sub-base, and the business knowledge sub-base contains multiple knowledge items. Among them, the knowledge items refer to the professional terms of the industry and the explanations of the professional terms. Based on this, the business knowledge sub-base can be understood as a database that stores multiple professional terms and explanations of multiple professional terms in a certain industry.
[0323] According to an embodiment of the present disclosure, the first matching knowledge item refers to a knowledge item in the business knowledge sub-base that matches the second type of element. Exemplarily, assuming that the target instruction is "the total operating volume of each company in Wushan County, Chongqing in 2022", the extracted second type of elements are "Wushan County, Chongqing", "Company" and "Total operating volume". Here, "Total operating volume" is used as an example to illustrate: for "Total operating volume", the knowledge items that can be retrieved in the business knowledge sub-base that match "Total operating volume" are the total operating volume and the corresponding explanation of the total operating volume. The total operating volume and the corresponding explanation of the total operating volume are the first matching knowledge items.
[0324] In step 2220, if multiple first matching knowledge items are retrieved, the multiple first matching knowledge items are added to the word segmentation expansion dictionary.
[0325] According to an embodiment of the present disclosure, a word segmentation expansion dictionary refers to a dictionary used to expand the scope and accuracy of word segmentation during the word segmentation process. If there are multiple first matching knowledge items retrieved, it means that the extraction granularity is too large when extracting the second type of elements from the target instruction, resulting in multiple matching knowledge items for the second type of elements. At this time, in order to refine the second type of elements with too large granularity, it is necessary to segment the second type of elements. However, when segmenting the second type of elements, a segmentation basis is required to clarify how to segment the words, and the word segmentation expansion dictionary is this segmentation basis. Exemplarily, assuming that the target instruction is "What is the revenue amount of Company A in Shanghai in 2021", the second type of elements extracted are: Shanghai, Company A and revenue amount. Assume that for "revenue amount", the first matching knowledge items that match it are "revenue" and "amount". Therefore, "revenue" and "amount" can be added to the word segmentation expansion dictionary to facilitate the subsequent segmentation of "revenue amount".
[0326] According to an embodiment of the present disclosure, if there is only one knowledge item matched by a second type element, that is, the first matching knowledge item retrieved is one, it can be determined that the extraction granularity when extracting the second type element is appropriate, and there is no need to segment the second type element.
[0327] In step 2230, the second type of elements are segmented with reference to the segmentation expansion dictionary to obtain segmented elements.
[0328] According to an embodiment of the present disclosure, the post-segmentation elements refer to a plurality of words obtained after segmenting the second type of elements. The post-segmentation elements can also be understood as words after the granularity of the second type of elements is refined. Fig.24, assuming that the target instruction is "Which middle school in Tianhe District, Guangzhou City, Guangdong Province has the highest admission score in 2023", the extracted second type of elements are: Tianhe District, Guangzhou City, Guangdong Province, middle school, and admission score. Assume that for "Tianhe District, Guangzhou City, Guangdong Province", its first matching knowledge items are "Guangzhou City" and "Tianhe District". Therefore, "Guangzhou City" and "Tianhe District" can be added to the word segmentation expansion dictionary, and "Tianhe District, Guangzhou City, Guangdong Province" can be segmented with reference to the word segmentation expansion dictionary to obtain the post-segmentation elements: Guangdong Province, Guangzhou City, Tianhe District.
[0329] It is understandable that when the granularity of the second type of elements is already appropriate and no further refinement is required, the post-segmentation elements can also be the second type of elements themselves. Exemplarily, assuming that the target instruction is "What is the revenue of J Company in Shanghai in 2022?", the extracted second type of elements include: Shanghai, J Company, and revenue. For the second type of elements extracted above, the granularity does not need to be further refined. Therefore, the post-segmentation element obtained after word segmentation of "Shanghai" is "Shanghai", the post-segmentation element obtained after word segmentation of "J Company" is "J Company", and the post-segmentation element obtained after word segmentation of "revenue" is "revenue".
[0330] In step 2240, a plurality of candidate clarification options corresponding to the segmented elements are determined.
[0331] According to the embodiments of the present disclosure, the post-segmentation elements may also be ambiguous or have multiple meanings. In order to clarify the intention of the target user, it is also necessary to generate multiple candidate clarification options based on the multiple meanings contained in the post-segmentation elements or the possible ambiguities of the post-segmentation elements.
[0332] The specific method of "determining multiple candidate clarification options corresponding to the post-segmentation elements" will be described in detail below.
[0333] In the above-mentioned embodiment of step 2210 to step 2240, when there are multiple first matching knowledge items matching the second type element, the multiple first matching knowledge items can be added to the word segmentation expansion dictionary. In addition, the second type element is segmented based on the word segmentation expansion dictionary to obtain the post-segmentation elements, so as to refine the second type element with too large granularity when the granularity of extracting the second type element is too large, so as to facilitate the subsequent generation of candidate clarification options based on the second type element with appropriate granularity, thereby improving the retrieval accuracy.
[0334] In one embodiment, the business knowledge sub-base further includes a plurality of knowledge sub-items corresponding to the knowledge item; Fig.25 , step 2240 includes:
[0335] Step 2510: Retrieve the business knowledge sub-base based on the post-segmentation elements;
[0336] Step 2520: If the business knowledge sub-base is searched to obtain a second matching knowledge item that matches the post-segmentation element, and in the business knowledge sub-base, the second matching knowledge item corresponds to multiple second knowledge sub-items, then multiple candidate clarification options are generated based on the multiple second knowledge sub-items.
[0337] Steps 2510 to 2520 are described in detail below:
[0338] In step 2510, the business knowledge sub-base is retrieved based on the post-segmentation elements.
[0339] According to the embodiments of the present disclosure, referring to Fig.26 In the business knowledge sub-base, some knowledge items may correspond to multiple knowledge sub-items. Among them, the knowledge sub-items can be the multiple meanings contained in the knowledge items, and the knowledge sub-items can also be the possible ambiguities of the knowledge items. For example, assuming that there is a knowledge item called "property behavior tax", the multiple knowledge sub-items corresponding to the knowledge item are "property tax", "vehicle and vessel tax", and "vehicle purchase tax". In other words, the property behavior tax includes property tax, vehicle and vessel tax, and vehicle purchase tax.
[0340] Based on this, in order to determine the possible ambiguity of the post-segmentation element or the multiple meanings contained in the post-segmentation element, the business knowledge sub-base can be searched based on the post-segmentation element to determine the knowledge sub-item matched by the post-segmentation element. Fig. 27 Assuming that the target instruction is "Which company in Chongqing has the highest profit and profitability index in 2023", after the target instruction is segmented, the second type of elements obtained are: "Chongqing City", "Company", "Profit and Profit Indicator". For "Profit and Profit Indicator", the first matching knowledge item that matches it is: "Profit", "Profit", "Indicator". Add the first matching knowledge item to the word segmentation expansion dictionary, and after segmenting "Profit and Profit Indicator" based on the word segmentation expansion dictionary, the post-segmentation elements obtained are "Profit", "Profit", and "Indicator". Based on the post-segmentation elements, the business knowledge sub-base is searched, and it can be obtained that there are multiple knowledge sub-items matching "Profit", namely "Gross Profit" and "Net Profit". This also shows that profit has multiple meanings, including gross profit and net profit.
[0341] In step 2520, if the business knowledge sub-base is searched to obtain a second matching knowledge item that matches the segmented element, and in the business knowledge sub-base, the second matching knowledge item corresponds to multiple second knowledge sub-items, then multiple candidate clarification options are generated based on the multiple second knowledge sub-items.
[0342] According to an embodiment of the present disclosure, if the second matching knowledge item matched by the post-segmentation element corresponds to multiple second knowledge sub-items, it means that the post-segmentation element has multiple meanings or ambiguities, and each second knowledge sub-item corresponds to a meaning of the post-segmentation element. In order to clarify the specific meaning of the post-segmentation element, it is necessary to display each second knowledge sub-item corresponding to the second matching item matched by the post-segmentation element as a candidate clarification option to the target user, so that the target user can select the candidate clarification option. For example, refer to Fig. 27 and Fig.28 , assuming that the target instruction is "Which company in Chongqing has the highest profit and profitability index in 2023". For the second type of element "profit and profitability index", its post-word segmentation elements are "profit", "profit", and "indicator". Among them, there are multiple knowledge sub-items matching "profit", namely "gross profit" and net profit. Based on this, "gross profit" can be displayed to the target user as a candidate clarification option, and "net profit" can be displayed to the target user as a candidate clarification option, such as Fig.28 shown.
[0343] According to an embodiment of the present disclosure, if the second matching knowledge item matched by the post-segmentation element corresponds to only one second knowledge sub-item, it means that the post-segmentation element does not have multiple meanings and no ambiguity. For the post-segmentation element, there is no need to clarify the intent.
[0344] The specific method of "if the business knowledge sub-base is searched to obtain a second matching knowledge item that matches the post-segmentation element, and in the business knowledge sub-base, the second matching knowledge item corresponds to multiple second knowledge sub-items, then based on the multiple second knowledge sub-items, multiple candidate clarification options are generated" will be described in detail below.
[0345] The above-mentioned embodiments of steps 2510 to 2520 can generate multiple candidate clarification options based on multiple second knowledge sub-items for the target user to choose from when the second matching knowledge item corresponds to multiple second knowledge sub-items, thereby clarifying the target user's true intention without the need for multiple interactions with the user, thereby improving retrieval efficiency.
[0346] In one embodiment, referring to Fig.29 , step 2520 includes:
[0347] Step 2910: determine that a second matching knowledge item matching the post-word segmentation element is obtained by searching the business knowledge sub-base, and in the business knowledge sub-base, the second matching knowledge item corresponds to a plurality of second knowledge sub-items;
[0348] Step 2920: input the post-segmentation element and the fifth guide word corresponding to the post-segmentation element into the knowledge sub-item prediction model to obtain at least one predicted supplementary knowledge sub-item corresponding to the post-segmentation element;
[0349] Step 2930: Generate multiple candidate clarification options based on the multiple second knowledge sub-items and at least one supplementary knowledge sub-item.
[0350] Steps 2910 to 2930 are described in detail below.
[0351] In step 2910, it is determined that a second matching knowledge item matching the segmented element is obtained by searching the business knowledge sub-base, and in the business knowledge sub-base, the second matching knowledge item corresponds to a plurality of second knowledge sub-items.
[0352] It can be understood that the embodiment of step 2520 above has explained the situation corresponding to "searching the business knowledge sub-base to obtain a second matching knowledge item that matches the post-word segmentation element, and in the business knowledge sub-base, the second matching knowledge item corresponds to multiple second knowledge sub-items", which will not be repeated here.
[0353] In step 2920, the post-segmentation element and the fifth guide word corresponding to the post-segmentation element are input into the knowledge sub-item prediction model to obtain at least one predicted supplementary knowledge sub-item corresponding to the post-segmentation element.
[0354] According to the embodiments of the present disclosure, the supplementary knowledge sub-items can be the multiple meanings contained in the post-segmentation elements, and the supplementary knowledge sub-items can also be the ambiguities that may exist in the post-segmentation elements. In the case where the professional terms and the explanations of the professional terms included in the business knowledge sub-base are not comprehensive, even if some post-segmentation elements are ambiguous or contain multiple meanings, if the second knowledge sub-item corresponding to the second matching knowledge item matched by the post-segmentation element is not comprehensive, this will result in the multiple candidate clarification options generated based on the second knowledge sub-item not including the target user's intention option, and the post-segmentation element cannot be clarified. Based on this, the embodiments of the present disclosure can predict the multiple meanings contained in the post-segmentation elements or the ambiguities that exist in the post-segmentation elements through the knowledge sub-item prediction model to obtain supplementary knowledge sub-items to more comprehensively supplement the ambiguities that may exist in the post-segmentation elements or the multiple meanings contained in the post-segmentation elements. Among them, the knowledge sub-item prediction model refers to a large language model used to predict the multiple meanings contained in the post-segmentation elements or the ambiguities that exist in the post-segmentation elements.
[0355] It is understandable that in order to facilitate the knowledge sub-item prediction model to predict the multiple meanings contained in the post-word segmentation elements or the ambiguities existing in the post-word segmentation elements more quickly, while inputting the post-word segmentation elements into the knowledge sub-item prediction model, it is also necessary to input the fifth guide word used to guide the knowledge sub-item prediction model to output the supplementary knowledge sub-item into the knowledge sub-item prediction model to assist the knowledge sub-item prediction model in predicting the multiple meanings contained in the post-word segmentation elements or the ambiguities existing in the post-word segmentation elements.
[0356] For example, refer to Fig.30 , assuming that the target instruction is "Which company in Chongqing has the highest profit and profitability index in 2023", the second type of elements extracted from the target instruction are "company", "Chongqing City", and "profit and profitability index". For "profit and profitability index", the post-segmentation elements obtained after word segmentation include: "profit", "profit" and "indicator". For "profit", it is assumed that there is a second matching knowledge item matching "profit" in the business knowledge sub-base, and the second knowledge sub-items corresponding to the second matching knowledge item of "profit" are "gross profit" and "net profit". Because "profit" has multiple meanings, in order to obtain a more comprehensive meaning of "profit", "profit" and the fifth guide corresponding to "profit" can also be input into the knowledge sub-item prediction model to obtain the supplementary knowledge sub-items corresponding to "profit". According to Fig.30 It can be obtained that the supplementary knowledge sub-items corresponding to "profit" include "operating profit" and "total profit".
[0357] In step 2930 , a plurality of candidate clarification options are generated based on the plurality of second knowledge sub-items and the at least one supplementary knowledge sub-item.
[0358] According to an embodiment of the present disclosure, each second knowledge sub-item and each supplementary knowledge sub-item corresponds to a meaning of the post-segmentation element. In order to clarify the specific meaning of the post-segmentation element, it is necessary not only to display each second knowledge sub-item corresponding to the second matching item matched by the post-segmentation element as a candidate clarification option to the target user, but also to display each supplementary knowledge sub-item as a candidate clarification option to the target user, so that the target user can select from multiple candidate clarification options. For example, refer to Fig.30 , assuming that the target instruction is "Which company in Chongqing has the highest profit and profitability index in 2023". For the second type of element "profit and profitability index", its post-word segmentation elements are "profit", "profit", and "indicator". For "profit", the second knowledge sub-items corresponding to the second matching knowledge item of "profit" are "gross profit" and "net profit", and the supplementary knowledge sub-items corresponding to "profit" include "operating profit" and "total profit". Based on this, "gross profit" can be displayed as a candidate clarification option, "net profit" can be displayed as a candidate clarification option, "operating profit" can be displayed as a candidate clarification option, and "total profit" can be displayed as a candidate clarification option.
[0359] The above-mentioned embodiment of step 2910 to step 2930 can input the post-segmentation element and the fifth guide corresponding to the post-segmentation element into the knowledge sub-item prediction model to obtain at least one predicted supplementary sub-item corresponding to the post-segmentation element, thereby more comprehensively supplementing the possible ambiguity of the post-segmentation element or the multiple meanings contained in the post-segmentation element. Furthermore, multiple candidate clarification options can be generated based on multiple second knowledge sub-items and supplementary knowledge sub-items for the target user to choose, thereby clarifying the target user's true intention without multiple interactions with the user, thereby improving the retrieval efficiency.
[0360] In one embodiment, referring to Fig.31 After step 2510, the database search method further includes:
[0361] Step 3110: If the business knowledge sub-base is searched and no second matching knowledge item matching the post-segmentation element is obtained, the post-segmentation element and the fourth guide word corresponding to the post-segmentation element are input into the common sense element recognition model;
[0362] Step 3120: If the common sense element recognition model recognizes that the post-segmentation element is not a common sense element, a supplement request is generated, where the supplement request is used to request supplementation of the post-segmentation element.
[0363] Steps 3110 to 3120 are described in detail below:
[0364] In step 3110, if the search of the business knowledge sub-base does not obtain a second matching knowledge item that matches the post-segmentation element, the post-segmentation element and the fourth guide word corresponding to the post-segmentation element are input into the common sense element recognition model.
[0365] According to an embodiment of the present disclosure, if the business knowledge sub-base is searched and no second matching knowledge item matching the post-segmentation element is obtained, it may be because the knowledge items stored in the business knowledge sub-base are not comprehensive, or it may be because the post-segmentation element is common sense, while the business knowledge sub-base only stores professional terms. Based on this, in the case where the knowledge sub-base is searched and no second matching knowledge item matching the post-segmentation element is obtained, the post-segmentation element can be input into the common sense element recognition model to identify whether the post-segmentation element is a common sense element. Among them, the common sense element refers to a vocabulary belonging to common sense, and the common sense element recognition model is a large language model for identifying whether the input vocabulary is a common sense element. Further, in order to facilitate the common sense element recognition model to more quickly determine whether the input post-segmentation element is a common sense element, while the post-segmentation element is input into the common sense element recognition model, it is also necessary to input the fourth guide word used to guide the common sense element recognition model to determine whether the input post-segmentation element is a common sense element into the common sense element recognition model, so as to assist the common sense element recognition model in identifying whether the post-segmentation element is a common sense element. The specific method of generating the fourth guide word will be described in detail below.
[0366] For example, here combined Fig.32A Step 3110 is explained as follows: Assuming the target instruction is "Which company in Chongqing paid the highest amount of turnover tax in 2023", the second type of elements corresponding to the target instruction include: "Chongqing", "Company", "Amount of turnover tax". It can be obtained that the post-word segmentation elements of "Amount of turnover tax" include "turnover tax" and "amount". For "turnover tax", assuming that the search of the business knowledge sub-base does not obtain the second matching knowledge item that matches "turnover tax", at this time, "turnover tax" and the fourth guide corresponding to "turnover tax" are input into the common sense element recognition model, and the common sense element recognition model will output "turnover tax is not a common sense element".
[0367] In step 3120, if the common sense element recognition model recognizes that the post-segmentation element is not a common sense element, a supplement request is generated, and the supplement request is used to request to supplement the post-segmentation element.
[0368] According to an embodiment of the present disclosure, if the common sense element recognition model recognizes that the post-segmentation element is not a common sense element, it means that the post-segmentation element does not belong to common sense. In order to clarify the specific interpretation of the post-segmentation element, it is necessary to generate a supplementary request for requesting the target user to supplement the post-segmentation element, so that the target user can explain the specific interpretation of the post-segmentation element. It is understandable that after obtaining the target user's explanation of the post-segmentation element, multiple candidate clarification options can also be generated based on the target user's supplementary explanation.
[0369] For example, refer to Fig.32A and Fig.32B , assuming that the target instruction is "Which company in Chongqing paid the highest amount of turnover tax in 2023", for the post-segmentation element "turnover tax", after inputting "turnover tax" and the fourth guide corresponding to "turnover tax" into the common sense element recognition model, the common sense element recognition model outputs "turnover tax is not a common sense element". Therefore, it is necessary to generate a supplementary request based on "turnover tax", such as Fig.32B As shown, the supplementary request based on "turnover tax" is "the meaning of turnover tax". In the case where the target user responds to the supplementary request and adds "turnover tax mainly includes: value-added tax, consumption tax and tariff", the embodiment of the present disclosure can also generate multiple candidate clarification options based on value-added tax, consumption tax and tariff.
[0370] In the above-mentioned embodiment of step 3110 to step 3120, when the search of the business knowledge sub-base does not obtain the second matching knowledge item that matches the post-segmentation element, the post-segmentation element and the fourth guide corresponding to the post-segmentation element can be input into the common sense recognition model to determine whether the post-segmentation element is a common sense element. Furthermore, when the common sense element recognition model recognizes that the post-segmentation element is not a common sense element, a supplementary request for requesting to supplement the post-segmentation element can be generated to allow the target user to explain the specific interpretation of the post-segmentation element, without repeatedly asking the target user common sense questions, thereby improving the search efficiency.
[0371] In one embodiment, referring to Fig.33 The fourth guide word of step 3110 is generated in the following manner:
[0372] Step 3310: Based on the definition of the common sense element, generate a fifth clause, the fifth clause is used to indicate whether the element after segmentation is a common sense element based on the definition of the common sense element;
[0373] Step 3320: Generate an identification rule clause based on the identification rule of the common sense element;
[0374] Step 3330: Generate a fourth guide based on the fifth clause and the recognition rule clause.
[0375] Step 3310 and step 3330 are described in detail below:
[0376] In step 3310, based on the definition of common sense elements, a fifth clause is generated, and the fifth clause is used to indicate whether the post-segmentation element is a common sense element based on the definition of common sense elements.
[0377] It is understood that the definition of common sense elements refers to the concept of common sense. Generally, common sense elements are defined as "nouns or concepts that most people can understand."
[0378] According to the embodiments of the present disclosure, since the common sense element recognition model is trained based on the general base model, the base model does not know what operation to perform on the data at the beginning of training. In order to guide the base model, it is also necessary to input a sentence used to guide the base model to determine whether the post-segmentation element is a common sense word, that is, the fifth clause. The fifth clause is used to indicate whether the post-segmentation element is a common sense element based on the definition of the common sense element.
[0379] For example, refer to Fig.34, the definition of common sense elements is "common sense elements are usually nouns or concepts that most people can understand". The fifth clause generated based on the definition of common sense elements is "In the business analysis scenario, for each given word, please determine whether the word is a common sense element or whether a supplementary request needs to be made to the target user to supplement the word. If the word is a common sense element, output 0. If a supplementary request needs to be made to the target user, output 1. Common sense elements are usually nouns or concepts that most people can understand. The words that need to be supplemented by the target user may be terms or abbreviations in the professional field and are not widely known. Please judge according to the following rules:". Among them, the common sense element recognition model outputs 0 to indicate that the input post-segmentation element is a common sense element, and the common sense element recognition model outputs 1 to indicate that the input post-segmentation element is not a common sense element.
[0380] In step 3320, an identification rule clause is generated based on the identification rule of the common sense element.
[0381] According to the embodiments of the present disclosure, the recognition rule of common sense elements refers to the criterion for judging whether the elements after word segmentation are common sense elements. The recognition rule clause can be spliced by the recognition rule of common sense elements to indicate the recognition rule of common sense elements. In general, the recognition rule of common sense elements is: 1. If the vocabulary is common sense, the vocabulary is a common sense element; 2. If the vocabulary is a noun in the question (whether it is the full Chinese name, the full English name or the abbreviation), the vocabulary is not a common sense element.
[0382] For example, refer to Fig.34 , assuming that the recognition rule of the common sense elements obtained is "1. If the word is common sense, the word is a common sense element; 2. If the word is a noun in the question (whether it is a full Chinese name, a full English name, or an abbreviation), the word is not a common sense element."
[0383] The recognition rule clauses generated by the recognition rules based on common sense elements are "1. If the vocabulary is common sense, output 0; 2. If the vocabulary is the noun in the question (whether it is the full Chinese name, the full English name or the abbreviation), output 1." Among them, the common sense element recognition model outputs 0 to indicate that the input post-word segmentation element is a common sense element, and the common sense element recognition model outputs 1 to indicate that the input post-word segmentation element is not a common sense element.
[0384] In step 3330, a fourth guide is generated based on the fifth clause and the recognition rule clause.
[0385] According to an embodiment of the present disclosure, the fourth introductory phrase can be obtained by concatenating the fifth clause and the recognition rule clause. Fig.34, we can get that the fifth clause is "In the business analysis scenario, for each given word, please determine whether the word is a common sense element or whether a supplementary request needs to be made to the target user to supplement the word. If the word is a common sense element, output 0. If a supplementary request needs to be made to the target user, output 1. Common sense elements are usually nouns or concepts that most people can understand. Vocabulary that requires supplementary requests to the target user may be terms or abbreviations in the professional field and are not widely known. Please make judgments based on the following rules:". The identification rule clause is "1. If the word is common sense, output 0; 2. If the word is a noun in the question (whether it is a full Chinese name, an English full name, or an abbreviation), output 1."
[0386] Assume that the post-segmentation element currently input to the common sense element recognition model is "turnover tax". The fourth guide sentence generated based on the fifth clause and the recognition rule clause is "In the business analysis scenario, for each given word, please determine whether the word is a common sense element or whether a supplementary request needs to be made to the target user to supplement the word. If the word is a common sense element, output 0. If a supplementary request needs to be made to the target user, output 1. Common sense elements are usually nouns or concepts that most people can understand. The words that need to be supplemented by the target user may be terms or abbreviations in the professional field and are not widely known. Please judge according to the following rules: 1. If the word is common sense, output 0; 2. If the word is a noun in the question (whether it is the full Chinese name, the full English name or the abbreviation), output 1. Vocabulary: Turnover tax; Reply: ..." Among them, the fields filled in the "Vocabulary" column are the post-segmentation elements input to the common sense element recognition model, and the "Reply" column is used to guide the common sense element recognition model to give a judgment result based on the input post-segmentation elements.
[0387] The above-mentioned embodiments of steps 3310 to 3330 can generate the fourth guide based on the fifth clause and the recognition rule clause, effectively assisting the base model to more accurately judge whether the input post-segmentation elements are common sense elements, thereby training it into a common sense element recognition model.
[0388] Detailed description of step 350
[0389] Step 350: based on the element supplementary information for the first type of element and the selection command for the plurality of candidate clarification options, modify the target instruction to obtain a modified instruction, and perform a search in the target database based on the modified instruction.
[0390] In one embodiment, referring to Fig.35 , step 350 comprises:
[0391] Step 3510: receiving element supplementary information for the first type of element input by a target user and a selection command for selecting a target clarification option from a plurality of candidate clarification options;
[0392] Step 3520: Supplement the first type of elements in the target instruction based on the element supplement information;
[0393] Step 3530: Based on the target clarification option, modify the second type of elements in the target instruction, and use the target instruction after supplementing the first type of elements and modifying the second type of elements as the modified instruction.
[0394] Steps 3510 to 3530 are described in detail below:
[0395] In step 3510 , element supplementary information for the first type of element input by a target user and a selection command for selecting a target clarification option from a plurality of candidate clarification options are received.
[0396] According to an embodiment of the present disclosure, after the target user supplements the first type of elements missing in the target instruction, element supplement information for the first type of elements input by the target user is received. After the target user selects multiple candidate clarification options corresponding to the second type of elements that are ambiguous or have multiple meanings in the target instruction, a selection command of the target user to select a target clarification option from the multiple candidate clarification options is received.
[0397] In step 3520, the first type of element in the target instruction is supplemented based on the element supplement information.
[0398] It is understandable that, in the case where the target instruction has a missing first-type element, the element supplementary information for the first-type element input by the target user can supplement the missing first-type element in the target instruction. Exemplarily, assuming that the target instruction input by the target user is "What is our revenue in 2023?", the first-type element extracted from the target instruction is "2023", and the main body field is missing in the first-type element. Assuming that after the target user supplements, the element supplementary information is obtained as "K Company", at this time, the element supplementary information can be used to supplement the main body field in the target instruction, and the supplemented target instruction is "What is our K Company's revenue in 2023?".
[0399] In step 3530, based on the target clarification option, the second type of elements in the target instruction are modified, and the target instruction after supplementing the first type of elements and modifying the second type of elements is used as the modified instruction.
[0400] It is understandable that, in the case where the second type element of the target instruction is ambiguous or has multiple meanings, the second type element that is ambiguous or has multiple meanings can be corrected based on the candidate clarification option selected by the target user to clarify the intention of the target user. Exemplarily, it is assumed that the target instruction input by the target user is "What is the profit of each department of G Company?" The first type element extracted from the target instruction is "G Company", and the time field is missing in the first type element. The second type element extracted from the target instruction includes: "G Company", "Various Departments", "Profit", where "Profit" contains multiple meanings, namely "Gross Profit", "Net Profit", etc. Assume that for the first type element, after the target user supplements it, the element supplement information is "2022". For the second type element, after the candidate clarification option selected by the target user, the target clarification option is "Gross Profit". The target instruction after supplementing the first type element and correcting the second type element is "What is the gross profit of each department of G Company in 2022?" This is the corrected instruction.
[0401] In the above-mentioned embodiment of step 3510 to step 3530, for the first type of elements, the target instruction can be supplemented based on the element supplement information, and for the second type of elements, the target instruction can be corrected based on the target clarification option selected by the target user. After the target instruction is supplemented and corrected, it can become a clear and unambiguous corrected instruction, which facilitates subsequent retrieval in the target database based on the corrected instruction.
[0402] In one embodiment, referring to Fig.36 , step 350 further includes:
[0403] Step 3610: Obtain a first type and first context information of a target instruction;
[0404] Step 3620: Obtain a historical instruction set of a target user, where the target user is a user who issues a target instruction;
[0405] Step 3630: For each historical instruction in the historical instruction set, obtain the second type and second context information of the historical instruction;
[0406] Step 3640: If the second type of a historical instruction in the historical instruction set matches the first type, and the second context information of the historical instruction matches the first context information, then obtain the first historical type element and the second historical type element in the historical instruction;
[0407] Step 3650: Generate element supplementary information based on the first history type element, and generate a selection command based on the second history type element;
[0408] Step 3660: Based on the element supplementary information and the selection command, correct the target instruction to obtain the corrected instruction.
[0409] Steps 3610 to 3660 are described in detail below:
[0410] In step 3610 , a first type and first context information of a target instruction are obtained.
[0411] According to an embodiment of the present disclosure, the first type refers to the type to which the target instruction belongs. Exemplarily, assuming that target instruction 1 is "the revenue of department B of company A in 2023", it can be obtained that target instruction 1 does not involve the calculation and analysis of data, but only involves the reading of data, so the first type of target instruction 1 is the financial statement data reading type. Assuming that target instruction 2 is "the proportion of net profit of each department of company A in the total revenue of company A in 2023", it can be obtained that target instruction 2 involves the calculation and analysis of data, so the first type of target instruction 2 is the financial statement data analysis type.
[0412] According to an embodiment of the present disclosure, the first context information refers to the operation information when retrieving and viewing the data involved in the target instruction. Exemplarily, assuming that there is a target instruction 1 of "calculate the gross profit of the beauty industry of Company A in 2023", it is known that the operating data of Company A in 2023 is stored in report M, and the first context information corresponding to the target instruction 1 is: retrieve report M, and view the sales and operating costs of the beauty industry in report M. Assuming that there is a target instruction 2 of "calculate the revenue of the food industry of Company B in 2022", it is known that the operating data of Company B in 2022 is stored in report P, and the first context information corresponding to the target instruction 2 is: retrieve report P, and view the revenue of the food industry in report P.
[0413] In step 3620, a historical instruction set of a target user is obtained, where the target user is the user who issues the target instruction.
[0414] According to an embodiment of the present disclosure, the historical instruction set refers to a set of target instructions typed by the target user in the past time period. For example, assuming that the target instruction typed by the target user one hour ago is "Expenditure of Company C in 2020", the instruction "Expenditure of Company C in 2020" will be stored in the historical instruction set.
[0415] In step 3630 , for each historical instruction in the historical instruction set, the second type and second context information of the historical instruction are obtained.
[0416] According to an embodiment of the present disclosure, the second type refers to the type to which the historical instruction belongs. Fig.37For example, assuming that historical instruction 1 is "calculate the net profit of department K in the toy industry in 2023", it can be obtained that historical instruction 1 involves the calculation and analysis of data, so the second type of historical instruction 1 is the financial statement data analysis type. Assuming that historical instruction 2 is "view the expenditure of department C in the food industry in 2023", it can be obtained that historical instruction 2 does not involve the calculation and analysis of data, but only involves the reading of data, so the second type of historical instruction 2 is the financial statement data reading type.
[0417] According to an embodiment of the present disclosure, the second context information refers to the operation information when the data involved in the historical instruction is retrieved and viewed. Fig.37 For example, suppose there is a historical instruction 1 of "calculate the net profit of department K in the toy industry in 2023", it is known that report A stores the business data of each department in the toy industry in 2023, and the second context information corresponding to historical instruction 1 is: call report A, view the revenue and expenditure of each department in the toy industry in 2023 in report A, and call the revenue and expenditure of department K in the toy industry in 2023. Suppose there is a historical instruction 2 of "view the expenditure of department C in the food industry in 2023", it is known that report B stores the business data of each department in the food industry in 2023, and the second context information corresponding to historical instruction 2 is: call report B, view the expenditure of department C in the food industry in 2023 in report B.
[0418] In step 3640, if the second type of a historical instruction in the historical instruction set matches the first type, and the second context information of the historical instruction matches the first context information, the first historical type element and the second historical type element in the historical instruction are obtained.
[0419] According to an embodiment of the present disclosure, the first history type element refers to a first type element in a history instruction, and the second history type element refers to a second type element in a history instruction.
[0420] In step 3650, element supplementary information is generated based on the first history type element, and a selection command is generated based on the second history type element.
[0421] It is understandable that if there is a historical instruction of the second type that matches the first type in the historical instruction set, and the second context information of the historical instruction matches the first context information, it means that this historical instruction is similar to the target instruction typed by the current target user. If the first type element of the current target instruction is missing, the first historical type element of the historical instruction can be referred to to generate element supplementary information to supplement the missing first type element in the target instruction. Similarly, if the second type element of the current target instruction is ambiguous or contains multiple meanings, the second historical type element of the historical instruction can also be referred to to select multiple candidate clarification options corresponding to the second type element in the target instruction, that is, generate a selection command for multiple candidate clarification options to clarify the specific interpretation of the second type element in the target instruction.
[0422] For example, refer to Fig.37 , assuming that the target instruction currently typed by the target user is "calculate the gross profit of the toy industry in 2023". The first type corresponding to the target instruction is the financial statement data analysis type, and the first context information corresponding to the target instruction is: call report A to view the revenue and expenditure of each department in report A in toy products in 2023. The historical instruction set of the target user includes historical instructions 1 and historical instructions 2. Among them, the second type of historical instruction 1 is the financial statement data analysis type, and the second context information of historical instruction 1 is: call report A to view the revenue and expenditure of each department in report A in the toy industry in 2023, and call the revenue and expenditure of department K in the toy industry in 2023. The second type of historical instruction 2 is the financial statement data reading type, and the second context information of historical instruction 2 is: call report B to view the expenditure of department C in the food industry in 2023 in report B. Based on this, it can be obtained that the second type of historical instruction 1 matches the first type, and the second context information of historical instruction 1 also matches the first context information. Therefore, the first historical type element and the second historical type element of the historical instruction 1 are obtained. The first historical type element of the historical instruction 1 includes "2023" and "K Department", and the second historical type element of the historical instruction 1 includes "K Department", "Toy Industry", and "Net Profit". Because the subject field of the first type element is missing in the target instruction, the element supplementary information "K Department" can be generated based on the subject field in the first historical type element, so as to supplement the missing subject field in the target instruction later.
[0423] In step 3660, the target instruction is corrected based on the element supplementary information and the selection command to obtain a corrected instruction.
[0424] For example, refer to Fig.37, assuming that the target instruction currently entered by the target user is "calculate the gross profit of the toy industry in 2023". At this point, it has been determined that the second type of historical instruction 1 matches the first type, and the second context information of historical instruction 1 also matches the first context information. Because the target instruction lacks the main field of the first type element, after generating the element supplementary information "K department" based on the main field in the first historical type element, the target instruction can be modified based on the element supplementary information, and the modified instruction is "calculate the gross profit of K department in the toy industry in 2023".
[0425] The above-mentioned embodiment of step 3610 to step 3660 can generate element supplementary information based on the first historical element of the historical instruction, generate a selection command based on the second historical element of the historical instruction, and correct the target instruction according to the element supplementary information and the selection command when there are historical instructions in the historical instruction set where the second type matches the first type and the second context information matches the first context information. After the target instruction is supplemented and corrected, it becomes a clear and unambiguous corrected instruction, and can be retrieved in the target database based on the corrected instruction. The whole process does not require multiple interactions with the user, and the target instruction can be corrected by referring to historical instructions similar to the target instruction, thereby improving the retrieval efficiency.
[0426] Description of the apparatus and device of the present disclosure
[0427] It is to be understood that, although the steps in the above-mentioned flowcharts are sequentially displayed according to the characterization of arrows, these steps are not necessarily executed in sequence according to the order of arrow characterization. Unless there is a clear description in the present embodiment, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the above-mentioned flowcharts can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0428] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to object characteristics such as object attribute information or attribute information sets, the permission or consent of the object will be obtained first, and the collection, use and processing of these data will comply with relevant laws, regulations and standards. In addition, when the embodiment of the present application needs to obtain object attribute information, the object's separate permission or separate consent will be obtained through a pop-up window or jump to a confirmation page. After clearly obtaining the object's separate permission or separate consent, the necessary object-related data used to enable the normal operation of the embodiment of the present application will be obtained.
[0429] Fig.38 The following is a schematic diagram of the structure of a database search device 3800 provided in an embodiment of the present disclosure. The database search device 3800 includes:
[0430] An acquisition unit 3810 is used to acquire a target database and a target instruction for searching the target database;
[0431] The first input unit 3820 is used to input the target instruction and the first guide language corresponding to the target instruction into the first type element extraction model to obtain the extracted first type element, wherein the first type element is the element that needs to be supplemented in the target instruction;
[0432] The second input unit 3830 is used to input the target instruction and the second guide language corresponding to the target instruction into the second type element extraction model to obtain the extracted second type elements, wherein the second type elements are the elements in the target instruction that need to be clarified;
[0433] A first determining unit 3840 is configured to determine a plurality of candidate clarification options corresponding to the second type of elements based on the second type of elements and the target database;
[0434] The correction unit 3850 is used to correct the target instruction based on the element supplementary information for the first type of element and the selection command for multiple candidate clarification options to obtain a corrected instruction, and perform a search in the target database based on the corrected instruction.
[0435] Optionally, the database retrieval device 3800 further includes a correlation analysis unit, which is specifically used to:
[0436] Based on the target instruction, search the target database and obtain the initial database inspection result;
[0437] Inputting the target instruction, the database initial inspection result, and the third guide word corresponding to the target instruction and the database initial inspection result into the data analysis correlation prediction model to obtain the predicted data analysis correlation result;
[0438] If the data analysis correlation result indicates that the target instruction is not relevant to the data analysis, the retrieval based on the target instruction is stopped.
[0439] Optionally, the correlation analysis unit is specifically used for:
[0440] Get keyword recognition rules;
[0441] Based on the keyword recognition rules, recognize keywords from the target instructions;
[0442] Input keywords into the target database and use the target retrieval algorithm to obtain the initial database search results.
[0443] Optionally, the correlation analysis unit is specifically used for:
[0444] Determining the word frequency of the candidate data segment relative to the keyword based on the number of times the keyword appears in each candidate data segment in the target database;
[0445] Determining an inverse document frequency of the candidate data segments relative to the keyword based on the number of candidate data segments containing the keyword in the target database;
[0446] Based on the word frequency and the inverse document frequency, the target data segment is determined from each candidate data segment in the target database as the database initial inspection result.
[0447] Optionally, the correlation analysis unit is specifically used for:
[0448] obtaining a first hypothesis condition for data analysis correlation;
[0449] Based on the first assumption condition, generating a first clause, the first clause being used to indicate whether the target instruction is related to data analysis based on the first assumption condition;
[0450] generating a first branch processing clause and a second branch processing clause, the first branch processing clause indicating processing when the target instruction is related to the data analysis, and the second branch processing clause indicating processing when the target instruction is not related to the data analysis;
[0451] A third introductory statement is generated based on the first clause, the first branch processing clause, and the second branch processing clause.
[0452] Optionally, the first input unit 3820 is specifically used for:
[0453] Obtaining a first definition and a first example of each first type element;
[0454] Based on the first definition and the first example, generate a second clause, the second clause being used to indicate whether the target instruction contains a first type of element based on the first definition and the first example;
[0455] Generate a third branch processing clause and a fourth branch processing clause, the third branch processing clause indicating display content when the target instruction includes the first type of element, and the fourth branch processing clause indicating display content when the target instruction does not include the first type of element;
[0456] A first introduction is generated based on the second clause, the third branch processing clause, and the fourth branch processing clause.
[0457] Optionally, the first input unit 3820 is specifically used for:
[0458] Acquire a first analysis process, a first mark, and a first text description, wherein the first analysis process is an analysis process in which a target instruction includes a first type of element, the first mark indicates that the target instruction includes the first type of element, and the first text description is a text description in which the target instruction includes the first type of element;
[0459] Generate a third branch processing clause based on the first analysis process, the first tag, and the first text description;
[0460] Obtaining a second analysis process, a second mark, and a second text description, wherein the second analysis process is an analysis process in which the target instruction does not include the first type of element, the second mark indicates that the target instruction does not include the first type of element, and the second text indicates the first type of element missing from the target instruction;
[0461] Based on the second analysis process, the second tag, and the second text description, a fourth branch processing clause is generated.
[0462] Optionally, the second input unit 3830 is specifically used for:
[0463] Obtain a second definition and a second example of each second type element;
[0464] Based on the second definition and the second example, generate a third clause, where the third clause is used to instruct to extract a second type of element from the target instruction based on the second definition and the second example;
[0465] Based on the extraction principle of extracting the second type of elements, a fourth clause is generated;
[0466] Based on the third clause and the fourth clause, a second introduction is generated.
[0467] Optionally, the target database includes a business knowledge sub-base, and the business knowledge sub-base includes multiple knowledge items;
[0468] The first determining unit 3840 is specifically configured to:
[0469] For each second type element, searching for a first matching knowledge item matching the second type element from a plurality of knowledge items;
[0470] If there are multiple first matching knowledge items retrieved, add the multiple first matching knowledge items into the word segmentation expansion dictionary;
[0471] Referring to the word segmentation expansion dictionary, the second type of elements are segmented to obtain post-segmentation elements;
[0472] Determine multiple candidate clarification options corresponding to the post-segmentation element.
[0473] Optionally, the business knowledge sub-base further includes a plurality of knowledge sub-items corresponding to the knowledge item;
[0474] The first determining unit 3840 is specifically configured to:
[0475] Based on the post-segmentation elements, search the business knowledge sub-base;
[0476] If the business knowledge sub-base is searched to obtain a second matching knowledge item that matches the post-segmentation element, and in the business knowledge sub-base, the second matching knowledge item corresponds to multiple second knowledge sub-items, then multiple candidate clarification options are generated based on the multiple second knowledge sub-items.
[0477] Optionally, the first determining unit 3840 is specifically configured to:
[0478] Determine that a second matching knowledge item matching the post-word segmentation element is obtained by searching the business knowledge sub-base, and in the business knowledge sub-base, the second matching knowledge item corresponds to a plurality of second knowledge sub-items;
[0479] Inputting the post-segmentation element and the fifth guide word corresponding to the post-segmentation element into the knowledge sub-item prediction model to obtain at least one predicted supplementary knowledge sub-item corresponding to the post-segmentation element;
[0480] Based on the plurality of second knowledge sub-items and the at least one supplemental knowledge sub-item, a plurality of candidate clarification options are generated.
[0481] Optionally, the first determining unit 3840 is specifically configured to:
[0482] If the search of the business knowledge sub-base does not obtain a second matching knowledge item that matches the post-segmentation element, the post-segmentation element and the fourth guide word corresponding to the post-segmentation element are input into the common sense element recognition model;
[0483] If the common sense element recognition model recognizes that the post-segmentation element is not a common sense element, a supplement request is generated, and the supplement request is used to request supplementation of the post-segmentation element.
[0484] Optionally, the first determining unit 3840 is specifically configured to:
[0485] Based on the definition of the common sense element, a fifth clause is generated, and the fifth clause is used to indicate whether the element after the word segmentation is a common sense element based on the definition of the common sense element;
[0486] Generate recognition rule clauses based on recognition rules of common sense elements;
[0487] Based on the fifth clause and the identification rule clause, a fourth introduction is generated.
[0488] Optionally, the correction unit 3850 is specifically configured to:
[0489] receiving element supplementary information for a first type of element input by a target user and a selection command for selecting a target clarification option from a plurality of candidate clarification options;
[0490] Supplementing the first type of elements in the target instruction based on the element supplement information;
[0491] Based on the target clarification option, the second type of elements in the target instruction are modified, and the target instruction after the first type of elements are supplemented and the second type of elements are modified is used as the modified instruction.
[0492] Optionally, the correction unit 3850 is specifically configured to:
[0493] Obtaining a first type and first context information of a target instruction;
[0494] Obtain a historical instruction set of a target user, where the target user is the user who issued the target instruction;
[0495] For each historical instruction in the historical instruction set, obtaining a second type and a second context information of the historical instruction;
[0496] If the second type of a historical instruction in the historical instruction set matches the first type, and the second context information of the historical instruction matches the first context information, obtaining the first historical type element and the second historical type element in the historical instruction;
[0497] Based on the first history type element, generating element supplementary information, and based on the second history type element, generating a selection command;
[0498] Based on the element supplementary information and the selection command, the target instruction is corrected to obtain a corrected instruction.
[0499] Reference Fig.39 , Fig.39 The structural block diagram of the terminal part for implementing the database retrieval method of the embodiment of the present disclosure is as follows: the terminal includes: a radio frequency (RF) circuit 3910, a memory 3915, an input unit 3930, a display unit 3940, a sensor 3950, an audio circuit 3960, a wireless fidelity (WiFi) module 3970, a processor 3980, and a power supply 3990. Those skilled in the art can understand that Fig.39 The terminal structure shown does not constitute a limitation on the mobile phone or computer, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0500] RF circuit 3910 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information from the base station, it is sent to processor 3980 for processing; in addition, the designed uplink data is sent to the base station.
[0501] The memory 3915 may be used to store software programs and modules. The processor 3980 executes various functional applications and data processing of the content terminal by running the software programs and modules stored in the memory 3915 .
[0502] The input unit 3930 may be used to receive input digital or character information and generate key signal input related to the setting and function control of the content terminal. Specifically, the input unit 3930 may include a touch panel 3931 and other input devices 3932.
[0503] The display unit 3940 may be used to display input information or provided information and various menus of the content terminal. The display unit 3940 may include a display panel 3941.
[0504] The audio circuit 3960, the speaker 3961, and the microphone 3962 may provide an audio interface.
[0505] In this embodiment, the processor 3980 included in the terminal can execute the database retrieval method of the previous embodiment.
[0506] The terminals of the embodiments of the present disclosure include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. The embodiments of the present invention can be applied to various scenarios, including but not limited to business intelligence analysis, online analysis and processing, etc.
[0507] Fig.40 A block diagram of the structure of a portion of a server for implementing the database retrieval method of an embodiment of the present disclosure. The server may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPUs) 4022 (for example, one or more processors) and a memory 4032, and one or more storage media 4030 (for example, one or more mass storage devices) storing application programs 4042 or data 4044. Among them, the memory 4032 and the storage medium 4030 can be short-term storage or permanent storage. The program stored in the storage medium 4030 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 4022 can be configured to communicate with the storage medium 4030 and execute a series of instruction operations in the storage medium 4030 on the server.
[0508] The server may also include one or more power supplies 4026, one or more wired or wireless network interfaces 4050, one or more input and output interfaces 4058, and / or one or more operating systems 4041, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0509] The central processor 4022 in the server can be used to execute the database retrieval method of the embodiment of the present disclosure.
[0510] The embodiments of the present disclosure further provide a computer-readable storage medium, which is used to store program codes, and the program codes are used to execute the database retrieval methods of the aforementioned embodiments.
[0511] The embodiment of the present disclosure also provides a computer program product, which includes a computer program. A processor of a computer device reads and executes the computer program, so that the computer device executes and implements the above-mentioned database retrieval method.
[0512] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present disclosure and the above-mentioned drawings are used to distinguish similar contents, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "comprises" and "comprising" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0513] It should be understood that in the present disclosure, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated content, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the associated content before and after is in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0514] It should be understood that in the description of the embodiments of the present disclosure, the meaning of multiple (or multiple items) is more than two, greater than, less than, exceed, etc. are understood as not including the number, and above, below, within, etc. are understood as including the number.
[0515] In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0516] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0517] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0518] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server 130, or network device, etc.) to perform all or part of the steps of the various embodiments of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store program codes.
[0519] It should also be understood that the various implementations provided in the embodiments of the present disclosure can be combined arbitrarily to achieve different technical effects.
[0520] The above is a specific description of the implementation methods of the present disclosure, but the present disclosure is not limited to the above implementation methods. Technical personnel familiar with the art can also make various equivalent modifications or substitutions without violating the spirit of the present disclosure. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present disclosure.
Claims
1. A database retrieval method, characterized in that: include: Acquire a target database and a target instruction for searching the target database; The target instruction and the first guide corresponding to the target instruction are input into a first type element extraction model to obtain extracted first type elements, wherein the first type elements are elements that need to be supplemented in the target instruction; the first guide is generated in the following manner: obtaining a first definition and a first example of each first type element; generating a second clause based on the first definition and the first example, the second clause being used to indicate whether the target instruction contains the first type element based on the first definition and the first example; generating a third branch processing clause and a fourth branch processing clause, the third branch processing clause indicating the display content when the target instruction contains the first type element, and the fourth branch processing clause indicating the display content when the target instruction does not contain the first type element; generating the first guide based on the second clause, the third branch processing clause and the fourth branch processing clause; Inputting the target instruction and the second guide language corresponding to the target instruction into a second type element extraction model to obtain extracted second type elements, wherein the second type elements are elements in the target instruction that need to be clarified; Based on the second type of elements and the target database, determining a plurality of candidate clarification options corresponding to the second type of elements; Based on the element supplementary information for the first type of element and the selection command for the plurality of candidate clarification options, the target instruction is modified to obtain a modified instruction, and a search is performed in the target database based on the modified instruction.
2. The database search method according to claim 1, characterized in that: Before inputting the target instruction and the first guide word corresponding to the target instruction into the first type element extraction model to obtain the extracted first type element, the database retrieval method further includes: Based on the target instruction, searching the target database to obtain a preliminary database inspection result; Inputting the target instruction, the database initial inspection result, and a third guide word corresponding to the target instruction and the database initial inspection result into a data analysis correlation prediction model to obtain a predicted data analysis correlation result; If the data analysis dependency result indicates that the target instruction is not relevant to data analysis, retrieval based on the target instruction is stopped.
3. The database search method according to claim 2, characterized in that: The step of searching the target database based on the target instruction to obtain a preliminary database inspection result includes: Get keyword recognition rules; Based on the keyword recognition rule, recognize keywords from the target instruction; The keywords are input into the target database, and the target search algorithm is used to obtain the initial search result of the database.
4. The database search method according to claim 3, characterized in that: The step of inputting the keyword into the target database and obtaining the initial search result of the database using a target search algorithm includes: Determining the word frequency of the candidate data segment relative to the keyword based on the number of times the keyword appears in each candidate data segment in the target database; determining an inverse document frequency of the candidate data segment relative to the keyword based on the number of candidate data segments in the target database that contain the keyword; Based on the word frequency and the inverse document frequency, a target data segment is determined from each candidate data segment in the target database as the database initial inspection result.
5. The database search method according to claim 2, characterized in that: The third guide is generated in the following way: obtaining a first hypothesis condition for data analysis correlation; Based on the first assumption condition, generating a first clause, the first clause being used to indicate whether the target instruction is related to data analysis based on the first assumption condition; generating a first branch processing clause and a second branch processing clause, wherein the first branch processing clause indicates processing when the target instruction is related to data analysis, and the second branch processing clause indicates processing when the target instruction is not related to data analysis; The third introduction is generated based on the first clause, the first branch processing clause, and the second branch processing clause.
6. The database search method according to claim 1, characterized in that: The generating of the third branch processing clause and the fourth branch processing clause comprises: Acquire a first analysis process, a first mark, and a first text description, wherein the first analysis process is an analysis process in which the target instruction includes the first type of element, the first mark indicates that the target instruction includes the first type of element, and the first text description is a text description in which the target instruction includes the first type of element; Generate the third branch processing clause based on the first analysis process, the first tag, and the first text description; Acquire a second analysis process, a second mark, and a second text description, wherein the second analysis process is an analysis process in which the target instruction does not include the first type of element, the second mark indicates that the target instruction does not include the first type of element, and the second text indicates the first type of element missing from the target instruction; The fourth branch processing clause is generated based on the second analysis process, the second tag, and the second text description.
7. The database search method according to claim 1, characterized in that: The second guide is generated in the following way: Obtain a second definition and a second example of each second type element; Based on the second definition and the second example, generate a third clause, the third clause being used to instruct to extract the second type element from the target instruction based on the second definition and the second example; generating a fourth clause based on the extraction principle for extracting the second type of elements; The second introduction is generated based on the third clause and the fourth clause.
8. The database search method according to claim 1, characterized in that: The target database includes a business knowledge sub-base, and the business knowledge sub-base includes multiple knowledge items; The determining, based on the second type of elements and the target database, a plurality of candidate clarification options corresponding to the second type of elements includes: For each of the second-type elements, searching the plurality of knowledge items for a first matching knowledge item that matches the second-type element; If the retrieved first matching knowledge items are multiple, adding the multiple first matching knowledge items to the word segmentation expansion dictionary; Referring to the segmentation expansion dictionary, segmenting the second type of elements to obtain segmented elements; A plurality of candidate clarification options corresponding to the post-segmentation elements are determined.
9. The database search method according to claim 8, characterized in that: The business knowledge sub-base also includes a plurality of knowledge sub-items corresponding to the knowledge item; The determining of the plurality of candidate clarification options corresponding to the post-segmentation elements includes: Based on the post-segmentation elements, searching the business knowledge sub-base; If a second matching knowledge item matching the segmented element is obtained by searching the business knowledge sub-base, and in the business knowledge sub-base, the second matching knowledge item corresponds to a plurality of second knowledge sub-items, then the plurality of candidate clarification options are generated based on the plurality of second knowledge sub-items.
10. The database search method according to claim 9, characterized in that: If the business knowledge sub-base is searched to obtain a second matching knowledge item that matches the post-segmentation element, and in the business knowledge sub-base, the second matching knowledge item corresponds to a plurality of second knowledge sub-items, then based on the plurality of second knowledge sub-items, generating the plurality of candidate clarification options comprises: Determine to retrieve the business knowledge sub-base to obtain a second matching knowledge item that matches the post-segmentation element, and in the business knowledge sub-base, the second matching knowledge item corresponds to a plurality of second knowledge sub-items; Inputting the post-segmentation element and the fifth guide word corresponding to the post-segmentation element into a knowledge sub-item prediction model to obtain at least one predicted supplementary knowledge sub-item corresponding to the post-segmentation element; The plurality of candidate clarification options are generated based on the plurality of second knowledge sub-items and the at least one supplemental knowledge sub-item.
11. The database search method according to claim 10, characterized in that: After searching the business knowledge sub-base based on the post-segmentation elements, the database search method further includes: If no second matching knowledge item matching the post-segmentation element is obtained by searching the business knowledge sub-base, the post-segmentation element and a fourth guide word corresponding to the post-segmentation element are input into a common sense element recognition model; If the common sense element recognition model recognizes that the post-segmentation element is not a common sense element, a supplement request is generated, where the supplement request is used to request supplementation of the post-segmentation element.
12. The database search method according to claim 11, characterized in that: The fourth guide is generated in the following way: Based on the definition of the common sense element, generating a fifth clause, the fifth clause being used to indicate whether the post-participle element is the common sense element based on the definition of the common sense element; Based on the recognition rules of the common sense elements, generating recognition rule clauses; The fourth guide is generated based on the fifth clause and the recognition rule clause.
13. The database search method according to claim 1, characterized in that: The step of modifying the target instruction based on the element supplementary information for the first type of element and the selection command for the plurality of candidate clarification options to obtain a modified instruction includes: receiving the element supplementary information for the first type of element input by a target user and the selection command for selecting a target clarification option from among the plurality of candidate clarification options; Supplementing the first type of elements in the target instruction based on the element supplement information; Based on the target clarification option, the second type element in the target instruction is modified, and the target instruction after the first type element is supplemented and the second type element is modified is used as the modified instruction.
14. The database search method according to claim 1, characterized in that: The step of modifying the target instruction based on the element supplementary information for the first type of element and the selection command for the plurality of candidate clarification options to obtain a modified instruction includes: Acquire a first type and first context information of the target instruction; Acquire a historical instruction set of a target user, where the target user is a user who issues the target instruction; For each historical instruction in the historical instruction set, obtaining a second type and a second context information of the historical instruction; If the second type of a historical instruction in the historical instruction set matches the first type, and the second context information of the historical instruction matches the first context information, obtaining a first historical type element and a second historical type element in the historical instruction; generating the element supplementary information based on the first history type element, and generating the selection command based on the second history type element; Based on the element supplementary information and the selection command, the target instruction is modified to obtain the modified instruction.
15. A database retrieval device, characterized in that: include: an acquisition unit, used for acquiring a target database and a target instruction for searching the target database; a first input unit, configured to input the target instruction and a first guide corresponding to the target instruction into a first type element extraction model to obtain extracted first type elements, wherein the first type elements are elements that need to be supplemented in the target instruction; the first guide is generated by: obtaining a first definition and a first example of each first type element; generating a second clause based on the first definition and the first example, the second clause being used to indicate whether the target instruction contains the first type element based on the first definition and the first example; generating a third branch processing clause and a fourth branch processing clause, the third branch processing clause indicating display content when the target instruction contains the first type element, and the fourth branch processing clause indicating display content when the target instruction does not contain the first type element; generating the first guide based on the second clause, the third branch processing clause and the fourth branch processing clause; A second input unit is used to input the target instruction and a second guide word corresponding to the target instruction into a second type element extraction model to obtain extracted second type elements, wherein the second type elements are elements in the target instruction that need to be clarified; A first determining unit, configured to determine, based on the second type of elements and the target database, a plurality of candidate clarification options corresponding to the second type of elements; The modifying unit is configured to modify the target instruction based on the element supplementary information for the first type of element and the selection command for the plurality of candidate clarification options to obtain a modified instruction, and perform a search in the target database based on the modified instruction.
16. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the database search method according to any one of claims 1 to 14 is implemented.
17. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the database search method according to any one of claims 1 to 14 is implemented.
18. A computer program product, comprising a computer program, wherein the computer program is read and executed by a processor of a computer device, so that the computer device executes the database retrieval method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Report generation method and device, electronic equipment and storage medium
CN117593410A
Conversation processing method, related equipment and storage medium
CN117951258A
Data query method and device, medium and electronic equipment
CN117971875A