Natural language text query and question-answering system for scientific and technological intelligence analysis
Through semantic analysis and the 'memory window' mechanism, the natural language text query and question-and-answer system solves the efficiency and accuracy of massive text intelligence analysis, realizes efficient processing and personalized query of scientific research entry data, and improves scientific research efficiency and results quality.
Patent Information
- Application Number
- CN202411011459.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2025-01-07
AI Technical Summary
The existing scientific research project management technology lacks the efficient and accurate analysis ability of massive text information, resulting in information overload, waste of time and resources. The Q&A system cannot achieve the accumulation and integration of process data, cannot meet the needs of personalized use, and reduces intelligence. The efficiency and benefits of analysis.
A natural language text query and question-and-answer system was designed to generate relevant tags and SQL statements through semantic analysis, and introduce the 'memory window' mechanism to save the query history and results, and use it for references to subsequent queries to improve the coherence and depth of analysis. .
It realizes efficient processing and data integration of scientific research entries, enhances semantic understanding capabilities, generates accurate SQL query statements, saves repeated input time, provides a friendly interactive experience, and improves scientific research efficiency and results quality.
Smart Images

Figure CN119271792A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical fields of natural language processing, deep learning and recommendation systems, and specifically relates to a natural language text query and question-answering system for scientific and technological intelligence analysis. Background Art
[0002] With the continuous acceleration of global scientific and technological innovation activities, the number of scientific and technological projects has shown a trend of massive growth, building a huge and complex information system. In the process of scientific research project management, by analyzing individual project data such as project introductions and summaries, we can judge the technical research and development of the project, understand the technical route, research methods and innovations; at the same time, by integrating a large number of intelligence data on scientific and technological projects and scientific and technological activities, we can dig out the development trends and technological progress directions in the field of science and technology, and predict future technological breakthroughs and potential changes in the industry. These data analyses help evaluate the maturity of technology, the level of innovation and the potential for market application, grasp the development trend of the field of science and technology, identify potential research directions and emerging technologies, and predict the path of future technological development, and formulate forward-looking scientific research plans, thereby promoting continuous innovation and development in the field of science and technology.
[0003] Although these large-scale data sets contain rich information resources and provide researchers with the possibility of conducting more comprehensive and in-depth research, the rapid expansion of data also brings challenges. First, the massive scientific and technological projects may cause researchers to cause information overload when processing and analyzing all available information. This not only prevents researchers from accurately and quickly locating key data and information, but also may lead to a waste of time and resources, thereby affecting scientific research efficiency and the quality of results. Secondly, the challenge faced by existing scientific research project management technologies is the lack of the ability to efficiently and accurately analyze massive text intelligence. This is mainly due to the fact that the current processing and analysis work is overly dependent on manpower and lacks the necessary deep semantic understanding and intelligent retrieval tools. Finally, the current question-answering system can only analyze immediate questions, and cannot realize the accumulation of process data and the integration of scattered information, thus failing to meet personalized use needs, further reducing the efficiency and benefits of intelligence analysis.
[0004] Therefore, how to improve the automation and intelligence level of scientific and technological intelligence analysis technology and develop a question-and-answer system with a memory function that can record query questions and results for subsequent reference and improvement has become a key scientific and technological issue that needs to be urgently addressed. Summary of the invention
[0005] In view of the deficiencies in the prior art, the present invention provides a natural language text query and question-answering system for scientific and technological intelligence analysis. After accurately understanding the input text through semantic analysis, the system automatically generates relevant tags and SQL statements, and designs a "memory window" mechanism that can save query history and results within a certain time window, so that subsequent SQL queries can easily reference previous query results, further improving the coherence and depth of the analysis.
[0006] In order to solve the above problems, the present invention provides a natural language text query and question-answering system for scientific and technological intelligence analysis, comprising:
[0007] The semantic information analysis module is the core part of the text query and question-answering system, responsible for deeply understanding the true intention and meaning of the user's input text.
[0008] The scientific research item label data storage module stores predefined labels and their associated metadata to support subsequent label generation and matching processes.
[0009] The scientific research item label generation and mapping module infers labels that are semantically relevant to the input text based on the results of semantic analysis, selects generated labels from predefined labels, and maps these labels to corresponding fields in the database query.
[0010] The scientific research item data processing module processes the scientific research items to ensure data alignment.
[0011] The intelligent query module automatically generates and verifies SQL statements based on the results of semantic analysis and label mapping in an intelligent way. The SQL statements are used to query scientific research item information.
[0012] Compared with the prior art, the system of the present invention achieves the following beneficial effects:
[0013] (1) Data processing capabilities. Process scientific research items to ensure the consistency of data units such as monetary units and time units, integrate, adjust and standardize data in the database, ensure the consistency of data between different sources or formats, and improve the accuracy and availability of data.
[0014] (2) Enhanced semantic understanding ability. Ability to deeply understand the true meaning of the text and the complex relationships behind it. This includes not only the recognition of keywords, but also a comprehensive analysis of context, sentence structure, and potential intent.
[0015] (3) Intelligent tag generation. Natural language processing is integrated with tags, which combines text content and context information to ensure that the generated tags reflect the theme and intent of the text to the greatest extent possible. The mapping of tags to database fields can seamlessly generate accurate SQL query statements.
[0016] (4) Intelligent SQL statement generation and verification function. This function can not only understand the query intent, but also automatically construct accurate SQL query statements and conduct strict verification to ensure the accuracy of the query results.
[0017] (5) Innovative application of the “memory window” mechanism. By saving the query history and its results within a certain time window, it not only saves the time and energy of repeatedly entering the same query, but also enables more in-depth analysis based on the accumulated data.
[0018] (6) Friendly interactive experience. The interactive page provided by the system is simple, intuitive and easy to operate. After entering the text, you can select the required tags from the recommended tags to generate more accurate SQL statements. This design greatly reduces the cost of use and learning. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a structural diagram of a text query and question-answering system for scientific and technological intelligence analysis according to an embodiment of the present application.
[0020] Figure 2 It is a flowchart of semantic analysis of an embodiment of the present application.
[0021] Figure 3 This is a flowchart of scientific research item label generation and mapping in an embodiment of the present application.
[0022] Figure 4 This is an embodiment of the present application that automatically generates SQL statements and verification flow charts. DETAILED DESCRIPTION
[0023] The principles and features of the present invention are described below in conjunction with the accompanying drawings. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0024] like Figure 1 As shown, the present application provides a natural language text query and question-answering system for scientific and technological intelligence analysis, which specifically includes: a semantic information analysis module, a scientific research item label data storage module, a scientific research item label generation and mapping module, a scientific research item data processing module, and an intelligent query module.
[0025] As an innovative technology in the field of natural language processing, the semantic information analysis module is of great significance for understanding and processing the complexity of human language. This application uses a model based on the Transformer architecture, and its core advantage is that it can accurately capture the semantic relevance between words.
[0026] Further, if Figure 2 As shown, the semantic information analysis module includes:
[0027] The text preprocessing submodule converts the original text into a numerical vector form by cleaning the input text, segmenting the text, and extracting stems. This module cleans the input file, including removing useless punctuation, deleting stop words, and normalizing the text. This reduces the noise of subsequent processing and ensures the accuracy of the analysis.
[0028] The feature extraction submodule comprehensively extracts key features such as word vectors, syntactic structures, and entity recognition from the preprocessed text. Through the multi-head attention mechanism, the contextual information of the text is deeply mined to accurately judge the intention of the input text. The features extracted from the preprocessed text by this module can represent the key information of the text and lay the foundation for subsequent deep semantic analysis.
[0029] The deep semantic analysis submodule uses advanced deep learning technology to parse the contextual relationships and implicit intentions in the text, and ultimately generates a comprehensive semantic analysis report containing information such as the main intention of the text, key entities and their relevance, and related tags, achieving beyond-the-surface keyword matching and accurate grasp of the overall meaning of the text.
[0030] Furthermore, the deep semantic analysis submodule first analyzes the contextual relationships among words, phrases, and sentences in the text, then determines the user's intention in inputting the text, and finally identifies the specific entities in the text and the relationships between entities; when performing contextual understanding, the deep learning model Transformer is used to understand long-distance dependencies.
[0031] In this application, scientific research items refer specifically to projects hosted or funded by government, enterprises, universities and other institutions. This includes summary text information such as project introduction, project summary, project summary keywords, project completion report, etc., as well as key elements such as the technical terms involved in the project itself, the project execution period and the project start and end time, the contract amount and its potential application scenarios. Scientific research item management is not only the starting point for the effective use of project information, but also a key cornerstone for advancing the progress of scientific research. Accordingly, the scientific research item label data storage module described in this application stores predefined labels and their associated metadata to support subsequent label generation and matching processes. Predefined labels include key fields such as project introduction, project summary, project summary keywords, project completion report, technical terms, project start time, project end time, contract amount, etc. Each field carries a specific information dimension, which provides rich metadata support for subsequent data processing and analysis.
[0032] Furthermore, the scientific research entry label data storage module introduces a data trigger mechanism to check whether there is duplicate data when the label is inserted or updated, and automatically execute response measures when duplication is detected. At the same time, the security protection of sensitive or private label information is also a key consideration. In this regard, the embodiment of the present application adopts security strategies such as access control of role and permission management, transparent data encryption, and two-factor authentication to ensure that label information is not subject to unauthorized access. Comprehensive consideration of these factors will help to design and maintain databases for storing label sets more accurately, securely, and manageably.
[0033] The scientific research item label generation and mapping module randomly samples α (changeable) scientific research items to form a test set for the semantic analysis model. The test set is accurately labeled through a professional manual annotation process to meet the high standards for model training and evaluation.
[0034] Furthermore, in the research item label generation and mapping module, the label generation is to find the most relevant labels through the natural language model, and these generated labels must be selected from predefined labels. When mapping, the system needs to have strong logical reasoning capabilities to achieve accurate mapping of labels to database fields.
[0035] Furthermore, the scientific research item label generation and mapping module introduces a feedback mechanism, which allows the relevance of generated labels to be evaluated and the label generation algorithm to be optimized through feedback.
[0036] Furthermore, the research item label generation and mapping module infers labels that are semantically related to the input text based on the results of semantic analysis. The generated labels are selected from the predefined labels, and these labels are mapped to the corresponding fields in the database query. The present invention innovatively integrates the natural language model with the label, and uses the Jaccard similarity algorithm to guide the adjustment of the model parameters to improve the overall performance of the model, so that the system can efficiently generate labels with a high degree of consistency. This integrated innovation of intelligent label generation provides a personalized and accurate search experience.
[0037] The intelligent query module includes an SQL statement automatic generation submodule and an SQL statement semantic verification module.
[0038] Furthermore, the SQL statement automatic generation submodule automatically constructs SQL based on the results of semantic analysis and label mapping. The generated SQL is not only a simple query, but also can generate more complex queries, including joint table query, subquery, aggregate function, etc.
[0039] Furthermore, the SQL statement semantic verification module needs to perform logical consistency verification, semantic consistency verification and performance evaluation on the generated SQL statements, and introduce advanced fault-tolerant mechanisms, including fuzzy matching technology to correct spelling errors, case-insensitive strategies to deal with case issues, and alias resolution rules to optimize alias processing. These measures improve the accuracy and robustness of the system in processing natural language input, ensuring that even in the case of non-standard input, the user's intention can be correctly parsed and valid SQL statements can be generated.
[0040] Preferably, the natural language text query and question-answering system for scientific and technological intelligence analysis further includes a query history record and memory module, which records the query history and results based on a certain time window, provides a memory function for the system, and enables subsequent queries to refer to previous results to achieve coherent analysis of information;
[0041] As well as, the human-computer interaction module provides an operation interface, supports interactive functions such as text input, display of recommended tags, and display of query results.
[0042] Furthermore, the query history record and memory module further includes:
[0043] The historical record storage submodule efficiently stores and manages historical query records and their results.
[0044] The time window management submodule defines and manages the retention policy of query history.
[0045] The query result reference submodule allows the system to reference previous query results in subsequent queries.
[0046] In particular, the query result reference submodule needs to generate a unique identifier for each query result.
[0047] In a specific embodiment, if Figure 3 As shown in the figure, the label generation and mapping process of scientific research items mainly includes label noise processing, label generation model construction, label generation and label mapping.
[0048] S1: Label noise processing
[0049] Noise labels usually refer to those that are irrelevant, misleading, or overly generalized, which will reduce the overall accuracy of the generation system and lead to inaccurate generation results. In addition, they will suffer from incorrect labels during the search or browsing process, which will affect user satisfaction and reduce trust in the system. To solve the noise problem, this application introduces the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm, which is a density-based clustering algorithm used to discover clusters of data points with sufficient density and can identify isolated data points as noise. The calculation steps are as follows:
[0050] S11: Define parameters, eps (neighborhood radius): specifies the neighborhood range of a data point, and the points within the radius are considered to be neighbors of the point. MinPts (minimum number of neighbors): specifies the minimum number of points in the neighborhood of a data point to mark the point as a core point.
[0051] S12: Initialization, marking all data points as unvisited.
[0052] S13: Traverse the data points, and if the number of points in its neighborhood is less than MinPts, mark it as noise.
[0053] If the number of points in its neighborhood is greater than or equal to MinPts, take this point as the core point, start a new clustering, and add this point and all the points in its neighborhood to the current cluster. For each point in the neighborhood, if the number of points in its neighborhood is greater than or equal to MinPts, add it to the current cluster. Recursively process all reachable points.
[0054] S14: Mark the visited points. For the points that have participated in the clustering, mark them as visited.
[0055] S15: Iterate, repeat steps S13 and S14 until all data points are visited.
[0056] Through the above steps, DBSCAN divides data points into core points, boundary points and noise points. Core points are points with a sufficient number of neighbors in their neighborhood, and boundary points are points that do not have enough points in their neighborhood to become core points, but they can become neighbors of other core points. Noise points are those points that do not belong to any cluster.
[0057] It should be noted that the performance of DBSCAN is sensitive to the choice of parameters, so it needs to be adjusted according to the characteristics of the data. In addition, DBSCAN makes no assumptions about the shape of the clusters and can discover clusters of arbitrary shapes.
[0058] S2: Label generation model construction
[0059] The label generation model is based on the BERT model. Compared with traditional natural language processing models, the main innovation of BERT is that it can understand the context in two directions and better capture the semantics of words in sentences through bidirectional Transformer.
[0060] The label generation model construction includes:
[0061] S21: Data collection and preprocessing, collect data sets containing text and corresponding labels, and preprocess the text.
[0062] S22: Convert labels into vector form using multi-hot encoding.
[0063] S23: Load the pre-trained BERT-base model.
[0064] S24: Model fine-tuning. First, the output layer is replaced with a fully connected layer with Dropout to reduce overfitting. The loss function uses the binary cross entropy loss function, which is suitable for multi-label separation problems. The optimizer selects the AdamW optimizer to better manage weight decay.
[0065] Furthermore, the binary cross entropy loss function considers the prediction of each label independently, decomposing the problem into multiple independent binary classification problems. For each label, the model predicts the probability of the label existing, and uses the binary cross entropy loss to calculate the difference between the predicted probability and the true label.
[0066] The formula is shown in formula (1):
[0067]
[0068] Among them, y is a binary label 0 or 1, p(y i) is the probability that the output belongs to the y label. As a loss function, binary cross entropy is used to judge the quality of the prediction results of a binary classification model. In layman's terms, for the case where the label y is 1, if the predicted value p(y i ) approaches 1, then the value of the loss function should approach 0. On the contrary, if the predicted value p(y i ) approaches 0, then the value of the loss function should be very large.
[0069] Furthermore, the AdamW optimizer is an improved algorithm based on Adam+L2 regularization. It solves the problem that weight decay is directly affected by learning rate adjustment by performing weight decay separately outside the parameter update step instead of considering weight decay as part of the loss function.
[0070] The formulas are shown in equations (2) to (6):
[0071] m t =β1*m t-1 +(1-β1)*g t (2)
[0072]
[0073] Where λ is the weight decay factor, which is commonly set to 0.005 / 0.01. This value can be adjusted and configured according to specific needs.
[0074] S25: Train the model using the prepared dataset.
[0075] S26: Performance evaluation. Use the validation set to evaluate the model performance, and select the accuracy and recall rate as the evaluation indicators.
[0076] S27: Iterative optimization. According to the results of performance evaluation, the model parameters or preprocessing process are continuously adjusted based on the Jaccard similarity algorithm to further improve the accuracy of the recommendation system.
[0077] Furthermore, the Jaccard similarity algorithm is a measurement method for comparing the similarity between two sets. During the model training process, the Jaccard similarity algorithm can help identify the similarity between texts or tags. This helps the model better understand and learn the relevance of different tags and their relationship with the text content. During the iterative optimization phase of the model, the similarity comparison algorithm can be used to evaluate and adjust the recommendation effect of the model. By comparing the similarity between the tag set recommended by the model and the actual tag set, the recommendation accuracy of the model can be quantified.
[0078] Furthermore, the Jaccard similarity algorithm measures the similarity of two sets by calculating the ratio of the number of elements in the intersection of two sets to the number of elements in their union. The calculation formula is shown in formula (7):
[0079]
[0080] Among them, |A∩B| represents the number of elements in the intersection of set A and set B, and |A∪B| represents the number of elements in their union. The value range of Jaccard similarity is between 0 and 1, where 0 means that the two sets have no common elements and 1 means that the two sets are exactly the same.
[0081] S3: Tag Generation
[0082] Through a similarity-based ranking algorithm, the tag generation model selects tags with higher similarity. This process allows for further refined search tag selection, leading to more efficient information retrieval. The top-ranked tags are then displayed for necessary screening and application.
[0083] S4: Label Mapping
[0084] Implementing the matching rules between labels and database fields based on natural language processing (NLP) is essentially a complex text analysis process, which aims to deeply explore the semantic associations between label content and the annotations and names of database fields. This process initially starts with the collection of high-quality and widely representative database field annotation and name datasets to ensure the accuracy and effectiveness of subsequent analysis. Subsequently, this batch of data is carefully cleaned and preprocessed, which includes eliminating text noise, filling missing values, removing irrelevant punctuation, and performing word segmentation to maintain the consistency of standardized text format. The preprocessed text is converted into vector form using the Skip-Gram method of Word2Vec. This step captures the rich semantic information behind words and phrases by simulating context, and introduces a negative sampling strategy to optimize the training efficiency of the model. Next, the cosine similarity algorithm is used to quantify the similarity between the label vector and the database field annotation and name vector as the main criterion for evaluating semantic proximity. Based on the obtained similarity score, we set a clear threshold to determine which database fields match a given label. This requires not only a deep understanding and proficient application of NLP technology and related algorithms, but also careful adjustment of matching rules in specific scenarios to ensure accurate and practical matching results.
[0085] Furthermore, the Skip-Gram algorithm is an algorithm in Word2Vec, and its main purpose is to predict the context of a given word. For example, given a specific word, the Skip-Gram model will try to predict the words around it in the text. In this way, the word vector learned by the model can capture rich semantic information and the relationship between words. It contains an embedding layer and a Softmax output layer. The embedding layer is used to map words to vector space.
[0086] The goal of Skip-Gram is to maximize the conditional probability, which is calculated as follows:
[0087] P(context_word|center_word)=Π context_word∈context_words P(context_word|center_word)
[0088] Among them, (center_word,context_words)(center_word,context_words) are training samples.
[0089] Furthermore, the Negative Sampling technique is an optimization technique used to simplify the training process of the Skip-Gram model. In the original Skip-Gram model, for each training sample, the model needs to update the weights of all words in the vocabulary, which is very inefficient when having a large vocabulary. Negative Sampling solves this problem by updating only a small part of the weights, that is, for each positive sample (the word that actually appears in the context), a small number of negative samples (the words that do not appear in the context) are randomly selected, and only the weights of these positive and negative samples are updated.
[0090] The calculation formula is as follows:
[0091] The objective function is changed to minimize the following loss:
[0092]
[0093] Among them, s is the Sigmoid function, score is the score between the center word and the context word, and k is the number of negative samples sampled.
[0094] In a specific embodiment, if Figure 4As shown in the figure, the automatic generation method of SQL statements aims to solve the problem that the existing SQL statement writing work is complicated and trivial, and consumes a lot of manpower and material resources. In this process, the scientific research entry data processing module plays a key role. The scientific research entries must be processed first to ensure the consistency and accuracy of the data, and then generate SQL statements based on text analysis and label generation. These SQL statements are used to query scientific research entry information. The specific implementation steps are as follows:
[0095] S5: The research item data processing module is responsible for comprehensive processing of research items to ensure data consistency and alignment. The functions of this module include integrating, adjusting and normalizing data in the database to ensure its consistency, accuracy and usability across different sources or formats.
[0096] In particular, in terms of unit unification, the time units in the data are converted into a standard format, for example, dates in different formats (such as DD / MM / YYYY and MM-DD-YYYY) are unified into the ISO format (YYYY-MM-DD); the currency units in the data are converted into a standard currency, for example, the US dollar, the euro, etc. are converted into RMB. Through these steps, the consistency of data between different sources or formats can be guaranteed, and the accuracy and availability of data can be improved.
[0097] S6: In order to convert natural language queries into SQL queries, it is necessary to establish corresponding rules between natural language keywords and SQL keywords, which can be set by analyzing the corresponding relationship between common natural language queries and SQL queries. For example, "query" corresponds to the SQL "select" keyword, "condition" corresponds to the SQL "where" keyword, and so on.
[0098] In addition, the connection information, fields, and relationships between tables involved in data query need to be classified and stored to facilitate subsequent conversion processing. For general configuration information, it can be set in advance in the rule library; for configuration information, it can be obtained by dynamically reading database metadata information. When establishing SQL statement corresponding rules, it is necessary to fully consider the grammatical structure of the SQL language and the needs of business queries, and set corresponding rules according to actual conditions to achieve the purpose of successful conversion. At the same time, it is necessary to regularly maintain the accuracy and completeness of the SQL statement corresponding rules to prevent rule matching errors or translation errors caused by changes in data structure.
[0099] S7: Through the semantic information analysis module, the system deeply analyzes the input text and extracts keywords directly related to the query. These keywords reflect the query requirements, including but not limited to the data table name to be queried, specific fields, and query conditions. At the same time, the tag recommendation model recommends relevant tags based on these keywords and determines the database target fields that are semantically related to the input text through tag mapping technology.
[0100] S8: According to the pre-defined SQL statement conversion rules, the target natural language keywords are accurately mapped to the corresponding SQL keywords. This process relies on the data structure and metadata in the rule base to achieve the conversion of natural language keywords to SQL keywords.
[0101] It is worth noting that in order to deal with possible spelling errors, inconsistent capitalization, or irregular use of aliases in table and field names, this system has introduced an advanced fault-tolerance mechanism. This includes using fuzzy matching technology to identify and automatically correct spelling errors, adopting a case-insensitive strategy to handle capitalization issues, and optimizing alias processing through alias resolution rules. These fault-tolerance measures significantly improve the accuracy and robustness of the system in processing natural language input, ensuring that even in the case of irregular input, the user's intent can be correctly parsed and valid SQL statements can be generated.
[0102] For example, when a user enters a natural language query such as "Please draw the research funding receipt status of xx University in the past five years, including vertical and horizontal projects", the system will extract keywords such as "past five years", "xx University", "research funding", "receipt status", "vertical projects" and "horizontal projects", automatically correct possible spelling errors, identify irregular capitalization or alias problems through fuzzy matching, and finally generate an SQL query statement such as "SELECT year, SUM (amount) as total_amount FROM research_funding WHERE university_name = 'xx University' AND project_type IN ('vertical projects', 'horizontal projects') AND year BETWEEN (CURRENT_YEAR-5) AND CURRENT_YEAR GROUP BY year;", to ensure the accuracy and effectiveness of the query.
[0103] S9: Generate a target SQL statement based on the target SQL keyword and the database field mapped by the user's selected tag, and merge the multiple target SQL keywords obtained in step 3 and the collected database fields to generate a target SQL statement. When the generated target SQL statement is executed, it is consistent with the test case query requirements written in natural language.
[0104] S10: Use the SQL parser to parse the automatically generated SQL statements into an abstract syntax tree, and then perform a comprehensive verification of the syntax tree to ensure the logical consistency and semantic accuracy of the SQL statements, and perform performance evaluation. This process includes checking the rationality of the conditions in the WHERE clause to ensure that there are no logical contradictions; verifying the relevance of the JOIN operation to ensure that the relationship between the tables is logically correct; promptly discovering and pointing out possible semantic errors, such as referencing non-existent fields or tables. In addition, the execution plan of the SQL statement will be evaluated to find potential performance bottlenecks. Once a problem is detected, the system will provide a detailed error description and correction suggestions to help quickly locate and solve the problem, thereby ensuring the efficiency and reliability of SQL queries.
[0105] Preferably, the natural language text query and question-answering system for scientific and technological intelligence analysis further adds a "memory window" mechanism, which improves the consistency and efficiency of interaction and avoids repeated input of complex query statements. The specific implementation steps include:
[0106] S111: Setting the window size. In this example, the window size is set to θ, that is, the most recent θ SQL query records and results are saved.
[0107] S112: Storage mechanism design, using a circular queue to store historical records. After executing a SQL query, the system encapsulates the query statement, execution result, and timestamp into a new record and adds it to the circular queue. When the queue is full, the oldest record will be removed to keep the queue size unchanged. Each record contains information such as the SQL query statement, execution result, and timestamp, and a unique identifier is set for it.
[0108] S113: record update, after each SQL query is executed, the query statement and result are stored in a circular queue.
[0109] S114: When a new query request is received, check whether to use historical results. If yes, search for the corresponding historical results according to the unique identifier. If the referenced historical results do not exist, return a clear error message.
[0110] Those skilled in the art can understand that the above are only preferred examples of the invention and are not intended to limit the invention. Although the invention is described in detail with reference to the above examples, those skilled in the art can still modify the technical solutions recorded in the above examples or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, etc. made within the spirit and principle of the invention shall be included in the protection scope of the invention.
[0111] Of course, the present invention may have many other embodiments. Without departing from the spirit and essence of the present invention, technicians familiar with the field may make various corresponding changes and deformations based on the present invention, but these corresponding changes and deformations should all fall within the scope of protection of the claims attached to the present invention.
Claims
1. A natural language text query and question-answering system for scientific and technological intelligence analysis, characterized in that: include: The semantic information analysis module is responsible for deeply understanding the true intention and meaning of the user input text; The scientific research item label data storage module stores predefined labels and their associated metadata to support the subsequent label generation and matching process; The research item label generation and mapping module infers labels that are semantically relevant to the input text based on the results of semantic analysis, selects the generated labels from predefined labels, and maps these labels to the corresponding fields in the database query; The scientific research item data processing module processes the scientific research items to ensure data alignment; The intelligent query module automatically generates and verifies SQL statements based on the results of semantic analysis and label mapping, and the SQL statements are used to query scientific research item information.
2. A natural language text query and question-answering system for scientific and technological information analysis according to claim 1, characterized in that: The semantic information analysis module comprises: The text preprocessing submodule cleans the input files, reduces noise, and ensures the accuracy of analysis; Feature extraction submodule, extracts useful features from the preprocessed text; The deep semantic analysis submodule parses the contextual relationships and implicit intentions in the text, achieving keyword matching beyond the surface and accurate grasp of the overall meaning of the text.
3. A natural language text query and question-answering system for scientific and technological information analysis according to claim 2, characterized in that: The deep semantic analysis submodule first analyzes the contextual relationships among words, phrases, and sentences in the text, then determines the intent of the user input text, and finally identifies specific entities in the text and the relationships between entities; when performing contextual understanding, the deep learning model Transformer is used to understand long-distance dependencies.
4. A natural language text query and question-answering system for scientific and technological information analysis according to claim 1, characterized in that: The predefined labels in the scientific research item label data storage module include project introduction, project summary, project summary keywords, project completion report, technical terms, project start time, project end time and contract amount.
5. A natural language text query and question-answering system for scientific and technological information analysis according to claim 1, characterized in that: The scientific research item label generation and mapping module includes a label generation submodule and a label mapping submodule; The tag generation submodule uses a similarity-based sorting algorithm to select tags whose similarity exceeds a set first threshold value from the tag generation model; The tag mapping submodule implements the tag and database field matching rules based on natural language processing, and aims to deeply explore the semantic association between the tag content and the annotations and names of the database fields.
6. A natural language text query and question-answering system for scientific and technological information analysis according to claim 5, characterized in that: The label mapping submodule performs the following operations: Collect high-quality and broadly representative database field annotation and name datasets; Clean and preprocess the data; The Skip-Gram method is used to convert the preprocessed text into vector form, and a negative sampling strategy is introduced to optimize the training efficiency; The cosine similarity algorithm is used to quantify the similarity between the tag vector and the database field annotation and name vector to obtain a similarity score; Based on a comparison of the obtained similarity score with a second threshold, it is determined which database fields match the given tag.
7. A natural language text query and question-answering system for scientific and technological information analysis according to claim 1, characterized in that: The intelligent query module comprises: SQL statement automatic generation submodule, automatically build SQL according to the results of semantic analysis and label mapping; The SQL statement semantic verification submodule checks whether the generated SQL statement semantically meets the query requirements to ensure the accuracy of the query results.
8. A natural language text query and question-answering system for scientific and technological information analysis according to claim 7, characterized in that: The SQL statement automatic generation submodule can generate complex queries, including joint table queries, subqueries and aggregate functions; the SQL statement semantic verification submodule introduces advanced fault-tolerant mechanisms, including fuzzy matching technology to correct spelling errors, case-insensitive strategies to deal with case issues, and alias resolution rules to optimize alias processing.
9. A natural language text query and question-answering system for scientific and technological information analysis according to claim 1, characterized in that: It also includes a query history and memory module, which records query history and results based on a certain time window, provides a memory function for the system, and enables subsequent queries to reference previous results to achieve coherent analysis of information; as well as, The human-computer interaction module provides an operation interface, supports text input, displays recommended tags, and displays query results.
10. A natural language text query and question-answering system for scientific and technological information analysis according to claim 9, characterized in that: The query history record and memory module includes: The historical record storage submodule stores and manages historical query records and their results; The time window management submodule defines and manages the retention policy of query history records; The query result reference submodule allows the system to reference previous query results in subsequent queries.