Geographic entity relationship extraction method and device, computer equipment and storage medium
The generative pre-training language model automatically generates annotation corpus and geographical knowledge corpus, and uses the knowledge enhancement model to enhance relevant domain knowledge, which solves the problems of high manual annotation cost and lack of geographical knowledge in the existing technology, and improves the extraction of geographical entity relationships. performance and efficiency.
Patent Information
- Application Number
- CN202410696023.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-10-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing geographic entity relationship extraction methods require a large amount of manual annotation and high-cost training data, and lack the introduction of geographic knowledge, resulting in poor data update timeliness and high computing costs.
By inputting geographical entity relation words and prompt words into a generative pre-training language model, annotation corpus and geographical knowledge corpus are generated, and the knowledge enhancement model is used to enhance knowledge of the annotation corpus, and the geographical entity relationship extraction results are output.
It reduces labor and time costs and improves the performance of the model in geographical entity relationship extraction tasks. By introducing geographical domain knowledge, the discriminative pre-trained language model can better understand geographical entities and related domain knowledge.
Smart Images

Figure CN118733689A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of geographic information technology, and in particular relates to a method, device, computer equipment and storage medium for extracting geographic entity relationships. Background Art
[0002] Text-oriented geographic entity relationship extraction aims to extract spatial relationships such as topological relationships, directional relationships, and distance relationships of geographic entities from natural language description texts for spatial query, spatial reference, and data prediction in geographic location-related applications. Current research on geographic entity relationship extraction is mostly based on machine learning methods, which complete supervised learning geographic entity relationship classification by capturing the semantic features of sentences. However, this method has the following two problems:
[0003] 1) A large amount of manual annotation is required; the geographic entity relationship corpus is used as training data for machine learning to extract geographic entity relationships. It is a large-scale structured text dataset containing geographic entity relationships, with text describing geographic entities or closely related to geographic entities as the data source. Although the quality of the manually constructed corpus is reliable, it relies on the knowledge of domain experts, is costly, has a long cycle, and has a limited corpus size, making it difficult to meet the timeliness requirements of network texts for updating the geographic entity relationship corpus.
[0004] 2) Existing methods lack the introduction of geographical knowledge; with the emergence of the Transformer model, discriminative pre-trained language models (such as BERT) and generative pre-trained language models based on this model, such as GPT (Generative Pre-trained Transformer), were born. After the discriminative pre-trained language model is pre-trained on an open domain corpus through a masked language model and the next sentence prediction task, it can learn rich general language representations, including semantic information of words and sentences, which helps the model better capture contextual semantic information and thus more accurately identify the relationship between geographic entities. Therefore, related studies have gradually begun to apply discriminative pre-trained language models to the task of geographic entity relationship extraction. However, due to domain differences, general language representations perform poorly on knowledge-driven tasks in specific domains, and the model pre-training process in the field of geographic entity relationship extraction is time-consuming and computationally expensive. Summary of the invention
[0005] The present application provides a method, apparatus, computer device and storage medium for extracting geographic entity relationships, aiming to solve at least one of the above-mentioned technical problems in the prior art to a certain extent.
[0006] In order to solve the above problems, this application provides the following technical solutions:
[0007] A geographic entity relationship extraction method, comprising:
[0008] Inputting geographic entity relationship words and corresponding prompt words into a trained generative pre-trained language model, and outputting annotated corpus corresponding to the geographic entity relationship words through the generative pre-trained language model, wherein the annotated corpus includes text content and geographic entity information related to the text content;
[0009] Inputting the geographic entity information and the corresponding prompt words into the generative pre-trained language model, generating geographic knowledge corpus corresponding to the geographic entity information through the generative pre-trained language model, wherein the geographic knowledge corpus includes geographic relationship triples corresponding to the geographic entity information;
[0010] The annotated corpus and the geographic knowledge corpus are input into a trained knowledge enhancement model. The knowledge enhancement model uses the geographic knowledge corpus to perform knowledge enhancement on the annotated corpus and then outputs a geographic entity relationship extraction result.
[0011] The technical solution adopted by the embodiment of the present application also includes: before the geographic entity relationship words and the corresponding prompt words are input into the trained generative pre-trained language model, it also includes:
[0012] Obtain geographic entity relationship words; the geographic entity relationship words include relationship words corresponding to various relationship categories, and the various relationship categories include topological relationships, directional relationships, and distance relationships.
[0013] The technical solution adopted by the embodiment of the present application also includes: after obtaining the geographic entity relationship words, it also includes:
[0014] The geographic entity relationship words are randomly sampled, and generation tasks are set according to the sampled geographic entity relationship words to construct prompt words for the generative pre-trained language model.
[0015] The technical solution adopted by the embodiment of the present application also includes: the geographic entity information is a geographic relationship triple consisting of a head entity, a relationship word and a tail entity.
[0016] The technical solution adopted by the embodiment of the present application also includes: the geographic entity information and the corresponding prompt words are input into the generative pre-trained language model, and the geographic knowledge corpus corresponding to the geographic entity information is generated by the generative pre-trained language model, specifically:
[0017] Extracting and integrating geographic entity information corresponding to the annotated corpus to generate a geographic entity set;
[0018] The geographic entity set is sampled without duplication and input into a trained generative pre-trained language model together with corresponding prompt words, and the geographic knowledge corpus corresponding to the geographic entity is generated by the generative pre-trained language model.
[0019] The technical solution adopted by the embodiment of the present application also includes: after the geographic entity information and the corresponding prompt words are input into the generative pre-trained language model, and the geographic knowledge corpus corresponding to the geographic entity information is generated by the generative pre-trained language model, it also includes:
[0020] The geographic knowledge corpus is stored in the form of a triple of a head entity, a relational word, and a tail entity.
[0021] The technical solution adopted by the embodiment of the present application also includes: the knowledge enhancement model includes a K-BERT module and a relationship classification module, the K-BERT module includes a knowledge layer, an embedding layer, a visible layer and an encoder, the relationship classification module includes a bidirectional GRU layer, an attention mechanism layer and a fully connected layer, the annotated corpus and the geographical knowledge corpus are input into the trained knowledge enhancement model, the knowledge enhancement model uses the geographical knowledge corpus to perform knowledge enhancement on the annotated corpus, and outputs a geographical entity relationship extraction result, specifically:
[0022] The annotated corpus is processed by the knowledge layer, which includes two stages: knowledge query and knowledge injection. In the knowledge query stage, all geographical entity names involved in the annotated corpus are extracted, and their corresponding geographical knowledge triples are searched in the geographical knowledge corpus; in the knowledge injection stage, the geographical knowledge triples are inserted into the corresponding annotated corpus to form a sentence tree containing relevant geographical knowledge;
[0023] The sentence tree is input into the bidirectional GRU layer after passing through the encoder for processing, and the output of the bidirectional GRU layer is input into the attention mechanism layer. The sentence tree and the local information related to the output at the current moment are mined through the attention mechanism layer, and all the relationship words are classified through the fully connected layer, and the geographic entity relationship extraction result is output.
[0024] Another technical solution adopted by the embodiment of the present application is: a geographic entity relationship extraction device, comprising:
[0025] Annotated corpus generation module: used to input geographic entity relationship words and corresponding prompt words into a trained generative pre-trained language model, and output annotated corpus corresponding to the geographic entity relationship words through the generative pre-trained language model, wherein the annotated corpus includes text content and geographic entity information related to the text content;
[0026] A knowledge corpus generation module is used to input the geographic entity information and the corresponding prompt words into the generative pre-trained language model, and generate geographic knowledge corpus corresponding to the geographic entity information through the generative pre-trained language model, wherein the geographic knowledge corpus includes geographic relationship triples corresponding to the geographic entity information;
[0027] Knowledge enhancement module: used to input the annotated corpus and geographic knowledge corpus into the trained knowledge enhancement model. The knowledge enhancement model uses the geographic knowledge corpus to perform knowledge enhancement on the annotated corpus and outputs the geographic entity relationship extraction result.
[0028] Another technical solution adopted by the embodiment of the present application is: a computer device, the computer device includes a processor and a memory coupled to the processor, wherein:
[0029] The memory stores program instructions for implementing the geographic entity relationship extraction method;
[0030] The processor is used to execute the program instructions stored in the memory to control the geographic entity relationship extraction method.
[0031] Another technical solution adopted by the embodiment of the present application is: a storage medium storing program instructions executable by a processor, wherein the program instructions are used to execute the geographic entity relationship extraction method.
[0032] Compared with the prior art, the beneficial effects of the embodiments of the present application are as follows: the geographic entity relationship extraction method, device, computer equipment and storage medium of the embodiments of the present application automatically generate annotated corpus and geographic knowledge corpus by using a generative pre-trained language model, giving full play to the generation ability of the generative pre-trained language model and reducing labor costs and time costs; at the same time, the knowledge of the geographic field is introduced, and the knowledge enhancement model is used to enhance the knowledge of the related field of the annotated corpus according to the geographic knowledge corpus, and then the geographic entity relationship is extracted from the annotated corpus. The embodiments of the present application enable the discriminative pre-trained language model to better understand geographic entities and the domain knowledge related thereto, thereby improving the performance of the model in the task of extracting geographic entity relationships from text. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flow chart of a method for extracting geographic entity relationships according to an embodiment of the present application;
[0034] Figure 2 A schematic diagram of generating a corpus annotation prompt word according to an embodiment of the present application;
[0035] Figure 3 This is a schematic diagram of a geographic entity relationship extraction framework based on the K-BERT knowledge enhancement model in an embodiment of the present application;
[0036] Figure 4 A schematic diagram of the structure of a geographic entity relationship extraction device according to an embodiment of the present application;
[0037] Figure 5 A schematic diagram of the computer device structure of an embodiment of the present application;
[0038] Figure 6 A schematic diagram of the structure of a storage medium according to an embodiment of the present application. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0040] The terms "first", "second", "third" in this application are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first", "second", "third" can expressly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In the embodiments of this application, all directional indications (such as up, down, left, right, front, back...) are only used to explain the relative position relationship, movement, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication also changes accordingly. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or computer device that includes a series of steps or units is not limited to the steps or units listed, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or computer devices.
[0041] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0042] Specifically, see Figure 1, is a flow chart of a method for extracting geographic entity relationships according to an embodiment of the present application. The method for extracting geographic entity relationships according to an embodiment of the present application comprises the following steps:
[0043] S1: Obtain geographic entity relationship words, randomly sample geographic entity relationship words, and construct prompt words for the generative pre-trained language model;
[0044] In this step, geographic entity relationship words are collected and sorted from relevant literature. The geographic entity relationship words include relationship words corresponding to different relationship categories such as topological relationship, directional relationship and distance relationship. For example, the relationship words corresponding to topological relationship include contain, adjacent, in, close to, near, etc., and the relationship words corresponding to directional relationship include north, southeast, northwest, etc. The specific acquired and integrated geographic entity relationship words are shown in Table 1 below:
[0045] Table 1. Geographic entity relationship words
[0046]
[0047] In order to prevent the generative pre-trained language model from generating errors and unexpected answers, it is necessary to generate prompt words for the generative pre-trained language model based on geographic entity relationship words. The prompt words are generated as follows: In order to improve the efficiency of GPT, the geographic entity relationship words are randomly sampled by random sampling, and a set number (10) of geographic entity relationship words are sampled each time. The generation task is set according to the sampled geographic entity relationship words, so as to construct the prompt words for generating the annotated corpus. Figure 2 , which is a schematic diagram of generating annotated corpus prompt words in an embodiment of the present application.
[0048] S2: The geographic entity relationship words and the corresponding prompt words are input into the trained generative pre-trained language model, and the generative pre-trained language model outputs the annotated corpus corresponding to the geographic entity relationship words according to the prompt words;
[0049] In this step, the generative pre-trained language model used is the ChatGPT-3.5Turbo version provided by OpenAI. Specifically, other generative pre-trained language models other than ChatGPT may also be used. After the geographic entity relationship words and the corresponding prompt words are input into GPT together, GPT is guided to generate annotated corpus about the prompt words, thereby improving the reliability of the output annotated corpus. In the embodiment of the present application, a total of 10,000 annotated corpora are generated, and the generated annotated corpus is divided into a training set and a test set according to a set ratio, wherein the training set includes 7,000 annotated corpora, and the test set includes 3,000 annotated corpora. The annotated corpus includes text content and geographic entity information related to the text content, wherein the geographic entity information is a geographic relationship triple composed of information such as a head entity, a relationship word, and a tail entity. For example, the generated annotated corpus is: Province A is located in City B with x, and is a province of Country A; the head entity corresponding to the annotated corpus is: Province A, the corresponding relationship word is: with x, and the corresponding tail entity is City B. The annotated corpus generated by GPT is specifically shown in Table 2 below:
[0050] Table 2. Examples of annotated corpora generated by GPT
[0051]
[0052] S3: Extract and integrate the geographic entity information corresponding to the annotated corpus to generate a geographic entity set;
[0053] In this step, the geographic entity information corresponding to all annotated corpora is extracted and integrated to generate a geographic entity set.
[0054] S4: After sampling the geographic entity set without duplication, the geographic entity set and the corresponding prompt words are input into the trained generative pre-trained language model, and the geographic knowledge corpus corresponding to the geographic entity is generated by the generative pre-trained language model;
[0055] In this step, the generated geographic knowledge corpus is stored in the form of a triple of head entity, relation word, and tail entity, as shown in Table 3 below:
[0056] Table 3. Examples of geographical knowledge corpus generated by GPT
[0057]
[0058]
[0059] S5: The annotated corpus generated by the generative pre-trained language model and the geographical knowledge corpus are input into the trained knowledge enhancement model. The knowledge enhancement model uses the geographical knowledge corpus to perform knowledge enhancement on the annotated corpus and outputs the geographical entity relationship extraction result.
[0060] In this step, the knowledge enhancement model used takes the K-BERT (Bidirectional EncoderRepresentations from Transformers, a pre-trained language model based on knowledge graph) model as an example. Specifically, other discriminative pre-trained language models or knowledge injection models other than BERT may also be used. The knowledge enhancement model of the embodiment of the present application includes a K-BERT module and a relationship classification module. The K-BERT module includes a knowledge layer, an embedding layer, a visible layer and an encoder. The relationship classification module includes a bidirectional GRU (Gate Recurrent Unit) layer, an attention mechanism layer and a fully connected layer. After the annotated corpus is enhanced with knowledge in related fields using geographic knowledge corpus, geographic entity relationships are extracted from the annotated corpus. Specifically, Figure 3 As shown, it is a schematic diagram of the geographic entity relationship extraction framework based on the K-BERT knowledge enhancement model in an embodiment of the present application, and its geographic entity relationship extraction process includes:
[0061] First, the annotated corpus is processed through the knowledge layer, which includes two stages: knowledge query and knowledge injection. In the knowledge query stage, all geographical entity names involved in the annotated corpus are extracted, and their corresponding geographical knowledge triples are searched in the geographical knowledge corpus; in the knowledge injection stage, the queried geographical knowledge triples are inserted into the corresponding annotated corpus to form a sentence tree containing relevant geographical knowledge; in the process of inserting geographical knowledge, the introduction of knowledge noise is avoided through the visible matrix in the visible layer, ensuring that the injected geographical knowledge will not interfere with content irrelevant to the knowledge.
[0062] Subsequently, the sentence tree is passed through the encoder and input into the bidirectional GRU layer for processing. The bidirectional GRU layer is a gated recurrent unit, including two gate functions, and has the advantages of fast convergence speed, few parameters, and high performance. In the embodiment of the present application, in order to make up for the shortcomings of the bidirectional GRU layer in obtaining local features of the corpus, the output of the bidirectional GRU layer is input into the attention mechanism layer, and the attention mechanism layer enables the model to mine the sentence tree and the local information related to the output at the current moment. Finally, all relationship words are classified through the fully connected layer, and the geographic entity relationship extraction result is output.
[0063] In order to verify the feasibility and effectiveness of the embodiment of the present application, the performance of the embodiment of the present application is compared with the existing NeuroSPE (using manually annotated corpus) and NeuroSPE (using GPT to generate corpus) methods through experiments. The test results are shown in Table 4 below:
[0064] Table 4. Performance comparison between the present embodiment and the NeuroSPE method
[0065]
[0066] As shown in ①② in Table 4, when the NeuroSPE model is trained using GPT to generate corpus, its performance is not much different from that of training using manually annotated corpus, but it avoids the time-consuming and labor-intensive manual annotation, proving that GPT can generate high-quality annotated corpus. As shown in ②③ in Table 4, when GPT is also used to generate corpus, the performance of the embodiment of the present application is improved compared to NeuroSPE, proving the effectiveness of the embodiment of the present application.
[0067] Based on the above, the geographic entity relationship extraction method of the embodiment of the present application uses a generative pre-trained language model to automatically generate annotated corpus and geographic knowledge corpus, giving full play to the generation ability of the generative pre-trained language model and reducing labor costs and time costs; at the same time, the knowledge of the geographical field is introduced, and the knowledge enhancement model is used to enhance the knowledge of the relevant field of the annotated corpus according to the geographical knowledge corpus, and then the geographic entity relationship is extracted from the annotated corpus. The embodiment of the present application enables the discriminative pre-trained language model to better understand geographic entities and related domain knowledge, thereby improving the performance of the model in the task of extracting geographic entity relationships from text.
[0068] See also Figure 4 , is a schematic diagram of the structure of a geographic entity relationship extraction device according to an embodiment of the present application. The geographic entity relationship extraction device 40 according to the embodiment of the present application comprises:
[0069] The annotated corpus generation module 41 is used to input the geographic entity relationship words and the corresponding prompt words into the trained generative pre-trained language model, and output the annotated corpus corresponding to the geographic entity relationship words through the generative pre-trained language model, wherein the annotated corpus includes text content and geographic entity information related to the text content;
[0070] The knowledge corpus generation module 42 is used to input the geographic entity information and the corresponding prompt words into the generative pre-trained language model, and generate geographic knowledge corpus corresponding to the geographic entity information through the generative pre-trained language model, wherein the geographic knowledge corpus includes geographic relationship triples corresponding to the geographic entity information;
[0071] The knowledge enhancement module 43 is used to input the annotated corpus and the geographical knowledge corpus into the trained knowledge enhancement model. The knowledge enhancement model uses the geographical knowledge corpus to perform knowledge enhancement on the annotated corpus and outputs the geographical entity relationship extraction result.
[0072] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0073] The device provided in the embodiment of the present application can be applied in the aforementioned method embodiment. For details, please refer to the description of the aforementioned method embodiment, which will not be repeated here.
[0074] See also Figure 5 , is a schematic diagram of the computer device structure of an embodiment of the present application. The computer device 50 includes:
[0075] A memory 51 storing executable program instructions;
[0076] A processor 52 connected to the memory 51;
[0077] The processor 52 is used to call the executable program instructions stored in the memory 51 and perform the following steps: input the geographic entity relationship words and the corresponding prompt words into the trained generative pre-trained language model, and output the annotated corpus corresponding to the geographic entity relationship words through the generative pre-trained language model, and the annotated corpus includes text content and geographic entity information related to the text content; input the geographic entity information and the corresponding prompt words into the generative pre-trained language model, and generate the geographic knowledge corpus corresponding to the geographic entity information through the generative pre-trained language model, and the geographic knowledge corpus includes the geographic relationship triples corresponding to the geographic entity information; input the annotated corpus and the geographic knowledge corpus into the trained knowledge enhancement model, and the knowledge enhancement model uses the geographic knowledge corpus to perform knowledge enhancement on the annotated corpus, and then outputs the geographic entity relationship extraction result.
[0078] The processor 52 may also be referred to as a CPU (Central Processing Unit). The processor 52 may be an integrated circuit chip having signal processing capabilities. The processor 52 may also be a general-purpose processor, 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, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0079] See also Figure 6, is a schematic diagram of the structure of the storage medium of the embodiment of the present application. The storage medium of the embodiment of the present application stores a program instruction 61 capable of implementing the following steps: inputting the geographic entity relationship words and the corresponding prompt words into a trained generative pre-trained language model, outputting the annotation corpus corresponding to the geographic entity relationship words through the generative pre-trained language model, the annotation corpus including text content and geographic entity information related to the text content; inputting the geographic entity information and the corresponding prompt words into the generative pre-trained language model, generating the geographic knowledge corpus corresponding to the geographic entity information through the generative pre-trained language model, the geographic knowledge corpus including the geographic relationship triples corresponding to the geographic entity information; inputting the annotation corpus and the geographic knowledge corpus into a trained knowledge enhancement model, the knowledge enhancement model uses the geographic knowledge corpus to perform knowledge enhancement on the annotation corpus, and outputs the geographic entity relationship extraction result. Among them, the program instruction 61 can be stored in the above storage medium in the form of a software product, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network computer device, etc.) or a processor to execute all or part of the steps of the methods of each implementation method of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program instructions, or terminal computer devices such as computers, servers, mobile phones, tablets, etc. Among them, the server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0080] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0081] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. The above is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the description and drawings of this application, or directly or indirectly used in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A method for extracting geographic entity relationships, characterized in that: include: Inputting geographic entity relationship words and corresponding prompt words into a trained generative pre-trained language model, and outputting annotated corpus corresponding to the geographic entity relationship words through the generative pre-trained language model, wherein the annotated corpus includes text content and geographic entity information related to the text content; Inputting the geographic entity information and the corresponding prompt words into the generative pre-trained language model, generating geographic knowledge corpus corresponding to the geographic entity information through the generative pre-trained language model, wherein the geographic knowledge corpus includes geographic relationship triples corresponding to the geographic entity information; The annotated corpus and the geographic knowledge corpus are input into a trained knowledge enhancement model. The knowledge enhancement model uses the geographic knowledge corpus to perform knowledge enhancement on the annotated corpus and then outputs a geographic entity relationship extraction result.
2. The method for extracting geographic entity relationships according to claim 1, characterized in that: Before the geographic entity relationship words and the corresponding prompt words are input into the trained generative pre-trained language model, the method further includes: Obtain geographic entity relationship words; the geographic entity relationship words include relationship words corresponding to various relationship categories, and the various relationship categories include topological relationships, directional relationships, and distance relationships.
3. The method for extracting geographic entity relationships according to claim 2, characterized in that: After obtaining the geographic entity relationship words, the method further includes: The geographic entity relationship words are randomly sampled, and generation tasks are set according to the sampled geographic entity relationship words to construct prompt words for the generative pre-trained language model.
4. The method for extracting geographic entity relationships according to any one of claims 1 to 3, characterized in that: The geographic entity information is a geographic relationship triple consisting of a head entity, a relationship word, and a tail entity.
5. The method for extracting geographic entity relationships according to claim 4, characterized in that: The step of inputting the geographic entity information and the corresponding prompt words into the generative pre-trained language model, and generating the geographic knowledge corpus corresponding to the geographic entity information through the generative pre-trained language model, specifically includes: Extracting and integrating geographic entity information corresponding to the annotated corpus to generate a geographic entity set; The geographic entity set is sampled without duplication and inputted into a trained generative pre-trained language model together with corresponding prompt words, and the geographic knowledge corpus corresponding to the geographic entity is generated by the generative pre-trained language model.
6. The method for extracting geographic entity relationships according to claim 5, characterized in that: After the geographic entity information and the corresponding prompt words are input into the generative pre-trained language model and the geographic knowledge corpus corresponding to the geographic entity information is generated by the generative pre-trained language model, the method further includes: The geographic knowledge corpus is stored in the form of a triple of a head entity, a relational word, and a tail entity.
7. The method for extracting geographic entity relationships according to claim 6, characterized in that: The knowledge enhancement model includes a K-BERT module and a relationship classification module. The K-BERT module includes a knowledge layer, an embedding layer, a visible layer and an encoder. The relationship classification module includes a bidirectional GRU layer, an attention mechanism layer and a fully connected layer. The annotated corpus and the geographic knowledge corpus are input into the trained knowledge enhancement model. The knowledge enhancement model uses the geographic knowledge corpus to perform knowledge enhancement on the annotated corpus and outputs a geographic entity relationship extraction result, which is specifically: The annotated corpus is processed by the knowledge layer, and the knowledge layer includes two stages: knowledge query and knowledge injection. In the knowledge query stage, all geographic entity names involved in the annotated corpus are extracted, and their corresponding geographic knowledge triples are searched in the geographic knowledge corpus; In the knowledge injection stage, the geographical knowledge triples are inserted into the corresponding annotated corpus to form a sentence tree containing relevant geographical knowledge; The sentence tree is input into the bidirectional GRU layer after passing through the encoder for processing, and the output of the bidirectional GRU layer is input into the attention mechanism layer. The sentence tree and the local information related to the output at the current moment are mined through the attention mechanism layer, and all the relationship words are classified through the fully connected layer, and the geographic entity relationship extraction result is output.
8. A device for extracting geographic entity relationships, characterized in that: include: Annotated corpus generation module: used to input geographic entity relationship words and corresponding prompt words into a trained generative pre-trained language model, and output annotated corpus corresponding to the geographic entity relationship words through the generative pre-trained language model, wherein the annotated corpus includes text content and geographic entity information related to the text content; A knowledge corpus generation module is used to input the geographic entity information and the corresponding prompt words into the generative pre-trained language model, and generate geographic knowledge corpus corresponding to the geographic entity information through the generative pre-trained language model, wherein the geographic knowledge corpus includes geographic relationship triples corresponding to the geographic entity information; Knowledge enhancement module: used to input the annotated corpus and geographic knowledge corpus into the trained knowledge enhancement model. The knowledge enhancement model uses the geographic knowledge corpus to perform knowledge enhancement on the annotated corpus and outputs the geographic entity relationship extraction result.
9. A computer device, characterized in that: The computer device includes a processor and a memory coupled to the processor, wherein: The memory stores program instructions for implementing the geographic entity relationship extraction method according to any one of claims 1 to 7; The processor is used to execute the program instructions stored in the memory to control the geographic entity relationship extraction method.
10. A storage medium, characterized in that: The device stores program instructions executable by a processor, wherein the program instructions are used to execute the geographic entity relationship extraction method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Automatic classification method of text syntax structure and semantic information fused text entity relationship
CN111177383A
Triad extraction method and device of safety report text and electronic equipment
CN112699665A
Entity recognition and relation extraction method and device, electronic equipment and storage medium
CN113901827A
Text data processing method and device, computer equipment and storage medium
CN114138985A
Geological knowledge graph construction method and device, electronic equipment and storage medium
CN114218333A
Cited By
Text spatial correlation calculation method based on semantic matching
CN121882057A
