Disaster knowledge element extraction method driven by cross-disaster dynamic prompt and related device

CN121328538BActive Publication Date: 2026-10-27INST OF DISASTER PREVENTION
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511368736.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-23
Publication Date
2026-10-27
Estimated Expiration
2045-09-23

AI Technical Summary

Technical Problem

在灾害领域,由于灾害事件的多样性和复杂性,获取大规模标注数据往往面临诸多挑战,这限制了传统方法的应用效果

Benefits of technology

[0036]本申请提供了一种跨灾种动态提示驱动的灾害知识元抽取方法及相关装置,建立与灾害类别对应的实体类别集和关系集;利用历史样本构建实体及类别二元组示例集以及实体关系三元组示例集;基于任务类别将上述示例集加入提示词,构建提示词模板集;对待处理文本进行预处理,划分多个分块,并提取每一分块的灾害类别;根据每一分块的灾害类别和提示词模板集生成分块的动态提示词;动态提示词包括命名实体识别的提示词以及关系识别的提示词;利用每一分块的动态提示词引导大语言模型进行实体关系抽取得到分块的实体识别结果和关系识别结果,无需大规模标注数据,即可实现灾害领域知识元的高效抽取。本申请通过动态构造特定的提示词,利用大语言模型抽取非结构化的灾害相关文本中的实体和关系,仅需少量样本即可构建示例集,无需大规模标注数据,显著降低了数据准备成本;通过动态提示词引导大语言模型直接进行抽取,无需复杂的训练或微调过程,加快了开发周期,即可实现灾害领域知识元的高效抽取。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121328538B_ABST
    Figure CN121328538B_ABST
Patent Text Reader

Abstract

The application discloses a disaster knowledge element extraction method driven by cross-disaster dynamic prompt and related devices, relates to the field of artificial intelligence application and disaster emergency information extraction, and comprises the following steps: establishing an entity category set and a relationship set corresponding to a disaster category; constructing an entity and category binary tuple example set and an entity relationship triple tuple example set by using historical samples; adding the example set to a prompt word based on a task category to construct a prompt word template set; preprocessing a text to be processed, dividing the text into multiple blocks, and extracting a disaster category of each block; generating a dynamic prompt word for each block according to the disaster category of each block and the prompt word template set; the dynamic prompt word comprises a prompt word for named entity recognition and a prompt word for relationship recognition; and guiding a large language model to perform entity relationship extraction by using the dynamic prompt word of each block to obtain an entity recognition result and a relationship recognition result of each block, so that efficient extraction of disaster field knowledge elements can be realized without large-scale labeled data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of artificial intelligence applications and disaster emergency information extraction, and in particular to a method and related apparatus for extracting disaster knowledge elements driven by dynamic prompts across disaster types. Background Technology

[0002] Disaster knowledge extraction is a crucial application of information extraction in the disaster domain. Its goal is to identify key disaster knowledge elements (such as disaster type, affected area, and impact level) and their interrelationships from unstructured disaster-related text. Traditional disaster knowledge extraction methods primarily rely on feature engineering and deep learning algorithms, especially neural network models such as Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), Long Short-Term Memory Networks (LSTMs), and Transformer architectures. These models have demonstrated powerful performance in Natural Language Processing (NLP) tasks, effectively capturing linguistic features and patterns in text. However, these methods typically require large amounts of high-quality, labeled text data for pre-training to learn rich linguistic knowledge and semantic relationships. In the disaster domain, due to the diversity and complexity of disaster events, obtaining large-scale labeled data often presents numerous challenges, limiting the effectiveness of traditional methods. Summary of the Invention

[0003] The purpose of this application is to provide a method and related apparatus for extracting disaster knowledge elements through dynamic prompts across disaster types, which can achieve efficient extraction of disaster-related knowledge elements without the need for large-scale labeled data.

[0004] To achieve the above objectives, this application provides the following solution:

[0005] Firstly, this application provides a disaster knowledge element extraction method driven by dynamic prompts across disaster types, including:

[0006] Establish entity category sets and relation sets corresponding to disaster categories;

[0007] Using historical samples, construct an example set of entity and category pairs and an example set of entity relation triples;

[0008] Based on the task category, the example set of entity and category bigrams and the example set of entity relation triples are added to the prompt words to construct a prompt word template set; the prompt word template set includes prompt word templates for named entity recognition and prompt word templates for relation recognition;

[0009] The text to be processed is preprocessed, the preprocessed text is divided into multiple blocks, and the disaster category of each block is extracted.

[0010] For each segment, dynamic prompts are generated based on the disaster category and prompt template set of the segment; the dynamic prompts include prompts for named entity recognition and prompts for relationship recognition.

[0011] For each segment, the dynamic prompts of the segment are used to guide the large language model to extract entity relationships, thereby obtaining the entity recognition result and relationship recognition result of the segment.

[0012] Optionally, the disaster knowledge element extraction method driven by cross-disaster dynamic prompts further includes:

[0013] The entity recognition results of all the aforementioned blocks constitute the entity recognition dataset;

[0014] The relation recognition results of all the aforementioned blocks constitute the relation recognition dataset;

[0015] The entity recognition dataset and the relationship recognition dataset are evaluated based on performance metrics.

[0016] Optionally, preprocessing includes removing unnecessary punctuation marks, special characters, and extra spaces.

[0017] Optionally, the disaster category for each block can be extracted, specifically including:

[0018] Each segment is input into a large language model to extract the disaster category of the segment.

[0019] Optionally, dynamic prompts for the segment are generated based on the disaster category and prompt template set of the segment, specifically including:

[0020] Based on the disaster category of the block, the block is matched with the entity category set and relation set corresponding to the disaster category. If there is a new entity category or new relation type in the block that is not covered by the entity category set and relation set corresponding to the disaster category, the new entity category is added to the entity category set corresponding to the disaster category, and the new relation type is added to the relation set corresponding to the disaster category.

[0021] Based on the disaster category of the block, relevant entity categories are selected from the entity category set corresponding to the disaster category. Relevant examples from the entity and category tuple example set are embedded into the prompt word template to generate dynamic prompt words for named entity recognition of the block. A tag version number for the dynamic prompt words for named entity recognition is generated, and the example content and prompt word template structure can be automatically updated in the next iteration.

[0022] Based on the disaster category of the segment, relevant relationships are selected from the relationship set corresponding to the disaster category, and relevant examples of the example set of entity relationship triples are embedded into the prompt word template to generate prompt words for relationship recognition of the segment; the prompt words for named entity recognition and the prompt words for relationship recognition constitute dynamic prompt words.

[0023] Optionally, the dynamic prompts of the segment are used to guide the large language model to extract entity relations, thereby obtaining the entity recognition results and relation recognition results of the segment, specifically including:

[0024] The prompts for named entity recognition and relation recognition of the blocks are input into the large language model. Guided by the prompts for named entity recognition of the blocks, the large language model performs entity recognition on the blocks to obtain the entity recognition results of the blocks. Guided by the prompts for relation recognition of the blocks, the large language model performs relation recognition on the blocks to obtain the relation recognition results of the blocks.

[0025] Optionally, the large language model is the Qwen3-30B-A3B model.

[0026] Secondly, this application provides a disaster knowledge element extraction device driven by dynamic prompts across disaster types, comprising:

[0027] The entity category set and relation set creation module is used to create entity category sets and relation sets corresponding to disaster categories;

[0028] The example set construction module is used to build example sets of entity and category pairs and example sets of entity relationship triples using historical samples;

[0029] The prompt word template set construction module is used to add entity and category bigram example sets and entity relation triple example sets to prompt words based on task categories, and construct prompt word template sets; the prompt word template set includes prompt word templates for named entity recognition and prompt word templates for relation recognition;

[0030] The disaster category extraction module is used to preprocess the text to be processed, divide the preprocessed text into multiple blocks, and extract the disaster category of each block.

[0031] The dynamic prompt word generation module is used to generate dynamic prompt words for each segment based on the disaster category of the segment and the prompt word template set; the dynamic prompt words include prompt words for named entity recognition and prompt words for relationship recognition;

[0032] The entity relation extraction module is used to guide the large language model to extract entity relations for each block using the dynamic prompt words of the block, so as to obtain the entity recognition result and relation recognition result of the block.

[0033] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the computer program to implement the above-described cross-disaster dynamic prompt-driven disaster knowledge element extraction method.

[0034] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned cross-disaster dynamic prompt-driven disaster knowledge element extraction method.

[0035] According to the specific embodiments provided in this application, the following technical effects are disclosed:

[0036] This application provides a method and related apparatus for extracting disaster knowledge elements driven by dynamic prompts across disaster types. It establishes entity category sets and relation sets corresponding to disaster categories; constructs example sets of entity-category binary pairs and entity-relation triplet pairs using historical samples; adds prompt words to the above example sets based on task categories to construct a prompt word template set; preprocesses the text to be processed, dividing it into multiple blocks and extracting the disaster category of each block; generates dynamic prompt words for each block based on the disaster category and prompt word template set; the dynamic prompt words include prompt words for named entity recognition and prompt words for relation recognition; and uses the dynamic prompt words of each block to guide a large language model to extract entity and relation results for the block, achieving efficient extraction of disaster domain knowledge elements without the need for large-scale labeled data. This application uses dynamically constructed specific prompt words and a large language model to extract entities and relationships from unstructured disaster-related texts. Only a small number of samples are needed to build an example set, eliminating the need for large-scale labeled data and significantly reducing data preparation costs. By guiding the large language model directly through dynamic prompt words, the extraction process can be accelerated without complex training or fine-tuning, thus achieving efficient extraction of knowledge elements in the disaster domain. Attached Figure Description

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

[0038] Figure 1 This is an application environment diagram of a disaster knowledge element extraction method driven by dynamic prompts across disaster types, as described in Embodiment 1 of this application.

[0039] Figure 2This is a flowchart illustrating a cross-hazard dynamic prompt-driven disaster knowledge element extraction method provided in Embodiment 1 of this application.

[0040] Figure 3 This is a schematic diagram illustrating the specific process of a disaster knowledge element extraction method driven by dynamic prompts across disaster types, as provided in Embodiment 1 of this application.

[0041] Figure 4 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of this application. Detailed Implementation

[0042] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0043] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0044] The cross-hazard dynamic prompt-driven disaster knowledge element extraction method provided in this application embodiment can be applied to, for example, Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be set up independently, integrated into server 104, or placed in the cloud or on another server. Terminal 102 can send requests to be processed to server 104. After receiving the requests, server 104 establishes an entity category set and a relation set corresponding to the disaster category. It uses historical samples to construct an example set of entity and category tuples and an example set of entity relation triples. Based on the task category, it adds prompt words to the above example sets, constructs a prompt word template set, preprocesses the text to be processed, divides it into multiple blocks, extracts the disaster category of each block, and generates dynamic prompt words for each block based on the disaster category and prompt word template set. Dynamic prompt words include prompt words for named entity recognition and prompt words for relation recognition. Using the dynamic prompt words for each block, it guides a large language model to extract entity relations and obtain the entity recognition results and relation recognition results for each block. Server 104 can feed back the obtained entity recognition results and relation recognition results for each block to terminal 102. In addition, in some embodiments, the disaster knowledge element extraction method driven by cross-disaster dynamic prompts can also be implemented by the server 104 or the terminal 102 separately. For example, the terminal 102 can directly extract disaster knowledge elements from the text to be processed, or the server 104 can obtain the video to be processed from the data storage system and extract disaster knowledge elements from the video to be processed.

[0045] The terminal 102 can be, but is not limited to, various desktop computers and laptops. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers, or it can be a cloud server.

[0046] In one exemplary embodiment, such as Figure 2 As shown, a method for extracting disaster knowledge elements driven by dynamic prompts across disaster types is provided. This method is executed by a computer device, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method is applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps 201 to 206.

[0047] Step 201: Establish the entity category set and relation set corresponding to the disaster category.

[0048] Step 202: Using historical samples, construct an example set of entity and category pairs and an example set of entity relationship triples.

[0049] Step 203: Based on the task category, add the example set of entity and category bigrams and the example set of entity relation triples to the prompt words to construct a prompt word template set; the prompt word template set includes prompt word templates for named entity recognition and prompt word templates for relation recognition.

[0050] Step 204: Preprocess the text to be processed, divide the preprocessed text into multiple blocks, and extract the disaster category of each block.

[0051] Step 205: For each block, generate dynamic prompts for the block based on the disaster category and prompt template set of the block; the dynamic prompts include prompts for named entity recognition and prompts for relationship recognition.

[0052] Step 206: For each block, the dynamic prompts of the block are used to guide the large language model to extract entity relationships, thereby obtaining the entity recognition result and relationship recognition result of the block.

[0053] Implementing steps 201 to 206 above, the disaster type is first determined in real time based on the input text, and the corresponding entity-relationship prompt template is dynamically loaded. Then, the template and a small number of scalable examples are injected into the large language model to achieve joint extraction of entities and relationships. The extraction results are automatically verified and fed back to the template library to iteratively optimize the prompt words, continuously improving the cross-disaster extraction accuracy with zero training. By dynamically constructing specific prompt words, entities and relationships in unstructured disaster-related text are extracted using the large language model. Only a small number of samples are needed to build the example set, eliminating the need for large-scale labeled data and significantly reducing data preparation costs. The dynamic prompt words guide the large language model to directly extract, eliminating the need for complex training or fine-tuning processes, accelerating the development cycle, and achieving efficient extraction of disaster domain knowledge elements.

[0054] like Figure 3 As shown, the cross-disaster dynamic prompt-driven disaster knowledge element extraction method provided in this application specifically includes the following steps: Based on the disaster category, establish an entity category set and relation set corresponding to the disaster type; construct an example set of entity and category tuples and entity relation triples using a small number of samples; add prompt words to the examples according to the task category to construct a prompt template set; preprocess the text to be processed, divide it into chunks and extract disaster categories; generate dynamic prompt words for each chunk based on the disaster category; use the dynamic prompt words to guide a large language model to extract entity relations, obtaining the acquired entity recognition dataset NER. predicted Relationship recognition dataset RE predicted The final extracted entity recognition dataset NER predicted Relationship recognition dataset RE predicted An assessment will be conducted.

[0055] Disaster Category EC Category= {EC1,EC2…EC n}(i∈[1,n]) includes: major landslides, mudslides, forest fires, grassland fires, earthquakes, floods, typhoons, droughts, landslide-dammed lakes, low-temperature freezing, snow disasters, and other natural disasters. Specifically, the disaster-related entity types defined in this embodiment are shown in Table 1.

[0056] Table 1. Partial Content of Disaster-Related Entity Types

[0057]

[0058] The set of entity categories is: C = {C1, C2, ..., C...} i …, C n}(i∈[1,n]), the set of relations between entity categories R={R1,R2,…,R i …, R m}(j∈[1,m]), where n and m represent the number of entity categories and relations to be extracted, respectively.

[0059] Construct entity and category pairs S using a small number of samples NER Example set and entity relation triple S RE Example set; entity and category tuple S NER Each E i Represented as (E) name E type ), entity relation triple S RE Each group is represented as (E) head R name E tail ).

[0060] Specifically, taking earthquake disasters as an example, the constructed example set contains entity and category tuples S. NER and entity relation triple S RE It can be represented as follows:

[0061] {

[0062] On May 12, 2024, a magnitude 7.0 earthquake struck Sichuan Province. The epicenter was located at 31 degrees north latitude and 103 degrees east longitude, with a focal depth of approximately 15 kilometers. The earthquake caused severe damage to brick-concrete structures in the area, and the population density near the epicenter was approximately 10,000 people.

[0063] "SNER":[

[0064] {"ename":"May 12, 2024", "etype":"date"},

[0065] {"ename":"Sichuan Region", "etype":"Region"}

[0066] {"ename":"7.0", "etype":"magnitude"},

[0067] {"ename":"31°N, 103°E","etype":"Epicenter location"}

[0068] {"ename":"15 km", "etype":"focal depth"}

[0069] {"ename":"brick-concrete structure", "etype":"building type"}

[0070] {"ename":"10000 people", "etype":"population density"}

[0071] ],

[0072] "SRE":[

[0073] {"Ehead":"Earthquake", "Rname":"Occurred on", "Etail":"May 12, 2024"}

[0074] {"Ehead":"Earthquake", "Rname":"Epicenter", "Etail":"31°N, 103°E"}

[0075] {"Ehead":"Earthquake", "Rname":"Impact", "Etail":"Brick-concrete structure building"}

[0076] {"Ehead":"Earthquake", "Rname":"Impact", "Etail":"10,000 people"} ]

[0078] }

[0079] In step 203 above, the task categories include named entity recognition and relation recognition; the prompt word template corresponding to named entity recognition is the prompt word template T for named entity recognition. NER The prompt word template corresponding to relation recognition is the relation recognition prompt word template T. RE .

[0080] The entity and category tuple S generated in step 202 is used as the input / output tuple. NER Example set, entity relation triple S REThe example set is embedded as an example in the prompt word template, where the entity and category tuple S NER Hint template T embedded in named entity recognition NER In the middle, the entity relation triple S RE Embedded prompt word template T for relation recognition RE In this process, a set of prompt word templates is constructed. Each prompt word template is then assigned a version identifier and an expandable example slot for subsequent online example additions and online iterative optimization of the templates.

[0081] Specifically, the prompt word template in this embodiment uses a JSON file format and is named prompt_templates.json. There are two task categories: Named Entity Recognition (NER) and Relation Extraction (RE). The corresponding prompt word templates are the prompt word template T for Named Entity Recognition. NER And relation extraction prompt word template T RE .

[0082] Specifically, the constructed named entity recognition prompt word template T NER As shown in the example below:

[0083] "##Goal You are {EC Category A senior knowledge extraction expert in the field, given a paragraph {Chunk} i}, and given a list of entity types in the paragraph: [{C1}...{C m Please extract the entity tuples from this passage; the format of the tuple is (entity, entity type); ##Example The following is a constructed extraction example, please refer to the example for extraction: {S NER}".

[0084] The prompt word template for named entity recognition includes the variable: EC Category (Disaster Type Name), Chunk i (paragraph), [{C1}...{C] m}](Related entity types corresponding to disaster types), S NER (Example set of entity extraction corresponding to disaster types).

[0085] Specifically, the constructed relation extraction prompt word template T RE As shown in the example below:

[0086] "##Goal You are {EC Category A senior knowledge extraction expert in the field, given a paragraph {Chunk} i}, and given a list of entity types in the paragraph: [{C1}...{C m}], and the relation list [{R1}...{R] n Please extract the entity relation triples from this passage; the triple format is (head entity, relation, tail entity); ##Example The following is a constructed extraction example, please refer to the example for extraction: {S RE}".

[0087] The template contains the variable: EC Category (Disaster Type Name), Chunk i (paragraph), [{C1}...{C] m}](the relevant entity type corresponding to the disaster type), [{R1}...{R n}](Relationship type corresponding to disaster type), S NER (Example set of entity extraction corresponding to disaster types).

[0088] In a specific example, step 204 above may include steps 2041 to 2043.

[0089] Step 2041: Preprocess (clean) the text to be processed. Preprocessing includes removing useless punctuation marks, special characters, and redundant spaces.

[0090] Specifically, the text to be processed in this embodiment is unstructured disaster-related text, which can be coupled disaster text involving earthquakes and floods. An example is as follows: "On August 20, 2024, a magnitude 6.5 earthquake occurred in Yunnan Province. The epicenter was located at 26.5 degrees north latitude and 100.2 degrees east longitude, with a focal depth of 10 kilometers. This earthquake damaged thousands of reinforced concrete houses. A month later, the area experienced flooding due to torrential rains, with accumulated rainfall reaching 200 millimeters within 24 hours. River levels surged to 12 meters, and the flood warning level was orange. The floods caused cracks in the dikes, threatening residents in upstream areas."

[0091] Step 2042: Based on the context window length (tokens) of the selected large language model, choose an appropriate chunk length (L). The chunk length should be less than or equal to the maximum context window length of the model. Divide the preprocessed text into multiple chunks {Chunk1, Chunk2, ..., Chunk...} i …, Chunk n}

[0092] Specifically, in this embodiment, the context window length is set to L = 500 tokens, and the text to be processed is divided into the following two chunks:

[0093] Chunk1: "On August 20, 2024, a magnitude 6.5 earthquake occurred in Yunnan Province. The epicenter was located at 26.5 degrees north latitude and 100.2 degrees east longitude, with a focal depth of 10 kilometers. This earthquake damaged thousands of reinforced concrete buildings."

[0094] Chunk2: "A month later, the region was flooded by torrential rains, with 200 millimeters of rainfall in 24 hours. The river level surged to 12 meters, and the flood warning level was raised to orange. The floods caused cracks in the levees, threatening residents in the upstream areas."

[0095] Step 2043: Extract the disaster category for each chunk, specifically including: inputting each chunk into the large language model and extracting the disaster category for that chunk. For each chunk... i The data is then input into a large language model, which is used to summarize and identify the disaster categories (ECs) contained in the identified blocks. i .

[0096] Specifically, for each segment, the prompt words for identifying the corresponding disaster category in the segment are as follows: T Category :

[0097] "You are a disaster response expert. Your task is to analyze the following text and identify all the disaster categories mentioned. Please output the identified disaster categories in a concise list format."

[0098] Disaster Category: {EC Category}

[0099] Text content: {Chunk i}

[0100] Output requirements:

[0101] - The output should be a list of disaster categories.

[0102] - Each category should be unique and not listed repeatedly.

[0103] - If no disaster category is mentioned in the text, an empty value should be output.

[0104] The template contains the variable: EC Category (Disaster Type Name), Chunk i (paragraph).

[0105] Specifically, for Chunk1, the final output of the large model should be [Earthquake]; for Chunk2, the disaster category identification result should be [Flood].

[0106] In step 205 above, the template content and examples can be iteratively updated based on feedback. Dynamic prompts for the blocks are generated based on the disaster categories and prompt word template sets, specifically including the following steps 2051 to 2053.

[0107] Step 2051: Based on the Chunk i The disaster category will be divided into chunks. i With the disaster category EC i The corresponding entity category set C i and relation set R i Perform matching when the chunk i The disaster category EC exists in the middle. i The corresponding entity category set C i and relation set R i For new entity categories or new relationship types that are not covered, add the new entity category to the entity category set C corresponding to the disaster category. i The new relation type is added to the relation set R corresponding to the disaster category. i Add categories and examples on the fly, then build T using the latest version of the template. NER (i) and T RE (i).

[0108] Specifically, for Chunk1, the cue word template T NER The construction process of (1) is as follows:

[0109] Input the original text from Chunk1, "August 20, 2024...damaged reinforced concrete structure building," into the large model and perform a zero-sample entity scan to return a list of potential entities:

[0110] {"Date", "Region", "Magnitude", "Epicenter", "Focal Depth", "Building Type", "Population Density", "Most Seismic Zone"};

[0111] Compared with the current earthquake disaster entity category set C1, it was found that the "magnitude zone" is missing, therefore:

[0112] Add "the zone of greatest seismic intensity" to the entity category set C1;

[0113] Generate a new example {"ename":"Severe Seismic Zone", "etype":"Affected Area"} and incorporate it into the entity and category tuple S. NER ;

[0114] Use the updated entity category set C1 and the latest entity and category tuple S NER Assembly prompt word T NER(1) The final list of entity types is: [magnitude, epicenter location, focal depth, geological structure, building type, population density, and epicenter zone].

[0115] Step 2052: Based on the Chunk i Disaster Category EC i From the disaster category EC i The corresponding entity category set C i Select the relevant entity category, embed the relevant examples from the entity and category tuple example set into the prompt word template, and generate the chunk. i Dynamic prompts T for named entity recognition NER (i) Generate dynamic prompts T for named entity recognition. NER (i) The tag version number and the relation identification prompt T RE (i) The version number is marked, and the example content and prompt word template structure can be automatically updated by the optimization module in the next iteration.

[0116] Specifically, for Chunk1, the hint word T for named entity recognition NER (1) As follows:

[0117] "##Goal: You are a senior knowledge extraction expert in the field of {earthquake}. Given a paragraph {Chunk1} and a list of entity types in the paragraph: [magnitude, epicenter location, focal depth, geological structure, building type, population density]. Please extract the entity tuples from this paragraph; the format of the tuple is (entity, entity type); ##Example: The following is a constructed extraction example. Please refer to the example for extraction:"

[0118] {

[0119] On May 12, 2024, a magnitude 7.0 earthquake struck Sichuan Province. The epicenter was located at 31 degrees north latitude and 103 degrees east longitude, with a focal depth of approximately 15 kilometers. The earthquake caused severe damage to brick-concrete structures in the area, and the population density near the epicenter was approximately 10,000 people.

[0120] "SNER":[

[0121] {"ename":"May 12, 2024", "etype":"date"},

[0122] {"ename":"Sichuan Region", "etype":"Region"}

[0123] {"ename":"7.0", "etype":"magnitude"},

[0124] {"ename":"31°N, 103°E","etype":"Epicenter location"}

[0125] {"ename":"15 km", "etype":"focal depth"}

[0126] {"ename":"brick-concrete structure", "etype":"building type"}

[0127] {"ename":"10000 people", "etype":"population density"} ]

[0129] }”

[0130] Specifically, for Chunk 2, Hint T for named entity recognition NER (2) As follows:

[0131] "##Goal You are a senior knowledge extraction expert in the {flood} domain. Given a paragraph {Chunk2} and a list of entity types in the paragraph: [rainfall, river level, flood warning level, levee status, drainage system, affected area]. Please extract the entity tuples from this paragraph; the format of the tuple is (entity, entity type); ##Example The following is a constructed extraction example. Please refer to the example for extraction: {S NER}

[0132] Step 2053: Based on the Chunk i Disaster Category EC i From the disaster category EC i The corresponding relation set R i Select the relevant relationship and set the entity relationship triple S RE The relevant examples from the example set are embedded into the prompt word template to generate the chunk. i The prompts for relation recognition, named entity recognition, and relation recognition together constitute the dynamic prompts, which serve as a reference for the model. The dynamic prompts T for named entity recognition are generated. NER (i) The tag version number and the relation identification prompt T RE (i) is marked with a version number, and its example content and template structure can be automatically updated by the optimization module in the next iteration.

[0133] Specifically, for Chunk1, the relation recognition cue word T RE (1) As follows:

[0134] "##Goal: You are a senior knowledge extraction expert in the field of {earthquake}. Given a paragraph {Chunk1}, and a list of entity types in the paragraph: [magnitude, epicenter location, focal depth, geological structure, building type, population density], and a list of relations [occurred at, caused, affected]. Please extract the entity relation triples from this paragraph; the triple format is (head entity, relation, tail entity); ##Example: The following is a constructed extraction example. Please refer to the example for extraction:"

[0135] {

[0136] On May 12, 2024, a magnitude 7.0 earthquake struck Sichuan Province. The epicenter was located at 31 degrees north latitude and 103 degrees east longitude, with a focal depth of approximately 15 kilometers. The earthquake caused severe damage to brick-concrete structures in the area, and the population density near the epicenter was approximately 10,000 people.

[0137] "SRE":[

[0138] {"Ehead":"Earthquake", "Rname":"Occurred on", "Etail":"May 12, 2024"}

[0139] {"Ehead":"Earthquake", "Rname":"Epicenter", "Etail":"31°N, 103°E"}

[0140] {"Ehead":"Earthquake", "Rname":"Impact", "Etail":"Brick-concrete structure building"}

[0141] {"Ehead":"Earthquake", "Rname":"Impact", "Etail":"10,000 people"} ]

[0143] }".

[0144] Specifically, for Chunk2, the relation recognition cue word T RE (2) As follows:

[0145] "##Goal You are a senior knowledge extraction expert in the {flood} domain. Given a paragraph {Chunk2}, and a list of entity types in the paragraph: [rainfall, river level, flood warning level, levee status, drainage system, affected area], and a list of relations [occurred at, caused, affected]. Please extract the entity relation triples from this paragraph; the triple format is (head entity, relation, tail entity); ##Example The following is a constructed extraction example. Please refer to the example for extraction: {S RE}".

[0146] In step 206 above, the dynamic prompts for the segment guide the large language model to extract entity relationships, obtaining the entity recognition result and relationship recognition result of the segment. Specifically, this includes: inputting the prompts for named entity recognition and relationship recognition of the segment into the large language model; the large language model performs entity recognition on the segment based on the prompts for named entity recognition, obtaining the entity recognition result of the segment; and the large language model performs relationship recognition on the segment based on the prompts for relationship recognition, obtaining the relationship recognition result of the segment. Using dynamic prompts T... NER (i) and T RE (i) Guide the large language model to extract entity relations and obtain the acquired entity recognition dataset NER. predicted Relationship recognition dataset RE predicted The entity recognition dataset NER is among them. predicted The data includes entity names and entity types; the relation identification dataset RE predicted The data includes the header entity name, relation name, and tail entity name. Specifically, it includes the following steps 2061 to 2064.

[0147] Step 2061: For each chunk i The corresponding dynamic prompt word T NER (i) and T RE (i) Input into the large language model. Specifically, the large language model can be the Qwen3-30B-A3B model. In this embodiment, Qwen3-30B-A3B is selected as the test model. The dynamic prompt words and the segmented text are transmitted to the large model by means of API calls.

[0148] Step 2062: The large language model uses dynamic prompt words T NER (i) guides the chunking process. i Perform entity recognition. Output the entity recognition result (NER). predicted (i) Includes the entity name and entity type, in the following format:

[0149] Specifically, for Chunk1, the entity recognition result is:

[0150] {

[0151] "chunk_index":1,

[0152] NER predicted ":[

[0153] {"Ename":"August 20, 2024", "Etype":"Date"}

[0154] {"Ename":"A certain place in Yunnan", "Etype":"Region"}

[0155] {"Ename":"6.5", "Etype":"Magnitude"}

[0156] {"Ename":"26.5°N, 100.2°E","Etype":"Epicenter location"}

[0157] {"Ename":"10 km", "Etype":"focal depth"}

[0158] {"Ename":"Reinforced concrete structure", "Etype":"Building type"} ]

[0160] }

[0161] Step 2063: The large language model uses dynamic prompt word T RE (i) guides the chunking process. i Perform relation identification. Output the relation identification result (RE). predicted (i) Includes the header entity name, relation name, and tail entity name. RE predicted (i)={(E head (1), R name (1), E tail (1)), (E head (2), R name (2), E tail (2)), …, (E) head (l), R name (l), E tail (l))}. Specifically, for Chunk1, the relation identification result is:

[0162] {

[0163] "chunk_index":1,

[0164] RE predicted ":[

[0165] {"Ehead":"Earthquake", "Rname":"Occurred on", "Etail":"August 20, 2024"}

[0166] {"Ehead":"Earthquake", "Rname":"Epicenter", "Etail":"26.5°N, 100.2°E"}

[0167] {"Ehead":"Earthquake", "Rname":"Caused", "Etail":"Damage to reinforced concrete buildings"} ]

[0169] }

[0170] Step 2064: For all chunks {Chunk1, Chunk2, ..., Chunk...} n}, and the entity recognition results of each block are NER predicted (i) and relation identification results RE predicted (i) Summarize to form a complete entity recognition dataset NER predicted Relationship recognition dataset RE predicted .

[0171] Specifically, the complete entity recognition dataset NER formed for the implementation examples predicted Relationship recognition dataset RE predicted as follows:

[0172] {

[0173] NER predicted ":[

[0174] {"Ename":"August 20, 2024", "Etype":"Date"}

[0175] {"Ename":"A certain place in Yunnan", "Etype":"Region"}

[0176] {"Ename":"6.5", "Etype":"Magnitude"}

[0177] {"Ename":"26.5°N, 100.2°E","Etype":"Epicenter location"}

[0178] {"Ename":"10 km", "Etype":"focal depth"}

[0179] {"Ename":"Reinforced concrete structure", "Etype":"Building type"}

[0180] {"Ename":"200 mm", "Etype":"Rainfall"},

[0181] {"Ename":"12 meters", "Etype":"river water level"}

[0182] {"Ename":"Orange", "Etype":"Flood Warning Level"}

[0183] {"Ename":"Upstream Region", "Etype":"Affected Area"}

[0184] ],

[0185] RE predicted ":[

[0186] {"Ehead":"Earthquake", "Rname":"Occurred on", "Etail":"August 20, 2024"}

[0187] {"Ehead":"Earthquake", "Rname":"Epicenter", "Etail":"26.5°N, 100.2°E"}

[0188] {"Ehead":"Earthquake", "Rname":"Caused", "Etail":"Damage to reinforced concrete structures"}

[0189] {"Ehead":"Flood", "Rname":"By", "Etail":"Triggered by heavy rain"}

[0190] {"Ehead":"Rainfall", "Rname":"Reached", "Etail":"200 mm"}

[0191] {"Ehead":"River water level", "Rname":"Increased to", "Etail":"12 meters"}

[0192] {"Ehead":"Flood Warning Level", "Rname":"Set to", "Etail":"Orange"},

[0193] {"Ehead":"Flood", "Rname":"Caused", "Etail":"Cracks appeared in the dam"}

[0194] {"Ehead":"Flood", "Rname":"Threat", "Etail":"Residents of the upstream area"} ]

[0196] }

[0197] The cross-hazard dynamic prompt-driven disaster knowledge element extraction method further includes: the entity recognition results of all the blocks constitute an entity recognition dataset; the relationship recognition results of all the blocks constitute a relationship recognition dataset; and the entity recognition dataset and the relationship recognition dataset are evaluated based on performance metrics.

[0198] Specifically, by calculating TP (TruePositive), FN (FalseNegative), and FP (FalsePositive), precision P (precision score), recall R (recall score), and F1 score are obtained, which are then used to evaluate the final entity recognition dataset NER. predicted Relationship recognition dataset RE predicted An assessment will be conducted.

[0199] For the entity recognition dataset NER predicted Assessment:

[0200] TP (True Positive): A set of entities that have been manually annotated and verified (used as the ground truth for evaluation). NER annotated Entity data in NER predicted The number of elements present in the array. The condition for determining this is NER. predicted The entity's (ename, etype) and NER annotated The entities have the same (ename, etype). Among them, NER annotated This represents the actual entity recognition dataset in the document to be processed; NER predicted This represents the final entity recognition dataset of the large model.

[0201] FN (False Negative): NER annotated Entity data in NER predicted The number of non-existent items is determined by the same criteria as above.

[0202] FP (False Positive): NER predicted Entity data in NER annotated The number of items that do not exist in the given list is determined by the same criteria as above.

[0203] For the relation recognition dataset RE predicted Assessment:

[0204] TP (True Positive): A set of relations that have been manually annotated and verified (used as ground-truth for evaluation). annotated Relational data in RE predicted The number of elements present in the array. The condition for determining this is RE. predicted Relationships and RE annotated The relationships are equal. Among them, RE annotated This represents a dataset for identifying real entity relationships in the documents to be processed; RE predicted This represents the final relation recognition dataset.

[0205] FN(FalseNegative): RE annotated Relational data in RE predicted The number of items that do not exist in the given list is determined by the same criteria as above.

[0206] FP (False Positive): RE predicted Relational data in RE annotated The number of items that do not exist in the given list is determined by the same criteria as above.

[0207] Precision score (P), recall score (R), and F1 score (f1 score) are calculated as follows:

[0208] - Precision P: P = TP / (TP + FP)

[0209] -Recall rate R: R = TP / (TP + FN)

[0210] -F1 value: F1 = 2*(P*R) / (P+R)

[0211] Specifically, in this embodiment, P, R, and F1 are calculated for each chunk to be processed, for example:

[0212] -Chunk1: P=0.8, R=0.9, F1=0.85

[0213] -Chunk2: P=0.75, R=0.8, F1=0.75

[0214] Simultaneously, P, R, and F1 are calculated separately for each entity type, for example:

[0215] -Earthquake P = 0.8, R = 0.9, F1 = 0.85;

[0216] -Flood P = 0.75, R = 0.8, F1 = 0.75.

[0217] When the performance metric F1 of a chunk is less than the set value, the large language model is called again to extract entities and relations for that chunk until the performance metric is not less than the set value or the current iteration count reaches the maximum number of retries. The set value can be 0.8.

[0218] Traditional disaster knowledge element extraction has long been limited by scarce annotations and overfitting due to few samples. With the rise of Large Language Models (LLM), researchers have begun to explore zero-sample or few-sample paradigms to alleviate data dependence:

[0219] In the related technology "A Zero-Shot Document-Level Relation Extraction Method Based on a General Large Language Model", entity-relation extraction is completed by directly calling a large model through a fixed prompt word template without training; however, the template of this method is closed and cannot be expanded online according to unknown entities / relations appearing in the text, and cross-domain transfer requires manual rewriting of the template.

[0220] The related technology "A Method and System for Constructing Entity Extraction Intelligent Agents Based on a Large Language Model" uses "entity extraction intelligent agents" to solidify domain prompt words and tag vector libraries. Although this supports rapid reuse across multiple domains, the prompt templates are closed-loop once released. When a new composite relationship of "storm surge + astronomical tide superposition" appears in typhoon disaster text, manual rollback to the prompt word and knowledge base re-editing stage is required, interrupting the real-time decision-making process.

[0221] The related technology, "A Method and System for Generating Typhoon Disaster Knowledge Graph Based on a Large Language Model," uses a dedicated TyphoonKGent for training typhoon scenarios, locking the typhoon corpus for the entity, stage, and state layers. However, when dealing with earthquake-flood coupled text, a four-layer model needs to be redesigned and fine-tuned, resulting in a high-cost dilemma of "one model for one type of disaster."

[0222] The related technology "A Low-Resource Named Entity Recognition Method and System Based on Evolutionary Hints" uses pseudo-labels to iteratively optimize entity boundaries, but each round requires K-Means clustering, re-screening of differential samples, and regeneration of type definitions. The iteration cycle is measured in hours, which cannot match the minute-level response requirements at disaster sites.

[0223] In summary, while existing large-scale model solutions have achieved breakthroughs in zero- or few-sample extraction, they all fall into new bottlenecks characterized by "template closure, disaster type locking, and iterative lag": once the prompt words are released, they become fixed, and unknown relationships cannot be expanded online; cross-disaster scenarios require manual rewriting of templates or retraining of models, resulting in a high-cost "one disaster, one model" dilemma; and the iteration cycle of pseudo-labels is measured in hours, far slower than the minute-level response at disaster sites. Therefore, there is an urgent need for a disaster knowledge element extraction technology that requires no fine-tuning, is adaptive to different disaster types, and allows prompt words to evolve online, thereby meeting the emergency response requirements of "one-time deployment, universal applicability across multiple disaster types, and real-time iteration."

[0224] This application focuses on the intersection of cross-disaster knowledge extraction, dynamic prompting engineering, and zero-training reasoning of large language models. In particular, it proposes a disaster knowledge element extraction method that requires no fine-tuning, is adaptive to disaster types, and allows prompt words to evolve online. This method is used for efficient extraction of knowledge elements in the disaster domain and has the ability to learn with few samples.

[0225] This application utilizes a large language model to extract entities and relationships from unstructured disaster-related text by dynamically constructing specific prompt words. Only a small number of samples are needed to build the example set, eliminating the need for large-scale labeled data and significantly reducing data preparation costs. This embodiment guides the large language model directly through dynamic prompt words, eliminating the need for complex training or fine-tuning processes and accelerating the development cycle. Dynamically generating prompt words based on different disaster categories adapts to various disaster types and text structures, improving the method's generalization ability. Furthermore, this embodiment combines entity-category bigrams and entity-relation triples as examples, providing clear guidance to the large language model and improving the accuracy of entity and relation extraction. Finally, verification and optimization steps further enhance the correctness and reliability of the extraction results, ensuring the quality of the output data.

[0226] This application dynamically constructs specific prompt words and uses a large language model to extract entities and relationships from unstructured disaster-related texts. Only a small number of samples are needed to build an example set, eliminating the need for large-scale labeled data and significantly reducing data preparation costs.

[0227] This embodiment guides a large language model to extract information directly using dynamic prompts, eliminating the need for complex training or fine-tuning processes and accelerating the development cycle. Dynamically generating prompts based on different disaster categories allows the method to adapt to various disaster types and text structures, enhancing its generalization ability.

[0228] Furthermore, this embodiment, by combining examples of entity and category bigrams and relation triples, provides explicit guidance for large language models, improving the accuracy of entity and relation extraction. Finally, through verification and optimization steps, the correctness and reliability of the extraction results are further improved, ensuring the quality of the output data.

[0229] This application also provides an application scenario in which the aforementioned cross-hazard dynamic prompt-driven disaster knowledge element extraction method is applied. Specifically, the cross-hazard dynamic prompt-driven disaster knowledge element extraction method provided in this embodiment can be applied in a disaster knowledge element extraction scenario. The disaster knowledge element extraction scenario includes a content production stage and a disaster knowledge element extraction stage; the text to be processed enters the disaster knowledge element extraction stage from the content production stage, obtaining segmented entity recognition results and relation recognition results. The cross-hazard dynamic prompt-driven disaster knowledge element extraction method provided in this embodiment belongs to the disaster knowledge element extraction stage. Specifically, in the disaster knowledge element extraction process for the text to be processed, an entity category set and a relation set corresponding to the disaster category can be established. Historical samples are used to construct an example set of entity and category pairs and an example set of entity relation triples. Based on the task category, these example sets are added to prompt words to construct a prompt word template set. The text to be processed is preprocessed by dividing it into multiple blocks and extracting the disaster category of each block. Dynamic prompt words for each block are generated based on the disaster category and prompt word template set. These dynamic prompt words include prompt words for named entity recognition and prompt words for relation recognition. The dynamic prompt words for each block are used to guide the large language model to extract entity and relation results for the block.

[0230] Example 2

[0231] Based on the same inventive concept, this application also provides a disaster knowledge element extraction device for implementing the disaster knowledge element extraction method driven by dynamic prompts across disaster types as described above. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the disaster knowledge element extraction device driven by dynamic prompts across disaster types provided below can be found in the limitations of the disaster knowledge element extraction method driven by dynamic prompts across disaster types described above, and will not be repeated here.

[0232] In one exemplary embodiment, a disaster knowledge element extraction device driven by dynamic prompts across disaster types is provided, comprising the following modules.

[0233] The entity category set and relation set creation module is used to create entity category sets and relation sets corresponding to disaster categories.

[0234] The example set building module is used to build example sets of entity and category pairs and example sets of entity relationship triples using historical samples.

[0235] The prompt word template set construction module is used to add entity and category bigram example sets and entity relation triple example sets to prompt words based on task categories, and construct prompt word template sets. The prompt word template set includes prompt word templates for named entity recognition and prompt word templates for relation recognition.

[0236] The disaster category extraction module is used to preprocess the text to be processed, divide the preprocessed text into multiple blocks, and extract the disaster category of each block.

[0237] The dynamic prompt word generation module is used to generate dynamic prompt words for each segment based on the disaster category of the segment and the prompt word template set; the dynamic prompt words include prompt words for named entity recognition and prompt words for relationship recognition.

[0238] The entity relation extraction module is used to guide the large language model to extract entity relations for each block using the dynamic prompt words of the block, so as to obtain the entity recognition result and relation recognition result of the block.

[0239] Example 3

[0240] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 4 As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs in the non-volatile storage media to run. The database stores knowledge element extraction data. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a cross-hazard dynamic prompt-driven disaster knowledge element extraction method.

[0241] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0242] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0243] Example 4

[0244] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0245] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0246] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0247] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchain. The processors involved in the embodiments provided in this application may be, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc.

[0248] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0249] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for extracting disaster knowledge elements driven by dynamic prompts across disaster types, characterized in that, The disaster knowledge element extraction method driven by cross-hazard dynamic prompts includes: Establish entity category sets and relation sets corresponding to disaster categories; Using historical samples, construct an example set of entity and category pairs and an example set of entity relation triples; Based on the task category, the example set of entity and category bigrams and the example set of entity relation triples are added to the prompt words to construct a prompt word template set; the prompt word template set includes prompt word templates for named entity recognition and prompt word templates for relation recognition; The text to be processed is preprocessed, the preprocessed text is divided into multiple blocks, and the disaster category of each block is extracted. For each segment, dynamic prompts are generated based on the disaster category and prompt template set of the segment, specifically including: Based on the disaster category of the block, the block is matched with the entity category set and relation set corresponding to the disaster category. If there is a new entity category or new relation type in the block that is not covered by the entity category set and relation set corresponding to the disaster category, the new entity category is added to the entity category set corresponding to the disaster category, and the new relation type is added to the relation set corresponding to the disaster category. Based on the disaster category of the block, relevant entity categories are selected from the entity category set corresponding to the disaster category. Relevant examples from the entity and category tuple example set are embedded into the prompt word template to generate dynamic prompt words for named entity recognition of the block. A tag version number for the dynamic prompt words for named entity recognition is generated, and the example content and prompt word template structure can be automatically updated in the next iteration. Based on the disaster category of the segment, relevant relationships are selected from the relationship set corresponding to the disaster category, and relevant examples of the entity relationship triplet example set are embedded into the prompt word template to generate prompt words for relationship recognition of the segment; dynamic prompt words include prompt words for named entity recognition and prompt words for relationship recognition; the tag version number of the dynamic prompt words for named entity recognition and the tag version number of the prompt words for relationship recognition are generated, and their example content and template structure are automatically updated by the optimization module in the next iteration; For each segment, the dynamic prompts of the segment are used to guide the large language model to extract entity relationships, thereby obtaining the entity recognition result and relationship recognition result of the segment.

2. The disaster knowledge element extraction method driven by cross-disaster dynamic prompts according to claim 1, characterized in that, The disaster knowledge element extraction method driven by cross-disaster dynamic prompts also includes: The entity recognition results of all the aforementioned blocks constitute the entity recognition dataset; The relation recognition results of all the aforementioned blocks constitute the relation recognition dataset; The entity recognition dataset and the relationship recognition dataset are evaluated based on performance metrics.

3. The disaster knowledge element extraction method driven by cross-disaster dynamic prompts according to claim 1, characterized in that, Preprocessing includes removing unnecessary punctuation marks, special characters, and extra spaces.

4. The disaster knowledge element extraction method driven by cross-hazard dynamic prompts according to claim 1, characterized in that, Extract the disaster category for each block, specifically including: Each segment is input into a large language model to extract the disaster category of the segment.

5. The disaster knowledge element extraction method driven by cross-hazard dynamic prompts according to claim 1, characterized in that, The dynamic prompts of the segmented data are used to guide the large language model in entity relation extraction, resulting in entity recognition and relation recognition results for the segmented data. Specifically, this includes: The prompts for named entity recognition and relation recognition of the blocks are input into the large language model. Guided by the prompts for named entity recognition of the blocks, the large language model performs entity recognition on the blocks to obtain the entity recognition results of the blocks. Guided by the prompts for relation recognition of the blocks, the large language model performs relation recognition on the blocks to obtain the relation recognition results of the blocks.

6. The disaster knowledge element extraction method driven by cross-hazard dynamic prompting according to claim 1, characterized in that, The large language model is the Qwen3-30B-A3B model.

7. A disaster knowledge element extraction device based on the cross-hazard dynamic prompting-driven disaster knowledge element extraction method according to claim 1, characterized in that, The disaster knowledge element extraction device driven by cross-disaster dynamic prompts includes: The entity category set and relation set creation module is used to create entity category sets and relation sets corresponding to disaster categories; The example set construction module is used to build example sets of entity and category pairs and example sets of entity relationship triples using historical samples; The prompt word template set construction module is used to add entity and category bigram example sets and entity relation triple example sets to prompt words based on task categories, and construct prompt word template sets; the prompt word template set includes prompt word templates for named entity recognition and prompt word templates for relation recognition; The disaster category extraction module is used to preprocess the text to be processed, divide the preprocessed text into multiple blocks, and extract the disaster category of each block. The dynamic prompt word generation module is used to generate dynamic prompt words for each segment based on the disaster category of the segment and the prompt word template set; the dynamic prompt words include prompt words for named entity recognition and prompt words for relationship recognition; The entity relation extraction module is used to guide the large language model to extract entity relations for each block using the dynamic prompt words of the block, so as to obtain the entity recognition result and relation recognition result of the block.

8. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that the processor executes the computer program to implement the disaster knowledge element extraction method driven by cross-disaster dynamic prompts as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the disaster knowledge element extraction method driven by cross-disaster dynamic prompts as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Entity relationship extraction method based on large model and dynamic prompt

    CN118779468A

  • Disaster chain construction and disaster response decision-making method based on large model

    CN119047868A

  • LLM information extraction method based on prompt enhancement

    CN120371935A