Question and answer interaction method based on multi-source data and storage medium
By constructing a question-and-answer interaction method for multi-source data, unified semantic access to multi-source data is achieved, which lowers the threshold for business users to operate heterogeneous data, improves query efficiency and in-depth analysis capabilities, and solves the problems of complexity and accuracy in enterprise-level data query.
Patent Information
- Application Number
- CN202610106856.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-27
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technologies for enterprise-level data querying suffer from high barriers to entry, difficulty in handling multi-source heterogeneous data, and a lack of in-depth analysis capabilities. In particular, they have low accuracy in multi-table joins and advanced query scenarios, and general language models struggle to understand the unique business semantics of enterprises.
We construct a question-and-answer interaction method based on multi-source data. Through semantic layer modeling, we map heterogeneous data sources into a unified semantic model. Combined with a language model, we generate a structured query language, support multi-level permission management and in-depth analysis, and automatically generate structured reports.
It lowers the barrier to entry for business users, improves the efficiency of querying multi-source heterogeneous data, supports in-depth analysis functions, can accurately handle complex query scenarios, and generate intuitive analysis results.
Smart Images

Figure CN121579660A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data query and intelligent analysis, in particular to a question and answer interaction method based on multi-source data and a storage medium. BACKGROUND
[0002] With the promotion of enterprise digitization and intelligentization, enterprises have accumulated a large amount of business data in production, operation, finance, supply chain, human resources and other links. These data are usually stored in different types of data sources in a heterogeneous form, including relational databases, distributed computing engines, cloud data warehouses and various file systems. Traditional data query and analysis methods have obvious limitations: first, business users need to rely on professional technical personnel to write complex query statements or configure reports, which has a high use threshold; second, pre-defined reports are difficult to meet the temporary data exploration needs of business personnel; third, existing systems generally lack unified semantic understanding ability for multi-source heterogeneous data, making it difficult to realize cross-data-source correlation analysis.
[0003] Although the Text2SQL technology that has emerged in recent years has reduced the threshold of data query to some extent, it still has limitations in enterprise-level applications. On the one hand, it lacks support for complex query scenarios, especially in handling multi-table association, window functions and other advanced query functions, the accuracy significantly decreases; on the other hand, general language models are difficult to understand business-specific business semantics and indicator definitions, resulting in deviations between generated query results and actual business needs. In addition, existing solutions are mostly limited to simple fact-based queries and cannot provide predictive analysis, trend judgment and other deep analysis functions, making it difficult to meet the needs of enterprise decision support. SUMMARY
[0004] In view of the deficiencies in the prior art, the present application provides a question and answer interaction method based on multi-source data and a storage medium, which has the advantages of reducing the use threshold of business users, improving the query efficiency of multi-source heterogeneous data, and supporting deep analysis functions.
[0005] In a first aspect, the present application provides a question and answer interaction method based on multi-source data, which comprises: performing semantic layer modeling based on a plurality of heterogeneous data sources to obtain a semantic model; the plurality of heterogeneous data sources include a relational database data source, a distributed engine data source, a cloud data warehouse data source and a file type data source; generating a structured query language for the original question based on the original question to be queried by a user, a pre-set language model and the semantic model; determining a query data set of the original question and a structured report of the original question according to the structured query language; Send the query dataset and the structured report as interactive information of the original question to a terminal corresponding to the user.
[0006] In some embodiments, the semantic layer modeling based on multiple heterogeneous data sources obtains a semantic model, including: The relational database data source, the distributed engine data source, the cloud data warehouse data source, and the file type data source are subjected to semantic data table modeling to obtain a semantic data table model. The semantic data table model, the language model, and the user-supplemented metadata and semantic information are subjected to multi-level permission management to generate the semantic model; the metadata and semantic information include dimensions, indicators, measures, and synonyms corresponding to each field of a business.
[0007] In some embodiments, the dimensions include time dimensions and region dimensions; the indicators include summation indicators and mean indicators; the measures include business measures and data measures; the synonyms include explanation words and logic words of the business; the multi-level permission management of the semantic data table model, the language model, and the user-supplemented metadata and semantic information to generate the semantic model includes: Determining a mapping relationship between each field of a business and the time dimensions, the region dimensions, the summation indicators, the mean indicators, the business measures, the data measures, the explanation words, and the logic words; Based on the semantic data table model, the language model, and the mapping relationship, multi-level permission management is performed to generate the semantic model.
[0008] In some embodiments, the structured query language of the original question is generated based on the original question to be queried by a user, a preset language model, and the semantic model, including: The original question is input into the language model to split and semantically rewrite the original question to generate a target question; The target question is input into the semantic model to perform semantic matching to obtain a query statement related to a business concept of the target question; The query statement is subjected to structured conversion processing to generate the structured query language.
[0009] In some embodiments, the splitting and semantic rewriting of the original question by the language model to generate a target question includes: Performing question recognition on the original question to obtain a question type of the original question, including a fuzzy expression question type and a multi-intention question type; When the question type is the fuzzy expression question type, the original question is supplemented with a time range limitation and then is semantically rewritten to generate the target question; When the question type is the multi-intention question type, the original question is split into sub-questions, and the sub-questions are taken as the target questions.
[0010] In some embodiments, the inputting the target question into the semantic model for semantic matching to obtain a query statement related to a business concept of the target question comprises: extracting keywords of the target question to obtain at least one keyword of the target question; performing semantic matching on each keyword by the semantic model to obtain a matching degree of each keyword; determining a difference between matching degrees corresponding to two keywords with the highest matching degrees; when the difference is less than a preset threshold, generating the query statement based on the two keywords.
[0011] In some embodiments, the method further comprises: when the original question is not split into sub-questions, collecting information of the structured report to form natural language interaction information of the original question; or, splitting the original question into multiple sub-questions, determining interaction information corresponding to each sub-question, and determining the natural language interaction information based on the interaction information corresponding to each sub-question.
[0012] In some embodiments, the method further comprises: when the structured report supports classification or time series analysis, performing attribution interpretation on the structured report to generate an extended question related to the structured report; performing prediction based on the extended question and the structured report to obtain predicted interaction information of the original question.
[0013] In some embodiments, the method further comprises: when the original question is a fact-based question, determining that the natural language interaction information is in the form of data, units, and key descriptions; when the original question is an analysis-based question, determining that the natural language interaction information is in the form of a conclusion, data supporting the conclusion, and judgment logic.
[0014] In a second aspect, embodiments of the present application provide a multi-source data-based question and answer interaction device, which comprises: The modeling module is configured to perform semantic layer modeling based on a plurality of heterogeneous data sources to obtain a semantic model, wherein the plurality of heterogeneous data sources include a relational database data source, a distributed engine data source, a cloud data warehouse data source, and a file type data source. The generating module is configured to generate a structured query language for the original question based on the original question to be queried by the user, a preset language model, and the semantic model. The determining module is configured to determine a query data set of the original question and a structured report of the original question according to the structured query language. The sending module is configured to send the query data set and the structured report as interactive information of the original question to a terminal corresponding to the user.
[0015] In a third aspect, the present application also provides an electronic device, which comprises a processor and a memory, and the memory stores a computer program configured to be executed by the processor to implement the method described in any of the above aspects.
[0016] In a fourth aspect, the present application also provides a computer readable storage medium, which stores a computer program configured to be executed by a processor to implement the method described in any of the above aspects.
[0017] The method for question and answer interaction based on multi-source data provided by the embodiments of the present application integrates multi-source data by constructing a unified semantic model, automatically generates a structured query language and interactive information in combination with a language model, solves the technical problem that the traditional method relies on professional personnel and cannot process multi-source heterogeneous data, and has the advantages of reducing the use threshold of business users, improving the query efficiency of multi-source heterogeneous data, and supporting deep analysis functions. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0019] Figure 1 A flowchart of a method for question and answer interaction based on multi-source data provided by the embodiments of the present application.
[0020] Figure 2 An architecture diagram of a question and answer interaction system based on multi-source data of enterprise-level AI4BI.
[0021] Figure 3 A schematic diagram of a question and answer interaction device based on multi-source data provided by the embodiments of the present application.
[0022] Figure 4 A schematic diagram of an electronic device is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person skilled in the art without creative work fall within the scope of protection of the present application.
[0024] In the description of the present application, the terms "first", "second" are used only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but can optionally include steps or modules not listed, or can optionally include other steps or modules inherent to the process, method, product or device.
[0025] In this document, the term "embodiment" means that the specific features, structures or characteristics described in connection with the embodiment can be included in at least one embodiment of the present application. The phrase appears at various places in the specification does not necessarily all refer to the same embodiment, nor does it necessarily refer to a separate or alternative embodiment. It is explicitly and implicitly understood by a person skilled in the art that the embodiments described herein can be combined with other embodiments.
[0026] The embodiments of the present application provide a question and answer interaction method based on multi-source data, which can include but is not limited to the following embodiments and combinations between the following embodiments.
[0027] Figure 1 A flowchart of a question and answer interaction method based on multi-source data is provided for the embodiments of the present application, as shown in Figure 1 The question and answer interaction method based on multi-source data provided by the embodiments of the present application can include but is not limited to the following steps and combinations between the following steps. The method comprises: Step 101: performing semantic layer modeling based on a plurality of heterogeneous data sources to obtain a semantic model; the plurality of heterogeneous data sources include a relational database data source, a distributed engine data source, a cloud data warehouse data source and a file type data source.
[0028] Step 102: generating a structured query language of the original question based on the original question to be queried by the user, a preset language model, and the semantic model.
[0029] Step 103: determining a query data set of the original question and a structured report of the original question according to the structured query language.
[0030] Step 104: sending the query data set and the structured report as interactive information of the original question to a terminal corresponding to the user.
[0031] Among them, the semantic layer modeling can be used to convert relational databases, distributed engines, cloud data warehouses, and file type data sources into a unified semantic data table model. Specifically, it can be implemented by using data table field mapping, business index definition, and dimension association relationship configuration to eliminate structural differences of different data sources. The language model can be a preset natural language processing model, which can be implemented by using a pre-training model based on the Transformer architecture to analyze the semantics of the user's question and split and rewrite it. The structured query language can be a query instruction conforming to the syntax of the target data source, which can be generated by semantic matching and syntax conversion to accurately extract the target data set. The structured report can be a formatted output containing a data table and visual elements, which can be generated by using a dynamic rendering engine combined with a predefined template to visually display the analysis results.
[0032] Specifically, first, the semantic layer modeling maps different data sources into a unified business index and dimension system, for example, the order table in MySQL and the inventory table in Hive are associated as the "sales inventory ratio" index. When the user inputs "compare the sales of each store in North China last month", the language model recognizes the time range and regional dimension, the semantic model matches the data table field corresponding to the "sales" index, and generates a SQL statement containing JOIN operation and GROUPBY clause. After executing the query, the data set is extracted, and a structured report containing a column chart and a year-on-year growth rate is automatically generated, and finally the result is pushed to the user terminal.
[0033] As an example, the question and answer interaction method based on multi-source data can be a question and answer interaction method based on enterprise-level AI4BI multi-source data, including the following steps: step 1: semantic layer modeling, accessing multi-heterogeneous data sources and building a unified semantic layer, the multi-heterogeneous data sources include relational databases, distributed engines, cloud data warehouses and file data sources, the access process is realized through unified connection configuration and security authentication; when building the semantic layer, semantic data table modeling is performed based on three ways of database table, SQL statement or Excel / CSV file, the table structure, field type and primary-foreign key relationship are automatically identified, and metadata and semantic information including dimensions, indicators, business scope, synonyms are supplemented by AI and manually; at the same time, synonym, alias and common scope expression are supported through term management, unified dictionary mapping is established for organization, region, product, channel code type fields through dictionary management, historical questions and answers are saved and high-quality samples are selected as few-shot examples through memory management, and multi-level permission control of data cabin level, table level, column level and row level is realized through permission management; step 2: query processing, receiving user natural language questions and converting them into executable queries, first, the AI large model splits and rewrites the user's original question, and combines the indicators and dimensions in the semantic layer built in step 1 to make the rewritten question close to the business semantics; then the AI large model selects the most relevant data cabin from multiple data cabins according to the rewritten question, and provides the AI large model with business concepts and context related to the question based on the business terminology system of the semantic layer to complete information reasoning; then the AI large model generates an intermediate query statement "semantic SQL" based on semantic information, and converts the semantic SQL into executable SQL through a Headless engine according to preset rules, and introduces the AI large model to perform executability check and error correction on the executable SQL during the conversion process; Step 3: result analysis and output, executing the executable SQL obtained in step 2, obtaining the query result dataset and processing it into a structured report; the AI large model combines the user's original question and the structured report to summarize the data and form a natural language answer; if the original question is split, the answers to each sub-question are integrated to form a unified reply; at the same time, the analysis module automatically selects an analysis method for attribution interpretation for structured reports supporting classification or time series analysis, and recommends three related extension questions based on the attribution conclusion; and the prediction module comprehensively considers the user's question, structured report, data trend and business scenario to intelligently predict key indicators and output actionable suggestions.
[0034] The application supports dynamically generating structured queries and visualized results to meet the needs of ad hoc analysis. The prior art lacks deep analysis capabilities, but the method can automatically output trend judgments and decision suggestions through the attribution interpretation and prediction expansion of structured reports. In this way, the application realizes unified semantic access of multi-source data, reduces the threshold for business users to directly operate heterogeneous data sources, improves the accuracy of complex query statement generation, reduces the need for manual intervention, supports multi-level analysis from fact queries to trend prediction, and enhances decision support capabilities. Business personnel can obtain integrated data across systems without writing SQL, and can explore data correlations through interactive question and answer, significantly improving data analysis efficiency and depth.
[0035] In some embodiments, the semantic layer modeling based on multiple heterogeneous data sources obtains a semantic model, including: performing semantic data table modeling on the relational database data source, the distributed engine data source, the cloud data warehouse data source, and the file type data source to obtain a semantic data table model; performing multi-level permission management on the semantic data table model, the language model, and user-supplemented metadata and semantic information to generate the semantic model; the metadata and semantic information include dimensions, indicators, measures, and synonyms corresponding to each business field.
[0036] Among them, semantic data table modeling can be converting data sources of different storage forms into a unified semantic expression data model. Specifically, it can be implemented by establishing logical table association relationships after data extraction using an ETL tool. This process can eliminate structural differences between different data sources.
[0037] Metadata and semantic information can be structured data describing business field attributes. Specifically, it can be implemented by labeling field tags using a data dictionary management system. For example, the sales amount field is labeled as a summation indicator, and the order date is labeled as a time dimension. This feature can provide business knowledge support for the language model.
[0038] Multi-level permission management can be an operation mechanism for controlling data access ranges according to user roles. Specifically, it can be implemented using an access control strategy based on the RBAC model. For example, ordinary users can only view department-level data. This can ensure data security and compliance.
[0039] Specifically, in the semantic data table modeling phase, by establishing a logical table mapping relationship across data sources, tables from a relational database and views from a cloud data warehouse can be called in a unified structure. Then the user-supplemented metadata is fused with the semantic data table model, for example, the "active user" index caliber defined by the business department is mapped with the user login record table in the data warehouse. Finally, the field-level access rules are set through the permission management module, for example, the finance department can only view the cost-related indicators, and the marketing department can only view the sales dimensions, thereby constructing a semantic model supporting permission control.
[0040] As an example, when AI supplements metadata, the field corresponding business index type (such as summation type index, mean type index), dimension attribution (such as time dimension, region dimension) and data caliber default value are automatically identified, when manually supplementing semantic information, the official explanation of business terminology is confirmed, the master foreign key association relationship is corrected, and the index calculation logic in special scenarios (such as holiday sales statistics logic) is supplemented.
[0041] The present application constructs a semantic model containing business metadata, so that the generated SQL statement can accurately match the enterprise-defined business indicators. The general language model in the prior art may lead to sensitive data leakage due to the lack of permission control mechanism, while the present scheme realizes field-level access control through multi-level permission management. In this way, the present application solves the problem of business semantic understanding deviation in enterprise-level applications, so that natural language queries can accurately identify custom indicators such as "gross profit margin" and "average order value". At the same time, the risk of data leakage due to lack of permissions is avoided, ensuring that users of different roles can only access business fields within the authorized range, effectively improving the security of enterprise data assets.
[0042] In some embodiments, the dimensions include time dimensions, region dimensions; the indicators include summation type indicators, mean type indicators; the calibers include business calibers, data calibers; the synonyms include explanation words and logic words of the business; the multi-level permission management of the semantic data table model, the language model and the user-supplemented metadata and semantic information generates the semantic model, including: determining the mapping relationship between each field of the business and the time dimension, the region dimension, the summation type indicator, the mean type indicator, the business caliber, the data caliber, the explanation word, and the logic word; based on the semantic data table model, the language model and the mapping relationship, multi-level permission management is performed to generate the semantic model.
[0043] Among them, the time dimension can be an attribute related to time in business data, which can be defined in time units such as years, quarters, months, etc., to support time range definition or trend analysis. The region dimension can be an attribute related to geographic location in business data, which can be defined in hierarchical structures such as provinces, cities, administrative divisions, etc., to support regional comparison or distribution analysis. The summation type index can be a business index that accumulates numerical fields, which can be implemented using aggregation functions, such as calculating the total sales.
[0044] The mean type index can be a business index that calculates the average value of numerical fields, which can be implemented using sliding windows or grouping calculations, such as calculating the average consumption amount of users. The business scope can be a business department-defined index calculation rule, which can be described using formulas or logical expressions, such as defining "active users" as users who have login behavior in the past 30 days.
[0045] The data scope can be the actual calculation logic of the fields in the data table, which can be implemented using SQL statements or ETL scripts, such as calculating the repurchase rate by associating the order table and the user table. The explanation word can be a colloquial description of business terminology, which can be mapped using a thesaurus or knowledge graph, such as explaining "GMV" as "total merchandise transaction volume".
[0046] The logical word can be a conditional relationship word in the business rule, which can be defined using Boolean operators or conditional expressions, such as "and", "or", "greater than", etc.
[0047] Specifically, in the semantic model construction process, first, the association relationship between business fields and time dimension, region dimension is established, such as mapping the "order date" field to the "month" level of the time dimension. Then, the business field is bound to the summation type index and the mean type index, such as the "sales" field is associated with both the summation type index (total sales) and the mean type index (average order amount). Further, according to the documents provided by the business department, the business scope is aligned with the data scope, such as converting the business-defined "new user" rule into the filtering condition of the user's first order time in the data table. At the same time, through the thesaurus, the explanation word and the logical word of the business terminology are matched with the field, such as mapping "revenue" to the "income" field. After completing the mapping relationship, combined with the semantic data table model and the language model, data access permissions and semantic understanding permissions are set for different user roles, such as limiting the finance department to only access fields and business scopes related to financial indicators.
[0048] The application can accurately identify business concepts in user questions by establishing the mapping relationship between fields and dimensions, indicators, and measures, for example, decomposing "sales in the East China region last month" into the region dimension "East China", the time dimension "last month", and the summation indicator "sales", thereby generating a SQL statement containing correct filtering conditions and aggregation functions. In this way, the application solves the problem of business semantic understanding deviation in enterprise-level applications, enabling the natural language question and answer system to accurately match business terminology, calculation rules, and data logic in user questions, and improving the accuracy of SQL generation in complex query scenarios. For example, in scenarios involving multi-table association and custom indicators, the system can automatically identify associated fields and apply the correct business measure through the mapping relationship, avoiding errors in query results due to semantic ambiguity.
[0049] In some embodiments, the generating of the structured query language based on the original question to be queried by the user, the preset language model, and the semantic model includes: inputting the original question into the language model to split and semantically rewrite the original question, generating a target question; inputting the target question into the semantic model for semantic matching to obtain a query statement related to the business concept of the target question; and performing structured conversion processing on the query statement to generate the structured query language.
[0050] The language model can be a pre-trained model for natural language processing, and can specifically be implemented by a model based on the Transformer architecture. The language model functions to identify ambiguous expressions or multi-intention features in the original question and perform semantic normalization processing. The semantic model can be a knowledge graph that integrates the semantic relationships of multiple sources of data, and can specifically be implemented by establishing a mapping relationship between business fields and dimensions, indicators, and measures. The semantic model functions to accurately map business concepts in natural language questions to underlying data structures. The structured conversion processing can be the conversion of non-standardized query statements into code that conforms to the syntax of a target database, and can specifically be implemented by a syntax tree parsing and template filling mechanism. The structured conversion processing functions to eliminate syntax differences between different data sources and generate executable query instructions.
[0051] Specifically, when the user inputs a question containing a fuzzy time range, such as "recent sales situation", the language model automatically supplements the time limit condition and rewrites it as "total sales amount in the past 30 days". The rewritten target question is input into the semantic model, and by matching the "sales amount" definition in the business indicator library, it is associated with the order amount field and statistical period field in the database to generate a basic query fragment containing the SUM function and WHERE condition. After syntax checking and JOIN condition completion, the query fragment is finally converted into a SQL statement suitable for cloud data warehouse. For complex questions involving multiple table associations, such as "the relationship between inventory turnover rate and sales amount in East China region stores", the semantic model can identify that "turnover rate" needs to associate with the inventory table and sales table, and automatically add cross-table JOIN logic and calculation formula.
[0052] As an example, the AI large model splits and semantically rewrites the user's original question, combining the indicators and dimensions defined in the semantic modeling stage, making the question expression closer to business semantics, providing clear input for subsequent query statement generation. The AI large model selects the most relevant one from multiple data capsules based on the user's question. This step can effectively reduce the scope of indicators and dimensions involved in subsequent query generation, improving semantic focus. Based on the business terminology system constructed in the semantic modeling stage, the AI large model provides all business concepts and context related to the question, helping it to deeply understand complex business scenarios and enhance the semantic accuracy of subsequent query generation. Based on the semantic information from the previous steps, the AI large model generates an intermediate query statement corresponding to the user's question (i.e. "semantic SQL", not real executable SQL). The prelude of the previous steps aims to improve the accuracy and semantic integrity of the results generated in this step. Through the Headless engine, the semantic SQL is converted into a real executable SQL statement according to the preset rules. In this process, the AI large model is introduced to check the SQL for executability and correct errors, ensuring the grammatical correctness and execution robustness of the generated statement. With the database connection of the selected data capsule, the generated SQL statement is executed to obtain the query result dataset, which is processed into a structured report that can be used for BI display.
[0053] The application can split a complex question into two independent queries "2022 new user number" and "2023 new user number" through the question splitting mechanism of the language model, and ensure that the two sub-queries use the same statistical caliber through the index association of the semantic model. In this way, the application effectively solves the problems of ambiguous expression and mixed intent of natural language questions in enterprise-level scenarios, and improves the generation accuracy of complex query statements. In particular, for business indicators that need to be associated and calculated across multiple data sources, the unified mapping relationship of the semantic model can automatically complete the JOIN condition and calculation logic, avoiding common table association errors and indicator calculation deviations when manually writing SQL. Further, the structured conversion processing module can ensure that the generated query statement adapts to different types of underlying data sources, reducing the development and maintenance cost of the system when interfacing with heterogeneous databases.
[0054] In some embodiments, the inputting the original question into the language model to split and semantically rewrite the original question to generate a target question comprises: performing question recognition on the original question to obtain a question type of the original question, the question type comprising a fuzzy expression question type and a multi-intent question type; when the question type is the fuzzy expression question type, supplementing a time range limit to the original question and then performing semantic rewriting to generate the target question; and when the question type is the multi-intent question type, splitting the original question into sub-questions, and taking the sub-questions as the target question.
[0055] The question type can be a classification of a natural language question proposed by a user in a semantic structure, which can be implemented by using a rule matching or a machine learning classifier to distinguish between a fuzzy question that needs to be supplemented with a limit condition and a complex question that contains multiple independent query intents.
[0056] The fuzzy expression question type can be a case where a question lacks necessary limit conditions, resulting in an invalid query statement. The missing context information can be supplemented by adding a default time interval, such as the last three months, or by asking the user to confirm the time range.
[0057] The multi-intent question type can be a case where a single question implies multiple independent business query requirements. The complex question can be split into multiple atomic query sub-questions by using a dependency syntax analysis combined with an intent recognition model, such as splitting "What are the regional sales and profit margins?" into two independent questions of regional sales query and regional profit margin query.
[0058] Specifically, the original question is input into the language model for question type recognition. When it is detected that the question lacks a time dimension, a preset time range is automatically appended, such as rewriting "sales trend" to "sales trend in the past three months". When it is detected that the question contains conjunctive query items, the composite question is split into multiple independent sub-questions through dependency tree parsing, such as splitting "inventory and turnover rate in North China and East China" into a query for inventory in North China, a query for turnover rate in North China, a query for inventory in East China, and a query for turnover rate in East China. Each sub-question generates a structured query language separately, thereby realizing differentiated processing flows for different types of questions.
[0059] As an example, the AI large model combines the user's original question with the SQL execution result to summarize and summarize the data and form a natural language answer. If the original question is disassembled, the answers to each sub-question will be integrated to reply to the user's initial question. For data results supporting classification or time series analysis, the AI large model automatically selects the corresponding analysis method to attribute the data, and recommends three related extension questions based on the analysis conclusion to guide the user to explore in depth.
[0060] The application automatically completes the limited conditions for fuzzy questions through a question type prediction mechanism, performs atomic splitting on multi-intent questions, makes the generated query statements have precise limited range and single query target, thereby reducing the database load and improving the query accuracy. In this way, the application can effectively solve the semantic ambiguity and intent mixed problems commonly existing in natural language questions. Through the type-driven differentiated processing strategy, the generated SQL statements not only meet the time limit requirements of the business scenario, but also avoid syntax errors caused by multi-intent mixing. When a business personnel asks "inventory situation of promotional goods" during an e-commerce promotion period, the system automatically supplements the "activity period" time limit. When the user asks "departmental efficiency and turnover rate", it is automatically split into two independent tasks: efficiency analysis query and turnover rate statistics query, which significantly improves the query accuracy and system reliability in complex scenarios.
[0061] In some embodiments, the inputting the target question into the semantic model for semantic matching to obtain a query statement related to a business concept of the target question comprises: extracting at least one keyword of the target question; performing semantic matching on each keyword through the semantic model to obtain a matching degree of each keyword; determining a difference value of the matching degrees corresponding to the two keywords with the highest matching degrees; and generating the query statement based on the two keywords when the difference value is less than a preset threshold.
[0062] The keyword extraction can be used to identify core words with business meanings from natural language questions. The natural language processing-based word segmentation technology and named entity recognition algorithm can be used to achieve this. For example, the token classification module in the BERT model is used for entity tagging, so as to accurately capture business entities and indicators in the question.
[0063] The matching degree can be the degree of association between the keyword and the pre-defined business concept in the semantic model. The cosine similarity algorithm or the semantic similarity calculation method based on the pre-trained language model can be used to achieve this. By comparing the keyword vector and the business concept vector, the closeness of the two in the semantic space is quantified.
[0064] The preset threshold can be a critical value for determining whether the keyword matching result is close enough. The threshold can be dynamically adjusted according to the fault tolerance requirements of the business scenario. For example, it is set to 0.15 in the financial risk control scenario and 0.2 in the sales analysis scenario. The influence of different thresholds on the accuracy of query statement generation is determined through experimental verification.
[0065] Specifically, when the target question input by the user is processed by the semantic model, the keywords such as "sales" and "year-over-year" are first extracted through word segmentation and entity recognition. After each keyword is converted into a vector form, similarity calculation is performed with the business indicator vectors stored in the semantic model. For example, the matching degree of "sales" and "sales_amount" is 0.92, and the matching degree of "year-over-year" and "year_over_year" is 0.88. After the system identifies the two keywords with the highest matching degree, the difference between the matching degrees is calculated to be 0.04. If the preset threshold is 0.05, the difference is less than the threshold, indicating that the semantic matching results of the two keywords are consistent. At this time, the database fields corresponding to the two keywords are associated, and the query statement "SELECT sales_amount, year_over_year FROM sales_table" is generated.
[0066] As an example, when selecting a data pod, the AI large model performs semantic matching between the keywords in the user's question (such as "East China region" and "Product A") and the business domain labels of each data pod (such as "East China region business pod" and "Product A sales pod"), calculates the matching degree, and selects the data pod with the highest matching degree. If the difference between the two data pods with the highest matching degrees is less than the preset threshold (such as 5%), the user is prompted to confirm the target data pod.
[0067] The application can effectively identify semantic ambiguity scenarios by comparing the difference between the two highest matching keywords. For example, when the matching degree of "revenue" and "revenue" is 0.85, and the matching degree of "revenue" and "income" is 0.84, the difference 0.01 is lower than the threshold value, the system will retain both possibilities and trigger the artificial confirmation mechanism, thereby avoiding the SQL statement generation deviation caused by single matching error. In this way, the application solves the problem of incorrect query statement generation caused by the polysemy of business terminology in an enterprise-level question answering system, effectively improves the semantic understanding accuracy in complex business scenarios through a double matching verification mechanism, so that the generated SQL statement can correctly reflect the user's intention, especially in queries involving multiple table associations or custom business indicators, significantly reducing the probability of empty results or incorrect data return caused by keyword mismatch.
[0068] In some embodiments, the method further comprises: if the original question is not split into sub-questions, collecting information from the structured report to form natural language interaction information of the original question; or splitting the original question into multiple sub-questions, determining the interaction information corresponding to each sub-question, and determining the natural language interaction information based on the interaction information corresponding to each sub-question.
[0069] The structured report can be a table form data with fixed fields and values extracted from a query data set by a structured query language. The SQL query result set conversion tool can be used to convert the two-dimensional table data returned by the database into a structured data table with business labels. The information collection can be a process of extracting key fields and values from the structured report. Regular expression matching or a pre-defined template mapping method can be used to identify the core business indicators in the data table and extract the corresponding values.
[0070] The natural language interaction information can be the conversion of structured data into text descriptions that conform to human language habits. A pre-set template-based sentence generation engine can be used to implement this conversion, such as converting the fields "region=East China" and "sales=120 million" to "East China sales of 120 million yuan".
[0071] The question splitting can be the decomposition of an original question containing multiple query intentions into independent sub-questions. Dependency syntax analysis and semantic role labeling techniques can be used to implement this decomposition, which can be used to identify conjunctions or logical conjunctions in the question to divide independent query units.
[0072] Specifically, when the original question proposed by the user is not split into sub-questions, the system directly performs field parsing on the structured report, such as extracting numerical values from a report containing "sales" and "profit margin" fields, and generating a natural language answer of "the sales of the third quarter of 2023 is X ten thousand yuan, and the profit margin is Y%" through a preset statement template. When the original question contains multiple implied query intentions, such as "compare the sales and profit margins of the East China and South China regions", the system first splits out "East China sales", "South China sales", "East China profit margin" and "South China profit margin" four sub-questions, and after executing data query respectively, integrates the results of each sub-question into a composite natural language response of "East China sales is A ten thousand yuan, South China is B ten thousand yuan; East China profit margin is C%, South China is D%" according to the preset comparison template.
[0073] The present application automatically generates natural language descriptions, so that business users can directly obtain readable analysis results without SQL knowledge. The prior art usually returns multiple independent data tables when processing complex questions, while the present scheme can generate complete analysis reports with logical correlation through the question splitting and result integration mechanism. In this way, the present application solves the problem of poor readability of the returned results of traditional question and answer systems, so that non-technical personnel can directly understand the business indicator values and their associated relationships in the query results. At the same time, through the question splitting mechanism, the multi-intention complex query scene is effectively handled, avoiding data interpretation errors caused by the mixing of multiple query conditions, and improving the response accuracy of complex business questions.
[0074] In some embodiments, the method further comprises: in the case that the structured report supports classification or time series analysis, performing attribution interpretation on the structured report to generate an extended question related to the structured report; and performing prediction based on the extended question and the structured report to obtain predicted interaction information of the original question.
[0075] Among them, attribution interpretation can be a process of identifying key influencing factors by analyzing the potential reasons for data changes in the structured report, which can be implemented by statistical correlation analysis, decision tree model or causal inference algorithm, to help users understand the business logic behind data fluctuations.
[0076] The extended question can be a subsequent analysis question related to the original question automatically generated based on the attribution interpretation result, which can be implemented by natural language generation technology combined with business rule templates, to guide users to conduct more in-depth exploratory analysis.
[0077] The predicted interaction information can be a future trend prediction result generated by combining the historical data of the structured report with the attribution result, which can be implemented by a time series prediction model or a machine learning regression model, to provide forward-looking decision support for users.
[0078] Specifically, when the structured report contains categorical dimensions or time series data, the system first performs attribution analysis on the key indicators in the report. For example, if the user queries "the reason for the decline in sales of a certain product in a quarter", the system identifies "insufficient promotion" as the main influencing factor by analyzing the correlation between sales data and related factors such as inventory and promotion activities, and automatically generates an extended question "whether to adjust the promotion strategy in the next quarter". Further, based on the correlation between historical promotion data and sales, a prediction model is used to output sales prediction results for the next three months, forming interactive information including reason explanation, extension suggestion and prediction trend.
[0079] As an example, in attribution interpretation, for categorical data (such as sales in each region), a contribution analysis method (such as calculating the contribution of sales decline in each region to the total sales decline) is used, for time series data (such as monthly sales), a trend decomposition method (such as decomposition into long-term trend, seasonal fluctuation, and random fluctuation) is used, and a visual attribution chart (such as a contribution pie chart, a trend decomposition line chart) is generated. In intelligent prediction, a time series model (such as ARIMA model, LSTM model) is used, inputting the historical indicator data of the last 12 months, adjusting the model parameters according to the business scenario parameters (such as whether there is a new product launch, whether there is a major promotion activity), and outputting the indicator prediction value and prediction confidence interval (such as "the predicted sales in the next quarter is 1300-1400 million yuan, with a confidence of 90%") for the next three months. That is, from "query tool" to "analysis partner", due to the existence of analysis and insight engine, the value chain has been extended after obtaining the data. It can not only perform queries, but also automatically perform attribution analysis, intelligent prediction and other in-depth analysis. It liberates users from the traditional process of "asking questions -> getting data -> manual analysis", and directly provides decision-making suggestions, realizing the transition from "data query" to "intelligent insight". Each query may trigger a deep analysis report, greatly improving the business value and ease of use of data results.
[0080] The present application introduces attribution interpretation and prediction model, not only can answer fact type question, but also can automatically generate extension question and provide prediction result, solve the limitation of lack of depth analysis ability of prior art. In this way, the present application can convert a single fact type query into complete decision support information containing reason analysis, trend prediction and suggestion, so that users can obtain intelligent prediction results without manually constructing complex analysis models, significantly improving the depth and practicality of interaction in enterprise-level data analysis scenarios.
[0081] In some embodiments, the method further comprises: when the original question is a factual question, determining that the natural language interaction information is in the form of presentation of data, units, and key descriptions; and when the original question is an analytical question, determining that the natural language interaction information is in the form of presentation of a conclusion, data supporting the conclusion, and judgment logic.
[0082] The factual question can be a query type that needs to obtain specific numerical values or explicit information, and can be implemented by matching interrogative words in the question through a semantic recognition model, for example, a question containing keywords such as "how much" and "how many". In this way, the basic query requirement is directly responded through structured data extraction.
[0083] The analytical question can be a query type that needs to explain data correlation or deduce a conclusion, and can be implemented by detecting causal correlation words in the question, for example, a question containing keywords such as "why", "trend", and "influencing factor". In this way, the deep analysis requirement is met by constructing a logical reasoning chain. The key description can be a supplementary description of the data source or calculation rule, and can be implemented by using metadata association technology to establish a mapping relationship between the field and the business dimension. This feature is used to eliminate data ambiguity and improve the result reliability.
[0084] The judgment logic can be a deduction process supporting the conclusion, and can be implemented by using a rule engine to execute a preset analysis model, for example, by using an attribution analysis model to identify key influencing factors. This feature makes the conclusion traceable and verifiable.
[0085] Specifically, when the system identifies that the question raised by the user is a factual question, it directly extracts a numerical result from the query data set, and at the same time, generates a standardized data expression by associating the unit definition in the metadata. For example, for the query of "North China sales last month", the system returns "1.2 billion yuan (data source: sales system; statistical dimension: signed contract amount)". For analytical questions, the system activates the built-in analysis model to perform multi-dimensional analysis on the structured report. For example, for the query of "reasons for the decline in quarterly sales", the system returns a conclusion type answer of "mainly affected by supply chain delay (supporting data: North China shortage rate increased by 15%; judgment logic: correlation coefficient between shortage rate and sales reached 0.82)".
[0086] In some specific implementations, the response template of the factual question can be configured as a three-part structure of "value + unit + (data update time)", and the response template of the analytical question can be configured as a tree structure of "conclusion title + core data item + analysis basis". When it is detected that the question contains a composite intent, fact data and analysis conclusions can be presented simultaneously in a column display mode.
[0087] As an example, for factual questions (such as "What was the sales in the last quarter?"), the answer form is "data + unit + key description" (such as "The sales in the last quarter was 12 million yuan, and the statistical range includes all direct channels"), and for analytical questions (such as "Why did the sales in the last quarter decrease?"), the answer form is "conclusion + data support + preliminary judgment" (such as "The sales in the last quarter decreased by 8% compared with the previous year, mainly due to a decrease of 3 million yuan in the sales of the East China region, and the preliminary judgment is related to the promotion of the competitor in the region").
[0088] The application can automatically generate the attribution conclusion "the decrease in activity is mainly affected by version update" and attach relevant data comparison. In this way, the application effectively solves the technical defect of single result presentation form in an enterprise-level question answering system, and can automatically select the optimal expression mode according to the nature of the question. For factual queries, it ensures data accuracy and completeness, and for analytical queries, it enhances the explainability of conclusions, so that business users can directly obtain decision support information without secondary processing, significantly improving the practical value of the question answering system.
[0089] As an example, the multi-source data-based question answering interaction method can be a multi-source data-based question answering interaction method based on enterprise-level AI4BI, which is applied to a multi-source data-based question answering interaction system based on enterprise-level AI4BI, such as Figure 2 as shown, Figure 2 is a schematic diagram of the architecture of the multi-source data-based question answering interaction system based on enterprise-level AI4BI, which includes an independent semantic modeling layer that works in parallel and cooperatively with a natural language processing module, a query assembly engine, a data access layer, and an intelligent analysis engine. In the data processing flow, it is a necessary path between the natural language processing module and the query assembly engine. Its internal storage structure contains a structured business model composed of "business indicator entities", "dimension entities", "terminology rules", and "dictionary mapping relationships". Through specific architectural layout and data flow, the consistency and accuracy of business semantics in the entire query life cycle are ensured. For example, the specific steps include: First, semantic layer modeling, including data source connection: multi-data source access: including relational databases (MySQL, Oracle, PostgreSQL, etc.), distributed engines (Hive, ClickHouse, Doris, etc.), cloud data warehouses (Redshift, Snowflake, BigQuery, etc.), and file-based data sources (Excel, CSV). Through unified connection configuration and security authentication, it ensures that multiple heterogeneous data sources can be accessed simultaneously, providing a foundation for subsequent modeling. Semantic data table modeling: the modeling stage converts physical data into semantic layer objects, forming a "business-readable" data structure. Based on multiple modeling methods: database tables, SQL statements, Excel / CSV, automatically identify table structure, field type, primary-foreign key relationship, and support AI and manual supplement of metadata and related semantic information (including dimensions, indicators, business scope, synonyms, etc.); can flexibly integrate data from different sources into a unified semantic modeling framework, ensuring the coverage of business analysis. Term management: supports synonyms, aliases, and commonly used scope expressions, solving ambiguity problems in user natural language questions. Dictionary management: establish a unified dictionary mapping for code-type fields such as organization, region, product, and channel, ensuring uniformity of scope and consistency of dimensions between different systems. Memory management: the system saves historical questions and their answers, and selects high-quality samples through manual evaluation, as few-shot examples for subsequent question rewriting and query optimization, thereby continuously improving the accuracy of question and answer. Permission management: supports multi-level permission control, including data compartment level, table level, column level, and row level, realizes fine-grained authorization, and guarantees compliance and security. After the completion of semantic layer modeling, user questions can be directly mapped to indicator and dimension definitions, significantly reducing ambiguity and errors, and providing unified business logic support for subsequent query and analysis.
[0090] Second, the query phase includes question rewriting: the AI large model splits and semantically rewrites the user's original question, combining the indicators and dimensions defined in the semantic modeling phase to make the question expression closer to business semantics, providing clear input for subsequent query statement generation. Select data capsule: the AI large model selects the most relevant data capsule from multiple data capsules based on the user's question. This step can effectively narrow the scope of indicators and dimensions involved in subsequent query generation, improving semantic focus. Information reasoning: based on the business terminology system constructed in the semantic modeling phase, the AI large model provides all business concepts and context related to the question to help it understand complex business scenarios and enhance the semantic accuracy of subsequent query generation. Query statement generation: the AI large model generates an intermediate query statement (i.e., "semantic SQL", not real executable SQL) corresponding to the user's question based on the semantic information from the previous steps. The prelude of the previous steps aims to improve the accuracy and semantic integrity of the results generated in this step. Query statement conversion: through the Headless engine, the semantic SQL is converted into a real executable SQL statement according to the preset rules. In this process, the AI large model checks the SQL for executability and corrects errors to ensure the grammatical correctness and execution robustness of the generated statement. Execute SQL statement: with the help of the database connection of the selected data capsule, execute the generated SQL statement, obtain the query result dataset, and process it into a structured report that can be used for BI display. Query summary: the AI large model summarizes the data based on the user's original question and SQL execution results, forming a natural language answer. If the original question is broken down, the final answer will be a comprehensive answer to each sub-question, unified to reply to the user's initial question. Attribution analysis: for data results that support classification or time series analysis, the AI large model automatically selects the corresponding analysis method to interpret the data, and based on the analysis conclusion, recommends three related extension questions to guide the user to explore further. Prediction and decision: the AI large model integrates the user's question, query results, data trends, and business scenarios to intelligently predict key indicators and output actionable recommendations to assist business decision-making. The query phase is the core part of the AI4BI system that interacts most closely with artificial intelligence. Unlike traditional Text2SQL solutions that directly use large models to generate SQL, this system builds a multi-stage, structured query processing process: first, based on the indicators, dimensions, and business terminology defined in the semantic modeling phase, the AI large model converts the user's original question into a more clear and business semantics-oriented structured question, and generates an intermediate-level "semantic SQL"; then, through the Headless engine, the semantic SQL is converted into a real executable SQL statement, which is executed by the database to obtain the results; finally, the AI large model is introduced again to analyze and summarize the query results intelligently to directly respond to the user's question in natural language.This process not only improves the accuracy and interpretability of the query, but also further expands the depth of the data, supporting attribution analysis, trend prediction and decision-making, and other high-level functions.
[0091] In this embodiment, by decomposing and converting natural language questions into semantic SQL queries and multiple execution steps, the scheme can more accurately utilize the capabilities of AI large models and apply different functional modules to corresponding links. Compared with the traditional method of directly inputting complete database schema and DDL information as prompt words to generate executable SQL, this method significantly reduces the large model illusion phenomenon caused by long prompt words, thereby effectively improving the accuracy of SQL generation. In addition, this process can also solve the problem of SQL generation under complex business logic, and break through the limitation of traditional SQL results being presented only in charts, further expanding the expression dimension and value depth of business data.
[0092] The architecture of the embodiment aims to reduce the data usage threshold and provide one-stop service for users from data query to deep insight through natural language interaction. The core is composed of two complementary stages: semantic modeling and query analysis. The overall architecture includes: semantic modeling layer (core foundation): this layer is the key to realize "business-friendly" query. It abstracts and maps the underlying complex and technical data table structure into terms and concepts familiar to business personnel through semantic model. Core components: indicators: define business metrics and unify calculation standards. Dimensions: define analysis perspectives (such as "time", "region", "product category"). Terms: support synonyms, aliases and common caliber expressions, solve ambiguity problems in user natural language questions. Dictionary: establish unified dictionary mapping for organization, region, product, channel and other code type fields, ensure caliber uniformity and dimension consistency between different systems. Query and analysis service layer (intelligent engine): this layer is the "brain" of the architecture, responsible for receiving user requests and driving the entire query and analysis process. Core components: natural language understanding: parse the user's natural language input into structured semantic intent. Semantic SQL generator: based on the parsed intent, query the semantic modeling layer, and "translate" the business problem into an efficient and accurate executable SQL statement. SQL execution engine: execute the generated SQL in the data source layer to quickly obtain the result set. Analysis and insight engine: secondary processing of query results to provide attribution analysis, intelligent prediction and other deep insights. Component position relationship, the two stages of the scheme constitute a closely linked "definition-use" closed loop. First, in the semantic modeling stage, we convert complex data structures into a unified business semantic layer by defining indicators, dimensions and other elements, providing a core "knowledge base" and "syntax rules" for subsequent queries. Then, in the query stage, the system uses this semantic layer to "translate" user natural language questions into executable SQL, and provides deeper attribution analysis and intelligent prediction based on query results. In short, semantic modeling is the foundation of business cognition, while the query stage is the application process of providing data services and insights based on this cognition. Working relationship, the workflow of the entire architecture is as follows: first, the user asks questions in natural language in the interactive interface. The system receives the question and immediately queries the semantic modeling layer to map the business terms in it to the specific table fields in the underlying database. Then, the query engine uses this mapping relationship to automatically "translate" the natural language question into an executable SQL statement. After the statement is executed in the database and the original data is obtained, the analysis engine further processes the data, and finally presents the intelligent results such as charts, attribution analysis or prediction conclusions to the user. This is an automatic closed loop of "understanding-translation-execution-deepening", which enables users to obtain deep data insights directly without worrying about technical details.
[0093] Secondly, based on the question-and-answer interaction method based on multi-source data in the above embodiments, the embodiments of this application provide a question-and-answer interaction device based on multi-source data. The question-and-answer interaction device based on multi-source data is used to execute the steps in any of the embodiments of the question-and-answer interaction method based on multi-source data described above. For example... Figure 3 As shown, Figure 3 This application provides a schematic diagram of a question-and-answer interaction device based on multi-source data. The question-and-answer interaction device 300 based on multi-source data may include: Modeling module 301 is used to perform semantic layer modeling based on multiple heterogeneous data sources to obtain a semantic model; the multiple heterogeneous data sources include relational database data sources, distributed engine data sources, cloud data warehouse data sources and file type data sources. The generation module 302 is used to generate a structured query language for the original question to be queried by the user, a preset language model and the semantic model; The determination module 303 is used to determine the query dataset of the original question and the structured report of the original question based on the structured query language; The sending module 304 is used to send the query dataset and the structured report as interactive information of the original question to the terminal corresponding to the user.
[0094] The specific process in this embodiment can be referred to the description of the foregoing embodiments, and will not be repeated here.
[0095] Thirdly, in order to realize the question-and-answer interaction method based on multi-source data in the embodiments of this application, Figure 4 A schematic diagram of an electronic device provided in an embodiment of this application; as shown Figure 4 As shown, the electronic device 400 may include: a memory 401 for storing a computer program; and a processor 402 for executing the computer program to implement the method described in any of the above-described methods. For example, the processor 402 may be used to: perform semantic layer modeling based on multiple heterogeneous data sources to obtain a semantic model; the multiple heterogeneous data sources include relational database data sources, distributed engine data sources, cloud data warehouse data sources, and file type data sources; generate a structured query language for the original question based on the user's original query, a preset language model, and the semantic model; determine the query dataset and structured report of the original question according to the structured query language; and send the query dataset and the structured report as interactive information of the original question to the user's corresponding terminal. The processor 402 may also implement any of the steps in the methods described above, which will not be elaborated here.
[0096] It should be noted that the electronic device provided by the above-mentioned embodiment and the question and answer interaction method based on multi-source data belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be described here.
[0097] Of course, in actual application, as shown in Figure 4 The electronic device 400 can also include at least one network interface 403. The various components in the electronic device are coupled together by a bus system 404. It can be understood that the bus system 404 is used to realize the connection and communication between the components. In addition to including a data bus, the bus system 404 also includes a power supply bus, a control bus and a status signal bus. However, for the sake of clarity, only the data bus is shown in Figure 4The various buses are collectively referred to as bus system 404. The number of processors 402 can be at least one. The network interface 403 is configured to enable wired or wireless communication between the electronic device and other devices. The memory 401 in the embodiments of the present application is configured to store various types of data to support the operation of the electronic device. The methods disclosed in the embodiments of the present application can be applied to or implemented by the processor 402. The processor 402 can be an integrated circuit chip having a processing capability. In the implementation process, the steps of the above method can be completed by the integrated logic circuit or the instruction in the form of software in the processor 402. The processor 402 can be a general-purpose processor, a digital signal processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The processor 402 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiments of the present application, the execution can be directly completed by the combination of hardware and software modules in the single-chip microcomputer. The software module can be located in the storage medium, which is located in the memory 401. The processor 402 reads the information in the memory 401 and combines the hardware to complete the steps of the above method. In the exemplary embodiments, the electronic device 400 can be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors (Microprocessors), or other electronic elements, which are used to execute the above method.
[0098] Specifically, the embodiments of the present application provide a computer readable storage medium having a computer program stored thereon, for example, the memory 401 storing the computer program, and the above computer program can be executed by the processor 402 to complete the steps of the above method. The computer readable storage medium can be FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM, etc.
[0099] In addition, each of the functional units in the embodiments of the present application can be integrated into one processing unit, each unit can be separately implemented as a single unit, or two or more units can be integrated into a unit; the integrated unit can be implemented in the form of hardware or in the form of hardware plus software function units.
[0100] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware, and the foregoing program can be stored in a computer readable storage medium, and the program executes the steps of the above-mentioned method embodiments when executed; and the foregoing storage medium includes mobile storage devices, read-only memories (ROMs), random access memories (RAMs), magnetic discs or optical discs, and various media that can store program codes.
[0101] Alternatively, the integrated units of the present application, if implemented in the form of software function modules and sold or used as independent products, can also be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products, which are stored in a storage medium and include a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes mobile storage devices, ROMs, RAMs, magnetic discs or optical discs, and various media that can store program codes.
[0102] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the detailed description of other embodiments above, which will not be repeated here.
[0103] The above describes in detail a method for question and answer interaction based on multi-source data, an electronic device and a storage medium provided by the present application. The principle and implementation manner of the present application are described by applying specific examples. The above embodiment description is only used to help understand the method and its core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range can be changed; and in view of the above, the content of the present description should not be understood as a limitation of the present application.
[0104] Each of the technical features of the above embodiments can be combined arbitrarily, and in order to make the description concise, not all possible combinations of the technical features in the above embodiments are described, however, as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present description.
Claims
1. A question-and-answer interaction method based on multi-source data, characterized in that, The method includes: Semantic modeling is performed based on multiple heterogeneous data sources to obtain a semantic model; the multiple heterogeneous data sources include relational database data sources, distributed engine data sources, cloud data warehouse data sources, and file type data sources. A structured query language for the original question to be queried by the user, a preset language model, and the semantic model is generated. The query dataset and structured report of the original question are determined based on the structured query language. The query dataset and the structured report are sent as interactive information for the original question to the user's corresponding terminal.
2. The question-answering interaction method based on multi-source data according to claim 1, characterized in that, The semantic layer modeling based on multiple heterogeneous data sources yields a semantic model, including: Semantic data table modeling is performed on the relational database data source, the distributed engine data source, the cloud data warehouse data source, and the file type data source to obtain a semantic data table model; The semantic data table model, the language model, and the user-supplemented metadata and semantic information are subject to multi-level permission management to generate the semantic model; the metadata and semantic information include the dimensions, metrics, definitions, and synonyms corresponding to the fields of each business.
3. The question-answering interaction method based on multi-source data according to claim 2, characterized in that, The dimensions include time and region; the indicators include summation indicators and mean indicators; the definitions include business definitions and data definitions; the synonyms include explanatory terms and logical terms for the business; the process of performing multi-level permission management on the semantic data table model, the language model, and the user-supplemented metadata and semantic information to generate the semantic model includes: Determine the mapping relationship between each business field and the time dimension, the region dimension, the summation indicator, the mean indicator, the business scope, the data scope, the explanatory terms, and the logical terms; Multi-level permission management is performed based on the semantic data table model, the language model, and the mapping relationship to generate the semantic model.
4. The question-answering interaction method based on multi-source data according to claim 1, characterized in that, The process of generating a structured query language for the original question based on the user's query, a preset language model, and the semantic model includes: The original question is input into the language model to split and semantically rewrite the original question, generating the target question. The target question is input into the semantic model for semantic matching to obtain query statements related to the business concepts of the target question. The query statement is subjected to structured transformation processing to generate the structured query language.
5. The question-answering interaction method based on multi-source data according to claim 4, characterized in that, The step of inputting the original question into the language model to decompose and semantically rewrite the original question to generate the target question includes: The original question is identified to obtain the question type of the original question, which includes fuzzy expression question type and multi-intent question type; When the question type is a vaguely defined question type, the original question is semantically rewritten after the time range is specified, and the target question is generated. When the question type is a multi-intent question type, the original question is split into sub-questions, and each sub-question is used as the target question.
6. The question-answering interaction method based on multi-source data according to claim 4, characterized in that, The step of inputting the target question into the semantic model for semantic matching to obtain query statements related to the business concepts of the target question includes: Keyword extraction is performed on the target question to obtain at least one keyword for the target question; The semantic model is used to perform semantic matching on each keyword to obtain the matching degree of each keyword; Determine the difference in matching degree between the two keywords with the highest matching degree; When the difference is less than a preset threshold, the query statement is generated based on the two keywords.
7. The question-answering interaction method based on multi-source data according to any one of claims 1-6, characterized in that, The method further includes: If the original problem is not broken down into sub-problems, information is collected from the structured report to form natural language interactive information about the original problem; or... The original problem is broken down into multiple sub-problems. The interaction information corresponding to each sub-problem is determined, and the natural language interaction information is determined based on the interaction information corresponding to each sub-problem.
8. The question-answering interaction method based on multi-source data according to claim 7, characterized in that, The method further includes: If the structured report supports classification or time-series analysis, the structured report is interpreted by attribution, and related extended questions are generated. Based on the extended question and the structured report, prediction interaction information for the original question is obtained.
9. The question-answering interaction method based on multi-source data according to claim 8, characterized in that, The method further includes: When the original question is a factual question, the natural language interaction information is determined to be presented in the form of data, units, and key descriptions; When the original question is an analytical question, the natural language interaction information is determined to be presented in the form of a conclusion, data supporting the conclusion, and judgment logic.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program configured to be executed by a processor to implement the question-and-answer interaction method based on multi-source data as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Question and answer method and device, equipment, storage medium and program product
CN120086344A
Structured query statement generation method and device and computer equipment
CN120705168A
Database question and answer model training method and device, storage medium and computer equipment
CN120822571A
Multi-source data analysis method and device, equipment and storage medium
CN121029796A
Multi-data-source intelligent question answering method and device based on large model and storage medium
CN121031776A