Screening type dynamic classification self-adaptive relation extraction method, device and equipment

By employing an adaptive relation extraction method based on filtering and dynamic classification, the problems of computational redundancy and model flexibility in knowledge graph construction are solved. This enables an end-to-end automated process from raw text to knowledge graph, improving efficiency and accuracy.

CN121480656APending Publication Date: 2026-02-06Liupanshan Laboratory
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511652575.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Existing technologies for knowledge graph construction suffer from problems such as the risk of error accumulation, computational redundancy, high cost, poor model flexibility, instability in long text processing, and lack of interpretability of output results.

Method used

An adaptive relation extraction method based on filtering and dynamic classification is adopted. By defining a list of entity types, combining static corpus statistics and a dynamic semantic hybrid scoring model to calculate the association strength, low-association candidate entity pairs are filtered out, and natural language summaries are generated in LLM to construct structured triples, thus realizing an end-to-end automated process.

Benefits of technology

It significantly improves knowledge extraction efficiency, solves the problems of computational redundancy and high cost, enhances the robustness of long text processing and the accuracy and interpretability of results, and realizes an automated process from raw text to knowledge graph.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121480656A_ABST
    Figure CN121480656A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of knowledge maps, and provides a screening type dynamic classification self-adaptive relation extraction method, device and equipment, and the method comprises the following steps: defining an entity type list, inputting a text by a user according to a cue word template in a labeling format, judging the length of the text, and extracting the entity type list according to the length of the text; selecting a corresponding strategy according to the text length to generate a candidate entity pair; the association strength of each candidate entity pair is calculated by combining static corpus statistics and a dynamic semantic hybrid scoring model, and the candidate entity pairs with low association are filtered; constructing a dynamic prompt request LLM to generate a natural language abstract describing the subject entity and the object entity, and classifying the abstract into a predefined relationship type to obtain a structured triple; and importing the triple into a graph database to construct the knowledge graph. According to the method, the knowledge extraction efficiency is improved, and the problems of calculation redundancy and high cost are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention generally relate to the field of knowledge graph technology, and more particularly to a method, apparatus and device for adaptive relation extraction using a filtering dynamic classification method. Background Technology

[0002] Currently, research on knowledge graph construction across various industries primarily relies on traditional machine learning and deep learning techniques. Mainstream methods generally employ a pipeline-style processing model of "NER first, then RE." This model artificially breaks down the complete knowledge extraction task into two independent sub-tasks, increasing the complexity of system integration and, more importantly, introducing the risk of error accumulation. Any errors in the entity recognition stage can be propagated and amplified to the subsequent relation extraction stage. Furthermore, the relation extraction step typically requires pairwise combinations of all identified entities. When the number of entities in the text is large, this results in an exponentially increasing number of candidate entity pairs, leading to a significant amount of redundant computation and a substantial reduction in processing efficiency.

[0003] The core challenge of traditional deep learning methods lies in their heavy reliance on large amounts of high-quality, manually labeled training data, which is costly and time-consuming. This dependence severely restricts the model's transferability to specific domains, often requiring retraining for new domains. Furthermore, when knowledge graphs need to expand to include new entity or relation types, the model structure typically needs to be modified and the entire training process re-executed, severely limiting the system's flexibility and scalability.

[0004] On the other hand, although Large Language Models (LLMs) demonstrate powerful semantic understanding capabilities, their application in knowledge graph construction is relatively limited and faces its own bottlenecks. The inherent limitation of LLM's context window length is particularly pronounced when processing long industrial documents; existing methods lack robust processing mechanisms and are prone to processing failures or the loss of key information due to exceeding the length limit. In the relation judgment stage, existing LLM-based methods typically treat it as a "black box" classification process for predefined relation types. When the model makes an incorrect judgment, users find it difficult to trace and understand the basis of its decision. The model is also prone to "illusioning" unclear or ambiguous relationships in the text, making it difficult to guarantee the accuracy of the output, and lacking effective verification methods and interpretable evidence chains to support relation judgments.

[0005] Finally, existing knowledge extraction systems often focus solely on the extraction task itself, resulting in a significant gap between the structured output and the final knowledge graph application. The persistent storage and application of knowledge are typically fragmented, requiring additional manual intervention or the writing of separate scripts for data transformation and import, failing to achieve end-to-end automated processes from raw text to the stored knowledge graph. Therefore, developing an industrial knowledge graph generation system that overcomes these challenges, particularly one based on LLM agents, possessing adaptive capabilities, and achieving end-to-end automated construction, is both necessary and urgent. Summary of the Invention

[0006] To address the above issues, this invention employs an innovative two-stage relation extraction method, which significantly improves knowledge extraction efficiency and effectively solves the problems of computational redundancy and high costs caused by the explosive growth in the number of entity pairs.

[0007] According to embodiments of the present invention, a method, apparatus, and device for adaptive relation extraction using a filtering dynamic classification method are provided.

[0008] In a first aspect of the invention, an adaptive relation extraction method based on filtering dynamic classification is provided. The method includes: Step S01: Define the entity type list. The user inputs text according to the prompt word template of the annotation format, judges the length of the text, and selects the corresponding strategy to generate candidate entity pairs based on the text length. Step S02: Calculate the association strength of each candidate entity pair using a hybrid scoring model that combines static corpus statistics and dynamic semantics, and filter out candidate entity pairs with low association. Step S03: Construct a dynamic prompting LLM to generate a natural language summary describing the subject entity and object entity, classify the summary into a predefined relation type, and obtain structured triples; Step S04: Import the triples into the graph database to construct a knowledge graph.

[0009] Furthermore, the annotation format described in step S01 is ((entity|type)).

[0010] Furthermore, the specific steps for generating candidate entity pairs by selecting the corresponding strategy based on the text length in step S01 are as follows: If the length of the input text is less than the first set of tokens, it is determined to be an ideal path, and a single inference call is executed. Based on the input text, labeled text containing all entities and their types is generated. Regular expressions are used to parse the labeled text to obtain a structured list of entities and their types. For the N identified entities, the system generates all N... (N-1) candidate entity pairs; If the length of the input text is greater than the first set tokens, the text is recursively split using the specified delimiter, text block size and overlap to obtain multiple text blocks with overlapping areas. A single reasoning call is executed independently for each text block to generate candidate entity pairs. If the number of entity types in the input text exceeds the second set of tokens, the entity type list is deemed too long. It is then automatically split into multiple batches, a unified hint is built for each batch, and the same text is called multiple times. Finally, the results of all batches are merged. Based on the input text, a labeled text containing all entities and their types is generated. Regular expressions are used to parse the labeled text to obtain a structured entity list and entity types. For the N identified entities, the system generates all N... (N-1) candidate entity pairs.

[0011] Furthermore, the specific steps of step S02 are as follows: Step S021: Using a dataset with pre-labeled entity types, iterate through the entity type corpus, calculate the PMI scores of all candidate entity pairs, and store them in a dictionary. The keys of the dictionary are type pairs, and the values ​​are PMI scores. Step S022: Using a bge vector model, obtain the vector representation of each entity in combination with the context, calculate the cosine similarity of the vectors to obtain the cosine similarity score of all candidate entity pairs, and store it in a dictionary, where the key of the dictionary is the candidate entity pair and the value is the cosine similarity score. Step S023: For each candidate entity pair, calculate its association strength score by weighted fusion of the PMI score and cosine similarity score, and set a threshold. When the association strength score of the candidate entity pair is greater than this threshold, the candidate entity pair is retained.

[0012] Furthermore, the formula for calculating the PMI score is as follows: ; Let A be the probability that entity type A appears in all sentences. Let B be the probability of entity type B appearing in all sentences. This represents the probability that entity types A and B both appear in the same sentence.

[0013] Furthermore, the formula for calculating the correlation strength score is as follows: , in, The PMI score, The cosine similarity score is... , These are the weighting coefficients.

[0014] In a second aspect of the invention, an apparatus for adaptive relation extraction using a filtering dynamic classification method is provided. The apparatus includes: Entity Pair Generation Module: This module defines a list of entity types. Users input text based on a prompt template with a labeled format. The module then determines the length of the text and selects the appropriate strategy to generate candidate entity pairs based on the text length. Entity pair filtering module: Used to calculate the relevance strength of each candidate entity pair using a hybrid scoring model that combines static corpus statistics and dynamic semantics, and to filter out candidate entity pairs with low relevance. Entity Pair Parsing Module: Used to construct a dynamic prompt request LLM to generate a natural language summary describing the subject entity and object entity, classify the summary into a predefined relation type, and obtain structured triples; Knowledge Graph Construction Module: Used to import triples into a graph database to build a knowledge graph.

[0015] In a third aspect of the invention, an electronic device is provided. The electronic device includes a memory and a processor, the memory storing a computer program, the processor executing the program to implement the method according to a first aspect of the invention.

[0016] In a fourth aspect of the invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method according to a first aspect of the invention.

[0017] This invention significantly improves knowledge extraction efficiency through an innovative two-stage relation extraction method, and effectively solves the problems of computational redundancy and high cost caused by the explosive growth in the number of entity pairs.

[0018] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of the present invention, nor is it intended to restrict the scope of the invention. Other features of the invention will become readily apparent from the following description.

[0019] The beneficial effects of this invention are: 1. This invention has the ability to process multiple file types and realizes a complete end-to-end process from automatic knowledge extraction from raw text to automatic import of structured knowledge into the knowledge graph. It significantly eliminates the gap between manual intervention and data conversion between knowledge extraction results and application storage in traditional methods, and greatly improves the efficiency and automation level of the entire knowledge graph construction process. 2. Before executing any LLM call operation, the required token length is calculated in advance. Once a risk of exceeding the LLM context window limit is detected, the system can make an autonomous decision and seamlessly switch to the optimal degradation processing strategy. This mechanism effectively overcomes the problems of information truncation, processing failure or loss of key knowledge that are common in existing technologies when dealing with long texts. It ensures stable and reliable processing capability for texts of any length, and the system significantly enhances the robustness and scalability of long text processing. 3. By adopting an innovative two-stage relation extraction method, the efficiency of knowledge extraction is greatly improved, and the problems of computational redundancy and high cost caused by the explosive growth in the number of entity pairs are effectively solved. In the first stage, a lightweight hybrid scoring model is introduced, which integrates static corpus statistical information and dynamic semantic similarity calculation. It can quickly pre-screen all candidate entity pairs based on "association strength". This efficient pre-screening step can filter out more than 90% of redundant candidate pairs that are extremely unlikely to have a relationship, greatly reducing the scale of data that needs to be analyzed and processed in depth later, thereby significantly improving the overall relation extraction efficiency and reducing computational costs. 4. A unique relation summarization and classification method was adopted in the second stage of relation extraction. This method requires the model to generate a summary explanation describing the basis for the relation judgment while judging the relationship between entities. This design not only effectively suppresses the illusion phenomenon that the model is prone to when dealing with fuzzy or implicit relations, and significantly improves the accuracy and credibility of the output results, but more importantly, the generated summary provides a clear and traceable basis for decision-making, making the relation judgment process transparent and verifiable, and greatly enhancing the interpretability of the results. Attached Figure Description

[0020] The above and other features, advantages, and aspects of the various embodiments of the present invention will become more apparent from the accompanying drawings and the following detailed description. Wherein: Figure 1 A flowchart illustrating an adaptive relation extraction method for filtering dynamic classification according to an embodiment of the present invention is shown. Figure 2 A schematic diagram of a prompt word template according to an embodiment of the present invention is shown; Figure 3 A schematic diagram of a dynamic prompt according to an embodiment of the present invention is shown; Figure 4 A schematic diagram of the final generated entity pairs in JSON format according to an embodiment of the present invention is shown; Figure 5 A block diagram of an apparatus for adaptive relation extraction using a filtering dynamic classification method according to an embodiment of the present invention is shown. Figure 6A schematic diagram of an adaptive relation extraction device for filtering dynamic classification according to an embodiment of the present invention is shown. Detailed Implementation

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

[0022] According to embodiments of the present invention, a method, apparatus and device for adaptive relation extraction based on screening dynamic classification are proposed. Through an innovative two-stage relation extraction method, the knowledge extraction efficiency is greatly improved, and the problems of computational redundancy and high cost caused by the explosive growth in the number of entity pairs are effectively solved.

[0023] The principles and spirit of the present invention will be explained in detail below with reference to several representative embodiments.

[0024] Figure 1 This is a schematic flowchart of an adaptive relation extraction method for filtering dynamic classification according to an embodiment of the present invention. The method includes: Step S01: Define the entity type list. The user inputs text according to the prompt word template of the annotation format, judges the length of the text, and selects the corresponding strategy to generate candidate entity pairs based on the text length. Step S02: Calculate the association strength of each candidate entity pair using a hybrid scoring model that combines static corpus statistics and dynamic semantics, and filter out candidate entity pairs with low association. Step S03: Construct a dynamic prompting LLM to generate a natural language summary describing the subject entity and object entity, classify the summary into a predefined relation type, and obtain structured triples; Step S04: Import the triples into the graph database to construct a knowledge graph.

[0025] It should be noted that although the operation of the method of the present invention has been described in a specific order in the above embodiments and figures, this does not require or imply that the operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0026] To provide a clearer explanation of the adaptive relation extraction method for the above-mentioned dynamic classification, a specific embodiment will be used for illustration below. However, it is worth noting that this embodiment is only for better illustrating the present invention and does not constitute an improper limitation of the present invention.

[0027] The following example from the field of control valves will further illustrate the adaptive relation extraction method of screening-based dynamic classification in more detail: Step S01: Define the entity type list. The user inputs text according to the prompt word template of the annotation format, judges the length of the text, and selects the corresponding strategy to generate candidate entity pairs based on the text length.

[0028] In this implementation, the entity type list is shown in Table 1: Table 1

[0029] The annotation format is ((entity|type)), which means that the entity of the input text comes before its type description.

[0030] In this embodiment, a single, standardized prompt word template is provided, such as Figure 2 As shown. This hint includes the definitions of all N entity types at once in the task description section and instructs the large language model to adopt a type-aware annotation format ((entity|type)).

[0031] The system determines the length of the input text. If the length is less than 20K tokens, it is considered an ideal path, and a single inference call is executed. Based on the input text, it generates labeled text containing all entities and their types ((Hastelloy | Material Type)). Regular expressions are used to parse the labeled text to obtain a structured list of entities and their types. For the N identified entities, the system generates all N... (N-1) candidate entity pairs ({'text':'locator', '':component''}, {'text':'smart valve positioner', 'type':'component'}).

[0032] If the length of the input text is greater than 20K tokens, the text is recursively split using a specified delimiter, text block size, and overlap to obtain multiple text blocks with overlapping regions. A single inference call is executed independently for each text block to generate candidate entity pairs.

[0033] If the number of entity types in the input text exceeds 4K tokens, the entity type list is deemed too long. It is automatically split into multiple batches, and a temporary, smaller, unified hint is created for each batch. This is repeated multiple times for the same text. Finally, the results of all batches are merged. Based on the input text, a labeled text containing all entities and their types is generated. Regular expressions are used to parse the labeled text to obtain a structured entity list and entity types. For the N identified entities, the system generates all N... (N-1) candidate entity pairs ({'text':'locator', '':component''}, {'text':'smart valve positioner', 'type':'component'}).

[0034] Step S02: Calculate the association strength of each candidate entity pair using a hybrid scoring model that combines static corpus statistics and dynamic semantics, and filter out candidate entity pairs with low association.

[0035] The specific steps are as follows: Step S021: Using a large-scale, domain-relevant dataset with pre-labeled entity types, iterate through the entity type corpus and calculate the following three values: the probability of entity type A appearing in all sentences. The probability of entity type B appearing in all sentences The probability that entity types A and B co-occur in the same sentence. Calculate the PMI scores for all candidate entity pairs and store them in a dictionary. The keys of this dictionary are type pairs, and the values ​​are the PMI scores. The formula for calculating the PMI scores is as follows: .

[0036] Step S022: Use an efficient bge vector model to obtain the vector representation of each entity in combination with the context. Calculate the cosine similarity of the vectors to obtain the cosine similarity score of all candidate entity pairs and store them in a dictionary. The key of the dictionary is the candidate entity pair and the value is the cosine similarity score.

[0037] Step S023: For each candidate entity pair, calculate its association strength score and set a threshold. When the association strength score of a candidate entity pair is greater than this threshold, retain the candidate entity pair. The calculation formula is: , in, The PMI score, The cosine similarity score is... , These are the weighting coefficients.

[0038] In this embodiment, , The threshold is 0.8, and the calculation results are shown in Table 2: Table 2

[0039] The high-potential JSON structures obtained after screening are: { "subject": { "text": "main control valve", "type": "equipment"}, "object": { "text": "executor", "type": "component"}, "strength": 0.92} Step S03: Construct a dynamic prompting LLM to generate a natural language summary describing the subject entity and the volume entity, classify the summary into a predefined relation type, and obtain structured triples.

[0040] By selecting high-potential candidate entity pairs, the system constructs a dynamic suggestion, such as... Figure 3 As shown, the LLM is required to first generate a natural language summary describing the subject and object entities. This is essentially an implicit thought chain prompting technique that improves the quality of the final result by guiding the model to perform more complex reasoning, suppressing model illusions. Then, the summary is categorized into predefined relation types to obtain structured triples, such as... Figure 4 As shown, this is the final JSON format data for generating entity pairs.

[0041] Step S04: Import the triples into the graph database to construct a knowledge graph.

[0042] The system imports the knowledge from the finally extracted and verified triples into graph databases such as Neo4j. For each triple, the system executes a carefully constructed Cypher query using the MERGE command. When multiple relations point to the same entity, they are automatically connected to that single node, thus ensuring the connectivity and accuracy of the graph and building a clean and connected knowledge graph.

[0043] Based on the same inventive concept, this invention also proposes an adaptive relation extraction device for screening-based dynamic classification. The implementation of this device is similar to the implementation of the method described above, and repeated details will not be elaborated further. Figure 5 As shown, the device 100 includes: Entity pair generation module 101: used to define a list of entity types. The user inputs text according to the prompt word template of the annotation format, judges the length of the text, and selects the corresponding strategy to generate candidate entity pairs based on the text length. Entity pair filtering module 102: Used to calculate the association strength of each candidate entity pair using a hybrid scoring model that combines static corpus statistics and dynamic semantics, and to filter candidate entity pairs with low association. Entity pair parsing module 103: used to construct a dynamic prompt request LLM to generate a natural language summary describing the subject entity and object entity, classify the summary into a predefined relation type, and obtain structured triples; Knowledge Graph Construction Module 104: Used to import triples into a graph database to construct a knowledge graph.

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

[0045] like Figure 6 As shown, the device includes a central processing unit (CPU), which can perform various appropriate actions and processes based on computer program instructions stored in read-only memory (ROM) or loaded from storage units into random access memory (RAM). The RAM can also store various programs and data required for device operation. The CPU, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.

[0046] Multiple components in the device are connected to the I / O interface, including: input units such as keyboards and mice; output units such as various types of displays and speakers; storage units such as disks and optical discs; and communication units such as network interface cards (NICs), modems, and wireless transceivers. The communication unit allows the device to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0047] The processing unit executes the various methods and processes described above, such as method steps S01 to S04. For example, in some embodiments, method steps S01 to S04 may be implemented as a computer software program tangibly contained in a machine-readable medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on the device via ROM and / or a communication unit. When the computer program is loaded into RAM and executed by the CPU, one or more steps of method steps S01 to S04 described above may be performed. Alternatively, in other embodiments, the CPU may be configured to execute method steps S01 to S04 by any other suitable means (e.g., by means of firmware).

[0048] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload programmable logic devices (CPLDs), and so on.

[0049] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0050] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0051] Furthermore, although the operations are described in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the invention. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.

[0052] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for adaptive relation extraction based on filtering dynamic classification, characterized in that, The method includes: Step S01: Define the entity type list. The user inputs text according to the prompt word template of the annotation format, judges the length of the text, and selects the corresponding strategy to generate candidate entity pairs based on the text length. Step S02: Calculate the association strength of each candidate entity pair using a hybrid scoring model that combines static corpus statistics and dynamic semantics, and filter out candidate entity pairs with low association. Step S03: Construct a dynamic prompting LLM to generate a natural language summary describing the subject entity and object entity, classify the summary into a predefined relation type, and obtain structured triples; Step S04: Import the triples into the graph database to construct a knowledge graph.

2. The adaptive relation extraction method for screening-based dynamic classification according to claim 1, characterized in that, The annotation format described in step S01 is ((entity|type)).

3. The adaptive relation extraction method for screening-based dynamic classification according to claim 1, characterized in that, The specific steps for generating candidate entity pairs by selecting the corresponding strategy based on the text length in step S01 are as follows: If the length of the input text is less than the first set of tokens, it is determined to be an ideal path, and a single inference call is executed. Based on the input text, labeled text containing all entities and their types is generated. Regular expressions are used to parse the labeled text to obtain a structured list of entities and their types. For the N identified entities, the system generates all N... (N-1) candidate entity pairs; If the length of the input text is greater than the first set tokens, the text is recursively split using the specified delimiter, text block size and overlap to obtain multiple text blocks with overlapping areas. A single reasoning call is executed independently for each text block to generate candidate entity pairs. If the number of entity types in the input text exceeds the second set of tokens, the entity type list is deemed too long. It is then automatically split into multiple batches, a unified hint is built for each batch, and the same text is called multiple times. Finally, the results of all batches are merged. Based on the input text, a labeled text containing all entities and their types is generated. Regular expressions are used to parse the labeled text to obtain a structured entity list and entity types. For the N identified entities, the system generates all N... (N-1) candidate entity pairs.

4. The adaptive relation extraction method for dynamic classification based on filtering according to claim 1, characterized in that, The specific steps of step S02 are as follows: Step S021: Using a dataset with pre-labeled entity types, iterate through the entity type corpus, calculate the PMI scores of all candidate entity pairs, and store them in a dictionary. The keys of the dictionary are type pairs, and the values ​​are PMI scores. Step S022: Using a bge vector model, obtain the vector representation of each entity in combination with the context, calculate the cosine similarity of the vectors to obtain the cosine similarity score of all candidate entity pairs, and store it in a dictionary, where the key of the dictionary is the candidate entity pair and the value is the cosine similarity score. Step S023: For each candidate entity pair, calculate its association strength score by weighted fusion of the PMI score and cosine similarity score, and set a threshold. When the association strength score of the candidate entity pair is greater than this threshold, the candidate entity pair is retained.

5. The adaptive relation extraction method for screening-based dynamic classification according to claim 4, characterized in that, The formula for calculating the PMI score is as follows: ; Let A be the probability that entity type A appears in all sentences. Let B be the probability of entity type B appearing in all sentences. This represents the probability that entity types A and B both appear in the same sentence.

6. The adaptive relation extraction method for screening-based dynamic classification according to claim 4, characterized in that, The formula for calculating the correlation strength score is as follows: , in, The PMI score. The cosine similarity score is... , These are the weighting coefficients.

7. An apparatus for adaptive relation extraction using a screening-based dynamic classification method, characterized in that, The device implements the method as described in any one of claims 1 to 6, comprising: Entity Pair Generation Module: This module defines a list of entity types. Users input text based on a prompt template with a labeled format. The module then determines the length of the text and selects the appropriate strategy to generate candidate entity pairs based on the text length. Entity pair filtering module: Used to calculate the relevance strength of each candidate entity pair using a hybrid scoring model that combines static corpus statistics and dynamic semantics, and to filter out candidate entity pairs with low relevance. Entity Pair Parsing Module: Used to construct a dynamic prompt request LLM to generate a natural language summary describing the subject entity and object entity, classify the summary into a predefined relation type, and obtain structured triples; Knowledge Graph Construction Module: Used to import triples into a graph database to build a knowledge graph.

8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 6.

Citation Information

Cited By

  • A few-shot relation extraction method and system based on abstract guided prompt fine-tuning

    CN122198091A