A parallel entity grouping relationship extraction method and system for a knowledge graph

CN123012186APending Publication Date: 2026-10-30SUZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611513154.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-28
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0005]为此,本发明所要解决的技术问题在于克服现有技术中的实体关系抽取方法存在难以准确判断多个并列实体应当共同形成一条事实、分别形成多条事实、还是按部分成员组合形成事实,导致抽取的实体关系与原文含义不一致,进而造成知识图谱结构化抽取精度低、语义保真度差的问题

Benefits of technology

首先通过共享预训练编码器获取词元向量和文档向量,利用跨度边界预测头完成全局跨度标注并输出各个候选跨度的跨度类型以及候选跨度向量,再利用关系分类预测头进行关系类型预测,完整捕获候选跨度内实体、触发关系以及各类槽位的基础语义信息,进一步针对候选跨度中实体词元向量的不同组合生成多个合法实体分组方案,并为各个合法实体分组方案生成多个候选事实向量,覆盖并列实体共同构成一条事实、分别构成多条事实、部分成员组合构成事实以及空事实的全部可能性,避免了单一固定分组模式带来的分组遗漏;通过对候选事实向量进行变化调整生成正候选事实向量和负候选事实向量,利用分组评分模块对各个合法实体分组方案及其正候选事实向量和负候选事实向量进行评分以构建实体分组关系抽取损失函数,使得模型能够学习到不同实体分组方案与文本真实语义之间的映射关系,自动区分适配文本语义的实体分组形式,从而降低实体分组判断错误带来的事实抽取偏差,避免抽取到的实体关系与原文语义不一致,从而提升知识图谱结构化抽取的精度和语义保真度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012186A_ABST
    Figure CN123012186A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of natural language processing, and relates to a parallel entity grouping relationship extraction method and system for a knowledge graph. A shared pre-training encoder is used to encode a word sequence to obtain a word vector and a document vector; a span boundary prediction head is used to perform global span labeling on the word vector, and output a candidate span type and a candidate span vector; a relationship classification prediction head is used to output a candidate relationship type and a relationship type representation; based on different combinations of entity word vectors in the candidate span, multiple legal entity grouping schemes are obtained, multiple candidate fact vectors are generated, and positive and negative candidate fact vectors are adjusted; a grouping scoring module is used to score the legal entity grouping scheme, the positive and negative candidate fact vectors, and construct an entity grouping relationship extraction loss function, and the shared pre-training encoder, the span boundary prediction head, the relationship classification prediction head, and the grouping scoring module are iteratively trained to obtain an entity grouping relationship extraction model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a method and system for extracting parallel entity grouping relationships for knowledge graphs. Background Technology

[0002] Entity relation extraction is a key technology for converting unstructured text information into structured semantic representations. It is widely used in the knowledge graph construction process. Knowledge graphs identify entities and relation triggering information from text, organize related entities into binary and triplet pairs, multi-factor facts, or event instances with attribute slots, and further store them in graph structures such as attribute graphs, resource description framework graphs, and event graphs. This provides structured semantic generation for downstream tasks such as retrieval reasoning, semantic parsing, and intelligent analysis. However, in technical texts such as software configurations, equipment parameters, experimental conditions, and biomedical abstracts, sentences commonly contain parallel entities connected by "and," "or," "as well as," "together," "separately," "each," commas, or semicolons. These parallel entities have complex semantics; multiple entities may participate in the same fact, or each entity may independently constitute multiple facts. Some complex sentences may also show local entities grouped together, forming multiple member blocks. If entity relation extraction fails to identify and distinguish the aforementioned parallel semantics, the output fact boundary will deviate from the semantics of the original text, directly causing distortion of the knowledge graph content. Therefore, the accuracy of entity relation extraction is of great significance to the quality of the knowledge graph and the operation of downstream tasks such as retrieval and semantic analysis.

[0003] The mainstream entity relation extraction techniques in the current technology can be divided into four categories: 1. Joint relation extraction method based on entity pairs. This method usually uses a bidirectional encoder representation model based on transformers (BERT) or a transformer encoder to obtain the text representation. After identifying the subject and object span, the "subject-relation-object" is classified or jointly decoded. It can effectively adapt to the extraction scenario of multiple sets of binary relations within a single sentence. However, the core prediction unit of this type of method is the independent entity pair. In essence, it scores and judges different entity pairs independently, ignoring the overall association semantics of parallel entities. For example, for "module A and module B use configuration C together", the entity pair model is prone to generating two independent facts "A uses C" and "B uses C", which is inconsistent with the semantics of A and B as a whole participating together in the original text. This is prone to the problem of incorrect entity splitting. 2. The relation extraction method based on set prediction utilizes the Set Prediction Network Relation Extraction Model (SPN4RE) to treat multiple relation triples in a sentence as an unordered set. It uses non-autoregressive parallel decoding and bipartite graph matching loss to reduce the impact of generation order on triple set prediction. The Bidirectional Set Prediction Network Model (BiSPN) further generates entity sets and relation sets in parallel and uses entity-relation consistency loss to constrain the matching relationship of the two types of outputs. It effectively solves the problems of triple order dependency, repeated prediction, and missed prediction in traditional sequence generation methods. However, its optimization core only focuses on the unordered arrangement and error correction of multiple triples and does not design constraints for the grouping rules of parallel entities. It cannot identify the grouping logic of parallel entities, and cannot achieve the overall grouping extraction of parallel members, nor can it accurately handle the complex scenario of local grouping of entities. 3. Based on the method of parallel structure recognition and sentence splitting before extraction, the parallel structure recognition is divided into two stages: coordinator word recognition and parallel component boundary detection using the parallel structure model (CoRec). It can identify continuous coordinators, paired coordinators, and structures containing "separately" without relying on a complete syntactic analyzer, and output the boundaries of each parallel component. Alternatively, the parallel sentences can be simplified or rewritten into multiple simple sentences, and then ordinary relation extraction can be performed on each simple sentence. This method can effectively solve the problem of ambiguous boundaries of parallel entities. However, it can only identify the division boundaries of parallel entities and cannot determine the legal grouping rules of different entities in the target relation. It cannot distinguish whether the entities participate together, participate independently, or participate in factual relations in a local group. Furthermore, the sentence splitting process may lose words such as "together", "separately", "each", and clause boundaries, which play a decisive role in grouping, thus resulting in incorrect expansion or incorrect merging.4. Multivariate relation extraction and structured argument extraction methods utilize a text-to-multivariate knowledge graph model (Text2NKG) and employ processing methods such as span unary classification, out-of-order merging, and output merging to support the extraction of multivariate structured facts such as superrelations, events, roles, and hypergraphs. The code generation model oriented towards structure prediction (Code4Struct) represents the event argument structure as code objects with type and role constraints, and then uses a language model to complete the generation of text-to-structure objects. These methods can represent and extract complex facts with multiple slots and variable atoms. However, "being able to output multivariate facts" is not the same as "being able to perform symmetrical comparisons of all legal groups of the same parallel membership set". If the model only classifies the given multivariate tuples or only generates a structure sequence, it cannot effectively constrain and correct errors in splitting and merging in parallel scenarios, and still cannot adapt to the needs of accurate entity relation extraction under complex parallel semantics.

[0004] In summary, existing entity relation extraction methods have difficulty in accurately determining whether multiple parallel entities should jointly form a fact, form multiple facts separately, or form a fact by combining some members. This leads to inconsistencies between the extracted entity relations and the original meaning, resulting in low accuracy and poor semantic fidelity in structured extraction of knowledge graphs. Summary of the Invention

[0005] Therefore, the technical problem to be solved by the present invention is to overcome the problem that the existing entity relationship extraction methods have difficulty in accurately determining whether multiple parallel entities should form a fact together, form multiple facts separately, or form a fact by combining some members, which leads to the inconsistency between the extracted entity relationships and the original meaning, and thus causes the knowledge graph structure extraction to have low accuracy and poor semantic fidelity.

[0006] To address the aforementioned technical problems, this invention provides a method for extracting parallel entity grouping relationships for knowledge graphs, comprising: The document samples in the training set are segmented into word sequences. The word sequences are then encoded using a shared pre-trained encoder to obtain word vectors for each word and document vectors for the document samples. The span boundary prediction head is used to perform global span annotation on each word vector, and the span type and candidate span vector of each candidate span are output. The relation classification prediction head is used to predict relation types based on the span type, candidate span vector, and document vector of each candidate span, and outputs the candidate relation types and their relation type representations. Multiple legal entity grouping schemes are obtained based on different combinations of entity word vectors in the candidate span. Multiple candidate fact vectors are generated for each legal entity grouping scheme based on the span type, candidate span vector, candidate relation type and relation type of each candidate span. The multiple candidate fact vectors of each legal entity grouping scheme are adjusted to obtain the positive candidate fact vector and negative candidate fact vector of each legal entity grouping scheme; The grouping scoring module scores each legitimate entity grouping scheme and its positive and negative candidate fact vectors, thereby constructing an entity grouping relationship extraction loss function. This loss function is then used to iteratively train the shared pre-trained encoder, span boundary prediction head, relationship classification prediction head, and grouping scoring module until the value of the entity grouping relationship extraction loss function converges, resulting in a trained entity grouping relationship extraction model. This model is then used to extract entity grouping relationships from the document to be processed.

[0007] Preferably, a span boundary prediction head is used to perform global span annotation on each word vector, outputting the span type and candidate span vector for each candidate span, including: The prediction probability of each word vector located at the beginning, end, and inside the candidate span is calculated using the span boundary prediction head. Candidate spans are constructed based on word vectors that meet the preset probability conditions, and the candidate span score is calculated. Candidate spans that meet the preset span width constraint are retained. The role classification module is used to classify each candidate span into roles, resulting in entity span, relationship trigger word span, coordination expression span, and slot candidate span corresponding to the candidate relationship type. The starting lexical vector, ending lexical vector, internal lexical vector of the span, and span width embedding of each candidate span are concatenated to obtain the candidate span vector of each candidate span.

[0008] Preferably, the relation classification prediction head is used to predict the relation type based on the span type of each candidate span, the candidate span vector, and the document vector, and outputs the candidate relation type and its relation type representation, including: The candidate span vector, document vector, and slot candidate of the relation trigger word span are aggregated and represented as input to the relation classification prediction head, and the classification values ​​corresponding to the target relation category and the non-target relation category are output. Candidate relation types and their representations are obtained based on the classification values ​​corresponding to the target relation category and the non-target relation category.

[0009] Preferably, multiple legitimate entity grouping schemes are obtained based on different combinations of entity lexical vectors in the candidate spans. Multiple candidate fact vectors are generated for each legitimate entity grouping scheme based on the span type, candidate span vector, candidate relation type, and relation type representation of each candidate span, including: When the number of entity word vectors in the candidate span is less than or equal to the preset number, all combinations of entity word vectors are enumerated to obtain multiple non-empty legal entity grouping schemes; based on the non-empty legal entity grouping schemes and the empty fact that none of the entity word vectors form a fact, multiple legal entity grouping schemes are obtained. When the number of entity word vectors in the candidate span is greater than the preset number, multiple legal entity grouping schemes are obtained based on partial combinations of entity word vectors and empty facts where none of the entity word vectors form facts. By performing permutation-invariant aggregation on each member block in the legal entity grouping scheme, we obtain the representation of each member block of the legal entity grouping scheme; Each member block representation of the legitimate entity grouping scheme is combined with the candidate span vector of the relation trigger word span, the relation type representation of the candidate relation type and its corresponding slot candidate span vector, and the document vector to obtain multiple candidate fact vectors of the legitimate entity grouping scheme.

[0010] Preferably, when the number of entity word vectors in the candidate span is greater than a preset number, multiple legal entity grouping schemes are obtained based on partial combinations of entity word vectors and the empty fact that none of the entity word vectors form a fact, including: S11: Initialize the initial legal entity grouping scheme, which is formed by each entity word vector into a member block; S12: Select two member blocks from the initial legal entity grouping scheme and merge them to obtain a new member block. Based on the new member block and the remaining unmerged member blocks, obtain a candidate legal entity grouping scheme. Based on the different selection results of the two member blocks, obtain multiple candidate legal entity grouping schemes. Perform legality checks on each candidate legal entity grouping scheme and calculate the local screening score to retain a preset number of candidate legal entity grouping schemes. S13: Use each candidate legal entity grouping scheme as a new initial legal entity grouping scheme, and return to step S12 until the obtained candidate legal entity grouping scheme contains all entity word vectors; S14: Based on all initial legal entity grouping schemes, candidate legal entity grouping schemes containing all entity lexical vectors, and empty facts where none of the entity lexical vectors form facts, multiple legal entity grouping schemes are obtained.

[0011] Preferably, the multiple candidate fact vectors of each legal entity grouping scheme are adjusted to obtain the positive candidate fact vector and negative candidate fact vector of each legal entity grouping scheme, including: The complete candidate facts from multiple candidate fact vectors of the legitimate entity grouping scheme are taken as the positive candidate fact vector; Replace the relation type representation of the candidate relation type in the positive candidate fact vector, and / or replace the candidate span vector of the slot candidate span corresponding to the candidate relation type in the positive candidate fact vector, and / or delete the candidate span vector of the slot candidate span corresponding to the candidate relation type in the positive candidate fact vector, and obtain a negative candidate fact vector of the legal entity grouping scheme based on the candidate fact vector after each replacement and deletion.

[0012] Preferably, the grouping scoring module is used to score each legitimate entity grouping scheme and its positive and negative candidate fact vectors, including: The complete fact score of each candidate fact vector for each legitimate entity grouping scheme is calculated using a multilayer perceptron; By using the parallel structure scoring head, the collective probability of each legal entity grouping scheme being formed by all entity word vectors as a member block, the allocation probability of each entity word vector forming a fact as a member block, the mixed probability of some entity word vectors forming a fact as a member block, and the probability of no fact being formed by all entity word vectors are obtained. For each member block in each legitimate entity grouping scheme, a complete candidate fact vector is constructed and its fact score is calculated. Based on the average fact score of the complete candidate fact vectors corresponding to each member block, the average fact score of the legitimate entity grouping scheme is obtained. The calculation process of the fact score of the constructed complete candidate fact vectors includes: Calculate the complete fact score of the complete candidate fact vector using a multilayer perceptron; Based on each word vector and its slot label in the complete candidate fact vector, calculate the text information omission penalty of the complete candidate fact vector; The target text information omission penalty for the complete candidate fact vector is obtained by multiplying the text information omission penalty of the complete candidate fact vector with the information omission penalty weight. The fact score of the complete candidate fact vector is obtained by the difference between the complete fact score of the complete candidate fact vector and the penalty for missing target information in the text. When the legal entity grouping scheme is a non-empty legal entity grouping scheme, the unified grouping score of the legal entity grouping scheme is obtained by weighted summation based on the logarithm of the parallel structure probability, the fact average score, and the learnable calibration value corresponding to the number of member blocks. When the legitimate entity grouping scheme is empty facts, the unified grouping score of the legitimate entity grouping scheme is obtained by taking the logarithm of the probability that all entity word vectors output by the parallel structure scoring head do not form empty facts, the learnable empty fact context score, and the empty fact bias.

[0013] Preferably, the loss function for constructing entity grouping relationship extraction includes: Construct candidate span identification loss and span type classification loss based on the output of the span boundary prediction head; Construct a relation type classification loss based on the output of the relation classification prediction head; Construct a parallel structure classification loss based on the output of the parallel structure scoring head; Based on the complete fact scores of positive and negative candidate fact vectors, a complete fact score loss for legitimate entity grouping schemes is constructed. Based on each word vector and its slot label in each candidate fact vector, a slot attribution loss is constructed. The error grouping score is obtained by aggregating the unified grouping scores of the incorrect legal entity grouping schemes using the log-sum-exponential function. The difference between the preset margin margin and the unified grouping score of the correct legal entity grouping scheme is calculated. The sum of the difference and the error grouping score is input into the smoothing positive value function to construct the grouping ranking loss. The entity grouping relationship extraction loss function is obtained by weighted summing of the candidate span recognition loss, span type classification loss, relationship type classification loss, parallel structure classification loss, complete fact scoring loss, slot assignment loss and grouping ranking loss.

[0014] Preferably, the trained entity grouping relationship extraction model is used to extract entity grouping relationships from the document to be processed, including: The document to be processed is segmented into words to obtain a sequence of words to be processed. The sequence of words to be processed is then input into the shared pre-trained encoder in the trained entity grouping relation extraction model, and the output is the vector of words to be processed and the vector of the document to be processed. The span boundary prediction head in the trained entity grouping relationship extraction model is used to perform global span annotation on each word vector to be processed, and the span type and candidate span vector of each candidate span in the document to be processed are output. Using the relation classification prediction head in the trained entity grouping relation extraction model, relation type prediction is performed based on the output of the span boundary prediction head and the document vector to be processed, and the candidate relation types and their relation type representations of the document to be processed are output. Multiple legal entity grouping schemes are obtained based on different combinations of entity word vectors in the candidate span of the document to be processed; The grouping scoring module in the trained entity grouping relationship extraction model scores each legitimate entity grouping scheme based on the output of the span boundary prediction head and the relationship classification prediction head. The entity grouping relationship of the document to be processed is obtained based on the legitimate entity grouping scheme with the highest unified grouping score.

[0015] This invention also provides a parallel entity grouping relation extraction system for knowledge graphs, comprising: The document encoding module is used to segment document samples in the training set to obtain word sequences, and to encode the word sequences using a shared pre-trained encoder to obtain word vectors for each word and document vectors for the document samples. The span annotation module is used to perform global span annotation on each word vector using the span boundary prediction head, and outputs the span type and candidate span vector for each candidate span. The relation type prediction module is used to predict the relation type based on the span type, candidate span vector and document vector of each candidate span using the relation classification prediction head, and outputs the candidate relation type and its relation type representation; The entity grouping and candidate fact generation module is used to obtain multiple legal entity grouping schemes based on different combinations of entity lexical vectors in the candidate span. It generates multiple candidate fact vectors for each legal entity grouping scheme based on the span type, candidate span vector, candidate relation type and relation type of each candidate span. The positive and negative candidate fact generation module is used to adjust multiple candidate fact vectors of each legal entity grouping scheme to obtain the positive and negative candidate fact vectors of each legal entity grouping scheme. The model training and acquisition module is used to score each legal entity grouping scheme and its positive and negative candidate fact vectors using the group scoring module, thereby constructing an entity grouping relationship extraction loss function. This loss function is then used to iteratively train the shared pre-trained encoder, span boundary prediction head, relationship classification prediction head, and group scoring module until the value of the entity grouping relationship extraction loss function converges, resulting in a trained entity grouping relationship extraction model. This model is then used to extract entity grouping relationships from the document to be processed.

[0016] The knowledge graph-oriented method for extracting parallel entity grouping relations provided in this application has the following advantages: First, word vectors and document vectors are obtained through a shared pre-trained encoder. A span boundary prediction head is then used to complete global span annotation and output the span type and candidate span vectors for each candidate span. Next, a relation classification prediction head is used to predict relation types, fully capturing the basic semantic information of entities, triggering relationships, and various slots within the candidate spans. Furthermore, multiple legitimate entity grouping schemes are generated for different combinations of entity word vectors in the candidate spans, and multiple candidate fact vectors are generated for each legitimate entity grouping scheme. This covers all possibilities: parallel entities jointly forming a fact, each forming multiple facts, some members combining to form a fact, and empty facts, avoiding... The model addresses the omissions caused by a single fixed grouping pattern. By modifying and adjusting candidate fact vectors to generate positive and negative candidate fact vectors, and using a grouping scoring module to score each legitimate entity grouping scheme and its positive and negative candidate fact vectors, an entity grouping relationship extraction loss function is constructed. This enables the model to learn the mapping relationship between different entity grouping schemes and the true semantics of the text, automatically distinguishing entity grouping forms that fit the text semantics. This reduces fact extraction bias caused by entity grouping errors, avoids inconsistencies between extracted entity relationships and the original text semantics, and thus improves the accuracy and semantic fidelity of structured extraction from knowledge graphs. Attached Figure Description

[0017] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein: Figure 1 Flowchart of the knowledge graph-oriented method for extracting parallel entity grouping relationships provided in this application; Figure 2 A schematic diagram of the coding and grouping scoring header provided in this application; Figure 3 A diagram illustrating the competition between legitimate entity groupings and uniform structures provided for this application; Figure 4 A schematic diagram illustrating model training and isolation of two types of error candidates provided for this application; Figure 5 A schematic diagram illustrating the selection of the optimal legal entity grouping scheme and the output of knowledge graph facts for this application; Figure 6 The system architecture diagram for extracting parallel entity grouping relationships based on knowledge graphs provided in this application is shown. Detailed Implementation

[0018] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.

[0019] Please see Figure 1 , Figure 1 The flowchart shown is a method for extracting parallel entity grouping relationships for knowledge graphs provided in this application. The method includes: S10~S60.

[0020] S10: Segment the document samples in the training set to obtain word sequences, and use a shared pre-trained encoder to encode the word sequences to obtain word vectors for each word and document vectors for the document samples.

[0021] For example, such as Figure 2 As shown, for document samples Word segmentation yields a word sequence. The word sequence is input into a shared pre-trained encoder to obtain word vectors. , The document vector is obtained by weighting and summing the word vectors using the attention pooling function. .

[0022] In a specific example of this application, the cross-language robust pre-trained language module base version (XLM-R-base) is used as a shared pre-trained encoder with a hidden dimension H=768, and the output is the word vector of each word. Then, attention pooling with padding masks is used to obtain the document vectors of the document samples. Specifically, first obtain the vectors of each word. Context representation ,in, This represents a trainable weight matrix. Indicates transpose; for satisfying the attention mask Calculate the effective word vectors. Finally, the document vector is obtained. It should be noted that the filling position is not involved in attention normalization and weighted summation.

[0023] Optionally, when the document sample is long, an overlapping sliding window can be used to encode the word sequence in the document sample, and the word vectors in the overlapping area can be averaged.

[0024] S20: Use the span boundary prediction head to perform global span annotation on each word vector, and output the span type and candidate span vector of each candidate span.

[0025] In some embodiments of this application, S20 includes: S200~S202.

[0026] S200: Calculate the prediction probability of each word vector at the beginning, end, and inside positions of the candidate span using the span boundary prediction head. Construct candidate spans based on word vectors that meet the preset probability conditions, calculate the candidate span score, and retain candidate spans that meet the preset span width constraint.

[0027] In a specific example of this application, the span boundary prediction head outputs three independent classification values ​​for each word vector. ,in The term vector represents the classification value as the starting position of the candidate span. This represents the classification value where the word vector is used as the end position of the candidate span. The classification value represents the word vector located within the candidate span; the three classification values ​​are then processed by a Sigmoid function to obtain... There is no mutual exclusion relationship among the three, therefore the same word vector can satisfy and ,in, This indicates the preset probability of the starting position. This indicates the preset probability of the ending position; when the starting position i and the ending position j satisfy... and Construct candidate spans The candidate span score is When the starting position i and the ending position j satisfy At that time, the candidate span score was At this point, we can obtain entity, trigger word, or slot candidate span of length 1, where, This represents the maximum number of word vectors in the candidate span; for example, .

[0028] S201: Use the span role classification module to classify each candidate span into roles, and obtain entity span, relationship trigger word span, coordination expression span, and slot candidate span corresponding to the candidate relationship type.

[0029] For example, for candidate span First, calculate the average representation of the word vectors within the candidate span. ,structure ,in, Indicates the starting lexical position of the candidate span. Indicates the position of the ending term of the candidate span. The starting word vector representing the candidate span. The ending word vector representing the candidate span. Indicates the candidate span width The corresponding learnable span width embedding, "" indicates a vector concatenation operation, which constructs a vector concatenation operation. The projection is a span representation consistent with the hidden dimensions of the shared pre-trained encoder. ,in, The trainable span represents the projected weight matrix. The trainable span represents the projection bias vector. Let Gaussian error be the linear unit activation function; then the projected candidate span representation is the same as the document vector. The splicing result is The role classification value of the candidate span ,in, This represents mapping the hidden layer representation to a trainable classification weight matrix for each role category. This represents the trainable weight matrix of the hidden layer of the role classification module. This represents the bias vector of the hidden layer in the role classification module. This represents the bias vector of the span classification output layer.

[0030] Specifically, the span role set includes: the empty tag 'none', the entity span 'member', the relationship trigger word span 'trigger', the coordination expression span 'coordination', and the various slot categories declared in the relationship type declaration. For example, the various slot categories declared in the actual implementation data include: parameter 'parameter', resource 'resource', method 'method', value 'value', unit 'unit', frequency 'frequency', duration 'duration', intensity 'intensity', current 'current', pulse width 'pulse_width', laterality 'laterality', condition 'condition', etc. After determining the relationship type, candidate slot spans suitable for that relationship type can be filtered based on the relationship type.

[0031] S202: Concatenate the starting lexical vector, ending lexical vector, internal lexical vector of the span, and span width embedding of each candidate span to obtain the candidate span vector of each candidate span.

[0032] S30: Utilize the relation classification prediction head to predict relation types based on the span type, candidate span vector, and document vector of each candidate span, and output the candidate relation types and their relation type representations.

[0033] In some embodiments of this application, S30 includes: S300~S301.

[0034] S300: The candidate span vector of the relation trigger word span, the document vector, and the slot candidate are summarized and represented as input to the relation classification prediction head, and the classification values ​​corresponding to the target relation category and the non-target relation category are output.

[0035] For example, the input to the relation classification prediction head is ,in, A candidate span vector representing the span of relation trigger words. This represents the aggregated representation of slot candidates. The process of obtaining the aggregated representation of slot candidates includes: for candidate spans other than entity spans and relation trigger word spans. , and its candidate span vector With spanning roles After embedding and adding, we get Then perform attention pooling to obtain It should be noted that when there are no other candidate spans besides entity span and relation trigger word span, the learnable empty slot summary representation is applicable.

[0036] Since H=768, the input dimension of the relation classification prediction head is 3H=2304. A specific implementation network is 2304-768-7, which outputs a total of 7 relation categories, including 6 target relation categories and 1 non-target relation category 'none'.

[0037] It should also be noted that the process of determining the relationship category is as follows: a relationship type table is established before model training. The general technical text and the traditional Chinese medicine text are jointly trained using the same model, and the two domains share the following: a shared pre-trained encoder, a span boundary prediction head, a span role classification module, a relationship classification prediction head, a parallel structure scoring head, a complete fact scoring head, a slot attribution scoring head, a group search, and a unified decoding module.

[0038] S301: Obtain candidate relation types and their relation type representations based on the classification values ​​corresponding to the target relation category and the non-target relation category.

[0039] For example, candidate relation types The relation type is represented as ,in, This represents the learnable relation embedding matrix.

[0040] S40: Based on different combinations of entity word vectors in the candidate span, multiple legal entity grouping schemes are obtained. Based on the span type, candidate span vector, candidate relation type and relation type representation of each candidate span, multiple candidate fact vectors are generated for each legal entity grouping scheme.

[0041] It should be noted that the entity word vector in the candidate span is the candidate span vector of the entity span.

[0042] like Figure 3 The diagram shown is a schematic diagram of the competition between the legitimate entity grouping and the unified structure provided in this application. Specifically, S40 includes: S400~S403.

[0043] S400: When the number of entity word vectors in the candidate span is less than or equal to the preset number, enumerate all combinations of entity word vectors to obtain multiple non-empty legal entity grouping schemes; based on the non-empty legal entity grouping schemes and the empty fact that none of the entity word vectors form a fact, obtain multiple legal entity grouping schemes.

[0044] For example, if the entity word vectors are A, B, and C, then the following are valid entity grouping schemes: 1. A, B, and C are each a member block, each forming a different fact; 2. A, B, and C are a member block, collectively forming a fact; 3. A and B form a member block forming a fact, while C forms a separate member block forming another fact; 4. A and C form a member block forming a fact, while B forms a separate member block forming another fact; 5. B and C form a member block forming a fact, while A forms a separate member block forming another fact; 6. A, B, and C do not form any facts, i.e. It should be noted that 1 to 5 are all non-empty valid entity grouping schemes, and 6 is an empty fact.

[0045] S401: When the number of entity word vectors in the candidate span is greater than the preset number, multiple legal entity grouping schemes are obtained based on partial combinations of entity word vectors and empty facts where none of the entity word vectors form facts.

[0046] S402: Perform permutation-invariant aggregation on each member block in the legal entity grouping scheme to obtain the representation of each member block of the legal entity grouping scheme; S403: Combine each member block representation of the legal entity grouping scheme with the candidate span vector of the relation trigger word span, the relation type representation of the candidate relation type and its corresponding slot candidate span vector, and the document vector to obtain multiple candidate fact vectors of the legal entity grouping scheme.

[0047] Furthermore, S401 includes: S11~S14.

[0048] S11: Initialize the initial legal entity grouping scheme by forming member blocks from each entity word vector.

[0049] S12: Select two member blocks from the initial legal entity grouping scheme and merge them to obtain a new member block. Based on the new member block and the remaining unmerged member blocks, obtain a candidate legal entity grouping scheme. Based on the different selection results of the two member blocks, obtain multiple candidate legal entity grouping schemes. Perform legality checks on each candidate legal entity grouping scheme and calculate the local screening score, thereby retaining a preset number of candidate legal entity grouping schemes.

[0050] For example, consider the candidate relation type r, member block B, and slot candidate set. Define block-level slot compatibility for: , in, Let r be the set of required slots for relation type r. For the set of optional slots of relation type r, To fill the slot Candidate span, The probability of the corresponding span type output by the span role classification module. Indicates slot Already filled. Indicates slot Not filled; Grouping scheme for candidate legitimate entities The group-level slot compatibility score is the average of the compatibility scores of each member block. ,in, Grouping scheme for candidate legitimate entities The i-th member block, This represents the set of candidate slots determined by the i-th member block. Grouping scheme for candidate legitimate entities The number of member blocks in the middle. The block-level slot compatibility score of the i-th member block under relation type r represents the local filtering score of the candidate legitimate entity grouping scheme. ,in, The partial complete fact score is generated by combining the member block representations of each member block in the candidate legitimate entity grouping scheme with the candidate span vectors of relation trigger word spans, relation type representations of candidate relation types, candidate span vectors of slot candidate spans, and document vectors to form a candidate fact vector. This vector is then scored using the complete fact score header, and the average score for each member block is calculated. This represents a local parallel structure score. The candidate legitimate entity grouping schemes are classified structurally using the parallel structure score header, and the classification value corresponding to the current grouping structure type is obtained. , All are greater than or equal to 0. This indicates the non-negative weight of the local parallel structure score. These represent the non-negative weights of the group-level slot compatibility scores, and are used to adjust the influence of the corresponding scoring items in the local screening scores.

[0051] S13: Use each candidate legal entity grouping scheme as a new initial legal entity grouping scheme, and return to step S12 until the obtained candidate legal entity grouping scheme contains all entity word vectors.

[0052] S14: Based on all initial legal entity grouping schemes, candidate legal entity grouping schemes containing all entity lexical vectors, and empty facts where none of the entity lexical vectors form facts, multiple legal entity grouping schemes are obtained.

[0053] Specifically, a valid grouping refers to a non-empty valid entity grouping scheme in which each entity word vector in the current set of parallel entity word vectors belongs to exactly one member block, the member blocks are not intersecting, and the union of the member blocks is equal to the current set of parallel entity word vectors.

[0054] For example, let the current set of parallel entity word vectors be... A non-empty legal entity grouping scheme is: ,in, If the Kth member block is represented, then and The set of non-empty legal entity grouping schemes under relation r is: The set of all legal entity grouping schemes is ,in, The grouping validity check function performs at least the following hard constraint checks: 1. Whether there are any missing entity lexical vectors; 2. Whether there are any duplicate entity lexical vectors; 3. Whether each entity lexical vector belongs to exactly one member block; 4. Whether the entity lexical vector type is compatible with the slot candidate of the candidate relation type; 5. Whether the number of member blocks exceeds the upper limit of the candidate relation type; 6. Whether each member block can form a complete candidate fact with the relation trigger word span and the required slot candidate span of the candidate relation type; 7. Whether the required slot candidate span is complete; 8. Whether the candidate relation type allows cross-sentence combination; 9. Whether the combined slot is located in the compatible outer semantic range; 10. Whether entity lexical vectors belonging to different experimental groups or comparison groups are incorrectly merged.

[0055] In a specific example of this application, when the number of entity word vectors When the number of entity word vectors is large, all combinations of entity word vectors are enumerated and added to empty fact candidates to obtain multiple legal entity grouping schemes; when the number of entity word vectors is large... At that time, a bottom-up block merging bundle search is used, for example: the initial grouping is Each step selects two distinct member blocks from the current grouping scheme, merges the two member blocks, performs a `Compat` hard validity check on the new candidates, calculates a local screening score for candidates that pass the validity check, retains the top-ranked candidates to continue expanding, and repeats the block merging process until the stopping condition is met. This search method can generate... , Mixed groups containing two or more multi-member blocks can cover general mixed partitions.

[0056] For example, for member blocks Member block representation is obtained by using permutation-invariant aggregation. ,in, This represents the span of the i-th entity in member block B. Candidate span vector, This represents a trainable non-linear mapping function corresponding to relation type r, used to map entity word vectors to a unified feature space. Let represent a trainable nonlinear aggregation function corresponding to relation type r, used to transform the summed representation. For the j-th slot corresponding to a candidate relation type, its state is first fused through state embedding: , This represents the candidate span for the j-th slot. Indicates the status of the slot. The corresponding state embedding vector, Let represent the trainable slot state embedding matrix, where each slot state is at least distinguished as filled, optional but missing, or not present in the current relation type. Missing optional slots are represented using the corresponding learnable empty slots. Then, by performing masked attention aggregation according to the fixed slot order in the candidate relation types, the candidate span vector of the slot candidate span corresponding to the candidate relation type can be obtained. ,in, This represents a masked attention pooling function used to weight and aggregate the slot representations according to the importance of each slot. This represents the number of slots declared for the candidate relation type, and the candidate fact vector is... Since each part has 768 dimensions, the input dimension for complete fact scoring is 3840.

[0057] It should be noted that a complete candidate fact refers to a candidate structure that includes a relation type and the required slots for that relation type.

[0058] S50: Adjust the multiple candidate fact vectors of each legal entity grouping scheme to obtain the positive candidate fact vector and negative candidate fact vector of each legal entity grouping scheme.

[0059] In some embodiments of this application, S50 includes: S500~S501.

[0060] S500: Take the complete candidate facts from multiple candidate fact vectors of the legal entity grouping scheme as the positive candidate fact vector.

[0061] It should be noted that a complete candidate fact refers to a candidate structure that includes a relation type and the required slots for that relation type.

[0062] S501: Replace the relation type representation of the candidate relation type in the positive candidate fact vector, and / or replace the candidate span vector of the slot candidate span corresponding to the candidate relation type in the positive candidate fact vector, and / or delete the candidate span vector of the slot candidate span corresponding to the candidate relation type in the positive candidate fact vector, and obtain a negative candidate fact vector of the legal entity grouping scheme based on the candidate fact vector after each replacement and deletion.

[0063] This application uses two types of error candidates when constructing training samples. The first type is ordinary factual errors, which are generated by replacing relation types, targets, values ​​or deleting required slots as described above. The second type is entity grouping errors, which are correct groupings and incorrect groupings among multiple legitimate entity grouping schemes.

[0064] S60: The group scoring module scores each legal entity grouping scheme and its positive and negative candidate fact vectors, thereby constructing an entity grouping relationship extraction loss function. This loss function is then used to iteratively train the shared pre-trained encoder, span boundary prediction head, relationship classification prediction head, and group scoring module until the value of the entity grouping relationship extraction loss function converges, resulting in a trained entity grouping relationship extraction model. This trained model is then used to extract entity grouping relationships from the document to be processed.

[0065] In some embodiments of this application, the grouping scoring module is used to score each legitimate entity grouping scheme and its positive candidate fact vector and negative candidate fact vector, including: S600~S604.

[0066] S600: Utilizes a multilayer perceptron to compute the complete fact score of each candidate fact vector for each legitimate entity grouping scheme.

[0067] Specifically, a higher completeness score indicates a higher degree of overall semantic matching between the current relation type, member blocks, relation trigger words, other slots, and the context.

[0068] S601: Using the parallel structure scoring head, output the collective probability that each legal entity grouping scheme belongs to all entity word vectors as a member block to jointly form a fact, the allocation probability that each entity word vector individually forms a fact as a member block, the mixed probability that some entity word vectors as a member block jointly form a fact, and the probability of no fact when all entity word vectors do not form a fact, thereby obtaining the parallel structure probability of the legal entity grouping scheme.

[0069] Specifically, the input vector for the parallel structure scoring head is: ,in, Represents the current set of entity metavectors. The summary represents, Candidate span representations for coordinating the span of expression. Candidate span representation of relation trigger word span, This represents the aggregated representation of slot candidates corresponding to the candidate relationship type. Representing the document vector, since the dimensions of the above five components are all shared with the pre-trained encoder dimension H, and in this embodiment H=768, the input dimension of the parallel structure scoring head is 5H=3840, and the output is four parallel structure categories: 'collective', 'distributive', 'mixed', and 'none'. The classification value of the parallel structure scoring head is... ,in, This represents the trainable weight matrix of the hidden layer of the parallel-structured scorehead. This represents the bias vector of the hidden layer of the parallel structure score header. This represents mapping the hidden layer representation to a trainable classification weight matrix of four parallel structural categories. This represents the bias vector of the output layer of the parallel structure scoring head. The Gaussian error linear unit activation function is denoted as ; the side-by-side structure probability is denoted as . ,in, Indicates the current parallel structure instance The predicted probability of parallel category structure c under the condition of document d. This represents a function that normalizes the classification values ​​of the four categories into a probability distribution; specifically, if the legal entity grouping scheme is such that the vectors of all entity words together form a fact, then... ,but If the legal entity grouping scheme is such that each entity's word vector forms a fact, then... ,but If the grouping scheme for legitimate entities is an empty fact candidate, then If the legal entity grouping scheme is another non-empty legal entity grouping scheme, then .

[0070] S602: For each member block in each legal entity grouping scheme, construct a complete candidate fact vector and calculate its fact score. Based on the average fact score of the complete candidate fact vectors corresponding to each member block, obtain the average fact score of the legal entity grouping scheme.

[0071] The calculation process of the fact score of the constructed complete candidate fact vector includes: Step 1-1 to Step 1-4.

[0072] Step 1-1: Calculate the complete fact score of the complete candidate fact vector using a multilayer perceptron.

[0073] Step 1-2: Based on each word vector and its slot label in the complete candidate fact vector, calculate the text information omission penalty of the complete candidate fact vector.

[0074] Steps 1-3: Based on the product of the text information omission penalty and the information omission penalty weight of the complete candidate fact vector, the target text information omission penalty of the complete candidate fact vector is obtained.

[0075] Steps 1-4: Obtain the fact score of the complete candidate fact vector based on the difference between the complete fact score of the complete candidate fact vector and the penalty for missing text target information.

[0076] For example, for each member block in a non-empty valid entity grouping scheme Construct complete candidate facts respectively ,in, This represents the set of other slots corresponding to the candidate relationship type. The document is represented; its fact score is then calculated.

[0077] Complete fact score output by multilayer perceptron ,in, This represents the transpose of the trainable weight vector of the complete fact score output layer. This represents a multilayer perceptron used to extract semantic features of complete candidate facts. This represents the trainable bias of the complete fact score output layer.

[0078] In a complete candidate fact vector, the slot labels of each word vector are determined by the relation type, and the slot labels of each word vector constitute a set of slot attribution labels. ,in, This represents the entity word meta slot tag. Indicates the relationship trigger word slot tag, This indicates the p-th additional slot label declared for candidate relation type r. To represent a residual slot, it should be noted that the text range corresponding to the complete candidate fact vector is determined by the minimum start position and maximum end position of its filled slots, and can be extended to the boundary of the sentence. After removing fixed punctuation and pure function words from this range, a set of lexical units participating in the slot allocation calculation is obtained. Among them, lexical units that do not belong to entity lexical units, relation trigger words, or other filled slots corresponding to relation types are classified as residual slots.

[0079] For word vectors and its slot labels ,calculate ,in, Indicates the complete candidate facts The t-th word vector is assigned to the slot label. The predicted probability, This represents the complete candidate fact vector. This indicates that the slot label is embedded. This represents the category to which the slot of the t-th word vector belongs. This indicates a multilayer perceptron for slot allocation scoring. This indicates the set of tags belonging to the slot. Normalize and obtain slot labels The probability of.

[0080] The penalty for missing textual information in the complete candidate fact vector is then... ,in, express The number of word vectors in the word vectors Represents the complete candidate fact vector The set of lexical positions that participate in slot allocation calculation within the corresponding text range. This represents the probability that the t-th word vector is predicted as a residual slot. This represents a preset positive number used to avoid zero input to the logarithmic function.

[0081] Furthermore, the fact score of the complete candidate fact vector. ,in, This indicates the penalty weight for missing information.

[0082] For example: Calculate separately ,Will The factual average score of the grouping scheme for legitimate entities.

[0083] S603: When the legal entity grouping scheme is a non-empty legal entity grouping scheme, the unified grouping score of the legal entity grouping scheme is obtained by weighted summation based on the logarithm of the parallel structure probability, the factual average score, and the learnable calibration value corresponding to the number of member blocks.

[0084] Specifically, when the legal entity grouping scheme is a non-empty legal entity grouping scheme, the formula for calculating the unified grouping score of the legal entity grouping scheme is as follows: , in, The logarithm of the probability of the parallel structure of the grouping scheme of legal entities; express The weights; The factual average score representing the grouping scheme of legitimate entities; This indicates the number of complete selected facts corresponding to each member block; This represents the learnable calibration value corresponding to the number of member blocks.

[0085] S604: When the legitimate entity grouping scheme is an empty fact, the unified grouping score of the legitimate entity grouping scheme is obtained by taking the logarithm of the probability that all entity word vectors output by the parallel structure scoring head do not form an empty fact, the learnable empty fact context score, and the empty fact bias.

[0086] Specifically, when the legitimate entity grouping scheme is an empty fact, the formula for calculating the unified grouping score of the legitimate entity grouping scheme is:

[0087] in, The logarithm of the probability that all entity word vectors output by the parallel structure score header do not form a fact is an empty fact. express The weights; This represents the learnable empty fact context score; This indicates a false fact bias.

[0088] It should be noted that for complete candidate fact vectors and positive candidate fact vectors confirmed by humans, the real slot labels are automatically generated by manually annotating the entity span, relation trigger word span, and other slot spans. For negative candidate fact vectors, the slot labels are regenerated according to the erroneous candidates. For example, if the original document contains "16GB" and the negative candidate fact vector deletes "16", then the word vector corresponding to "16" is marked as a residual slot.

[0089] Furthermore, the loss function for extracting entity grouping relationships is constructed as follows: S605~S611.

[0090] S605: Construct candidate span identification loss and span type classification loss based on the output of the span boundary prediction head.

[0091] Specifically, candidate span identification loss Used to supervise the prediction accuracy of the starting word vector, ending word vector, and internal word vectors within the candidate span; span type classification loss. Used to monitor the prediction accuracy of entity span, relation trigger word span, coordination expression span, and slot candidate span corresponding to candidate relation types.

[0092] S606: Construct a relation type classification loss based on the output of the relation classification prediction head.

[0093] Specifically, the relation type classification uses the probability after the domain relation mask. ,in, This represents the predicted probability of a candidate relation of type r given document d. This represents a vector consisting of the classification values ​​corresponding to each relation category output by the relation classification prediction head. This represents a mask vector for relation categories corresponding to the domain of the current document. It restricts the relation categories that can be classified within the current domain. For relation categories allowed by the current domain, the corresponding mask value is set to 0. For relation categories not applicable to the current domain, the corresponding mask value is set to a pre-set large negative value, making the predicted probability of that relation category after Softmax normalization approach 0. Relationship type classification loss. ,in, This indicates the number of valid samples with relational type supervision labels. This represents the true relation type manually labeled in the i-th valid sample. This represents the documents corresponding to the i valid samples. This indicates the true relation type of the relation classification prediction head for the i-th valid sample. The output predicted probability.

[0094] S607: Construct a parallel structure classification loss based on the output of the parallel structure scoring head.

[0095] Specifically, the parallel structure classification loss monitors the accuracy of the predicted probability that each legitimate entity grouping scheme output by the parallel structure scoring head belongs to one of the four parallel structures. ,in, This indicates the number of valid samples with parallel category supervision labels. This represents the true parallel structure category manually labeled by the i-th valid sample, and its value can be collective, distributed, mixed, or none. This represents the parallel structure instance corresponding to the i-th valid sample. This represents the document corresponding to the i-th valid sample. This represents the true parallel structure category of the parallel structure score head for the i-th valid sample. The output predicted probability.

[0096] S608: Construct the complete fact score loss for the legitimate entity grouping scheme based on the complete fact scores of positive candidate fact vectors and negative candidate fact vectors.

[0097] Specifically, the complete fact-scoring loss for the legitimate entity grouping scheme: , in, This represents the set of positive candidate fact vectors for legal entity grouping schemes. This represents the number of positive candidate fact vectors for a legal entity grouping scheme. This represents the set of negative candidate fact vectors for the grouping scheme of legitimate entities. This represents the number of negative candidate fact vectors for the legal entity grouping scheme.

[0098] S609: Construct a slot attribution loss based on each word vector and its slot label in each candidate fact vector.

[0099] Specifically, the slot assignment supervision loss for candidate fact vectors , This represents the true slot attribution label of the slot attribution scoring head for the t-th word vector under the candidate fact vector y. The output is the predicted probability.

[0100] S610: Aggregate the unified grouping scores of erroneous legitimate entity grouping schemes using a logarithmic-sum-exponential function to obtain erroneous grouping scores. Calculate the difference between the preset margin margin and the unified grouping score of the correct legitimate entity grouping schemes. Input the sum of this difference and the erroneous grouping scores into a smoothing positive value function to construct the grouping ranking loss.

[0101] Example: Incorrect set of valid entity grouping schemes The correct legal entity grouping scheme is: Unified grouping score for a legitimate entity grouping scheme that aggregates erroneous entities using LES. Grouping and sorting loss ,in, This indicates the preset interval margin.

[0102] S611: The entity grouping relationship extraction loss function is obtained by weighted summing of the candidate span recognition loss, span type classification loss, relationship type classification loss, parallel structure classification loss, complete fact scoring loss, slot assignment loss and grouping ranking loss.

[0103] For example, the loss function for entity grouping relation extraction: , in, , , , , , and All are greater than or equal to 0, representing the non-negative loss weights of each item, either preset or determined based on a parameter set.

[0104] It should also be noted that model training can employ a phased joint optimization approach. In the initial training phase, the shared pre-trained encoder, span boundary prediction head, and relationship classification prediction head are updated under supervision using candidate span, span classification, and relationship type classification. After reaching a preset stability condition, parallel structure classification, complete fact scoring, slot assignment, and group ranking are introduced for joint training. This training method can reduce the impact of different loss terms on the stability of model parameter optimization due to variations in the number of effective training samples and numerical scales. For example, model training is isolated from two types of erroneous candidates, such as... Figure 4 As shown.

[0105] Furthermore, the trained entity grouping relationship extraction model is used to extract entity grouping relationships from the document to be processed, including: steps 2-1 to 2-5.

[0106] Step 2-1: Segment the document to be processed to obtain the word sequence to be processed. Input the word sequence to be processed into the shared pre-trained encoder in the trained entity grouping relation extraction model, and output the word vector to be processed and the document vector to be processed.

[0107] Step 2-2: Use the span boundary prediction head in the trained entity grouping relationship extraction model to perform global span annotation on each word vector to be processed, and output the span type and candidate span vector of each candidate span in the document to be processed.

[0108] Steps 2-3: Using the relation classification prediction head in the trained entity grouping relation extraction model, predict the relation type based on the output of the span boundary prediction head and the document vector to be processed, and output the candidate relation types and their relation type representations for the document to be processed.

[0109] Steps 2-4: Based on different combinations of entity word vectors in the candidate spans of the document to be processed, obtain multiple legal entity grouping schemes.

[0110] Steps 2-5: Using the grouping scoring module in the trained entity grouping relationship extraction model, score each legitimate entity grouping scheme based on the output of the span boundary prediction head and the relationship classification prediction head, and obtain the entity grouping relationship of the document to be processed based on the legitimate entity grouping scheme with the highest unified grouping score.

[0111] Specifically, the grouping scheme for the legal entities with the highest unified grouping score is represented as follows: ,in, This represents the operation of selecting the one with the highest score.

[0112] Specifically, all entity lexical vectors generate one fact; each entity lexical vector generates multiple independent facts; mixed grouping generates facts by grouping each entity lexical vector separately; empty fact candidates do not generate facts. Each output fact retains the relation type, entity lexical vector grouping, trigger words, other slots, and original source information, and can be mapped to attribute graphs, Resource Description Framework (RDF) restates, event nodes, or hyperedges according to preset fields. The optimal grouping selection and fact output process is as follows: Figure 5 As shown.

[0113] This application also provides specific examples to further explain the above-mentioned method for extracting parallel entity grouping relationships for knowledge graphs.

[0114] First, this example uses a computer device with a Python programming language environment and the PyTorch deep learning framework installed. The device includes a processor, memory, and storage media for storing model parameters and intermediate results. Model training can be performed using a graphics processing unit (GPU), and inference can be performed by a central processing unit (CPU) or a graphics processing unit; the hardware type is not a necessary limitation.

[0115] This example contains 2147 documents, 168437 characters, and 3847 manually confirmed parallel instances. The training set contains 1539 documents, 123684 characters, and 2913 parallel instances; the parameter determination set contains 287 documents, 22917 characters, and 427 parallel instances; and the independent test set contains 321 documents, 21836 characters, and 507 parallel instances.

[0116] Step 1: Establish the relationship schema file. This example uses the "component uses resources" relationship as an example, and its configuration content is as follows: json { "relation_id": "assigned_resource", "set_slot": {"name": "components", "type": "Component", "min": 1, "max": 8}, "required_slots": ["trigger", "resource"], "optional_slots": ["numeric_value", "unit", "condition"], "max_partition_blocks": 8, "allow_cross_sentence": false } ``` The above configuration uses JavaScript Object Notation (JSON). Here, `relation_id` represents the relationship identifier, `set_slot` represents the set slot, `required_slots` represents the list of required slots, `optional_slots` represents the list of optional slots, `max_partition_blocks` represents the maximum number of partition blocks, and `allow_cross_sentence` indicates whether cross-sentence combinations are allowed; `name` represents the name, `type` represents the type, `min` and `max` represent the minimum and maximum values ​​respectively, `Component` represents the component type, and `false` indicates that cross-sentence combinations are not allowed; `assigned_resource` represents the "use resource" relationship, `components` represents the component set, `trigger` represents the trigger word, `resource` represents the resource, `numeric_value` represents the numeric value, `unit` represents the unit, and `condition` represents the condition.

[0117] After loading the mode, initialize the shared text encoder, span boundary prediction head, relation classification head, parallel structure scoring head, complete fact scoring head, and slot attribution scoring head. One specific configuration uses the cross-lingual robust pre-trained language model base version (XLM-R-base) encoder with a hidden dimension of 768, a maximum span width of 16 subwords, and a grouping bundle search upper bound. It should be noted that this parameter group is only one feasible configuration.

[0118] Step 2: Model training data preparation and model training process, specifically including the following steps 1-8: 1. Read manually annotated data in line-by-line JavaScript Object Notation (JSONL) format. Each record contains a document identifier (`doc_id`), the original text, the text range containing the complete fact, the range of parallel members, the trigger word position, the member position and canonical identifier, the relationship type, other slots, the grouping category, the correct grouping, and the complete fact.

[0119] 2. Perform automatic verification on records: check whether the character offset is a left-closed and right-open interval, whether the members of each non-empty fact sample appear exactly in a correct grouping block, whether the grouping category is consistent with the block structure, and whether each block has a corresponding complete fact.

[0120] 3. Group the data according to document identifier (`doc_id`) and template family (`template_family`) to ensure that the same document and the same template family do not cross the training set, parameter determination set and test set.

[0121] 4. Encode the original text using a word segmenter that is paired with the pre-trained encoder, preserving the offset mapping from characters to subwords; convert the manual span into start and end subword labels.

[0122] 5. For each parallel member set (the members are the entity word vectors in the above method), generate valid groupings. If the number of members does not exceed 6, enumerate all member grouping schemes and add empty fact candidates. If it exceeds 6, perform block merging and beam search. Correct groupings in the training data are not pruned.

[0123] 6. Construct a complete fact vector for each candidate block, and calculate the complete fact score, word slot assignment probability, information omission penalty score, and unified group score; when training correct complete facts, use manually labeled correct groups, and incorrect groups are only used to calculate the group ranking loss.

[0124] 7. Take the average of the effective samples for the span recognition loss, parallel structure classification loss, complete fact scoring loss, slot assignment loss and group ranking loss respectively, then add them according to the weights, and perform backpropagation and parameter update.

[0125] 8. A specific training configuration uses an adaptive moment estimation optimizer with weight decay (AdamW), with an encoder learning rate of... The learning rate of the scorehead is The batch size is 8, and the maximum training time is 20 epochs. The parameters are determined by the complete set of facts. If the precision and recall harmonic mean (F1 score) do not improve for three consecutive epochs, the training stops early. Three random seeds (13, 42, and 2026) are used to store the configuration, model checkpoints, and instance-by-instance predictions, respectively. The above hyperparameters are implementable configurations; other equivalent values ​​are not restricted.

[0126] Step 3: For the text "The parser and indexer share a 16 gigabyte (GB) cache", perform steps 1-6: 1. Use a word segmenter to generate a word sequence and offset mapping, and input the sequence into the encoder.

[0127] 2. The span boundary prediction header outputs the members `component_1=parser` and `component_2=indexer`, the trigger word "shared use", the resource slot "cached", the value "16", and the unit "GB"; the relation classification header outputs the relation type candidate `assigneds_resource` (using resources). Here, `component_1` and `component_2` represent the program internal identifiers of the first and second components, respectively.

[0128] 3. The set of parallel members is Collective grouping is retained after structural inspection. Grouping and empty facts .

[0129] 4. Construct a complete fact with slot ` `、` The fields `trigger=shared`, `resource=cached`, `numeric_value=16`, and `unit=GB` represent the relation type, component collection, trigger keyword, resource, value, and unit, respectively. Replace the collection slots with members `[1]` and `[2]` respectively, while keeping the other slots unchanged.

[0130] 5. Calculate the complete fact score and information omission penalty score for each candidate, then combine them with the parallel structure probability to form a unified group score. An illustrative calculation is as follows: Pick , , , The probabilities of the collective, the distribution, and the empty fact are 0.70, 0.20, and 0.10, respectively. The original fact score for the collective candidate is 2.10, the information omission penalty score is 0.20, the final fact score is 2.06, and the unified group score is approximately 1.882. The original fact scores for the two assignment candidates are 1.25 and 1.20, respectively, and the information omission penalty scores are 0.55 and 0.50, respectively. The assignment group score is approximately 0.265. Empty facts use dedicated candidate scores.

[0131] It should be noted that the above values ​​are only used to illustrate the calculation method of the formula, and are not experimental results.

[0132] 6. Perform the maximum score selection on the three candidates. In this example, The highest score is output as a complete fact containing two members, without expanding it into two separate facts.

[0133] Step 4: For the text "Module A and Module B are grouped together, and Module D and Module E each use the same grouping configuration C", perform the following steps 1-6: 1. Identify the four members and the same target slot "Configuration C", and number the members from 1 to 4.

[0134] 2. Four members can form 15 non-empty grouping schemes. The system enumerates these 15 schemes, adds an empty fact candidate, and then performs a validity check based on the slot type and the upper limit of the number of blocks.

[0135] 3. For each non-empty group, replace the `components` slots in turn with its member blocks, while keeping `relation=assigned_resource` (relation is "use resource"), `trigger=use` (trigger word is "use"), and `resource=configuration_C` (resource is configuration C) unchanged.

[0136] 4. Candidates This indicates that all four modules are written in C; candidate This indicates that all four modules use C independently; candidate This means that A and B are a pair, and D and E are separate.

[0137] 5. The complete fact scoring head checks whether the members, relationships, trigger words and other slots of each candidate fact match; the slot attribution scoring head checks whether keywords such as "as a group" and "separately" have been explained by the candidate facts; the unified grouping scoring module calculates the scores of all candidates and selects the optimal group.

[0138] 6. When When the score is highest, the fact output module generates three facts: member block. Together with configuration C, they form a collective fact, member block. and Each of these forms an independent fact with configuration C.

[0139] Step 5: Perform inference on the text "The report compares the latency of the parser and the indexer" with "component usage configuration" as the target relation schema. The system can recognize the two parallel entities "parser" and "indexer," but cannot find the trigger word and resource slot required for the "usage" relation. Therefore, the validity check removes groups that cannot form complete candidate facts, or the unified scoring module lowers their score below that of empty fact candidates. When the score of an empty fact candidate is the highest, the fact output module returns an empty list and does not write it to the knowledge graph.

[0140] For technical abstracts, candidate members are first located using a code and alias table, with a standardized identifier only entered when a unique mapping exists for the alias. Then, different experimental group identifiers (`arm_id`) are set based on the text boundaries of the experimental group, sham operation group, or placebo control group. Text from different experimental groups is first separated by these identifiers, and then valid groupings are generated within each experimental group. Finally, the optimal grouping is selected using the same scoring function as for general technical texts. The dictionary is only used to discover candidate and uniform entity names and does not directly determine collective, assigned, or mixed groupings.

[0141] Step 6: For each optimal non-empty group, the fact output module iterates through its member blocks, generating a unique fact identifier (`fact_id`) for each block, while retaining the original span and document identifier. Taking the first member block in Step 4 as an example, the intermediate fact object is: json { "fact_id": "doc_001_fact_001", "relation": "assigned_resource", "member_ids": ["component_A", "component_B"], "resource_id": "configuration_C", "trigger_text": "Use", "grouping_type": "mixed", "source_doc": "doc_001", "source_span": [0, 29] } ``` In the above objects, `relation` represents the relation type, `member_ids` represents the member identifier list, `resource_id` represents the resource identifier, `trigger_text` represents the trigger text, `grouping_type` represents the grouping type, `source_doc` represents the source document, and `source_span` represents the original document location range; the field value `mixed` indicates mixed grouping, and the remaining English field values ​​are internal identifiers for computer reading and writing, and are determined by the corresponding Chinese entity or field meaning.

[0142] When using event node storage, a fact node `doc_001_fact_001` is created, and role-based edges are established from this fact node to `component_A`, `component_B`, and `configuration_C`; these three identifiers represent component A, component B, and configuration C, respectively. Relationship type, trigger text, and source span are used as fact node attributes. When using Resource Description Framework (RDF) restatements or hyperedges, equivalent field mappings are performed on the same intermediate fact object, without re-determining member groupings.

[0143] Step 7: Save the model configuration, random seed, parameter update record, parameter determination set index, and model checkpoints for each training run. For each inference run, save the following information by document identifier (`doc_id`) and instance identifier (`instance_id`): parallel members, all legal grouping candidates, complete fact score for each candidate, information omission penalty score, parallel structure probability, unified grouping score, optimal group, and output knowledge graph facts.

[0144] During validation, the same text encoder, data partitioning, optimizer, training epochs, and early stopping rules were used for rule-based full expansion extraction, entity pair extraction, sentence splitting before extraction, multivariate classification with a given span, set predictive extraction, and the method provided in this application. The main data recorded were the precision, recall, and harmonic mean of precision and recall (F1 score) for exact matching of complete fact sets, as well as the grouping perfect match rate, splitting error rate, and false merging rate. The F1 score for expanded triples was only used as an auxiliary record. Table 1 shows the specific experimental data. Table 1

[0145] This embodiment also conducted an ablation experiment on the method provided in this application. The experimental results show that if the grouping and sorting loss is removed, the F1 value of the entity relationship grouping result is 0.708, and the error splitting rate increases to 0.268. If the text information omission penalty related terms are removed, the error merging rate is 0.156. This indicates that the grouping and sorting constraint can reduce error splitting and error merging, while the text information omission penalty can suppress grouping candidates that do not fully interpret the original text information.

[0146] Based on the knowledge graph-oriented parallel entity grouping relationship extraction method provided in the above embodiments, this application also provides a knowledge graph-oriented parallel entity grouping relationship extraction system, such as... Figure 6 As shown, the system includes: document encoding module 10, span annotation module 20, relation type prediction module 30, entity grouping and candidate fact generation module 40, positive and negative candidate fact generation module 50, and model training and acquisition module 60.

[0147] The document encoding module 10 is used to segment the document samples in the training set to obtain word sequences, and to encode the word sequences using a shared pre-trained encoder to obtain word vectors for each word and document vectors for the document samples.

[0148] The span annotation module 20 is used to perform global span annotation on each word vector using the span boundary prediction head, and output the span type and candidate span vector of each candidate span.

[0149] The relation type prediction module 30 is used to predict the relation type based on the span type, candidate span vector and document vector of each candidate span using the relation classification prediction head, and outputs the candidate relation type and its relation type representation.

[0150] The entity grouping and candidate fact generation module 40 is used to obtain multiple legal entity grouping schemes based on different combinations of entity lexical vectors in the candidate span. Based on the span type, candidate span vector, candidate relation type and relation type representation of each candidate span, multiple candidate fact vectors are generated for each legal entity grouping scheme.

[0151] The positive and negative candidate fact generation module 50 is used to adjust multiple candidate fact vectors of each legal entity grouping scheme to obtain the positive candidate fact vector and negative candidate fact vector of each legal entity grouping scheme.

[0152] The model training and acquisition module 60 is used to score each legal entity grouping scheme and its positive and negative candidate fact vectors using the group scoring module, thereby constructing an entity grouping relationship extraction loss function. This loss function is then used to iteratively train the shared pre-trained encoder, span boundary prediction head, relationship classification prediction head, and group scoring module until the value of the entity grouping relationship extraction loss function converges, resulting in a trained entity grouping relationship extraction model. This trained model is then used to extract entity grouping relationships from the document to be processed.

[0153] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0154] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0155] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0156] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1The steps of the function specified in one or more boxes.

[0157] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A method for extracting parallel entity grouping relations for knowledge graphs, characterized in that, include: The document samples in the training set are segmented into word sequences. The word sequences are then encoded using a shared pre-trained encoder to obtain word vectors for each word and document vectors for the document samples. The span boundary prediction head is used to perform global span annotation on each word vector, and the span type and candidate span vector of each candidate span are output. The relation classification prediction head is used to predict the relation type based on the span type, candidate span vector and document vector of each candidate span, and outputs the candidate relation type and its relation type representation; Multiple legal entity grouping schemes are obtained based on different combinations of entity word vectors in the candidate span. Multiple candidate fact vectors are generated for each legal entity grouping scheme based on the span type, candidate span vector, candidate relation type and relation type of each candidate span. The multiple candidate fact vectors of each legal entity grouping scheme are adjusted to obtain the positive candidate fact vector and negative candidate fact vector of each legal entity grouping scheme; The grouping scoring module scores each legitimate entity grouping scheme and its positive and negative candidate fact vectors, thereby constructing an entity grouping relationship extraction loss function. This loss function is then used to iteratively train the shared pre-trained encoder, span boundary prediction head, relationship classification prediction head, and grouping scoring module until the value of the entity grouping relationship extraction loss function converges, resulting in a trained entity grouping relationship extraction model. This model is then used to extract entity grouping relationships from the document to be processed.

2. The method for extracting parallel entity grouping relations for knowledge graphs according to claim 1, characterized in that, The span boundary prediction head is used to perform global span annotation on each word vector, outputting the span type and candidate span vector for each candidate span, including: The prediction probability of each word vector located at the beginning, end, and inside the candidate span is calculated using the span boundary prediction head. Candidate spans are constructed based on word vectors that meet the preset probability conditions, and the candidate span score is calculated. Candidate spans that meet the preset span width constraint are retained. The role classification module is used to classify each candidate span into roles, resulting in entity span, relationship trigger word span, coordination expression span, and slot candidate span corresponding to the candidate relationship type. The starting lexical vector, ending lexical vector, internal lexical vector of the span, and span width embedding of each candidate span are concatenated to obtain the candidate span vector of each candidate span.

3. The method for extracting parallel entity grouping relationships for knowledge graphs according to claim 1, characterized in that, The relation classification prediction head is used to predict relation types based on the span type, candidate span vector, and document vector of each candidate span. The output includes candidate relation types and their representations, including: The candidate span vector, document vector, and slot candidate of the relation trigger word span are aggregated and represented as input to the relation classification prediction head, and the classification values ​​corresponding to the target relation category and the non-target relation category are output. Candidate relation types and their representations are obtained based on the classification values ​​corresponding to the target relation category and the non-target relation category.

4. The method for extracting parallel entity grouping relations for knowledge graphs according to claim 1, characterized in that, Multiple legitimate entity grouping schemes are obtained based on different combinations of entity lexical vectors in the candidate spans. Multiple candidate fact vectors are generated for each legitimate entity grouping scheme based on the span type, candidate span vector, candidate relation type, and relation type representation of each candidate span, including: When the number of entity word vectors in the candidate span is less than or equal to the preset number, all combinations of entity word vectors are enumerated to obtain multiple non-empty legal entity grouping schemes; based on the non-empty legal entity grouping schemes and the empty fact that none of the entity word vectors form a fact, multiple legal entity grouping schemes are obtained. When the number of entity word vectors in the candidate span is greater than the preset number, multiple legal entity grouping schemes are obtained based on partial combinations of entity word vectors and empty facts where none of the entity word vectors form facts. By performing permutation-invariant aggregation on each member block in the legal entity grouping scheme, we obtain the representation of each member block of the legal entity grouping scheme; Each member block representation of the legitimate entity grouping scheme is combined with the candidate span vector of the relation trigger word span, the relation type representation of the candidate relation type and its corresponding slot candidate span vector, and the document vector to obtain multiple candidate fact vectors of the legitimate entity grouping scheme.

5. The method for extracting parallel entity grouping relations for knowledge graphs according to claim 4, characterized in that, When the number of entity lexical vectors in the candidate span exceeds a preset number, multiple valid entity grouping schemes are obtained based on partial combinations of entity lexical vectors and the fact that none of the entity lexical vectors form a fact, including: S11: Initialize the initial legal entity grouping scheme, which is formed by each entity word vector into a member block; S12: Select two member blocks from the initial legal entity grouping scheme and merge them to obtain a new member block. Based on the new member block and the remaining unmerged member blocks, obtain a candidate legal entity grouping scheme. Based on the different selection results of the two member blocks, obtain multiple candidate legal entity grouping schemes. Perform legality checks on each candidate legal entity grouping scheme and calculate the local screening score to retain a preset number of candidate legal entity grouping schemes. S13: Use each candidate legal entity grouping scheme as a new initial legal entity grouping scheme, and return to step S12 until the obtained candidate legal entity grouping scheme contains all entity word vectors; S14: Based on all initial legal entity grouping schemes, candidate legal entity grouping schemes containing all entity lexical vectors, and empty facts where none of the entity lexical vectors form facts, multiple legal entity grouping schemes are obtained.

6. The method for extracting parallel entity grouping relations for knowledge graphs according to claim 1, characterized in that, The candidate fact vectors for each legal entity grouping scheme are adjusted to obtain the positive and negative candidate fact vectors for each legal entity grouping scheme, including: The complete candidate facts from multiple candidate fact vectors of the legitimate entity grouping scheme are taken as the positive candidate fact vector; Replace the relation type representation of the candidate relation type in the positive candidate fact vector, and / or replace the candidate span vector of the slot candidate span corresponding to the candidate relation type in the positive candidate fact vector, and / or delete the candidate span vector of the slot candidate span corresponding to the candidate relation type in the positive candidate fact vector, and obtain a negative candidate fact vector of the legal entity grouping scheme based on the candidate fact vector after each replacement and deletion.

7. The method for extracting parallel entity grouping relations for knowledge graphs according to claim 1, characterized in that, The grouping scoring module is used to score each legitimate entity grouping scheme and its positive and negative candidate fact vectors, including: The complete fact score of each candidate fact vector for each legitimate entity grouping scheme is calculated using a multilayer perceptron; By using the parallel structure scoring head, the collective probability of each legal entity grouping scheme being formed by all entity word vectors as a member block, the allocation probability of each entity word vector forming a fact as a member block, the mixed probability of some entity word vectors forming a fact as a member block, and the probability of no fact being formed by all entity word vectors are obtained. For each member block in each legitimate entity grouping scheme, a complete candidate fact vector is constructed and its fact score is calculated. Based on the average fact score of the complete candidate fact vectors corresponding to each member block, the average fact score of the legitimate entity grouping scheme is obtained. The calculation process of the fact score of the constructed complete candidate fact vectors includes: Calculate the complete fact score of the complete candidate fact vector using a multilayer perceptron; Based on each word vector and its slot label in the complete candidate fact vector, calculate the text information omission penalty of the complete candidate fact vector; The target text information omission penalty for the complete candidate fact vector is obtained by multiplying the text information omission penalty of the complete candidate fact vector with the information omission penalty weight. The fact score of the complete candidate fact vector is obtained by the difference between the complete fact score of the complete candidate fact vector and the penalty for missing target information in the text. When the legal entity grouping scheme is a non-empty legal entity grouping scheme, the unified grouping score of the legal entity grouping scheme is obtained by weighted summation based on the logarithm of the parallel structure probability, the fact average score, and the learnable calibration value corresponding to the number of member blocks. When the legitimate entity grouping scheme is empty facts, the unified grouping score of the legitimate entity grouping scheme is obtained by taking the logarithm of the probability that all entity word vectors output by the parallel structure scoring head do not form empty facts, the learnable empty fact context score, and the empty fact bias.

8. The method for extracting parallel entity grouping relations for knowledge graphs according to claim 7, characterized in that, The loss function for constructing entity grouping relationship extraction includes: Construct candidate span identification loss and span type classification loss based on the output of the span boundary prediction head; Construct a relation type classification loss based on the output of the relation classification prediction head; Construct a parallel structure classification loss based on the output of the parallel structure scoring head; Based on the complete fact scores of positive and negative candidate fact vectors, a complete fact score loss for legitimate entity grouping schemes is constructed. Based on each word vector and its slot label in each candidate fact vector, a slot attribution loss is constructed. The error grouping score is obtained by aggregating the unified grouping scores of the incorrect legal entity grouping schemes using the log-sum-exponential function. The difference between the preset margin margin and the unified grouping score of the correct legal entity grouping scheme is calculated. The sum of the difference and the error grouping score is input into the smoothing positive value function to construct the grouping ranking loss. The entity grouping relationship extraction loss function is obtained by weighted summing of the candidate span recognition loss, span type classification loss, relationship type classification loss, parallel structure classification loss, complete fact scoring loss, slot assignment loss and grouping ranking loss.

9. The method for extracting parallel entity grouping relations for knowledge graphs according to claim 1, characterized in that, The trained entity grouping relationship extraction model is used to extract entity grouping relationships from the document to be processed, including: The document to be processed is segmented into words to obtain a sequence of words to be processed. The sequence of words to be processed is then input into the shared pre-trained encoder in the trained entity grouping relation extraction model, and the output is the vector of words to be processed and the vector of the document to be processed. The span boundary prediction head in the trained entity grouping relationship extraction model is used to perform global span annotation on each word vector to be processed, and the span type and candidate span vector of each candidate span in the document to be processed are output. Using the relation classification prediction head in the trained entity grouping relation extraction model, relation type prediction is performed based on the output of the span boundary prediction head and the document vector to be processed, and the candidate relation types and their relation type representations of the document to be processed are output. Multiple legal entity grouping schemes are obtained based on different combinations of entity word vectors in the candidate span of the document to be processed; The grouping scoring module in the trained entity grouping relationship extraction model scores each legitimate entity grouping scheme based on the output of the span boundary prediction head and the relationship classification prediction head. The entity grouping relationship of the document to be processed is obtained based on the legitimate entity grouping scheme with the highest unified grouping score.

10. A parallel entity grouping relation extraction system for knowledge graphs, characterized in that, include: The document encoding module is used to segment document samples in the training set to obtain word sequences, and to encode the word sequences using a shared pre-trained encoder to obtain word vectors for each word and document vectors for the document samples. The span annotation module is used to perform global span annotation on each word vector using the span boundary prediction head, and outputs the span type and candidate span vector for each candidate span. The relation type prediction module is used to predict the relation type based on the span type, candidate span vector and document vector of each candidate span using the relation classification prediction head, and outputs the candidate relation type and its relation type representation; The entity grouping and candidate fact generation module is used to obtain multiple legal entity grouping schemes based on different combinations of entity lexical vectors in the candidate span. It generates multiple candidate fact vectors for each legal entity grouping scheme based on the span type, candidate span vector, candidate relation type and relation type of each candidate span. The positive and negative candidate fact generation module is used to adjust multiple candidate fact vectors of each legal entity grouping scheme to obtain the positive and negative candidate fact vectors of each legal entity grouping scheme. The model training and acquisition module is used to score each legal entity grouping scheme and its positive and negative candidate fact vectors using the group scoring module, thereby constructing an entity grouping relationship extraction loss function. This loss function is then used to iteratively train the shared pre-trained encoder, span boundary prediction head, relationship classification prediction head, and group scoring module until the value of the entity grouping relationship extraction loss function converges, resulting in a trained entity grouping relationship extraction model. This model is then used to extract entity grouping relationships from the document to be processed.