Meteorological question and answer matching method and device

By performing semantic parsing and intent recognition in an intelligent question-answering system in the meteorological field, parallel retrieval of meteorological knowledge graphs and text databases, and feature fusion using a dynamic attention model, the system addresses the shortcomings in accuracy and real-time performance of existing meteorological question-answering systems, thereby improving the user experience.

CN122019717APending Publication Date: 2026-05-12BEIJING METEOROLOGICAL DATA CENTER (BEIJING METEOROLOGICAL ARCHIVES)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610116670.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-28
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing intelligent question-answering systems in the meteorological field face challenges in integrating multi-source heterogeneous information and possessing weak capabilities in complex semantics and multi-step reasoning when dealing with complex meteorological questions. This results in a difficulty in simultaneously ensuring the accuracy, real-time performance, and professionalism of the answers.

Method used

By acquiring natural language questions input by users, semantic parsing and intent recognition are performed. Parallel retrieval is conducted using a pre-built meteorological knowledge graph and text database. Attention weights are calculated using a dynamic attention model, and feature fusion is performed to generate high-quality response information.

Benefits of technology

It has improved the accuracy and professionalism of Q&A in the meteorological field, curbed the "illusion" problem of large language models, ensured the high real-time performance and reliability of information, and enhanced the user interaction experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122019717A_ABST
    Figure CN122019717A_ABST
Patent Text Reader

Abstract

The invention provides a meteorological question and answer matching method and device, and relates to the technical field of natural language processing, and the method comprises the steps: obtaining a natural language question input by a user; semantic analysis and intention recognition are carried out on the natural language question, and label vectors are classified; retrieving an entity relationship set from the meteorological domain knowledge graph based on the classification tag vector; retrieving a text fragment from the text library; adopting a dynamic attention model to calculate attention weights of the classification label vector, the entity relationship set and the text fragment, and performing feature fusion on the classification label vector, the entity relationship set and the text fragment based on the attention weights to obtain a guide vector; and generating response information corresponding to the natural language question based on the guide vector. According to the meteorological question and answer matching method and device provided by the invention, guide type reasoning can be more accurately and comprehensively performed based on the guide vector, so that the accuracy of response information is ensured, and the interaction experience degree of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing, and in particular to a meteorological question-and-answer matching method and apparatus. Background Technology

[0002] In intelligent question-answering systems for meteorology, existing technologies mainly fall into two categories: The first category is based on traditional information retrieval. This approach uses keyword matching to retrieve relevant text fragments or data from structured meteorological databases or unstructured meteorological documents and directly returns them to the user. This method is suitable for handling simple, factual questions, such as "What is today's temperature?". The second category is based on general-purpose large language models. This approach directly utilizes the natural language generation capabilities of unoptimized general-purpose large models to generate answers to complex questions input by the user.

[0003] However, the main drawback of traditional retrieval technologies for the first category lies in their lack of deep semantic understanding and reasoning capabilities. The system cannot comprehend the complex logical relationships implicit in the question, such as time series and causal relationships, and can only return fragmented, scattered information. It cannot automatically integrate and generate coherent, structured answers, resulting in a poor user experience. As for the second category of general large-scale model technologies, their main drawback is the low credibility of the generated results. Specifically, this manifests as: a tendency to generate factual illusions, such as the large model generating seemingly reasonable but factually incorrect answers; a lack of knowledge lag and real-time updates, such as the static nature of the knowledge in the large model parameters, making it impossible to access and utilize the latest real-time meteorological data (such as newly generated typhoon path forecasts); and insufficient domain specialization, such as a lack of precise meteorological domain knowledge support, leading to sloppy reasoning processes and unreliable conclusions.

[0004] Therefore, existing intelligent question-answering systems in the meteorological field often face difficulties in fusing multi-source heterogeneous information when dealing with complex meteorological questions. Furthermore, they have weak capabilities in complex semantics and multi-step reasoning, leading to problems such as difficulty in achieving accuracy, real-time performance, and professionalism in answers, thereby reducing the user experience. Summary of the Invention

[0005] In view of this, the purpose of the present invention is to provide a weather question-and-answer matching method and apparatus to alleviate the above-mentioned technical problems.

[0006] In a first aspect, embodiments of the present invention provide a meteorological question-and-answer matching method, the method comprising: acquiring a natural language question input by a user; performing semantic parsing and intent recognition on the natural language question to obtain a classification label vector of the natural language question; wherein, the elements in the classification label vector are used to characterize the probability that the natural language question belongs to a corresponding question type; retrieving multiple entities and multiple relations related to the natural language question from a pre-constructed meteorological domain knowledge graph based on the classification label vector to obtain an entity relation set containing multiple entities and multiple relations; and retrieving a preset number of text fragments semantically related to the natural language question from a pre-constructed text library; calculating the attention weights of the classification label vector, the entity relation set, and the text fragments using a pre-constructed dynamic attention model; performing feature fusion on the classification label vector, the entity relation set, and the text fragments based on the attention weights to obtain a guidance vector corresponding to the natural language question; and generating response information corresponding to the natural language question based on the guidance vector.

[0007] In conjunction with the first aspect, this embodiment of the invention provides a first possible implementation of the first aspect, wherein the steps of performing semantic parsing and intent recognition on the natural language question to obtain a classification label vector for the natural language question include: performing word segmentation preprocessing on the natural language question to obtain input information corresponding to the natural language question that meets a preset format; inputting the input information into a pre-trained natural language processing model, extracting semantic features of the natural language question through the natural language processing model; predicting the probability that the natural language question belongs to each question type based on the semantic features, and generating the classification label vector based on the prediction result.

[0008] In conjunction with the first aspect, this embodiment of the invention provides a second possible implementation of the first aspect, wherein the step of retrieving multiple entities related to the natural language problem from a pre-constructed meteorological domain knowledge graph based on the classification label vector includes: obtaining a directed graph of the knowledge graph corresponding to the meteorological domain knowledge graph; mapping the meteorological-related entities in the directed graph of the knowledge graph, and the relationships between the meteorological-related entities, to a pre-constructed low-dimensional embedding space to obtain meteorological entity vectors and corresponding relationship vectors; calculating the correlation degree between each meteorological entity vector and the classification label vector in the low-dimensional embedding space; and determining the entities corresponding to the meteorological entity vectors with a correlation degree greater than a preset threshold as entities related to the natural language problem.

[0009] In conjunction with the second possible implementation of the first aspect, this embodiment of the invention provides a third possible implementation of the first aspect, wherein the step of retrieving multiple relations related to the natural language problem from a pre-constructed meteorological domain knowledge graph based on the classification label vector includes: calculating the similarity between each relation vector and the classification label vector; and selecting a preset number of relation vectors with the highest similarity as multiple relations related to the natural language problem.

[0010] In conjunction with the second possible implementation of the first aspect, this embodiment of the invention provides a fourth possible implementation of the first aspect, wherein the step of calculating the correlation between each meteorological entity vector and the classification label vector includes: calculating the semantic similarity and frequency correlation between each meteorological entity vector and the classification label vector; performing a weighted calculation on the semantic similarity and the frequency correlation according to a pre-set weight parameter to obtain a correlation score between the meteorological entity vector and the classification label vector; and performing a weighted calculation on the correlation score based on each element in the classification label vector to obtain the correlation degree.

[0011] In conjunction with the first aspect, this embodiment of the invention provides a fifth possible implementation of the first aspect, wherein the step of retrieving a preset number of text fragments from the pre-constructed text library that are semantically related to the natural language question includes: constructing a comprehensive vector based on the natural language question and the classification label vector; inputting the comprehensive vector into a pre-constructed semantic matching model, so that the semantic matching model retrieves the preset number of text fragments most semantically related to the natural language question from the text library based on the comprehensive vector.

[0012] In conjunction with the first aspect, this embodiment of the invention provides a sixth possible implementation of the first aspect, wherein the step of calculating the attention weights of the classification label vector, the entity relation set, and the text fragment using a pre-constructed dynamic attention model includes: extracting feature representations of the classification label vector, the entity relation set, and the text fragment respectively; constructing corresponding dynamic attention weight functions based on the feature representations respectively; and calculating the attention weights corresponding to each feature representation according to the dynamic attention weight functions.

[0013] In conjunction with the sixth possible implementation of the first aspect, this embodiment of the invention provides a seventh possible implementation of the first aspect, wherein the step of performing feature fusion on the classification label vector, the entity relation set, and the text fragment based on the attention weight to obtain the guiding vector corresponding to the natural language question includes: using the attention weight to perform weighted fusion on the feature representations corresponding to the classification label vector, the entity relation set, and the text fragment to obtain the guiding vector corresponding to the natural language question.

[0014] In conjunction with the first aspect, this embodiment of the invention provides an eighth possible implementation of the first aspect, wherein the above method further includes: if the classification label vector represents the question type of the natural language question as a simple type, then based on the semantics of the natural language question, retrieve the response information corresponding to the natural language question from the meteorological domain knowledge graph, or retrieve the response information corresponding to the natural language question from the text library.

[0015] Secondly, embodiments of the present invention also provide a meteorological question-and-answer matching device, the device comprising: an acquisition module for acquiring a natural language question input by a user; a parsing module for performing semantic parsing and intent recognition on the natural language question to obtain a classification label vector of the natural language question; wherein, the elements in the classification label vector are used to characterize the probability that the natural language question belongs to a corresponding question type; a retrieval module for retrieving multiple entities and multiple relations related to the natural language question from a pre-constructed meteorological domain knowledge graph based on the classification label vector to obtain an entity relation set containing multiple entities and multiple relations; and retrieving a preset number of text fragments semantically related to the natural language question from the pre-constructed text library; a fusion module for calculating the attention weights of the classification label vector, the entity relation set, and the text fragments using a pre-constructed dynamic attention model, and performing feature fusion on the classification label vector, the entity relation set, and the text fragments based on the attention weights to obtain a guidance vector corresponding to the natural language question; and a response module for generating response information corresponding to the natural language question based on the guidance vector.

[0016] The embodiments of the present invention bring the following beneficial effects: This invention provides a meteorological question-answering matching method and apparatus, which can acquire a natural language question input by a user; perform semantic parsing and intent recognition on the natural language question to obtain a classification label vector of the natural language question; retrieve multiple entities and multiple relations related to the natural language question from a pre-constructed meteorological domain knowledge graph based on the classification label vector to obtain an entity relation set containing multiple entities and multiple relations; and retrieve a preset number of text fragments semantically related to the natural language question from a pre-constructed text library; calculate the attention weights of the classification label vector, entity relation set, and text fragments using a pre-constructed dynamic attention model; perform feature fusion on the classification label vector, entity relation set, and text fragments based on the attention weights to obtain a guidance vector corresponding to the natural language question; and then generate response information corresponding to the natural language question based on the guidance vector. During the retrieval process, parallel retrieval of meteorological knowledge graphs and text databases can be achieved, ensuring the comprehensiveness of the retrieval. At the same time, the dynamic attention model can use a dynamic attention mechanism to allocate attention weights to information from multiple sources, which can better highlight the retrieval focus of natural language questions, enabling the generated guidance vector to conduct more accurate and comprehensive guided reasoning, thereby obtaining high-quality response information, ensuring the accuracy of the response information, and thus improving the user's interactive experience.

[0017] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0018] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

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

[0020] Figure 1 A flowchart of a meteorological question-and-answer matching method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the system architecture of a meteorological question-and-answer system provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a meteorological question-and-answer matching device provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] Currently, the general large model (LLM model) used in existing intelligent question-answering systems in the meteorological field mostly relies on static, potentially outdated, or incomplete intrinsic knowledge acquired during training. When generating answers for highly specialized and dynamically changing meteorological data, it is prone to factual errors, i.e., meteorological "illusions," leading to problems such as difficulty in balancing answer accuracy, real-time performance, and professionalism, thereby reducing the user experience.

[0023] Based on this, the meteorological question-and-answer matching method and apparatus provided in this embodiment of the invention can specifically improve the accuracy and professionalism of questions and answers in the meteorological field, effectively curb the "illusion" problem of traditional large models, and improve the user experience.

[0024] To facilitate understanding of this embodiment, a meteorological question-and-answer matching method disclosed in this embodiment of the invention will first be described in detail.

[0025] In one possible implementation, this invention provides a weather-related question-and-answer matching method. This method can be applied to a weather-related question-and-answer system. For example, the system may include a server and a client communicating with the server. The client can provide an interactive interface for users to input natural language questions. The client can be a smart terminal used by the user, such as a smartphone, tablet, desktop computer, or PC. The user can install a corresponding application (APP) and log in to the backend server through the APP. Once the APP is launched, an interactive interface can be displayed in the graphical user interface of the smart terminal for the user to perform operations, such as inputting natural language questions, thereby executing the weather-related question-and-answer matching method provided in this invention.

[0026] like Figure 1 The flowchart shown is a weather question-and-answer matching method, which includes the following steps: Step S102: Obtain the natural language question input by the user; Step S104: Perform semantic parsing and intent recognition on the natural language question to obtain the classification label vector of the natural language question; In this embodiment of the invention, the elements in the classification label vector are used to characterize the probability that a natural language question belongs to the corresponding question type.

[0027] In actual use, users can input natural language questions through text or voice in the input controls provided on the interactive interface. After the backend server obtains the natural language questions, it can execute the process of step S104 above to perform semantic parsing and intent recognition on the natural language questions.

[0028] Step S106: Based on the classification label vector, retrieve multiple entities and multiple relations related to the natural language problem from the pre-built meteorological domain knowledge graph to obtain an entity relation set containing multiple entities and multiple relations; and retrieve a preset number of text fragments related to the semantics of the natural language problem from the pre-built text library. Step S108: The attention weights of the classification label vector, entity relation set and text fragment are calculated using a pre-built dynamic attention model. Based on the attention weights, the features of the classification label vector, entity relation set and text fragment are fused to obtain the guiding vector corresponding to the natural language question. Step S110: Generate response information corresponding to the natural language question based on the guiding vector.

[0029] In step S106, the process described above is a parallel retrieval process, meaning that the retrieval process based on the meteorological knowledge graph and the text database can be performed simultaneously. In step S108, an attention mechanism is used to fuse the retrieval results obtained from the parallel retrieval, thereby generating a high-quality guiding vector. Furthermore, the attention mechanism can employ a Transformer-based cross-attention mechanism or a multi-round iterative hierarchical attention structure, depending on the actual application; this embodiment of the invention does not impose any limitations on this.

[0030] Furthermore, in step S110 above, the guiding vector can be input into a large language model. The large language model performs reasoning based on the guiding vector to obtain response information. This large language model is typically a large language model precisely fine-tuned using meteorological data. Under the constraints of context and guided by the guiding vector, the large language model can perform logical reasoning and natural language generation, outputting a final professional, accurate, and structured answer. This answer can serve as the response information corresponding to the natural language question in this embodiment of the invention and is ultimately fed back to the user.

[0031] The meteorological question-and-answer matching method provided in this invention can achieve parallel retrieval of meteorological knowledge graphs and text databases during the retrieval process, ensuring the comprehensiveness of the retrieval. At the same time, the dynamic attention model can use a dynamic attention mechanism to allocate attention weights to information from multiple sources, which can better highlight the retrieval focus of natural language questions, enabling the generated guidance vector to perform more accurate and comprehensive guided reasoning, thereby obtaining high-quality response information, ensuring the accuracy of the response information, and thus improving the user's interactive experience.

[0032] In practical use, in order to implement the meteorological question-and-answer matching method provided in the embodiments of the present invention in the meteorological question-and-answer system, it is usually necessary to establish a system architecture for the meteorological question-and-answer system. Specifically, the system architecture of the meteorological question-and-answer system in the embodiments of the present invention adopts a pipeline architecture of "retrieval-enhancement-generation", which can combine the accuracy of meteorological knowledge graph, the comprehensiveness of semantic retrieval based on text library and the adaptive fusion capability of dynamic attention with the smooth generation capability of large language model after domain fine-tuning, so as to solve the technical problems mentioned in the background art.

[0033] For ease of understanding, Figure 2 A schematic diagram of the system architecture of a weather question-and-answer system is shown, such as... Figure 2 As shown, the meteorological question-answering system in this embodiment of the invention includes: a question classifier module 20, a knowledge graph module 30, a semantic retrieval module 40, an attention fusion module 50, and a fine-tuning module 60. Each module is further subdivided into multiple units. The question classifier module 20 includes a data preprocessing unit 201, a BERT encoding unit 202, and a classification prediction unit 203; the knowledge graph module 30 includes an entity embedding unit 301, a relation embedding unit 302, an entity and question retrieval unit 303, and a relation and question retrieval unit 304; the semantic retrieval module 40 includes a semantic matching unit 401 and a retrieval ranking unit 402; the attention fusion module 50 consists of a dynamic attention unit 501 and a fusion unit 502; and the fine-tuning module 60 includes a pre-trained model unit 601 and a fine-tuning unit 602.

[0034] Specifically, based on Figure 2The system architecture of the meteorological question-and-answer system shown is as follows: When a user inputs a natural language question, the question classifier module classifies it and outputs the aforementioned classification label vector; that is, the process in step S104 of this embodiment is executed in the question classifier module. Next, based on the classification results, the knowledge graph module retrieves relevant structured knowledge and outputs entities and relationships related to the natural language question. The semantic retrieval module retrieves the Top-N text fragments most relevant to the natural language question from unstructured data in the text library. The attention fusion module, combining a dynamic attention mechanism, weights and fuses the output information (entity relationship set and text fragments) from the knowledge graph module and the semantic retrieval module. Finally, the precision fine-tuning module generates the final answer to the natural language question, thus obtaining the response information in this embodiment.

[0035] Specifically, the following combination Figure 2 The meteorological question-and-answer matching method in the embodiments of the present invention will be described in detail below. Specifically, it may include the following process: (1) Problem classification and routing; This process is in Figure 2 The problem classifier module in the middle is used.

[0036] Specifically, the question classifier module can perform word segmentation preprocessing on natural language questions to obtain input information that meets the preset format corresponding to the natural language questions; input the input information into a pre-trained natural language processing model, extract the semantic features of the natural language questions through the natural language processing model; predict the probability that the natural language questions belong to each question type based on the semantic features, and generate a classification label vector based on the prediction results.

[0037] In practice, after a user inputs a natural language question, the question classifier module performs semantic parsing and intent recognition on the question. This classifier module typically uses pre-trained models such as BERT, outputting a classification label for each question type and determining whether the question is a complex question requiring a complex reasoning process. Therefore, step S104 performed by the question classifier module achieves the triage of natural language questions, optimizing resource allocation in the meteorological question-answering system.

[0038] Specifically, based on Figure 2After the user inputs a natural language question, this question is fed into the question classifier module. The data preprocessing unit 201 performs word segmentation preprocessing on the natural language question, that is, it segments the natural language question into words and adds special markers such as [CLS] and [SEP] to adapt to the input format of the BERT encoding unit's natural language processing model. In the BERT encoding unit, the BERT model is used as the natural language processing model to extract the semantic features of the natural language question. Specifically, a pre-trained BERT model is used to encode the pre-processed natural language question and extract its semantic features. The classification prediction unit, based on the semantic features encoded by the BERT model, predicts the category of the natural language question through fully connected layers and the Softmax activation function, that is, the probability that the natural language question belongs to each question type. Based on the prediction results, a classification label vector is generated. Thus, the question classifier module classifies the natural language question into simple or complex types based on its complexity. Typically, complex questions include four types: combinatorial questions, combined questions, comparative questions, and superlative questions.

[0039] For ease of understanding, Table 1 below shows examples of different types of questions, as shown in Table 1 below: Table 1:

[0040] Based on Table 1 above, the process of step S104 performed by the question classifier module can be represented as follows: Assume Q is the natural language question input by the user, C is the question classifier used by the question classifier module, and P is the probability classification prediction result of the natural language question. The goal of the question classifier is to map the natural language question Q onto a probability distribution P, representing the probability that the natural language question belongs to different categories in Table 1. Therefore, this probability distribution P is the classification label vector in this embodiment of the invention, expressed as... Let represent the probability that the natural language question Q belongs to the i-th question type, and . Where n represents the number of problem types, and based on Table 1 above, we know that n = 6.

[0041] (2) Parallel knowledge retrieval; This process is in Figure 2 The knowledge graph module 30 and semantic retrieval module 40 are executed in parallel, and correspond to the above. Figure 1 Step S106 in the process.

[0042] Specifically, based on the aforementioned classification label vector, it can be determined whether the natural language question input by the current user is a simple or complex question. For questions identified as complex, two retrieval paths are initiated simultaneously: one based on a pre-built meteorological knowledge graph and the other based on a pre-built text database, to perform parallel knowledge retrieval. Conversely, if the classification label vector indicates that the natural language question is simple, the response information corresponding to the natural language question is retrieved from the meteorological knowledge graph based on the semantics of the natural language question, or from the text database. That is, for simple questions... For a given question, a search can be performed between a meteorological knowledge graph and a pre-built text database. Specifically, the search can be performed based on the semantics of the natural language question. This embodiment of the invention does not impose any limitations on this. In addition, for simple types of natural language questions, a parallel knowledge retrieval process can also be performed. However, since simple types of natural language questions may yield relatively few results during parallel knowledge retrieval, or duplicate search results may occur, the results obtained after the feature fusion process in step S108 are often consistent with the results of the aforementioned selective retrieval. Therefore, for simple types of natural language questions, the selective retrieval method is usually chosen to reduce the computational load and response time of the meteorological question-and-answer system.

[0043] Furthermore, the parallel knowledge retrieval process in this embodiment of the invention, taking the aforementioned complex and similar natural language problem as an example, includes the following retrieval path: Path 1: The retrieval process of the meteorological knowledge graph, also known as structured retrieval, involves matching the natural language question with the pre-constructed meteorological knowledge graph through the aforementioned knowledge graph module, retrieving the entities and relationships involved in the natural language question, and outputting structured knowledge units.

[0044] Typically, when retrieving multiple entities related to a natural language problem, it is necessary to obtain a directed knowledge graph corresponding to a meteorological knowledge graph; map the meteorological-related entities in the directed knowledge graph, as well as the relationships between them, to a pre-constructed low-dimensional embedding space to obtain meteorological entity vectors and their corresponding relationship vectors; in the low-dimensional embedding space, calculate the correlation between each meteorological entity vector and the classification label vector; and identify entities corresponding to meteorological entity vectors with a correlation greater than a preset threshold as entities related to the natural language problem.

[0045] Furthermore, when retrieving multiple relations related to the natural language problem, the similarity between each relation vector and the classification label vector is calculated; the relation vectors with the highest similarity are selected as the multiple relations related to the natural language problem.

[0046] In specific implementation, based on Figure 2Typically, the entity embedding unit maps meteorological-related entities to a low-dimensional embedding space, and the relation embedding unit maps the relationships between meteorological-related entities to a low-dimensional embedding space. The entity and question retrieval unit and the relation and question retrieval unit respectively search for the entity set and relation set related to the natural language question based on the classification label vector output by the question classifier and the entities and relations mapped to the low-dimensional embedding space in the meteorological domain knowledge graph.

[0047] For example, suppose the directed graph of the knowledge graph corresponding to the meteorological domain knowledge graph is represented as: ,in, It is a collection of entities. It is a set of relations. The entity embedding unit maps meteorological-related entities to a low-dimensional embedding space. Each meteorological entity Recorded as ,in, For meteorological entity vectors, the relation embedding unit maps the relationships between meteorological entities to a low-dimensional space. At this point, each relationship Recorded as ,and, Also known as relation vector.

[0048] Furthermore, in the low-dimensional embedding space, when calculating the relevance between each meteorological entity vector and the classification label vector, the entity and question retrieval unit uses cosine similarity to calculate the relevance of each meteorological entity vector. elements of the category label vector The semantic similarity and frequency correlation; where semantic similarity is expressed as Frequency correlation is expressed as Then, semantic similarity and frequency correlation are weighted according to pre-set weight parameters to obtain the correlation score between the meteorological entity vector and the classification label vector; for example, assuming semantic similarity... The weighting parameter is α, and the frequency correlation is... If the weight parameter is β, then we have Furthermore, the correlation score between the meteorological entity vector and the classification label vector is expressed as: ; Further, the relevance scores are weighted based on each element in the classification label vector to obtain the degree of relevance. That is, the final weight is obtained by weighting the categories of all question types, which is the degree of relevance in this embodiment of the invention. The calculation formula is expressed as follows: ; Set a preset threshold Select those with a relevance greater than or equal to a preset threshold, i.e. The entities corresponding to the meteorological entity vectors are identified as meteorological-related entities relevant to the natural language problem. The set of these meteorological-related entities constitutes a preliminary set of related entities, i.e., [the set of entities]. .

[0049] Furthermore, the calculation of the similarity between the relation vector and the classification label vector is performed by the relation and question retrieval unit. Specifically, the relation and question retrieval unit uses the dot product to calculate the similarity between each relation and question. and elements of the category label vector Similarity, using This means that the top M relation vectors with the highest similarity are selected as multiple relations related to the natural language problem. At this point, multiple relations form a set of relations related to the natural language problem. Finally, the entity relationship set in this embodiment of the invention is represented as follows: This serves as the output of the knowledge graph module and the input of the subsequent attention fusion module.

[0050] Path 2: Text database retrieval process, also known as unstructured retrieval, and the corresponding text database is also called an unstructured text database.

[0051] In practice, the retrieval process constructs a comprehensive vector based on the natural language question and the classification label vector; the comprehensive vector is then input into a pre-built semantic matching model, which retrieves a preset number of text fragments from the text library that are most semantically relevant to the natural language question based on the comprehensive vector.

[0052] Typically, this unstructured retrieval is in Figure 2 The semantic retrieval module 40 is implemented in the middle. Specifically, the semantic retrieval module uses a semantic matching model (such as Sentence-BERT) to retrieve a predetermined number of text fragments that are most semantically relevant to the natural language question from an unstructured text database, that is, the top-N most semantically relevant text fragments. The semantic retrieval module includes two units: semantic matching and retrieval ranking. The semantic matching unit calculates the semantic similarity between the natural language question and meteorological-related entities and relationships in the meteorological knowledge graph, and identifies the knowledge fragments most relevant to the natural language question. The retrieval ranking unit ranks the retrieval results according to semantic similarity, extracts the N most relevant knowledge fragments as the final text fragments, and provides input for the subsequent attention fusion module.

[0053] Specifically, when performing unstructured retrieval, the natural language question Q is first embedded into a low-dimensional space, denoted as... The output classification label vector P of the problem classifier is also embedded into the low-dimensional space, denoted as... The two combined form a comprehensive vector. , represents Then combine the vectors. As input, retrieve the N text fragments most relevant to the natural language problem from an unstructured text database, denoted as NN. This information serves as the output of the semantic retrieval module and the input of the subsequent attention fusion module.

[0054] (3) Adaptive fusion of multi-source information; This process is in Figure 2 This is performed in the attention fusion module, corresponding to step S108 above.

[0055] Specifically, in this process, the structured entity set and unstructured text fragments obtained in (2) above are input into the attention fusion module. The attention fusion module uses a dynamic attention mechanism to calculate a dynamic weight for each retrieved piece of information (i.e., the aforementioned structured entity set and unstructured text fragments) based on the context of the current natural language question. This weight is the attention weight in this embodiment of the invention, which represents the importance of the corresponding information to the generation of the final response information. Subsequently, all information is weighted and summed to generate an enhanced answer generation guidance vector rich in contextual semantics.

[0056] Specifically, when calculating attention weights, the feature extraction function in the attention fusion module extracts feature representations of the classification label vector, entity relation set, and text fragment, respectively. During this process, the classification label vector P, entity relation set, and text fragment feature representations are calculated. and text fragments As input, they are respectively fed into the corresponding feature extraction functions. , , This allows us to obtain the label vector P and the set of entity relations. and text fragments The features are represented as follows: , , Furthermore, during feature extraction, each classification label vector, entity relation set, and text fragment needs to be mapped to a unified feature space for computation. Specifically, the feature extraction function in this embodiment can be implemented using a linear transformation or a fully connected mapping function, and their specific correspondence can be expressed as follows: = (P); = ; = (F) N ) in, and Preferably, a fully connected mapping function is preferred; The preferred method is a linear transformation function.

[0057] After obtaining the above feature representations, we further construct corresponding dynamic attention weight functions based on the feature representations, and calculate the attention weights corresponding to each feature representation according to the dynamic attention weight functions.

[0058] Usually by Figure 2 The dynamic attention unit 501 is responsible for constructing the dynamic attention weight function and calculating the attention weight corresponding to each feature representation.

[0059] The dynamic attention weight function is expressed as follows:

[0060] in, This is the feature representation of module i, corresponding to the feature representations of the classification label vector, entity relation set, and text fragment mentioned above. and It consists of pre-configured, learnable weight matrices and vectors. It is a bias term. The inputs to the dynamic attention weight function are the feature representations mentioned above. , , The outputs of the dynamic attention weight function are respectively , , This yields the corresponding attention weights, i.e., the input. = When ;enter = When ;enter = When .

[0061] Furthermore, when performing feature fusion on the classification label vector, entity relation set, and text fragment based on the aforementioned attention weights, the attention weights can be used to perform weighted fusion on the feature representations corresponding to the classification label vector, entity relation set, and text fragment to obtain the guiding vector corresponding to the natural language question.

[0062] Specifically, this fusion process is in Figure 2This is implemented in the fusion unit 502, which performs weighted fusion of the various feature representations according to attention weights to obtain the guidance vector corresponding to the natural language question. Its formula is expressed as: .

[0063] (4) The process of generating constrained answers; The process described above Figure 2 This is performed in the precise fine-tuning module, corresponding to step S110 above.

[0064] Specifically, the aforementioned guiding vector can be used as a context vector and input together with the natural language question into the large language model in the precision fine-tuning module 60. This large language model is usually a large language model that has been precisely fine-tuned with meteorological data, such as an LLM (Large Language Model). Under the contextual constraints and guidance of this guiding vector, logical reasoning and natural language generation are performed, and the final professional, accurate, and structured answer is output. This answer is output as the response information of the natural language question.

[0065] In summary, the meteorological question-and-answer matching method provided in this embodiment of the invention has the following significant advantages and effects: (1) It has improved the accuracy and professionalism of answers in the meteorological field and effectively curbed the "illusion" problem of large language models.

[0066] For example, in this embodiment of the invention, structured meteorological knowledge graphs and unstructured text databases can be retrieved in parallel. The meteorological knowledge graph can provide precise meteorological entity relationships, such as "Typhoon 'Mui-fa'—impact—Zhejiang Province," ensuring the rigid constraints of basic facts. The unstructured text database can utilize authoritative literature libraries, providing detailed background knowledge and professional descriptions. Together, these constitute an external, reliable, and professional "knowledge source," transforming the generation process of large-scale language models from relying on internal parameters to generation based on external evidence. Furthermore, during the construction of the meteorological knowledge graph, automated information extraction technology based on large-scale language models can be used to construct and expand the graph from unstructured text.

[0067] Furthermore, the dynamic attention mechanism in this embodiment of the invention does not simply input all retrieved information into a large language model with equal weight. In this embodiment, the relevance of the retrieval results to the natural language question is first scored to obtain a relevance score, and then the text fragments are weighted and fused based on the relevance score. This allows the meteorological question-answering system to automatically focus on the "key evidence" most relevant to the current natural language question (for example, for a question about "typhoon path," "path prediction map" and "official warning text" will be given higher weight), while filtering out secondary or irrelevant information.

[0068] By combining the above technical solutions, the embodiments of the present invention first replace or strongly supplement the uncertain internal knowledge of large language models with reliable knowledge sources (knowledge graphs in the meteorological field), which can solve the problem of knowledge sources. Then, the "signal-to-noise ratio" of knowledge input is optimized through dynamic attention mechanism to solve the problems of information overload and focus bias. This can make the answers generated by large language models accurate and highly relevant, fundamentally limiting the space for the generation of "illusions", thereby systematically improving the accuracy and professionalism of the answers at the meteorological fact level.

[0069] (2) It achieves high real-time output of meteorological information and breaks through the limitations of static knowledge in traditional large-scale language models.

[0070] Specifically, existing pure large-scale language model solutions cannot effectively answer questions that rely on the latest data, such as "Where is the typhoon currently located?", because the parameters of large-scale language models are fixed once trained.

[0071] In this embodiment of the invention, the reasoning capabilities of a large language model are decoupled and recoupled from the real-time updated meteorological database. During this process, the knowledge graph module and semantic retrieval module, acting as independent, on-demand triggered "data sensors," access the latest observational data, forecast products, and official announcements in real time based on time keywords in the user's natural language question, such as "current," "recently," and "today," during each question-and-answer session. This design ensures that the "knowledge freshness" of the meteorological question-and-answer system is no longer constrained by the expensive retraining or fine-tuning cycles of the large language model, but is synchronized with the update frequency of the backend database. The user's question directly drives a real-time data retrieval, ensuring that regardless of whether the user inquires about historical data, current conditions, or future forecasts, the meteorological question-and-answer system can answer based on the latest available information at that point in time, thus achieving a reliable response to time-sensitive questions.

[0072] (3) Through the collaborative architecture of “retrieval-fusion-reasoning”, reliable and interpretable reasoning for complex meteorological problems has been realized.

[0073] For complex reasoning questions such as "Why did a severe rainstorm occur in a certain place?", a single source of information, such as the relationship chain of a meteorological knowledge graph or a single document, is often insufficient, and there may be conflicts or redundancies between the information.

[0074] In this embodiment of the invention, the key steps are: parallel retrieval ensures comprehensiveness by simultaneously acquiring information from multiple heterogeneous sources, such as meteorological knowledge graphs, literature in text databases, and data interfaces, avoiding information blind spots. Dynamic fusion achieves refinement by utilizing a dynamic attention mechanism to deduplicate, resolve conflicts, and assign weights to multi-source information, generating a concise, consistent, and focused "comprehensive evidence report." When the comprehensive evidence report is input into a large-scale language model, carefully designed prompts, such as "Please analyze and answer step by step based on the following evidence...", serve as guiding information, directing the large-scale language model to perform evidence-driven chain reasoning. This process firmly anchors the powerful natural language understanding and generation capabilities of the large-scale language model onto the high-quality, structured evidence provided by the retrieval and fusion modules. The role of the large-scale language model shifts from an "omniscient but unreliable narrator" to a "rigorous logical organizer and expresser." This synergistic effect not only makes the final answer more reliable but also enhances the interpretability and credibility of the meteorological question-and-answer system because the answer can be traced back to specific fragments of retrieved evidence.

[0075] (4) Through rigorous experimental design and quantitative indicators, the superiority of the technical solution and the effectiveness of the core modules of the embodiments of the present invention were objectively verified. To quantitatively evaluate the effect of the embodiments of the present invention, a dedicated meteorological question-answering benchmark dataset can also be constructed, covering various question types such as factual, time-sensitive, and inferential questions. The complete model used in the embodiments of the present invention is compared with several representative baseline models, such as pure knowledge graph retrieval question-answering, pure semantic retrieval question-answering, and unoptimized native large models. The experimental results show that the embodiments of the present invention have achieved significant improvements in core objective indicators such as accuracy, recall, and F1 score. Among them, the F1 score reaches 0.77, which is about 15% higher than the best baseline model. This directly proves the effectiveness of the overall architecture design of the meteorological question-answering system of the embodiments of the present invention. For further analysis, an ablation experiment was also conducted, that is, removing or replacing the key modules of the embodiments of the present invention, such as replacing the dynamic attention mechanism with simple splicing. Experimental results show that the model performance deteriorates most significantly when the dynamic attention mechanism is removed; for example, the F1 score drops by more than 8%. This proves that the dynamic attention mechanism is not an optional optimization, but rather a key technical contribution to achieving the aforementioned technical effects, especially in improving accuracy and enabling reliable inference.

[0076] Furthermore, embodiments of the present invention also provide a weather question-and-answer matching device, such as... Figure 3 The diagram shows a weather-related question-and-answer matching device, which includes the following structure: The acquisition module 31 is used to acquire natural language questions input by the user; The parsing module 32 is used to perform semantic parsing and intent recognition on the natural language question to obtain a classification label vector for the natural language question; wherein, the elements in the classification label vector are used to represent the probability that the natural language question belongs to the corresponding question type; The retrieval module 33 is used to retrieve multiple entities and multiple relations related to the natural language question from a pre-built meteorological domain knowledge graph based on the classification label vector, to obtain an entity relation set containing multiple entities and multiple relations; and to retrieve a preset number of text fragments related to the semantics of the natural language question from the pre-built text library. The fusion module 34 is used to calculate the attention weights of the classification label vector, the entity relationship set, and the text fragment using a pre-built dynamic attention model, and to perform feature fusion on the classification label vector, the entity relationship set, and the text fragment based on the attention weights to obtain the guiding vector corresponding to the natural language question; The response module 35 is used to generate response information corresponding to the natural language question based on the guiding vector.

[0077] The meteorological question-and-answer matching device provided in this embodiment of the invention has the same technical features as the meteorological question-and-answer matching method provided in the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.

[0078] Furthermore, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above method.

[0079] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the above-described method.

[0080] Furthermore, embodiments of the present invention also provide a schematic diagram of the structure of an electronic device, such as... Figure 4 The diagram shows the structure of the electronic device, which includes a processor 41 and a memory 40. The memory 40 stores computer-executable instructions that can be executed by the processor 41, and the processor 41 executes the computer-executable instructions to implement the above-described method.

[0081] exist Figure 4 In the illustrated embodiment, the electronic device further includes a bus 42 and a communication interface 43, wherein the processor 41, the communication interface 43, and the memory 40 are connected via the bus 42.

[0082] The memory 40 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 43 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 42 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 42 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0083] Processor 41 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 41 or by software instructions. Processor 41 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this invention can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the memory, and the processor 41 reads the information in the memory and uses its hardware to complete the aforementioned method.

[0084] The computer program product of the weather question-and-answer matching method and apparatus provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0085] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0086] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0087] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0088] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0089] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A meteorological question-and-answer matching method, characterized in that, The method includes: The problem of obtaining natural language input from users; Semantic parsing and intent recognition are performed on the natural language question to obtain a classification label vector for the natural language question; wherein, the elements in the classification label vector are used to represent the probability that the natural language question belongs to the corresponding question type; Based on the classification label vector, multiple entities and multiple relations related to the natural language question are retrieved from the pre-constructed meteorological domain knowledge graph to obtain an entity relation set containing multiple entities and multiple relations; and a predetermined number of text fragments related to the semantics of the natural language question are retrieved from the pre-constructed text library. A pre-built dynamic attention model is used to calculate the attention weights of the classification label vector, the entity relation set, and the text fragment. Based on the attention weights, feature fusion is performed on the classification label vector, the entity relation set, and the text fragment to obtain the guiding vector corresponding to the natural language question. Based on the guiding vector, generate response information corresponding to the natural language question.

2. The method according to claim 1, characterized in that, The steps of performing semantic parsing and intent recognition on the natural language question to obtain the classification label vector of the natural language question include: The natural language problem is preprocessed by word segmentation to obtain the input information that meets the preset format corresponding to the natural language problem; The input information is fed into a pre-trained natural language processing model, and the semantic features of the natural language question are extracted by the natural language processing model. Based on the semantic features, predict the probability that the natural language question belongs to each question type, and generate the classification label vector based on the prediction results.

3. The method according to claim 1, characterized in that, The steps of retrieving multiple entities related to the natural language question from a pre-constructed meteorological domain knowledge graph based on the classification label vector include: Obtain the directed graph of the knowledge graph corresponding to the meteorological knowledge graph; The meteorological-related entities in the directed graph of the knowledge graph, and the relationships between the meteorological-related entities, are mapped to a pre-constructed low-dimensional embedding space to obtain meteorological entity vectors and corresponding relationship vectors. In the low-dimensional embedding space, the correlation between each meteorological entity vector and the classification label vector is calculated; The entities corresponding to the meteorological entity vectors whose relevance is greater than a preset threshold are identified as entities related to the natural language problem.

4. The method according to claim 3, characterized in that, The steps of retrieving multiple relations related to the natural language question from a pre-constructed meteorological domain knowledge graph based on the classification label vector include: Calculate the similarity between each of the relationship vectors and the classification label vectors; Select the preset number of relation vectors with the highest similarity as multiple relations related to the natural language problem.

5. The method according to claim 3, characterized in that, The step of calculating the correlation between each meteorological entity vector and the classification label vector includes: Calculate the semantic similarity and frequency correlation between each meteorological entity vector and the classification label vector; The semantic similarity and frequency correlation are weighted according to the pre-set weight parameters to obtain the correlation score between the meteorological entity vector and the classification label vector; The relevance score is weighted and calculated based on each element in the classification label vector to obtain the degree of relevance.

6. The method according to claim 1, characterized in that, The step of retrieving a predetermined number of text fragments from the pre-built text library that are semantically related to the natural language problem includes: Construct a comprehensive vector based on the natural language question and the classification label vector; The integrated vector is input into a pre-built semantic matching model, which then retrieves a preset number of text fragments from the text library that are most relevant to the semantics of the natural language question based on the integrated vector.

7. The method according to claim 1, characterized in that, The steps of calculating the attention weights of the classification label vector, the entity relation set, and the text segment using a pre-built dynamic attention model include: Extract feature representations from the classification label vector, the entity relationship set, and the text segment, respectively; Based on the feature representations, corresponding dynamic attention weight functions are constructed, and attention weights corresponding to each feature representation are calculated according to the dynamic attention weight functions.

8. The method according to claim 7, characterized in that, The step of fusing features of the classification label vector, the entity relation set, and the text fragment based on the attention weights to obtain the guiding vector corresponding to the natural language question includes: The attention weights are used to perform a weighted fusion of the classification label vector, the entity relationship set, and the feature representation corresponding to the text fragment to obtain the guiding vector corresponding to the natural language question.

9. The method according to claim 1, characterized in that, The method further includes: If the classification label vector represents the natural language question as a simple type, then the response information corresponding to the natural language question is retrieved from the meteorological domain knowledge graph based on the semantics of the natural language question, or the response information corresponding to the natural language question is retrieved from the text library.

10. A weather-related question-and-answer matching device, characterized in that, The device includes: The acquisition module is used to acquire natural language questions input by the user; The parsing module is used to perform semantic parsing and intent recognition on the natural language question to obtain a classification label vector for the natural language question; wherein, the elements in the classification label vector are used to represent the probability that the natural language question belongs to the corresponding question type; The retrieval module is used to retrieve multiple entities and multiple relations related to the natural language question from a pre-built meteorological domain knowledge graph based on the classification label vector, to obtain an entity relation set containing multiple entities and multiple relations; and to retrieve a preset number of text fragments related to the semantics of the natural language question from the pre-built text library. The fusion module is used to calculate the attention weights of the classification label vector, the entity relation set, and the text fragment using a pre-built dynamic attention model, and to perform feature fusion on the classification label vector, the entity relation set, and the text fragment based on the attention weights to obtain the guiding vector corresponding to the natural language question. The response module is used to generate response information corresponding to the natural language question based on the guiding vector.