Intelligent question and answer method and device in refining field

By determining the data type of user queries in the refining field and generating SQL statements using classification and SQL generation models, the problem of low accuracy and efficiency in intelligent question answering in the refining field is solved, resulting in cost reduction and improved user experience.

CN121326942BActive Publication Date: 2026-04-14RICHFIT INFORMATION TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511427395.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-30
Publication Date
2026-04-14
Estimated Expiration
2045-09-30

AI Technical Summary

Technical Problem

Existing intelligent question-answering technologies in the refining and chemical industry suffer from problems such as low accuracy, low efficiency, high cost, low generalization ability, and poor user experience, especially when dealing with abstract descriptions and multi-turn interactions.

Method used

By acquiring user query data, we determine whether the query is for real-time data or metrics. We then use a pre-trained classification model to perform intent recognition and slot extraction, combine it with a tag mapping table to generate SQL statements, and use the trained SQL generation model to query the data. Depending on the complexity of the requirements, we call APIs or NL2SQL to provide feedback.

Benefits of technology

It has improved the accuracy, efficiency, and generalization ability of intelligent question answering in the refining and chemical industry, reduced costs, and enhanced user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121326942B_ABST
    Figure CN121326942B_ABST
Patent Text Reader

Abstract

The application discloses a kind of intelligent inquiry method and device in refining field, the method includes: obtaining user asking data;Judge user asking data is real-time data asking data demand or index asking data demand;Judge is real-time data asking data demand data, execute: determine intent type;Generation word slot matching result;Determine position number information;Generate first SQL sentence;Execute first SQL sentence, output the first feedback result of user asking data;Judge is index asking data demand data, execute: complexity judgment is carried out to user asking data;According to complexity judgment result, generate second SQL sentence after execution, output the second feedback result corresponding to user asking data, can improve the accuracy, efficiency and generalization ability of intelligent inquiry in refining field, reduce cost, improve user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of large-scale model technology, and in particular to an intelligent question-and-answer method and device for the refining and chemical industry. Background Technology

[0002] This section is intended to provide background or context for embodiments of the present invention. The description herein is not intended to imply that it is prior art simply because it is included in this section.

[0003] With the continuous development of the social economy, the refining and chemical industry is developing at an increasingly rapid pace, market competition is becoming increasingly fierce, and the application of modern information technology is becoming more and more frequent. Refining and chemical enterprises are increasingly embarking on the path of information technology construction. Collecting and integrating various types of data is an important but tedious task in information technology construction. Currently, databases are the main way to store data. However, how to accurately provide users with the data they need from a database that stores large amounts of data remains a pain point and a challenge.

[0004] Existing technologies typically involve users inputting questions to obtain data, then using a rule engine and SQL (Structured Query Language) templates for intelligent question answering. However, this method has several drawbacks: it requires manually writing a large number of matching rules, multi-round interactions necessitate hard-coded state machines, resulting in high development costs; it only supports preset sentence structures, leading to low generalization ability; and it cannot handle abstract descriptions such as "What is the current load of atmospheric pressure unit 1?" (where atmospheric pressure unit 1 refers to one set of atmospheric and vacuum distillation unit). Therefore, existing technologies suffer from low accuracy, low efficiency, high cost, low generalization ability, and poor user experience in intelligent question answering within the refining and chemical industry. Summary of the Invention

[0005] This invention provides an intelligent question-answering method for the refining and chemical industry, aimed at improving the accuracy, efficiency, and generalization ability of intelligent question-answering in this field, reducing costs, and enhancing user experience. The method includes:

[0006] Obtain user question data;

[0007] Determine whether the user's query data is a real-time data query or a metric query. If it is determined to be a real-time data query, it means that the user's query data is being processed as time-series data stored in a time-series database. If it is determined to be a metric query, it means that the user's query data is being processed as metric data stored in a relational database.

[0008] Once it is determined that the user's query data is real-time data demand data, perform the following steps:

[0009] Using a pre-trained classification model, the intent of user query data is identified to determine the intent type; the intent type includes one or any combination of data query, data addition, data deletion and data modification.

[0010] The user query data is processed by first slot extraction to generate slot matching results; the first slot extraction process is used to match the user query data with preset slots.

[0011] Based on the slot matching results and the pre-configured position number mapping table, determine the position number information;

[0012] Input the intent type, tag number information, and matching result into the pre-trained SQL generation model to generate the first SQL statement; the SQL generation model is obtained by training a large model using a training set; the training set includes preset user question data and the intent type, tag number information, matching result, and SQL statement corresponding to the preset user question data;

[0013] Execute the first SQL statement and output the first feedback result of the user's question data;

[0014] Once it is determined that the user's query data is data related to metric requirements, perform the following steps:

[0015] Perform complexity assessment on user query data and generate complexity assessment results;

[0016] Based on the complexity assessment result, after generation, the second SQL statement is executed to output the second feedback result corresponding to the user's question data.

[0017] This invention also provides an intelligent question-answering device for the refining and chemical industry, used to improve the accuracy, efficiency, and generalization ability of intelligent question-answering in the refining and chemical industry, reduce costs, and enhance user experience. The device includes:

[0018] The acquisition module is used to acquire user-asked questions data;

[0019] The judgment module is used to determine whether the user's query data is a real-time data query requirement or a metric query requirement. If the user's query data is determined to be a real-time data query requirement, it means that the user's query data is processed as time series data stored in a time series database. If the user's query data is determined to be a metric query requirement, it means that the user's query data is processed as metric data stored in a relational database.

[0020] The first execution module, when determining that the user's query data is real-time data request data, performs the following steps:

[0021] Using a pre-trained classification model, the intent of user query data is identified to determine the intent type; the intent type includes one or any combination of data query, data addition, data deletion and data modification.

[0022] The user query data is processed by first slot extraction to generate slot matching results; the first slot extraction process is used to match the user query data with preset slots.

[0023] Based on the slot matching results and the pre-configured position number mapping table, determine the position number information;

[0024] Input the intent type, tag number information, and matching result into the pre-trained SQL generation model to generate the first SQL statement; the SQL generation model is obtained by training a large model using a training set; the training set includes preset user question data and the intent type, tag number information, matching result, and SQL statement corresponding to the preset user question data;

[0025] Execute the first SQL statement and output the first feedback result of the user's question data;

[0026] The second execution module is used to perform the following steps when it is determined that the user's query data is a data requirement for metrics:

[0027] Perform complexity assessment on user query data and generate complexity assessment results;

[0028] Based on the complexity assessment result, after generation, the second SQL statement is executed to output the second feedback result corresponding to the user's question data.

[0029] Compared with existing intelligent question-answering technologies, this invention obtains user question data; determines whether the user question data is a real-time data query requirement or an indicator query requirement; if it is a real-time data query requirement, the processing object is time-series data stored in a time-series database; if it is an indicator query requirement, the processing object is indicator data stored in a relational database; when it is determined that the user question data is a real-time data query requirement, the following steps are performed: using a pre-trained classification model, the intent of the user question data is identified to determine the intent type; the intent type includes one or any combination of data query, data addition, data deletion, and data modification; the user question data undergoes first slot extraction processing to generate slot matching results; the first slot extraction processing is used to match the user question data with a preset... Slot matching is performed; based on the slot matching results and a pre-configured tag mapping table, tag information is determined; the intent type, tag information, and matching results are input into a pre-trained SQL generation model to generate the first SQL statement; the SQL generation model is obtained by training a large model using a training set; the training set includes preset user question data and the intent type, tag information, matching results, and SQL statement corresponding to the preset user question data; the first SQL statement is executed, outputting the first feedback result of the user question data; when it is determined that the user question data is indicator question demand data, the following steps are performed: the complexity of the user question data is judged, and a complexity judgment result is generated; based on the complexity judgment result, a second SQL statement is generated and executed, outputting the second feedback result corresponding to the user question data. This can improve the accuracy, efficiency, and generalization ability of intelligent question answering in the refining and chemical industry, reduce costs, and improve user experience. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:

[0031] Figure 1 This is a flowchart of an intelligent question-answering method in the refining field provided in an embodiment of the present invention;

[0032] Figure 2 A flowchart illustrating a specific example of an intelligent question-answering method in the refining field provided in this embodiment of the invention;

[0033] Figure 3 A flowchart illustrating a specific example of an intelligent question-answering method in the refining field provided in this embodiment of the invention;

[0034] Figure 4 A flowchart illustrating a specific example of an intelligent question-answering method in the refining field provided in this embodiment of the invention;

[0035] Figure 5 This is a schematic diagram of the structure of an intelligent question-and-answer device in the refining and chemical industry provided in an embodiment of the present invention;

[0036] Figure 6 This is a schematic diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0037] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0038] The acquisition, storage, use, and processing of data in this application comply with relevant laws and regulations.

[0039] In this document, the term "and / or" merely describes a relationship, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0040] In the description of this specification, the terms "comprising," "including," "having," and "containing" are open-ended terms, meaning that they include but are not limited to. The terms "an embodiment," "a specific embodiment," "some embodiments," and "for example," etc., refer to specific features, structures, or characteristics described in connection with that embodiment or example that are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, or characteristics described can be combined in any suitable manner in one or more embodiments or examples. The order of steps involved in the various embodiments is used to illustrate the implementation of this application, and the order of steps is not limited and can be adjusted appropriately as needed.

[0041] In view of the problems existing in the prior art, the purpose of this invention is to provide a method for implementing intelligent question answering in the refining field using a large model + slot mechanism. This method reduces development costs by fine-tuning to adapt to new slots, understands the equivalence of "constant 1" and "normal and reduced pressure (first set)" to improve generalization ability, automatically tracks slots based on an attention mechanism, and achieves fuzzy querying by associating slots. To achieve the above objective, this invention provides an intelligent question answering method for the refining field. Figure 1 This is a flowchart of an intelligent question-answering method in the refining field provided in an embodiment of the present invention, such as... Figure 1 As shown, the method may include:

[0042] Step 101: Obtain user question data;

[0043] Step 102: Determine whether the user's question data is a real-time data requirement or a metric requirement. If the user's question data is a real-time data requirement, it means that the processing object of the user's question data is time series data stored in a time series database. If the user's question data is a metric requirement, it means that the processing object of the user's question data is metric data stored in a relational database.

[0044] Step 103: If it is determined that the user's question data is real-time data demand data, proceed to steps 104 to 108; if it is determined that the user's question data is indicator demand data, proceed to steps 109 to 111. Figure 2 A flowchart illustrating a specific example of an intelligent question-answering method in the refining field provided in this embodiment of the invention is shown below. Figure 2 As shown, intelligent question-answering methods in the refining and chemical industry also include:

[0045] Step 104: Using a pre-trained classification model, perform intent recognition on the user's query data to determine the intent type; the intent type includes one or any combination of data query, data addition, data deletion, and data modification.

[0046] Step 105: Perform first slot extraction processing on the user question data to generate slot matching results; the first slot extraction processing is used to match the user question data with preset slots;

[0047] Step 106: Determine the bit information based on the slot matching results and the pre-configured bit mapping table;

[0048] Step 107: Input the intent type, tag number information and matching result into the pre-trained SQL generation model to generate the first SQL statement; the SQL generation model is obtained by training a large model using a training set; the training set includes preset user question data and the intent type, tag number information, matching result and SQL statement corresponding to the preset user question data;

[0049] Step 108: Execute the first SQL statement and output the first feedback result of the user's question data.

[0050] Figure 3 A flowchart illustrating a specific example of an intelligent question-answering method in the refining field provided in this embodiment of the invention is shown below. Figure 3 As shown, intelligent question-answering methods in the refining and chemical industry also include:

[0051] Step 109: Once it is determined that the user's question data is data related to metric data requirements, perform the following steps:

[0052] Step 110: Perform a complexity assessment on the user query data and generate a complexity assessment result;

[0053] Step 111: Based on the complexity judgment result, generate and execute the second SQL statement to output the second feedback result corresponding to the user's question data.

[0054] The embodiments of the present invention are as follows: Figures 1-3 These steps can improve the accuracy, efficiency, and generalization ability of intelligent question answering in the refining and chemical industry, reduce costs, and enhance user experience.

[0055] Figure 4 A flowchart illustrating a specific example of an intelligent question-answering method in the refining field provided in this embodiment of the invention is shown below. Figure 4 As shown, the intelligent question-answering method in the refining and chemical industry can specifically include: acquiring user question data; determining whether the user question data is a data requirement; if not, calling LLM (Large Language Model) for fallback question answering; if so, determining whether the user question data is a real-time data requirement or an indicator data requirement; if the user question data is a real-time data requirement, determining the tag information and generating an SQL statement; executing the SQL statement; if the user question data is an indicator data requirement, performing a complexity assessment on the user question data; if the complexity of the user question data is high (less than a preset threshold), configuring NL2API and calling the API (Application Programming Interface); if the complexity of the user question data is low (not less than a preset threshold), configuring NL2SQL execution; obtaining preliminary results after successful execution; refining the preliminary results; and outputting the final results.

[0056] First, the data foundation required for the method needs to be established, including a pre-configured tag mapping table and an index question example table. The pre-configured tag mapping table is shown in Tables 1 and 2 below (the data for the same P_ID in Tables 1 and 2 correspond to each other), and may specifically include:

[0057] Device information mapping and association: Establish the mapping relationship between UNIT_NAME (device abbreviation), LC_UNIT_NAME (device full name), and HQ_UNIT_ID (location number);

[0058] Device and enterprise information mapping association: The correspondence between UNIT_NAME (abbreviated device name), LC_UNIT_NAME (full device name), HQ_UNIT_ID (tag number) and CORP_ID (enterprise ID) and CORP_NAME (enterprise name) is sorted out;

[0059] Standardize the DCS and PLC tag numbers, such as converting "TI1601A.PV" to "DGSH_CDU_TI1601A.PV", where "DGSH" is the enterprise prefix code information and "CDU1" is the device prefix code information;

[0060] The relationships between tag information are as follows: HQ_TAG_ID (tag ID), LC_TAG_NAME (tag name), TAG_MIN_VALUE (lower limit of indicator), TAG_MAX_VALUE (upper limit of indicator), and TAG_UNIT (tag unit).

[0061] Table 1

[0062]

[0063]

[0064] Table 2

[0065]

[0066]

[0067]

[0068] Multiple indicator question sample tables were created based on different dimensions. The specific sorting process included:

[0069] Refining and chemical enterprises streamline their plant business object models, including identifying personnel, equipment, products, materials, process segments, production capacity, product definitions, planning, production, and performance. The streamlining process includes:

[0070] 1) Forward analysis: Starting from business processes, reports, and operating procedures, analyze input and output information, and organize, deduplicate, and merge output business objects and attributes;

[0071] 2) Reverse analysis: Starting with the information system, take stock of the existing system database tables and fields, organize, deduplicate, and merge them, and output the business objects and business attributes;

[0072] 3) Combine the results of forward and reverse analysis to form business objects and business attributes.

[0073] Indicator dimensions analysis:

[0074] 1. Divide the business data identified in the first step into different business areas according to the indicator dimensions, such as equipment input and output, storage tank information, utilities, equipment management, quality information, and process technology.

[0075] 2. The input and output of the equipment are divided into major categories such as equipment processing plan, equipment processing volume, equipment production volume, equipment loss volume, material production plan, material production, and material component production;

[0076] 3. The unit processing plan is divided into subcategories such as: monthly unit processing plan, monthly unit production plan, monthly unit material processing plan, monthly unit material production plan, monthly unit material planned yield, and monthly unit planned load.

[0077] 4. Identify keywords for each indicator subcategory: xx unit xx processing plan quantity, xx unit xx production plan quantity, xx unit xx material processing plan quantity, xx unit xx material production plan quantity, xx unit xx material planned yield;

[0078] 5. Examples of question scenarios for each subcategory of indicators: What is the planned processing volume of one atmospheric and vacuum distillation unit on February 1, 2024? What is the planned production volume of one atmospheric and vacuum distillation unit on February 1, 2024? What is the planned crude oil processing volume of one atmospheric and vacuum distillation unit on February 1, 2024? What is the planned production volume of atmospheric non-condensable gas of one atmospheric and vacuum distillation unit on February 1, 2024? What is the planned yield of atmospheric non-condensable gas of one atmospheric and vacuum distillation unit on February 1, 2024? Examples of question scenarios for other indicators are shown in Table 3 below. Table 3 includes examples of unit input and output, storage tank indicators, comprehensive production indicators, utility indicators, and quality analysis indicators.

[0079] Table 3

[0080]

[0081]

[0082]

[0083] Before determining whether user-submitted questions represent a real-time data requirement or a metric requirement, it is necessary to first determine whether the user-submitted questions represent a data requirement.

[0084] In one embodiment, before determining whether the user's question data is a real-time data requirement or a metric requirement, the process may further include: if the user's question data is determined to be a requirement based on the context information of the user's question data, performing a second slot extraction process on the user's question data to generate a slot extraction result; the requirement includes real-time data requirements and / or metric requirements; determining whether the user's question data is a real-time data requirement or a metric requirement may include: determining whether the user's question data is a real-time data requirement or a metric requirement based on the slot extraction result.

[0085] In one embodiment, in step 101, the user's question data can be, for example, text data: "What is the processing volume of one atmospheric and vacuum distillation unit on February 1, 2024?". The user's question and context information are analyzed and judged; the user's question intent is categorized to determine if the user's question is a data demand; if it is determined to be a data demand, then the user's data demand is accurately matched using slot information from structured data used to store and track key information; the analysis in the previous step can determine whether the user is asking for real-time data or indicator data. Context information can be historical user question data within the same scenario as the user's question data. For example, a user opens a new question-and-answer scenario and asks question one: "What is the processing volume of one atmospheric and vacuum distillation unit on February 1, 2024?", and after receiving an answer, asks question two: "What is the current temperature?". Question one is the context information for question two; based on question one, the complete information for question two is: "What is the current temperature of one atmospheric and vacuum distillation unit?". Context information can also be other data that helps understand the user's question data, which will not be elaborated here.

[0086] When the context information of the user's question data indicates a demand for data, a second slot extraction process is performed to generate slot extraction results. This second slot extraction process can be consistent with the first, including: splitting the user's question data; using a dynamic fuzzy matching algorithm and a pre-configured synonym name mapping table, dynamically fuzzily matching the split user's question data with pre-configured slots and time-range slots to generate slot matching results (slot extraction results); the pre-configured slots include the text information of each cell in a pre-configured tag mapping table; the pre-configured tag mapping table includes the mapping relationship between device information, company information, and indicator information, or any combination thereof, and tag information. Alternatively, the second slot extraction process can differ from the first, only splitting the user's question data into phrases and then identifying entities based on the pre-configured tag mapping table.

[0087] In one embodiment, the intelligent question-answering method in the refining and chemical industry may further include: when it is determined, based on the context information of the user's question data, that the user's question data is not a question-based requirement, invoking a pre-trained large language model (LLM) for intelligent question answering; when it is determined to be a non-question-based requirement, invoking a pre-trained large language model (LLM) for fallback question answering.

[0088] In one embodiment, the intelligent data query business scenario includes two types: indicator-based data query and real-time data query. Each of these two scenarios corresponds to three different processing logics. If the user's query data is determined to be a real-time data query requirement, it means the processing object is time-series data stored in a time-series database. If the user's query data is determined to be an indicator-based data query requirement, it means the processing object is indicator data stored in a relational database. Existing feature extraction algorithms can be used to extract features from indicator-based and real-time data queries. Based on these features and the slot extraction results, it can be determined whether the user's query data is a real-time data query requirement or an indicator-based data query requirement.

[0089] Examples of scenarios for real-time data querying:

[0090] User input: What is the current temperature at the top of the atmospheric distillation tower of Petrochemical Unit A?

[0091] Slot trigger: Intent slot: Current value data query;

[0092] Intent recognition: The classification model determines it to be a database query (not an add, delete, or modify operation);

[0093] Slot extraction:

[0094] Through slotting, large models transform unstructured queries into precise database operation instructions while retaining the flexibility of natural language.

[0095] By identifying the device name and company name, the tag mapping table is queried to determine the unique correspondence with the tag information.

[0096] For example, "A Petrochemical" corresponds to the entity with the company name "CORP_NAME", one set of atmospheric and vacuum distillation unit corresponds to the entity with the unit abbreviation "UNIT_NAME", and "top temperature of vacuum distillation tower" corresponds to the entity with the tag name "LC_TAG_NAME".

[0097] The uniqueness of the tag number is determined by identifying the unique tag number information corresponding to "A Petrochemical", "1 set of atmospheric and vacuum distillation unit", and "top temperature of vacuum distillation tower": "HQ_TAG_ID". If no unique tag number information is found, the following steps need to be repeated: output a prompt message, obtain new user query data, and combine it with the original user query data to re-execute the previous steps until a unique tag number information is found.

[0098] By parsing the time and using the word "now" in the question, we can obtain the current time and determine the time range slots (start_time / end_time).

[0099] The terms "UNIT_NAME: Atmospheric and Vacuum Distillation Unit (First Set)" and "LC_UNIT_NAME: 5 Million Tons / Year Atmospheric and Vacuum Distillation Unit" are broken down into individual entries based on their individual characters. Duplicate entries are then removed, and each UNIT_NAME and LC_UNIT_NAME is treated as a separate phrase. For example, "Atmospheric and Vacuum Distillation Unit (First Set)" and "5 Million Tons / Year Atmospheric and Vacuum Distillation Unit" are broken down into "Atmospheric, Vacuum, Pressure, First, Set, 500, Thousand, Tons, Year, Distillation, Unit, Device".

[0100] Preset synonym name mapping table:

[0101] For example, a pre-configured device synonym name mapping table is as follows:

[0102] Device_synonyms = {

[0103] "First set": ["1 set", "one set", "1", "yi", "Ⅰ"]};

[0104] This establishes a mapping relationship between "the first set" and "1 set", "a set", "1", "yi", and "I". It is used to expand and match device names with different expressions.

[0105] The pre-configured enterprise synonym name mapping table is as follows:

[0106] Enterprise_synonyms = {

[0107] "Dushanzi Petrochemical": ["Dushanzi Petrochemical", "Dushanzi", "dushanzi"]};

[0108] The pre-defined tag description synonym name mapping table is as follows:

[0109] Position_synonyms = {

[0110] "Decompression tower top temperature": ["Decompression tower", "tower top temperature", "decompression tower top temperature"]};

[0111] Other preset synonym name mapping tables are similar to those described above, and will not be repeated here.

[0112] In one embodiment, the first word slot extraction process may include: splitting the user question data; using a dynamic fuzzy matching algorithm and a preset synonym name mapping table to perform dynamic fuzzy matching between the split user question data and preset word slots and time range word slots, generating a word slot matching result; the preset word slots include the text information of each cell in a preconfigured tag number mapping table; the preconfigured tag number mapping table includes the mapping relationship between one or any combination of device information, enterprise information, and indicator information and tag number information.

[0113] In one embodiment, the first word slot extraction process specifically includes: performing phrase splitting and single character splitting on the user question data to generate a phrase set and a character set; comparing each character in the character set with each character in the preset word slots and time range word slots one by one to calculate the character difference; correcting the character difference according to the preset synonym name mapping table; using the dynamic fuzzy matching algorithm and the corrected character difference to perform dynamic fuzzy matching, and filling each phrase in the phrase set into the successfully matched preset word slot or time range word slot to generate a word slot matching result.

[0114] Dynamic fuzzy matching:

[0115] According to the split words and phrases, perform dynamic fuzzy matching with the characters in the word slots of the standard phrases to determine the word slots corresponding to the words in the input question.

[0116] For word slots such as device names that may have multiple expressions, calculate the character difference between the input word and the characters in the word slots of the standard phrases through the edit distance (Levenshtein NAME) to perform dynamic fuzzy matching. For example, when the input is "Chang 1", it can be expanded to "atmospheric and vacuum distillation (the first set)" through the fuzzy matching algorithm, and thus can be filled into the corresponding word slot.

[0117] # Example: Calculate similarity (character difference):

[0118] >>>NAME("Chang", "Chang") # Output 0 (0 character difference);

[0119] >>>NAME("Jian", "Jian") # Output 0 (0 character difference);

[0120] >>>NAME("Ya", "Ya") # Output 0 (0 character difference);

[0121] >>>NAME("Zhuang", "Zhuang") # Output 0 (0 character difference);

[0122] >>>NAME("Zhi", "Zhi") # Output 0 (0 character difference);

[0123] >>>NAME("1", "the first set") # Output 0 (0 character difference);

[0124] >>>NAME("Set", "Set") # Output 0 (0 character difference).

[0125] In one embodiment, after performing the first slot extraction process on the user question data to generate a slot matching result, it further includes: determining the header cell corresponding to the preset slot that matches successfully in the slot matching result according to the pre-configured tag number mapping table; using a sequence labeling algorithm to label each phrase in the phrase set according to the text information in the header cell. According to the text information in the header cells of Table 1 - Table 2, use sequence labeling (such as BIO labeling) to identify entities: A Petrochemical → CORP_NAME; 1 set of atmospheric and vacuum distillation units → UNIT_NAME; vacuum tower top temperature → LC_TAG_NAME.

[0126] In one embodiment, determining the tag number information according to the slot matching result and the pre-configured tag number mapping table may include: searching for the uniquely corresponding tag number information in the pre-configured tag number mapping table according to the labeled phrase set; if the uniquely corresponding tag number information is not found, output a prompt message.

[0127] Tag number uniqueness judgment, lock the corresponding tag number information in Table 1 and Table 2 → HQ_TAG_ID;

[0128] Time parsing: Now → time range slot (start_time / end_time);

[0129] In one embodiment, it further includes: obtaining preset user question data and the SQL statement corresponding to the preset user question data; the preset user question data is one or any combination of historical user question data, manually input user question data, and randomly generated user question data; judging whether the preset user question data is a real-time data query requirement or an indicator query requirement; when it is judged that the preset user question data is a real-time data query requirement data, perform the following steps: using the pre-trained classification model to perform intent recognition on the preset user question data to determine the intent type corresponding to the preset user question data; performing the first slot extraction process on the preset user question data to generate the slot matching result corresponding to the preset user question data; determining the tag number information corresponding to the preset user question data according to the slot matching result corresponding to the preset user question data and the pre-configured tag number mapping table; performing noise data cleaning on the preset user question data, the intent type, tag number information, matching result, and SQL statement corresponding to the preset user question data, and then constructing a training set; using the training set to train the large model to obtain an SQL generation model; in the training process, the large model is adapted to the professional terms in the refining field through the low-rank adaptation LoRA fine-tuning technology.

[0130] Steps 102-106 are performed on historical user question data, manually entered user question data, or randomly generated user question data to obtain the corresponding intent type, tag number information, and matching results. The SQL statement can be pre-configured by the user. The historical user question data, manually entered user question data, or randomly generated user question data, along with the corresponding intent type, tag number information, matching results, and SQL statement, are used as the training set to train the large model, generating an SQL generation model. The training process teaches the large model how to generate SQL statements. The training uses the pre-configured indicator subcategories, indicator names, examples, scenario examples, and corresponding SQL names shown in Table 4 below.

[0131] Table 4

[0132]

[0133]

[0134]

[0135]

[0136]

[0137] Based on the SQL generation model, execute the slot-to-SQL transformation rules:

[0138] SELECT * FROM xxx table

[0139]

[0140] In one embodiment, when the intent type is data query, the first and second feedback results of the user's question data are: the queried data or text generated by combining the queried data with the user's question data; when the intent type is data addition, data deletion and / or data modification, the first and second feedback results of the user's question data are data addition result, data deletion result and / or data modification result.

[0141] In this embodiment, as Figure 4 As shown, the result of executing an SQL statement may only be a data point, a preliminary result. For example, if a user's question is: "What is the current temperature at the top of the first vacuum distillation tower in the atmospheric and vacuum distillation unit?", the SQL execution result would be 65. To improve the user experience, the preliminary result needs to be refined. For example, the obtained data can be combined with the slots in the user's question data to output the final result: "The current temperature at the top of the first vacuum distillation tower in the atmospheric and vacuum distillation unit is 65." In addition, large industry models can be used to refine the text output results.

[0142] In one embodiment, appropriate visualization methods can also be selected according to the data type of the query result and user requirements: for experimental data, display it in the form of tables, lists, bar charts, etc.; for real-time data, display it in the form of line charts; embed the visualization results and the original data into the conversation page for users to view and analyze.

[0143] In one embodiment, the intelligent question-answering method in the refining and chemical field provided by the embodiment of the present invention provides a fault tolerance mechanism. In addition to the above-mentioned slot fuzzy matching that automatically expands the user input "Chang 1" to "atmospheric and vacuum distillation (the first set)", the fault tolerance mechanism also provides threshold fallback: when there is no result for LC_TAG_NAME: temperature at the top of the vacuum column, prompt "Please re-describe the tag question information."

[0144] When it is determined that the user's question data is index question number demand data, the following steps are executed: judge the complexity of the user's question data; when it is judged that the complexity of the user's question data is less than the preset threshold, input the user's question data into the pre-trained SQL generation model to generate a second SQL statement; execute the second SQL statement and output the second feedback result of the user's question data; when it is judged that the complexity of the user's question data is not less than the preset threshold, match the corresponding API according to the user's question data; call the API and obtain and output the second feedback result corresponding to the user's question data.

[0145] In one embodiment, judging the complexity of the user's question data may include: inputting the user's question data into a pre-trained complexity judgment model and outputting the complexity of the user's question data; the complexity judgment model is obtained by training an artificial intelligence model with preset user question data marked with complexity; the complexity judgment model judges the complexity of the user's question data by training and learning based on the number of database tables associated with the user's question data.

[0146] In one embodiment, according to the complexity judgment result, after generating, execute the second SQL statement and output the second feedback result corresponding to the user's question data, which may include: when it is judged that the complexity of the user's question data is less than the preset threshold, input the user's question data into the pre-trained SQL generation model to generate a second SQL statement; execute the second SQL statement and output the second feedback result of the user's question data; when it is judged that the complexity of the user's question data is not less than the preset threshold, match the corresponding application programming interface API according to the user's question data; call the API and obtain and output the second feedback result corresponding to the user's question data.

[0147] The internal processing logic of the complexity judgment model is introduced below.

[0148] For each subcategory of indicators, a corresponding SQL statement or API interface is constructed. For example, when a user wants to query "What is the planned processing volume of one set of atmospheric and vacuum distillation unit on February 1, 2024?", a joint query is needed from the "Unit Basic Information Table" and the "Unit Processing Plan Table". Since retrieving the required indicator information takes less time and consumes fewer resources, the NL2SQL (Natural Language to SQL) method is used for the query. An example of the corresponding SQL statement is as follows:

[0149] SELECT processing plan quantity;

[0150] FROM device processing schedule;

[0151] JOIN Unit Basic Information Table ON Unit Processing Plan Table.Unit Number = Unit Basic Information Table.Unit Number; WHERE Unit Basic Information Table.Unit Name = 'Atmospheric and Vacuum Distillation Unit 1 Set';

[0152] AND device processing schedule. Processing date = '2024-02-01';

[0153] When a user queries "What is the planned monthly crude oil yield for set 1 of the atmospheric and vacuum distillation unit in February 2024?", a joint query is required from multiple tables, including "Unit Basic Information Table," "Material Basic Information Table," "Unit Material Information Table," "Unit Material Processing Plan Table," and "Unit Material Production Results Table." Using NL2SQL for this SQL query results in long query times, slow response times, and high server resource consumption. This is likely due to the fact that large models may not be able to produce high-quality SQL statements, potentially leading to data quality issues. However, using NL2API (Natural Language to API, converting natural language queries to APIs) effectively avoids the pressure on data services caused by complex query logic. By calling the API, the load is distributed, improving both data retrieval speed and quality. The API input parameters may include unit name, material name, month, etc. Example code (using Python to call a hypothetical API) is as follows:

[0154]

[0155] The technical architecture of this invention is layered as follows: a three-layer architecture of "large model + vector database + SQL optimizer" is adopted, and a closed-loop feedback system is constructed in combination with business scenarios.

[0156] Semantic understanding and generation layer: Utilizing a massive model with hundreds of billions of elements, it adapts to professional terminology in fields such as oil refining through fine-tuning (LoRA).

[0157] Vector retrieval layer: Converts database table structure and historical query records into vectors and stores them in a vector database to accelerate semantic matching.

[0158] Execution optimization layer: Integrates a large model framework to automatically optimize SQL execution plans and combines a rule engine (such as malicious query rules) to verify results.

[0159] The key strategies for improving accuracy in the embodiments of the present invention are shown in Table 5 below.

[0160] Table 5

[0161]

[0162] Specific examples of business scenarios in this invention:

[0163] 1. User input

[0164] The salesperson entered the following question in natural language: "What is the processing volume of one atmospheric and vacuum distillation unit on February 1, 2024?"

[0165] 2. Semantic parsing and vector retrieval

[0166] Large-scale model analysis problem, extracting key entities (time range, device, tag number / indicator, etc.).

[0167] Vector database retrieval of similar historical queries, matching table structures (materials table, equipment table, inventory table, etc.).

[0168] 3. SQL generation and optimization

[0169] Model generates initial SQL draft:

[0170]

[0171]

[0172] 4. Execution and Result Verification

[0173] The initial SQL draft generated by the large model needs to be executed and the result set validated in a sandbox environment. The sandbox environment pre-copyes the table structure and historical data of the production environment, configures independent read-only permissions to isolate risks, and can preset a small amount of high-risk test data for rule validation. During the execution phase, two SQL statements querying the processing volume of "Ambient Temperature and Distillation Unit I" and "Ambient Temperature and Distillation Unit II" are run sequentially, while performance indicators such as execution time and number of rows scanned are monitored to provide a basis for subsequent analysis.

[0174] Result set validation first focuses on data correctness, verifying whether the time dimension accurately filters the target date, whether the device alias matches the input, and whether the indicator type is correctly distinguished, ensuring that the source of the "processing volume" data conforms to business logic; at the same time, it verifies that the values ​​are non-negative and within a reasonable range to avoid outliers. In conjunction with the rule engine, if the business rule involves cross-enterprise association (such as the risk label of the enterprise to which the device belongs), it is necessary to check whether there are high-risk labels through the associated enterprise risk table and add warnings to the results.

[0175] The rules engine plays a crucial role in the verification process: data permission compliance rules prevent unauthorized access, blocking queries if the user's input device is not in their permission list; time range restriction rules avoid tracing back too long of data, automatically truncating or prompting the user to adjust when the data exceeds the past year; result set size restriction rules, based on system processing capacity, paginate or block data exceeding 100,000 rows in a single table or exceeding 50,000 rows in multi-table joins; data consistency verification rules check for conflicts between tables, ensuring logical consistency between fields such as device and enterprise identifiers; and mandatory audit log recording rules retain all query traces to meet compliance requirements.

[0176] This invention provides precise schema mapping:

[0177] 1. Retrieval Enhancement Generation (RAG): Injects database metadata (table names, field comments) as contextual clues.

[0178] 2. Fine-tuning the model: Fine-tuning the large model on data in a specific domain to improve the accuracy of field recognition.

[0179] 3. Complex query processing:

[0180] Step-by-step generation: First generate the query logic (such as "which tables need to be joined"), and then gradually fill in the details.

[0181] Chain-of-Thought: This requires the model to output intermediate reasoning steps, making it easier to debug.

[0182] 4. Security and Access Control:

[0183] Sandbox execution: Execute the generated SQL in an isolated environment, restricting sensitive operations (such as DROP).

[0184] Dynamic masking: Masking sensitive fields (such as mobile phone numbers) in the results based on user roles.

[0185] 5. Performance optimization:

[0186] Caching mechanism: Cache results for frequently queried queries (such as "sales this month").

[0187] Query rewriting: Optimize SELECT * into specific fields to reduce data transmission volume.

[0188] This invention also proposes an intelligent question-and-answer device for the refining and chemical industry, the principle of which is similar to the intelligent question-and-answer method in the refining and chemical industry, and will not be described in detail here.

[0189] Figure 5 This is a schematic diagram of the structure of an intelligent question-and-answer device in the refining and chemical industry provided in an embodiment of the present invention, such as... Figure 5 As shown, a smart question-and-answer device for the refining and chemical industry may include:

[0190] Module 501 is used to acquire user question data;

[0191] The judgment module 502 is used to determine whether the user's question data is a real-time data query requirement or an indicator query requirement. If the user's question data is determined to be a real-time data query requirement, it means that the processing object of the user's question data is time series data stored in a time series database. If the user's question data is determined to be an indicator query requirement, it means that the processing object of the user's question data is indicator data stored in a relational database.

[0192] The first execution module 503 is used to perform the following steps when it is determined that the user's query data is real-time data query data:

[0193] Using a pre-trained classification model, the intent of user query data is identified to determine the intent type; the intent type includes one or any combination of data query, data addition, data deletion and data modification.

[0194] The user query data is processed by first slot extraction to generate slot matching results; the first slot extraction process is used to match the user query data with preset slots.

[0195] Based on the slot matching results and the pre-configured position number mapping table, determine the position number information;

[0196] Input the intent type, tag number information, and matching result into the pre-trained SQL generation model to generate the first SQL statement; the SQL generation model is obtained by training a large model using a training set; the training set includes preset user question data and the intent type, tag number information, matching result, and SQL statement corresponding to the preset user question data;

[0197] Execute the first SQL statement and output the first feedback result of the user's question data;

[0198] The second execution module 504 is used to perform the following steps when it is determined that the user's query data is a metric query data:

[0199] Perform complexity assessment on user query data and generate complexity assessment results;

[0200] Based on the complexity assessment result, after generation, the second SQL statement is executed to output the second feedback result corresponding to the user's question data.

[0201] In one embodiment, the intelligent question-answering device for the refining and chemical industry may further include: a second slot extraction and processing module, used for:

[0202] When the context information of the user's question data indicates that the user's question data is a question quantity requirement, the user's question data is processed by the second slot extraction process to generate slot extraction results; the question quantity requirement includes real-time data question quantity requirement and / or indicator question quantity requirement.

[0203] Module 502 is specifically used for:

[0204] Based on the slot extraction results, it is determined whether the user's question data reflects a real-time data requirement or a metric requirement. In one embodiment, the intelligent question-answering device in the refining and chemical industry may further include: an intelligent question-answering module, used for:

[0205] If, based on the contextual information of the user's question data, it is determined that the user's question data does not meet the required number of questions, a pre-trained large language model is invoked for intelligent question answering.

[0206] In one embodiment, the first slot extraction process includes:

[0207] Segment the user query data;

[0208] Using a dynamic fuzzy matching algorithm and a preset synonym name mapping table, the split user query data is dynamically fuzzy matched with preset slots and time range slots to generate slot matching results. The preset slots include the text information of each cell in the pre-configured tag mapping table. The pre-configured tag mapping table includes the mapping relationship between one or any combination of device information, enterprise information, and indicator information and tag information.

[0209] In one embodiment, the first slot extraction process specifically includes:

[0210] The user query data is split into phrases and individual characters to generate phrase sets and character sets.

[0211] The character set is compared one by one with each character in the preset slots and time range slots, and the character differences are calculated.

[0212] Based on the preset synonym name mapping table, the character differences are corrected;

[0213] By using a dynamic fuzzy matching algorithm and corrected character differences, dynamic fuzzy matching is performed to fill each word in the word set into a preset word slot or time range word slot that has been successfully matched, thus generating word slot matching results.

[0214] In one embodiment, the intelligent question-and-answer device for the refining and chemical industry may further include: a labeling module, used for:

[0215] Based on the pre-configured tag mapping table, determine the header cell corresponding to the preset slot that was successfully matched in the slot matching results;

[0216] A sequence labeling algorithm is used to label each phrase in the phrase set based on the text information in the header cell.

[0217] In one embodiment, the first execution module 503 is specifically used for:

[0218] The unique corresponding tag information is searched in the pre-configured tag mapping table based on the annotated set of terms.

[0219] If no unique corresponding tag number is found, a prompt message will be output.

[0220] In one embodiment, the intelligent question-answering device for the refining and chemical industry may further include: a training module, used for:

[0221] Retrieve preset user question data and the corresponding SQL statement; the preset user question data can be one or any combination of historical user question data, manually entered user question data, and randomly generated user question data.

[0222] Determine whether the preset user question data is a real-time data query requirement or a metric query requirement;

[0223] If the preset user query data is determined to be real-time data query demand data, perform the following steps:

[0224] Using a pre-trained classification model, intent recognition is performed on preset user question data to determine the intent type corresponding to the preset user question data;

[0225] The first slot extraction process is performed on the preset user question data to generate the slot matching results corresponding to the preset user question data;

[0226] Based on the slot matching results corresponding to the preset user question data and the pre-configured position number mapping table, determine the position number information corresponding to the preset user question data;

[0227] A training set is constructed by cleaning up noisy data from the preset user question data and the intent type, tag information, matching results and SQL statements corresponding to the preset user question data;

[0228] The SQL generation model is obtained by training a large model using the training set; the training process uses low-rank adaptive LoRA fine-tuning technology to adapt the large model to the professional terminology of the refining field.

[0229] In one embodiment, when the intent type is data query, the first feedback result and the second feedback result of the user's question data are: the queried data or the text generated by combining the queried data with the user's question data;

[0230] When the intent type is data addition, data deletion, and / or data modification, the first and second feedback results for the user's data request are data addition, data deletion, and / or data modification results.

[0231] In one embodiment, the second execution module 504 is specifically used for:

[0232] User question data is input into a pre-trained complexity assessment model, which outputs the complexity of the user question data. The complexity assessment model is obtained by training an artificial intelligence model with pre-defined user question data labeled with complexity. The complexity assessment model learns to judge the complexity of user question data based on the number of database tables associated with the user question data through training.

[0233] In one embodiment, the second execution module 504 is specifically used for:

[0234] When the complexity of the user's query data is determined to be less than a preset threshold, the user's query data is input into a pre-trained SQL generation model to generate a second SQL statement.

[0235] Execute the second SQL statement to output the second feedback result of the user's question data;

[0236] When the complexity of the user's query data is determined to be no less than a preset threshold, the corresponding API is matched based on the user's query data.

[0237] Call the API to retrieve and output the second feedback result corresponding to the user's question data.

[0238] Compared with existing intelligent question-answering technologies, this invention obtains user question data; determines whether the user question data is a real-time data query requirement or an indicator query requirement; if it is a real-time data query requirement, the processing object is time-series data stored in a time-series database; if it is an indicator query requirement, the processing object is indicator data stored in a relational database; when it is determined that the user question data is a real-time data query requirement, the following steps are performed: using a pre-trained classification model, the intent of the user question data is identified to determine the intent type; the intent type includes one or any combination of data query, data addition, data deletion, and data modification; the user question data undergoes first slot extraction processing to generate slot matching results; the first slot extraction processing is used to match the user question data with a preset... Slot matching is performed; based on the slot matching results and a pre-configured tag mapping table, tag information is determined; the intent type, tag information, and matching results are input into a pre-trained SQL generation model to generate the first SQL statement; the SQL generation model is obtained by training a large model using a training set; the training set includes preset user question data and the intent type, tag information, matching results, and SQL statement corresponding to the preset user question data; the first SQL statement is executed, outputting the first feedback result of the user question data; when it is determined that the user question data is indicator question demand data, the following steps are performed: the complexity of the user question data is judged, and a complexity judgment result is generated; based on the complexity judgment result, a second SQL statement is generated and executed, outputting the second feedback result corresponding to the user question data. This can improve the accuracy, efficiency, and generalization ability of intelligent question answering in the refining and chemical industry, reduce costs, and improve user experience.

[0239] Compared with existing technologies, this invention provides a method for intelligent querying in the refining field based on a large model and slot mechanism. By fine-tuning to adapt to new slots, it reduces development costs, understands the equivalence of "Constant 1" and "Constant Decompression (First Set)", improves generalization ability, automatically tracks slots based on attention mechanism, and realizes fuzzy query by associating slots.

[0240] This invention also provides a computer device. Figure 6 This is a schematic diagram of a computer device in an embodiment of the present invention. The computer device 600 includes a memory 610, a processor 620, and a computer program 630 stored in the memory 610 and executable on the processor 620. When the processor 620 executes the computer program 630, it implements the above-mentioned intelligent question-and-answer method in the refining field.

[0241] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned intelligent question-and-answer method in the refining field.

[0242] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-mentioned intelligent question-and-answer method in the refining field.

[0243] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0244] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0245] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0246] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0247] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A smart question-answering method in the refining and chemical industry, characterized in that, include: Obtain user question data; Determine whether the user's question data is a real-time data requirement or a metric requirement; if the user's question data is a real-time data requirement, it means that the user's question data is being processed as time-series data stored in a time-series database; if the user's question data is a metric requirement, it means that the user's question data is being processed as metric data stored in a relational database. Once it is determined that the user's query data is real-time data demand data, perform the following steps: Using a pre-trained classification model, intent recognition is performed on user query data to determine the intent type; the intent type includes one or any combination of data query, data addition, data deletion, and data modification. The user query data is processed to extract the first slot and generate slot matching results. The first slot extraction process is used to match user query data with preset slots; Based on the slot matching results and the pre-configured position number mapping table, determine the position number information; The intent type, tag number information, and matching result are input into a pre-trained structured query language (SQL) generation model to generate the first SQL statement. The SQL generation model is obtained by training a large model using a training set. The training set includes preset user question data and the intent type, tag number information, matching result, and SQL statement corresponding to the preset user question data. Execute the first SQL statement and output the first feedback result of the user's question data; Once it is determined that the user's query data is data related to metric requirements, perform the following steps: Perform complexity assessment on user query data and generate complexity assessment results; Based on the complexity assessment result, after generation, the second SQL statement is executed to output the second feedback result corresponding to the user's question data.

2. The method as described in claim 1, characterized in that, Before determining whether a user's query is a real-time data requirement or a metric requirement, the following steps are also required: When the context information of the user's question data indicates that the user's question data is a question quantity requirement, the user's question data is subjected to the second word slot extraction process to generate word slot extraction results; the question quantity requirement includes real-time data question quantity requirement and / or indicator question quantity requirement. Determining whether a user's query is for real-time data or metrics includes: Based on the slot extraction results, determine whether the user's question data is a real-time data query or a metric query.

3. The method as described in claim 1, characterized in that, Also includes: If, based on the contextual information of the user's question data, it is determined that the user's question data does not meet the required number of questions, a pre-trained large language model is invoked for intelligent question answering.

4. The method as described in claim 1, characterized in that, The first slot extraction process includes: Segment the user query data; Using a dynamic fuzzy matching algorithm and a preset synonym name mapping table, the split user query data is dynamically fuzzy matched with preset slots and time range slots to generate slot matching results; the preset slots include the text information of each cell in the pre-configured tag mapping table; the pre-configured tag mapping table includes the mapping relationship between one or any combination of device information, enterprise information and indicator information and tag information.

5. The method as described in claim 4, characterized in that, The first slot extraction process specifically includes: The user query data is split into phrases and individual characters to generate phrase sets and character sets. The character set is compared one by one with each character in the preset slots and time range slots, and the character differences are calculated. The character differences are corrected according to a preset synonym name mapping table; By using a dynamic fuzzy matching algorithm and corrected character differences, dynamic fuzzy matching is performed to fill each word in the word set into a preset word slot or time range word slot that has been successfully matched, thus generating word slot matching results.

6. The method as described in claim 4, characterized in that, After performing the first slot extraction process on the user query data and generating slot matching results, the process also includes: Based on the pre-configured tag mapping table, determine the header cell corresponding to the preset slot that was successfully matched in the slot matching results; A sequence labeling algorithm is used to label each phrase in the phrase set based on the text information in the header cell.

7. The method as described in claim 6, characterized in that, Based on the slot matching results and the pre-configured position number mapping table, determine the position number information, including: The unique corresponding tag information is searched in the pre-configured tag mapping table based on the annotated set of terms. If no unique corresponding tag number is found, a prompt message will be output.

8. The method as described in claim 1, characterized in that, Also includes: Obtain preset user question data and the corresponding SQL statement; the preset user question data is one or any combination of historical user question data, manually entered user question data, and randomly generated user question data. Determine whether the preset user question data is a real-time data query requirement or a metric query requirement; If the preset user query data is determined to be real-time data query demand data, perform the following steps: Using a pre-trained classification model, intent recognition is performed on preset user question data to determine the intent type corresponding to the preset user question data; The first slot extraction process is performed on the preset user question data to generate the slot matching results corresponding to the preset user question data; Based on the slot matching results corresponding to the preset user question data and the pre-configured position number mapping table, determine the position number information corresponding to the preset user question data; A training set is constructed by cleaning up noisy data from the preset user question data and the intent type, tag information, matching results and SQL statements corresponding to the preset user question data; A SQL generation model is obtained by training a large model using the training set; The training process uses low-rank adaptive LoRA fine-tuning technology to adapt the large model to the professional terminology of the refining field.

9. The method as described in claim 1, characterized in that, When the intent type is data query, the first feedback result and the second feedback result of the user question data are: the queried data or the text generated by combining the queried data with the user question data; When the intent type is data addition, data deletion, and / or data modification, the first feedback result and the second feedback result of the user's question data are data addition result, data deletion result, and / or data modification result.

10. The method as described in claim 1, characterized in that, Complexity assessment of user query data includes: User question data is input into a pre-trained complexity judgment model, which outputs the complexity of the user question data. The complexity judgment model is obtained by training an artificial intelligence model using pre-defined user question data with complexity annotation. The complexity judgment model learns to judge the complexity of user question data based on the number of database tables associated with the user question data through training.

11. The method as described in claim 1, characterized in that, Based on the complexity assessment result, after generation, a second SQL statement is executed to output the second feedback result corresponding to the user's question data, including: When the complexity of the user's query data is determined to be less than a preset threshold, the user's query data is input into a pre-trained SQL generation model to generate a second SQL statement. Execute the second SQL statement to output the second feedback result of the user's question data; When the complexity of the user's query data is determined to be no less than a preset threshold, the corresponding application programming interface (API) is matched according to the user's query data. Call the API to retrieve and output the second feedback result corresponding to the user's question data.

12. An intelligent question-and-answer device for the refining and chemical industry, characterized in that, include: The acquisition module is used to acquire user-asked questions data; The judgment module is used to determine whether the user's question data is a real-time data query requirement or an indicator query requirement; if the user's question data is determined to be a real-time data query requirement, it means that the user's question data is processed as time series data stored in a time series database; if the user's question data is determined to be an indicator query requirement, it means that the user's question data is processed as indicator data stored in a relational database. The first execution module, when determining that the user's query data is real-time data request data, performs the following steps: Using a pre-trained classification model, intent recognition is performed on user query data to determine the intent type; the intent type includes one or any combination of data query, data addition, data deletion, and data modification. The user query data is processed to extract the first slot and generate slot matching results. The first slot extraction process is used to match user query data with preset slots; Based on the slot matching results and the pre-configured position number mapping table, determine the position number information; The intent type, tag number information, and matching result are input into a pre-trained structured query language (SQL) generation model to generate the first SQL statement. The SQL generation model is obtained by training a large model using a training set. The training set includes preset user question data and the intent type, tag number information, matching result, and SQL statement corresponding to the preset user question data. Execute the first SQL statement and output the first feedback result of the user's question data; The second execution module is used to perform the following steps when it is determined that the user's query data is a data requirement for metrics: Perform complexity assessment on user query data and generate complexity assessment results; Based on the complexity assessment result, after generation, the second SQL statement is executed to output the second feedback result corresponding to the user's question data.

13. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 1 to 11.

15. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 11.

Citation Information

Patent Citations

  • Question and answer method and system based on military domain knowledge graph

    CN116414961A

  • Natural language intelligent number asking method and device and storage medium

    CN119025552A