Zero sample document level relation extraction method based on general large language model
By adopting a zero-sample method based on a general large language model in document-level relationship extraction, and using prompt word templates to directly perform relationship extraction, the dependence problem of large amounts of labeled data in the existing technology is solved, and more efficient and accurate relationship extraction is achieved, adapting to a variety of document types and fields.
Patent Information
- Application Number
- CN202411881458.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art relies on a large amount of high-quality labeled text data in document-level relationship extraction, resulting in high data preparation cost and time, and is sensitive to sample dependence and labeled text quality.
The zero-sample document-level relationship extraction method based on the general large language model is adopted. By establishing a prompt word template corresponding to the task category, the large language model is used to directly recognize named entity and extract relationships, reducing dependence on labeled data.
It reduces the cost and time of data preparation, reduces the dependence on samples, avoids the impact of labeled text quality on the extraction results, improves the efficiency and accuracy of relationship extraction, and adapts to different document types and fields.
Smart Images

Figure CN119807327A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of document-level relationship extraction, and in particular to a zero-sample document-level relationship extraction method based on a universal large language model. Background Art
[0002] The background technology of the present invention mainly focuses on the fields of text-level relation extraction, named entity recognition (NER) and large model technology, especially the zero-sample document-level relation extraction method based on a universal large language model. The following is an overview of the background technology in these fields:
[0003] Entity naming recognition and relationship extraction: It is one of the core tasks of information extraction, which aims to identify semantic relationships between entities from unstructured text. Traditional relationship extraction methods rely on feature engineering and deep learning algorithms, especially neural network models such as CNN, RNN, LSTM, and Transformer. These models have shown strong capabilities in natural language processing (NLP) tasks. However, these models rely on pre-training on a large amount of high-quality annotated text data to capture rich language features and patterns. As well as repeated testing and tuning of algorithm models. Document-level text requires more parameters, which means that training requires more electricity. Summary of the invention
[0004] The present invention discloses a zero-sample document-level relationship extraction method based on a universal large language model to overcome the above technical problems.
[0005] In order to achieve the above object, the technical solution of the present invention is:
[0006] A zero-shot document-level relation extraction method based on a universal large language model comprises the following steps:
[0007] S1: according to the task category, establishing a prompt word template corresponding to the task category;
[0008] The task categories include named entity recognition and relation extraction;
[0009] The prompt word template corresponding to the named entity recognition is the prompt word template T of the named entity recognition. NER ; The prompt word template corresponding to the relation extraction is the prompt word template T for relation extraction RE ;
[0010] The prompt word template T of the named entity recognition NER , the prompt word template T for relation extraction RE The structures of are the same, including entity type and description of entity type;
[0011] S2: Based on the sentence and word segmentation methods of the spaCy library, obtain the sentences and words in the document to be processed;
[0012] S3: Recognize the prompt word template T according to the named entity NER , sentences, words, and a preset set of entity types, based on a large language model, to obtain a dataset for named entity recognition;
[0013] The data of named entity recognition includes entity name, entity type, entity sentence index, word index in entity sentence, synonym index, and document index.
[0014] S4: Based on the dataset of named entity recognition; obtain the dataset NER with synonym encoding indexed ;
[0015] S5: extracting a prompt word template T according to the name of the preset entity relationship, the mode of the preset entity relationship based on the name of the entity relationship, the document to be processed, and the relationship RE and the NER dataset with synonym encoding indexed , based on the large language model, obtain the final relation extraction dataset RE predicted ; to complete the relationship extraction of document-level text.
[0016] Furthermore, we obtain the NER dataset with synonym encoding. indexed Here’s how:
[0017] S41: according to the named entity recognition data set, grouping the named entity recognition data of the same entity type into a group to form a named entity recognition data group of the entity type;
[0018] S42: According to the entity name of the i-th named entity recognized data and the entity name of the j-th named entity recognized data in the named entity recognized data group of the entity type, based on the large language model, determine whether the entity name of the i-th named entity recognized data and the entity name of the j-th named entity recognized data in the named entity recognized data group are synonyms, so as to obtain an updated synonym index of the named entity recognized data, and then obtain the NER dataset with synonym encoding. indexed; i, j are both indexes of data in the named entity recognition data set of entity type.
[0019] Furthermore, the method for obtaining an updated synonym index of named entity recognition data is:
[0020] When the entity name of the data of the i-th named entity recognition in the data group of named entity recognition and the entity name of the data of the j-th named entity recognition are synonyms, the synonym index of the data of the i-th named entity recognition in the data group of named entity recognition is equal to the synonym index of the data of the j-th named entity recognition;
[0021] Otherwise, when the entity name of the i-th named entity recognized data in the named entity recognized data group and the entity name of the j-th named entity recognized data are not synonyms, the synonym index of the i-th named entity recognized data in the named entity recognized data group is not equal to the synonym index of the j-th named entity recognized data.
[0022] Furthermore, we obtain the final relation extraction dataset RE predicted The method used is as follows:
[0023] S51: Obtain a subject entity name and an object entity name in the document to be processed; to obtain a data pair formed by the subject entity name and the object entity name;
[0024] S52: Prompt word template T extracted according to the relationship RE , based on the large language model, determining whether the subject entity name and the object entity name in the to-be-processed document in the data pair conform to a preset entity relationship;
[0025] S53: When the subject entity name and the object entity name in the to-be-processed document in the data pair meet the preset entity relationship, the data pair is added to the relationship extraction data set to obtain a final relationship extraction data set.
[0026] Furthermore, after S5, the method further includes S6: obtaining a final relationship extraction data set RE predicted The total number of entity names in the document and the total number of real entity names in the document to be processed are used to extract the final relational data set RE predicted , for evaluation.
[0027] Beneficial effects: The present invention is a zero-sample document-level relationship extraction method based on a universal large language model. By establishing a prompt word template, the entity relationship in the document-level text is extracted based on the large language model, which reduces the need for a large amount of labeled data. This reduces the cost and time of data preparation, making the relationship extraction technology easier to be applied to fields where data is scarce. This embodiment does not require training through training samples and parameter tuning, but directly obtains results on the existing large model through prompt words, reducing dependence on samples. At the same time, it also avoids the influence of the quality of the annotated text on the extraction results. At the same time, the relationship extraction process can be carried out faster without the need to train / fine-tune the large model, thereby speeding up the development cycle. The need for manual intervention is reduced, labor costs are reduced, and processing speed is improved. The present invention can adapt to different document types and fields. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0029] Figure 1 This is a flow chart of the zero-sample document-level relationship extraction method based on a universal large language model of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0031] This embodiment introduces a zero-sample document-level relation extraction method based on a universal large language model. Figure 1 As shown,
[0032] S1: according to the task category, establishing a prompt word template corresponding to the task category;
[0033] The task categories include named entity recognition and relation extraction;
[0034] The prompt word template corresponding to the named entity recognition is the prompt word template T of the named entity recognition. NER ; The prompt word template corresponding to the relation extraction is the prompt word template T for relation extractionRE ;
[0035] The prompt word template T of the named entity recognition NER , the prompt word template T for relation extraction RE The structures of are the same, including entity type and description of entity type;
[0036] Specifically, the prompt word template of this embodiment adopts the json file format and is named prompt_templates.json. The task categories are named entity recognition NER and relation extraction RE. The corresponding prompt word templates are the prompt word template for named entity recognition and T NER Tip word template T for relation extraction RE ;
[0037] Specifically, in this embodiment, the entity type and the description of the entity type form a tuple set L: {l1,l2,l3,...,l D}, where l D Represents a tuple consisting of an entity type and a description of the entity type, i.e., l D = {entity type, description of entity type}, where l D represents the Dth tuple consisting of an entity type and a description of the entity type; D represents the total number of tuples consisting of an entity type and a description of the entity type; Figure 1 shown.
[0038] S2: Based on the sentence and word segmentation methods of the spaCy library, obtain the sentences and words in the document to be processed;
[0039] Specifically, this embodiment uses the sentence segmentation and word segmentation methods of the conventional spaCy library to split the document to be processed into sentences and words.
[0040] Specifically, in this embodiment, the document to be processed D={D1, D2, D3, ..., D n ..., D N}, split into sentences and words, among which the document to be processed D n , is a text-level text file; D n represents the nth document to be processed; n is the number of the document to be processed; N is the total number of documents to be processed; where D n ={S1,S2,S3,...,S m ,...,S M},S m represents the mth sentence in the nth document to be processed; m is the index of the sentence in the nth document to be processed; M is the total number of sentences in the nth document to be processed; each sentence consists of several words, represented by S m={W1,W2,W3,...,W p ,...,W P},W p represents the pth word in the mth sentence, p is the index of the word in the mth sentence; P is the total number of words in the mth sentence;
[0041] S3: Recognize the prompt word template T according to the named entity NER , sentences, words, and a preset set of entity types, based on a large language model, to obtain a dataset for named entity recognition;
[0042] The data of named entity recognition includes entity name, entity type, entity sentence index, word index in entity sentence, synonym index, and document index.
[0043] Specifically, with the development of deep learning and pre-trained models, large language models have made significant progress in the fields of text-level relationship extraction and named entity recognition (NER). Technology giants such as Meta, Google, and Alibaba Research Institute have released open-source general large models, which have tens of billions or even trillions of parameters and are capable of complex logical reasoning tasks, making document-level relationship extraction possible. This provides a theoretical basis and technical support for zero-shot document-level relationship extraction methods based on general large language models.
[0044] Specifically, the prompt word template T of the named entity recognition NER , sentences, words and entity type set L of the document to be processed are input into the large language model to obtain a data set for named entity recognition; the data in the data set for named entity recognition includes entity name, entity type, entity sentence index, word index in entity sentence, synonym index and document index;
[0045] Specifically, some of the datasets for named entity recognition in this embodiment are as follows:
[0046]
[0047] The synonym index to be processed is initially assigned a value of -1.
[0048] Specifically, the output named entity recognition data set: {E1,E2,E3,...,E r ,...,E R}, E r Represents the rth entity data in the named entity recognition data set; R is the total number of named entity recognition data in the named entity recognition data set;
[0049] E r={entity name, entity type, entity sentence index, word index in entity sentence, synonym index, document index}, consisting of six tuples.
[0050] An example of named entity recognition data is as follows: {Locatep, drug, 1, [08, 11], -1, 0001}, where the sentence index "1" means that "Locatep" appears in the first sentence; the word index "[08, 11]" means that "Locatep" appears in the 8th to 11th words of the first sentence; the document index "0001" means the 0001th document; the synonym index is initially assigned a value of -1 due to pending processing.
[0051] S4: Based on the dataset of named entity recognition; obtain the dataset NER with synonym encoding indexed ;
[0052] Preferably, get a dataset NER with synonym encodings indexed Here’s how:
[0053] S41: according to the named entity recognition data set, grouping the named entity recognition data of the same entity type into a group to form a named entity recognition data group of the entity type;
[0054] S42: According to the entity name of the i-th named entity recognized data and the entity name of the j-th named entity recognized data in the named entity recognized data group of the entity type, based on the large language model, determine whether the entity name of the i-th named entity recognized data and the entity name of the j-th named entity recognized data in the named entity recognized data group are synonyms, so as to obtain an updated synonym index of the named entity recognized data, and then obtain the NER dataset with synonym encoding. indexed; i, j are both indexes of data in the named entity recognition data set of entity type;
[0055] Preferably, the method for obtaining an updated synonym index of named entity recognition data is:
[0056] When the entity name of the data of the i-th named entity recognition in the data group of named entity recognition and the entity name of the data of the j-th named entity recognition are synonyms, the synonym index of the data of the i-th named entity recognition in the data group of named entity recognition is equal to the synonym index of the data of the j-th named entity recognition;
[0057] Otherwise, when the entity name of the i-th named entity recognized data in the named entity recognized data group and the entity name of the j-th named entity recognized data are not synonyms, the synonym index of the i-th named entity recognized data in the named entity recognized data group is not equal to the synonym index of the j-th named entity recognized data.
[0058] Specifically, for the data in each named entity recognition data set, the data of the same entity type is divided into a group to form a named entity recognition data group of the entity type, so that the data in the named entity recognition data group of each entity type is composed of data of the same entity type, and the data in the named entity recognition data group are combined in pairs, and through the large language model, it is determined whether the entity names in the two groups of data are synonyms, and if so, the synonym indexes in the group of data are unified;
[0059] In this embodiment, the entity names under the entity type "disease" are: Locatep, Losartan, angiotensin II receptor antagonist, ARB; these entity names are combined in pairs as follows:
[0060]
[0061]
[0062] The results of determining whether the entity names in pairs are synonyms are as follows: a: yes; b: no; c: no; d: no; e: no; f: yes.
[0063] Specifically, in this embodiment, when the entity name of the data of the i-th named entity recognition and the entity name of the data of the j-th named entity recognition are synonyms, the synonym indexes in the data of the i-th named entity recognition and the data of the j-th named entity recognition are updated to the same number, thereby obtaining a data set NER with synonym encoding. indexed ; Among them, the dataset NER with synonym encoding indexed The data structure in is the same as that in the named entity recognition dataset, such as:
[0064]
[0065] Among them, Losartan and Losartan are synonyms, so the synonym index is the same and is set to 1.
[0066] Angiotensin II receptor antagonist and ARB are synonyms, so the synonym index is the same, set to position 6. The other entity names are not synonyms, so each synonym index is different.
[0067] S5: extracting a prompt word template T according to the name of the preset entity relationship, the preset entity relationship mode based on the name of the entity relationship, the document to be processed, and the relationship RE and the NER dataset with synonym encoding indexed , based on the large language model, obtain the final relation extraction dataset RE predicted ; To complete the relationship extraction of document-level text;
[0068] The model of the entity relationship includes a subject entity type, a name of the entity relationship, and an object entity type; specifically, the subject entity type and the object entity type in this embodiment are set by ordinary technicians in the field according to specific needs, such as defining the entity type drug as the subject entity type; and defining the entity type disease as the object entity type.
[0069] Preferably, the final relation extraction dataset RE is obtained predicted Here’s how:
[0070] S51: Obtain a subject entity name and an object entity name in the document to be processed; to obtain a data pair formed by the subject entity name and the object entity name;
[0071] S52: Prompt word template T extracted according to the relationship RE , based on the large language model, determining whether the subject entity name and the object entity name in the to-be-processed document in the data pair conform to a preset entity relationship;
[0072] S53: When the subject entity name and the object entity name in the to-be-processed document in the data pair meet the preset entity relationship, the data pair is added to the relationship extraction data set to obtain a final relationship extraction data set.
[0073] Specifically, the subject entity name LH i and object entity name LT i The subject entity name and the object entity name that have a relationship between them are used as data in the relationship extraction dataset. A specific example is as follows:
[0074] Subject entity name|Subject sentence index|Subject word index|Relation name|Object entity name|Object sentence index|Object word index|Document index
[0075] Locatep|1| [08,11]|Treatment|Hypertension|1| [24,26]| 0001
[0076] Losartan |1| [13,20]|Treatment|Hypertension|1| [24,26]| 0001
[0077] Locatep|1| [08,11]|Treatment|Renal Failure|2| [18,21]| 0001
[0078] Specifically, the entity relationship in this embodiment is exemplified as follows:
[0079] The relationship between drugs and diseases, such as Locatep for treating hypertension; the relationship between drugs and synonyms, such as AIDS is a synonym for AIDS;
[0080] In the therapeutic relationship between drugs and diseases, the entity types are drugs and diseases; the description of the drug entity type is as follows: drug name, including the abbreviation, abbreviation, English name, Chinese name of the drug, but not the manufacturer name. Exclude the name of nutritional products and gene names. The description of the disease entity type is as follows: disease name, including the symptoms of the disease, the full name of the disease, the abbreviation of the disease, the abbreviation of the disease, such as AIDS, Chinese name, and English name. If there is a human tissue name before the disease name, the human tissue disease name is extracted, such as liver cancer.
[0081] Specifically, the entity type in this embodiment is specifically defined according to actual user needs.
[0082] Specifically, the entity relationship pattern configured in this embodiment is: {subject entity type, relationship name, object entity type}.
[0083] A specific example of this embodiment is as follows:
[0084] The names of the preset entity relationships are: "Treatment", "Side Effect".
[0085] The relational model defines the set RS as:
[0086] Subject entity type, relation name, object entity type
[0087] Medicine, Treatment, Disease
[0088] Drugs, side effects, diseases
[0089] The prompt word template T for relation extraction in this embodiment RE Here is an example:
[0090] In the document to be extracted, determine whether {subject entity name} treats {object entity name}, or whether {subject entity name} is beneficial to the treatment of {object entity name}?
[0091] In the documents to be extracted, determine whether {subject entity name} has side effects on {object entity name}? Or did the {object entity name} patient get worse after taking {subject entity name}? Or did {subject entity name} increase the risk of {object entity name} getting worse?
[0092] Specifically, the content of the to-be-processed document index 0001 in this embodiment is as follows:
[0093] The aim of this study was to investigate the protective effect of Losartan on renal function in patients with hypertension. Hypertension is a common cardiovascular disease that is closely related to renal failure. Losartan is an angiotensin II receptor antagonist (ARB) that has been widely used to treat hypertension. In this study, we randomly selected 100 patients with hypertension and divided them into two groups: one group received Losartan treatment and the other group received placebo treatment. After 12 months of follow-up observation, we found that the renal function indicators (such as serum creatinine and urine protein) in the Losartan treatment group were significantly better than those in the placebo group. In addition, blood pressure control was more stable in the Losartan treatment group. These results show that Losartan can not only effectively control blood pressure, but also protect renal function in patients with hypertension.
[0094] The format of a prompt word template file for named entity recognition in this embodiment is as follows:
[0095] {"Document name, such as CDR":
[0096] Task Category:
[0097] "Prompt word template":
[0098] {Documents to be processed}
[0099] Please extract {entity type and entity description} from the above document. The output format is {name|entity type}, one per line. Note: The entity name must appear in the input document. Do not output other content. If there is none, please output none. "
[0100] "Entity Type and Entity Description":
[0101] {“Drug”: “Drug name, including the drug’s abbreviation, abbreviation, English name, Chinese name, but excluding the manufacturer’s name. Exclude nutritional supplement names and gene names.”
[0102] "Disease": "Disease name, including symptoms, full name, abbreviation, abbreviation, such as AIDS, Chinese name, English name. If there is a human tissue name before the disease name, then the human tissue disease name is drawn, such as liver cancer."}
[0103] }
[0104] Preferably, after S5, the step further includes S6:
[0105] Get the final relation extraction dataset RE predictedThe total number of entity names in the document and the total number of real entity names in the document to be processed are used to extract the final relational data set RE predicted Conduct assessments;
[0106] In this embodiment, by calculating TP, FN and FP, the precision rate P (precision_score), recall rate R (recall_score), and F1 value (f1_score) are obtained to extract the final relationship data set RE. predicted , conduct an assessment;
[0107] Among them, TP (True Positive), that is, RE annotated The entity data in RE predicted The number of existence in the, its judgment condition is RE annotated Entity and RE predicted Entity's (sen_id head ,pos head ,r name ,sent_id tail ,pos tail ,d) are equal. Among them, RE annotated A relational dataset representing the real entity names in the document to be processed; RE predicted Represents the final relation extraction dataset; FN (False Negative), i.e. RE annotated The entity data in RE predicted The number of items that do not exist in the table is determined by the same conditions as above.
[0108] FP (False Positive), also known as RE predicted The entity data in RE annotated The number of items that do not exist in the table is determined by the same conditions as above.
[0109] The calculation of precision P (precision_score), recall R (recall_score), and F1 value (f1_score) is as follows:
[0110] P=TP / (TP+FP)
[0111] R=TP / (TP+FN)
[0112] F1=2*(P*R) / (P+R)
[0113] Specifically, in this embodiment, P, R, and F1 are calculated for each document to be processed, for example:
[0114] Document 0001P=0.8,R=0.9,F1=0.85
[0115] Document 0002P=0.75,R=0.8,F1=0 / 75
[0116] At the same time, P, R, and F1 are calculated for each entity type separately, for example:
[0117] Disease P = 0.8, R = 0.9, F1 = 0.85
[0118] Drug P = 0.75, R = 0.8, F1 = 0 / 75
[0119] Calculate P, R, F1 for each entity relationship type, for example:
[0120] Treatment P = 0.8, R = 0.9, F1 = 0.85
[0121] Side effects P = 0.75, R = 0.8, F1 = 0 / 75
[0122] According to the P, R, F1 calculated according to the documents to be processed, entity types and entity relationships, the final relation extraction dataset RE is extracted according to the specific usage requirements. predicted The evaluation method is a conventional technique in the field and will not be described in detail here.
[0123] The zero-sample document-level relationship extraction technology based on the general large model of this embodiment has multiple beneficial effects:
[0124] Reduce data dependence: Zero-shot learning methods reduce the need for large amounts of labeled data, which reduces the cost and time of data preparation, making it easier for relationship extraction technology to be applied in areas where data is scarce. Zero-Shot aims to enable large models to directly complete entity naming recognition and relationship extraction tasks without any sample training. It can significantly reduce the cost of manual labeling. This embodiment does not require training through training samples and parameter tuning, but directly obtains results on the existing large model through prompt words, reducing dependence on samples. At the same time, it also avoids the impact of the quality of the labeled text on the extraction results.
[0125] Improved efficiency: The relationship extraction process can be performed faster without the need to train / fine-tune large models, thus speeding up the development cycle.
[0126] Enhanced generalization capabilities: Able to adapt to different document types and domains.
[0127] Improved accuracy: Co-reference resolution can be achieved through double-sentence overlapping NER and identification of entity synonyms, which can more accurately identify and associate entities in documents, thereby improving the accuracy of relationship extraction.
[0128] Flexibility and scalability: The custom design of relationship patterns and relationship prompts allows the system to flexibly adapt to new relationship types and fields, and is easy to expand and maintain.
[0129] Reduced manual intervention: Automated relationship extraction reduces the need for manual intervention, reduces labor costs, and increases processing speed.
[0130] These beneficial effects work together to make zero-shot document-level relation extraction technology based on a general large model a powerful tool that can provide value in a variety of application scenarios.
[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A zero-shot document-level relation extraction method based on a universal large language model, characterized in that: The steps include: S1: according to the task category, establishing a prompt word template corresponding to the task category; The task categories include named entity recognition and relation extraction; The prompt word template corresponding to the named entity recognition is the prompt word template T of the named entity recognition. NER ; The prompt word template corresponding to the relation extraction is the prompt word template T for relation extraction RE ; The prompt word template T of the named entity recognition NER , the prompt word template T for relation extraction RE The structures of are the same, including entity type and description of entity type; S2: Based on the sentence and word segmentation methods of the spaCy library, obtain the sentences and words in the document to be processed; S3: Recognize the prompt word template T according to the named entity NER , sentences, words, and a preset set of entity types, based on a large language model, to obtain a dataset for named entity recognition; The data of named entity recognition includes entity name, entity type, entity sentence index, word index in entity sentence, synonym index, and document index. S4: Based on the dataset of named entity recognition; obtain the dataset NER with synonym encoding indexed ; S5: extracting a prompt word template T according to the name of the preset entity relationship, the mode of the preset entity relationship based on the name of the entity relationship, the document to be processed, and the relationship RE and the NER dataset with synonym encoding indexed , based on the large language model, obtain the final relation extraction dataset RE predicted ; to complete the relationship extraction of document-level text.
2. According to claim 1, a zero-shot document-level relationship extraction method based on a universal large language model is characterized in that: Get the dataset NER with synonym encoding indexed Here’s how: S41: according to the named entity recognition data set, grouping the named entity recognition data of the same entity type into a group to form a named entity recognition data group of the entity type; S42: According to the entity name of the i-th named entity recognized data and the entity name of the j-th named entity recognized data in the named entity recognized data group of the entity type, based on the large language model, determine whether the entity name of the i-th named entity recognized data and the entity name of the j-th named entity recognized data in the named entity recognized data group are synonyms, so as to obtain an updated synonym index of the named entity recognized data, and then obtain the NER dataset with synonym encoding. indexed; i, j are both indexes of data in the named entity recognition data set of entity type.
3. According to claim 2, a zero-sample document-level relationship extraction method based on a universal large language model is characterized in that: The method to obtain an updated synonym index for named entity recognition data is: When the entity name of the data of the i-th named entity recognition in the data group of named entity recognition and the entity name of the data of the j-th named entity recognition are synonyms, the synonym index of the data of the i-th named entity recognition in the data group of named entity recognition is equal to the synonym index of the data of the j-th named entity recognition; Otherwise, when the entity name of the i-th named entity recognized data in the named entity recognized data group and the entity name of the j-th named entity recognized data are not synonyms, the synonym index of the i-th named entity recognized data in the named entity recognized data group is not equal to the synonym index of the j-th named entity recognized data.
4. According to claim 1, a zero-shot document-level relationship extraction method based on a universal large language model is characterized in that: Get the final relation extraction dataset RE predicted The method used is as follows: S51: Obtain a subject entity name and an object entity name in the document to be processed; to obtain a data pair formed by the subject entity name and the object entity name; S52: Prompt word template T extracted according to the relationship RE , based on the large language model, determining whether the subject entity name and the object entity name in the to-be-processed document in the data pair conform to a preset entity relationship; S53: When the subject entity name and the object entity name in the to-be-processed document in the data pair meet the preset entity relationship, the data pair is added to the relationship extraction data set to obtain a final relationship extraction data set.
5. According to claim 1, a zero-shot document-level relationship extraction method based on a universal large language model is characterized in that: After S5, the method further includes S6: obtaining a final relation extraction dataset RE predicted The total number of entity names in the document and the total number of real entity names in the document to be processed are used to extract the final relational data set RE predicted , for evaluation.
Citation Information
Cited By
Super-relation extraction method based on collaboration of multiple large language models and application of super-relation extraction method
CN120450089A
A Method for Constructing a Jewelry Valuation Knowledge Base Based on a Large Language Model
CN120562536B
Text data automatic extraction method and equipment based on large language model
CN120911446A