A knowledge graph construction method and system based on large language model

By preprocessing the source text and using large language models, similar entity groups are formed and further classified according to semantic structure and contextual relationships, the problem of difficulty in classifying entities in the knowledge graph is solved, and the simplification and efficient construction of the knowledge graph is achieved.

CN119047553BActive Publication Date: 2025-04-25THE QUARTERMASTER RES INST OF THE GENERAL LOGISTICS DEPT OF THE CPLA
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411053000.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2025-04-25
Estimated Expiration
2044-08-01

AI Technical Summary

Technical Problem

In the process of building knowledge graphs, it is difficult for the existing technology to effectively classify entities with the same representation meaning, resulting in duplication and complex knowledge graph nodes and failure to simplify the graph.

Method used

By preprocessing the source text, extracting entities and forming similar entity groups, using a large language model to further classify entities according to semantic structure and contextual relationships, ensuring that entities with the same meaning are classified into the same group, and ultimately building a simplified knowledge graph.

Benefits of technology

It effectively reduces the complexity of subsequent processing, improves the accuracy and efficiency of knowledge graph construction, and simplifies the knowledge graph structure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119047553B_ABST
    Figure CN119047553B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of text processing technology, and specifically discloses a knowledge graph construction method and system based on a large language model, including: obtaining all pre-text processing sentences of the source text based on all source text sentences of the source text; obtaining all extracted entities in all pre-text processing sentences of the source text and all text processing sentences of the source text based on all pre-text processing sentences of the source text and a preset large language model; obtaining all second-determined similar entity groups of the source text based on all extracted entities of all text processing sentences of the source text, obtaining all standard extracted entities of all text processing sentences of the source text based on all second-determined similar entity groups of the source text; obtaining knowledge graph construction results based on all standard extracted entities of all text processing sentences of the source text. The present invention accurately classifies extracted entities with the same meaning, accurately simplifies the knowledge graph, and improves the efficiency and accuracy of knowledge graph construction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of text processing technology, and in particular to a knowledge graph construction method and system based on a large language model. Background Art

[0002] At present, in the process of knowledge graph construction, accurately and effectively extracting entities from source text and classifying these entities is the basis for building high-quality knowledge graphs. However, due to the naturalness, complexity and diversity of text, this process faces a series of challenges. Entities with the same meaning are often used as different nodes in graph construction, resulting in repeated and complicated nodes in the constructed knowledge graph. Therefore, how to classify extracted entities with the same meaning into the same node and how to simplify the knowledge graph have become urgent issues.

[0003] However, the existing knowledge graph construction method and system based on a large language model only performs text clustering on knowledge text data to obtain several knowledge text data sets of different text types, and constructs graph node links between each knowledge entity according to the association information of each knowledge entity in the knowledge text data sets of different text types to obtain a knowledge graph, but does not consider how to classify extracted entities with the same meaning, and does not consider how to simplify the knowledge graph. For example, the patent with the publication number "CN117150050A" and the name "A method and system for constructing a knowledge graph based on a large language model" includes the following steps: performing text clustering on the knowledge text data to obtain a number of knowledge text data sets T of different text types; submitting the knowledge text data set T to the first HDFS for distributed file storage; extracting the knowledge text type from the first HDFS in order according to the length of the knowledge text type, and using the preset large language model CoT to perform knowledge entity recognition on the extracted knowledge text type to obtain the associated information of each knowledge entity; submitting the associated information of each knowledge entity to the second HDFS for distributed file storage; constructing graph node links between each knowledge entity based on the associated information of each knowledge entity stored in the second HDFS to obtain a knowledge graph. However, this patent can only adapt to the language processing and storage functions of massive knowledge text data, and handle the construction of knowledge graphs of large-scale text types. It does not consider how to classify extracted entities with the same meaning, and does not consider how to simplify the knowledge graph.

[0004] Therefore, the present invention proposes a knowledge graph construction method and system based on a large language model. Summary of the invention

[0005] The present invention provides a knowledge graph construction method and system based on a large language model, which are used to obtain all first-determined similar entity groups of the source text according to all extracted entities of all text processing sentences of the source text, effectively preliminarily integrate and classify entities with the same representation meaning, reduce the complexity of subsequent processing, and obtain all text sentence groups of the source text according to all text processing sentences of the source text and all first-determined similar entity groups, so as to facilitate the subsequent re-classification of extracted entities according to the semantic structure and contextual relationship of the sentences in the text sentence groups, obtain all second-determined similar entity groups of the source text according to all text sentence groups of the source text, and further improve the accuracy of classification of extracted entities according to semantic structure and contextual relationship, ensure that extracted entities with the same meaning are classified into the same group, and facilitate the accuracy of knowledge graph construction, obtain all standard extracted entities of all text processing sentences of the source text according to all second-determined similar entity groups of the source text, and facilitate the accurate acquisition of subsequent knowledge graph construction results, and obtain the knowledge graph construction results according to all standard extracted entities of all text processing sentences of the source text and the extraction relationships within all pre-text processing sentences, so as to simplify the knowledge graph and improve the efficiency of knowledge graph construction.

[0006] The present invention provides a method for constructing a knowledge graph based on a large language model, comprising:

[0007] S1: performing data preprocessing on the source text to obtain all source text sentences of the source text, and obtaining all pre-text processed sentences of the source text based on all source text sentences of the source text;

[0008] S2: based on all pre-text processing sentences of the source text and a preset large language model, all extracted entities and all extracted relations in all pre-text processing sentences of the source text are obtained, and based on all extracted entities of all pre-text processing sentences, all text processing sentences of the source text are obtained;

[0009] S3: based on all extracted entities of all text processing sentences of the source text, all first-determined similar entity groups of the source text are obtained, and based on all text processing sentences of the source text and all first-determined similar entity groups, all text sentence groups of the source text are obtained, based on all text sentence groups of the source text, all second-determined similar entity groups of the source text are obtained, and based on all second-determined similar entity groups of the source text, all standard extracted entities of all text processing sentences of the source text are obtained;

[0010] S4: Obtain the knowledge graph construction result based on all standard extracted entities of all text processing sentences of the source text and the extracted relations within all pre-text processing sentences.

[0011] Preferably, the knowledge graph construction method based on the large language model, S1: performing data preprocessing on the source text to obtain all source text sentences of the source text, and obtaining all pre-text processed sentences of the source text based on all source text sentences of the source text, including:

[0012] Receive the source text uploaded to the knowledge graph construction system, and use all sentence symbols in the source text as sentence markers, segment the source text based on all sentence markers, and obtain all source text sentences of the source text;

[0013] All pre-text processing sentences of the source text are obtained based on all source text sentences of the source text.

[0014] Preferably, the knowledge graph construction method based on the large language model obtains all pre-text processed sentences of the source text based on all source text sentences of the source text, including:

[0015] Eliminate the removable words in each source text sentence of the source text to obtain a text-removed sentence corresponding to each source text sentence;

[0016] Select all the texts to remove all the unknown words in the sentences, and use all the texts before each unknown word in the source text as the analysis text corresponding to the unknown word;

[0017] Based on each unknown word and the corresponding analysis text and the unknown word analysis model, a replacement word for the corresponding unknown word is obtained, and all unknown words in all text-eliminating sentences in the source text are replaced with corresponding replacement words to obtain all pre-text-processed sentences of the source text.

[0018] Preferably, the knowledge graph construction method based on the large language model, S2: based on all pre-text processing sentences of the source text and the preset large language model, all extracted entities and all extracted relations in all pre-text processing sentences of the source text are obtained, and all text processing sentences of the source text are obtained based on all extracted entities of all pre-text processing sentences, including:

[0019] Obtain all extracted entities and all extracted relations of each pre-text processing sentence of the source text based on a preset large language model;

[0020] Treat the pre-text processing sentence with zero number of extracted entities in the source text as an invalid text processing sentence;

[0021] All pre-text processing sentences in the source text except all invalid text sentences are taken as text processing sentences of the source text.

[0022] Preferably, the knowledge graph construction method based on the large language model obtains all first-determined similar entity groups of the source text based on all extracted entities of the sentence processing of all texts of the source text, including:

[0023] Taking any two different extracted entities from all extracted entities of all text processing sentences of the source text as a group of entity groups, obtaining all group entity groups;

[0024] All entity groups in the source text that contain overlapping characters between two extracted entities are regarded as all first verification entity groups of the source text;

[0025] Obtain the frequency of each word in the source text, use the frequency of each word as the vector element representation of the corresponding word, and obtain the vector representation of each extracted entity in each first verification entity group based on the vector element representation of each word;

[0026] Based on the vector representations of the two extracted entities in the first verification entity group and all invalid text processing sentences of the source text, the judgment substitution value between the two extracted entities in the first verification entity group is obtained, which is:

[0027] ;

[0028] in, is the decision substitution value between two extracted entities in the first verification entity group currently being calculated, is the total number of words in the source text, is the sum of the word counts of all invalid text processing sentences in the source text, The first extracted entity in the currently calculated validation entity group. vector elements, The second extracted entity in the currently calculated validation entity group. vector elements, The number of words in the extracted entity with fewer words in the currently calculated verification entity group, is the natural logarithm, and the value of the natural constant e is 2.718;

[0029] All first verification entity groups whose judgment substitution values ​​are greater than a preset judgment substitution value threshold are regarded as the first judgment similar entity groups of the source text.

[0030] Preferably, the knowledge graph construction method based on the large language model processes all text sentences and all first-determined similar entity groups of the source text to obtain all text sentence groups of the source text, including:

[0031] Determine the two extracted entities in each first similarity group as first entities of the same type, and aggregate all the extracted entities of the same type in the source text as first entities of the same type as the first similarity group;

[0032] The extracted entity with the largest number of occurrences in the source text among all the extracted entities in the first similar determination group is taken as the first replacement entity, and all the first replacement entities are used to replace all the remaining extracted entities in the first similar determination group except the corresponding first replacement entity in all the text processing sentences of the source text, to obtain all the text sentences of the source text;

[0033] If all the extracted entities in the first similar determination group have the same number of occurrences in the source text, the extracted entity that first appears in the source text among all the extracted entities in the first similar determination group is taken as the first replacement entity, and all the first replacement entities are used to replace all the remaining extracted entities in the first similar determination group except the corresponding first replacement entity in all the text processing sentences of the source text, so as to obtain all the text sentences of the source text;

[0034] Each text sentence of the source text and the corresponding adjacent previous text sentence and the corresponding adjacent next text sentence are combined to obtain all text sentence groups.

[0035] Preferably, the knowledge graph construction method based on the large language model obtains all second-determined similar entity groups of the source text based on all text sentence groups of the source text, including:

[0036] Obtain all extracted entities of each text sentence in each text sentence group based on a preset large language model;

[0037] Based on the vector element representation of each word, the vector representation of all extracted entities of each text sentence in each text sentence group is obtained, and any two different extracted entities in each text sentence group are taken as a set of comparison groups to obtain all comparison groups, wherein the two extracted entities in each comparison group are comparison entities;

[0038] Obtain the sum of the number of times the two comparison entities of each comparison group appear in the corresponding text sentence group as the calculation number of the corresponding comparison group;

[0039] Based on the vector representation of the two extracted entities in each alignment group and the number of calculations of the corresponding alignment group, the calculated substitution value between the two extracted entities in the corresponding alignment group is obtained, which is:

[0040] ;

[0041] in, is the calculated substitution value between two extracted entities in the currently calculated alignment group, is the number of calculations of the currently calculated alignment group, is the sum of the number of all extracted entities in all text sentences in the text sentence group corresponding to the currently calculated comparison group, The first extracted entity in the currently calculated alignment group vector elements, The second extracted entity in the currently calculated alignment group. vector elements, The number of words in the extracted entity with fewer words in the currently calculated comparison group, is the natural logarithm, and the value of the natural constant e is 2.718;

[0042] All comparison groups whose calculated substitution values ​​are greater than a preset calculated substitution value threshold are taken as all second-determined similar entity groups of the source text.

[0043] Preferably, the knowledge graph construction method based on the large language model obtains all standard extraction entities of all text processing sentences of the source text based on all second judgment similar entity groups of the source text, including:

[0044] Determine the two extracted entities in each second similarity group as second similar entities to each other, and aggregate all the extracted entities in the source text that are second similar entities to each other as a second similarity determination group;

[0045] The extracted entity with the highest number of occurrences in the source text among all the extracted entities in the second similar determination group is regarded as the second replacement entity, and all the second replacement entities are used to replace all the remaining extracted entities in the second similar determination group except the corresponding second replacement entity in all the text processing sentences of the source text, to obtain all the replaced text processing sentences;

[0046] If all the extracted entities in the second similar determination group have the same number of occurrences in the source text, the extracted entity that first appears in the source text among all the extracted entities in the second similar determination group is taken as the second replacement entity, and all the second replacement entities are used to replace all the remaining extracted entities in the second similar determination group except the corresponding second replacement entity in all the text processing sentences of the source text, to obtain all the replaced text processing sentences;

[0047] All extracted entities in each replaced text processing sentence are used as standard extracted entities of the corresponding text processing sentence.

[0048] Preferably, the knowledge graph construction method based on the large language model, S4: obtaining the knowledge graph construction result based on all standard extraction entities of all text processing sentences of the source text and extraction relations in all pre-text processing sentences, including:

[0049] Simplifying the extraction relations in all pre-text processing sentences based on all standard extraction entities of all text processing sentences of the source text to obtain all simplified extraction relations;

[0050] All standard extracted entities of all text processing sentences of the source text are taken as nodes, and all simplified extracted relations are taken as relation edges to obtain the knowledge graph construction result.

[0051] The present invention provides a knowledge graph construction system based on a large language model, which is used to execute any one of the knowledge graph construction methods based on a large language model in embodiments 1 to 9, including:

[0052] A preprocessing module, used for performing data preprocessing on the source text, obtaining all source text sentences of the source text, and obtaining all pre-text processed sentences of the source text based on all source text sentences of the source text;

[0053] An extraction module, used for obtaining all extraction entities and all extraction relations in all pre-text processing sentences of the source text based on all pre-text processing sentences of the source text and a preset large language model, and obtaining all text processing sentences of the source text based on all extraction entities of all pre-text processing sentences;

[0054] A calculation module, configured to obtain all first-determined similar entity groups of the source text based on all extracted entities of all text processing sentences of the source text, obtain all text sentence groups of the source text based on all text processing sentences of the source text and all first-determined similar entity groups, obtain all second-determined similar entity groups of the source text based on all text sentence groups of the source text, and obtain all standard extracted entities of all text processing sentences of the source text based on all second-determined similar entity groups of the source text;

[0055] A construction module is used to obtain a knowledge graph construction result based on all standard extracted entities of all text processing sentences of the source text and the extracted relations within all pre-text processing sentences.

[0056] The beneficial effects of the present invention compared with the prior art are as follows: all first-determination similar entity groups of the source text are obtained according to all extracted entities of all text processing sentences of the source text, entities with the same representation meaning are effectively preliminarily integrated and classified, and the complexity of subsequent processing is reduced; all text sentence groups of the source text are obtained according to all text processing sentences of the source text and all first-determination similar entity groups, which is convenient for subsequent re-classification of extracted entities according to the semantic structure and contextual relationship of the sentences in the text sentence groups; all second-determination similar entity groups of the source text are obtained according to all text sentence groups of the source text, and the accuracy of classification of extracted entities is further improved according to the semantic structure and contextual relationship, ensuring that extracted entities with the same meaning are classified into the same group, which is convenient for the accuracy of knowledge graph construction; all standard extracted entities of all text processing sentences of the source text are obtained according to all second-determination similar entity groups of the source text, which is convenient for accurate acquisition of subsequent knowledge graph construction results; the knowledge graph construction results are obtained according to all standard extracted entities of all text processing sentences of the source text and the extraction relationships within all pre-text processing sentences, which simplifies the knowledge graph and improves the efficiency of knowledge graph construction.

[0057] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structure specifically pointed out in the written application document.

[0058] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0060] Figure 1 This is a flow chart of a method for constructing a knowledge graph based on a large language model in an embodiment of the present invention;

[0061] Figure 2 A schematic diagram of a knowledge graph construction system based on a large language model in an embodiment of the present invention. DETAILED DESCRIPTION

[0062] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention. Embodiment 1:

[0063] The present invention provides a method for constructing a knowledge graph based on a large language model. Figure 1 ,include:

[0064] S1: performing data preprocessing on the source text to obtain all source text sentences of the source text, and obtaining all pre-text processed sentences of the source text based on all source text sentences of the source text;

[0065] S2: based on all pre-text processing sentences of the source text and a preset large language model, all extracted entities and all extracted relations in all pre-text processing sentences of the source text are obtained, and based on all extracted entities of all pre-text processing sentences, all text processing sentences of the source text are obtained;

[0066] S3: based on all extracted entities of all text processing sentences of the source text, all first-determined similar entity groups of the source text are obtained, and based on all text processing sentences of the source text and all first-determined similar entity groups, all text sentence groups of the source text are obtained, based on all text sentence groups of the source text, all second-determined similar entity groups of the source text are obtained, and based on all second-determined similar entity groups of the source text, all standard extracted entities of all text processing sentences of the source text are obtained;

[0067] S4: Obtain the knowledge graph construction result based on all standard extracted entities of all text processing sentences of the source text and the extracted relations within all pre-text processing sentences.

[0068] In this embodiment, the source text is the text input into the knowledge graph construction system based on the large language model. The knowledge graph construction system based on the large language model can represent the extracted entities and extracted relationships in the source text in the form of a knowledge graph (a graph-based data structure used to represent extracted entities and the extracted relationships between them. These extracted entities and extracted relationships are usually composed of attributes, edges and nodes, forming a complex network structure).

[0069] In this embodiment, data preprocessing is a process of obtaining all source text sentences of the source text based on the source text.

[0070] In this embodiment, the source text sentences are sentences of the source text obtained by segmenting the source text.

[0071] In this embodiment, the pre-text processed sentence is a sentence obtained by removing removable words and replacing unknown words in the source text sentence.

[0072] In this embodiment, the preset large language model is an existing model that is pre-set to extract all extracted entities (such as names of people, places, organization names, etc.) and all extracted relations (such as "born in", "belongs to", etc.) in a pre-text processing sentence or a text sentence, such as GPT, BERT, etc.

[0073] In this embodiment, the text processing sentences are all pre-text processing sentences in the source text except all invalid text sentences.

[0074] In this embodiment, the first determined similar entity group is a first verification entity group whose determined replacement value is greater than a preset determined replacement value threshold.

[0075] In this embodiment, the text sentence group is a combination of each text sentence of the source text and the corresponding adjacent previous text sentence and the corresponding adjacent next text sentence.

[0076] In this embodiment, the second determined similar entity group is a comparison group whose calculated substitution value is greater than a preset calculated substitution value threshold.

[0077] In this embodiment, the standard extracted entity is an extracted entity obtained after deduplication of all extracted entities in all text processing sentences of the source text (the deduplication here targets extracted entities with the same representation meaning, such as potato and potato, etc.).

[0078] In this embodiment, the knowledge graph construction result is a network structure representing the extraction entities and the extraction relations between them, obtained based on all standard extraction entities of all text processing sentences of the source text and the extraction relations within all pre-text processing sentences.

[0079] The beneficial effects of the above technology are as follows: all first-determination similar entity groups of the source text are obtained according to all extracted entities of all text processing sentences of the source text, entities with the same representation meaning are effectively preliminarily integrated and classified, reducing the complexity of subsequent processing, and all text sentence groups of the source text are obtained according to all text processing sentences of the source text and all first-determination similar entity groups, which is convenient for subsequent re-classification of extracted entities according to the semantic structure and contextual relationship of the sentences in the text sentence groups, and all second-determination similar entity groups of the source text are obtained according to all text sentence groups of the source text, so as to further improve the accuracy of classification of extracted entities according to semantic structure and contextual relationship, ensure that extracted entities with the same meaning are classified into the same group, and facilitate the accuracy of knowledge graph construction, and all standard extracted entities of all text processing sentences of the source text are obtained according to all second-determination similar entity groups of the source text, so as to facilitate the accurate acquisition of subsequent knowledge graph construction results, and the knowledge graph construction results are obtained according to all standard extracted entities of all text processing sentences of the source text and the extraction relationships within all pre-text processing sentences, so as to simplify the knowledge graph and improve the efficiency of knowledge graph construction. Embodiment 2:

[0080] Based on Example 1, a method for constructing a knowledge graph based on a large language model, S1: Perform data preprocessing on the source text to obtain all source text clauses of the source text, and obtain all pre-text processing clauses of the source text based on all source text clauses of the source text, including:

[0081] Receive the source text uploaded to the knowledge graph construction system, and use all clause symbols in the source text as clause markers. Based on all clause markers, split the source text to obtain all source text clauses of the source text;

[0082] Obtain all pre-text processing clauses of the source text based on all source text clauses of the source text.

[0083] In this embodiment, the clause symbol is a symbol that can split the text in the source text, such as a comma, a period, etc.

[0084] In this embodiment, the clause marker is a position marker for clause splitting of the source text.

[0085] The beneficial effects of the above technology are: Perform data preprocessing on the source text to obtain all source text clauses of the source text, which is convenient for accurately identifying extraction entities in the text later, avoiding omission or misidentification of extraction entities due to the complex structure of long texts, and obtaining all pre-text processing clauses of the source text based on all source text clauses of the source text. Example 3:

[0086] Based on Example 2, a method for constructing a knowledge graph based on a large language model, obtain all pre-text processing clauses of the source text based on all source text clauses of the source text, including:

[0087] Remove the words that can be removed in each source text clause of the source text to obtain the text removal clause corresponding to each source text clause;

[0088] Select all unclear words in all text removal clauses, and use all the text before each unclear word in the source text as the analysis text corresponding to the unclear word;

[0089] Based on each unclear word, the corresponding analysis text, and the unclear word analysis model, obtain the replacement word for the corresponding unclear word, and replace all unclear words in all text removal clauses in the source text with the corresponding replacement words to obtain all pre-text processing clauses of the source text.

[0090] In this embodiment, the words that can be removed are words that are extremely common in each source text clause, but generally have no actual meaning compared with other words and can be removed, such as "le" as a modal particle, "zai" as a preposition, etc.

[0091] In this embodiment, the unknown words are words with unknown references in sentences removed from each text, such as "it", "this", etc.

[0092] In this embodiment, the unknown word analysis model is pre-trained using a large number of unknown words and the analysis text corresponding to each unknown word as model input, and manually selected replacement words corresponding to the unknown words as model output. The model can output replacement words corresponding to the unknown words by inputting unknown words and the corresponding analysis text.

[0093] The beneficial effects of the above technology are: removing removable words and replacing unknown words in all source text sentences of the source text helps to highlight the semantic structure in the text, obtain all pre-text processed sentences of the source text, and facilitate the subsequent extraction of entities and extraction relationships. Embodiment 4:

[0094] Based on Example 1, a knowledge graph construction method based on a large language model, S2: based on all pre-text processing sentences of the source text and a preset large language model, all extracted entities and all extracted relations in all pre-text processing sentences of the source text are obtained, and all text processing sentences of the source text are obtained based on all extracted entities of all pre-text processing sentences, including:

[0095] Obtain all extracted entities and all extracted relations of each pre-text processing sentence of the source text based on a preset large language model;

[0096] Treat the pre-text processing sentence with zero number of extracted entities in the source text as an invalid text processing sentence;

[0097] All pre-text processing sentences in the source text except all invalid text sentences are taken as text processing sentences of the source text.

[0098] In this embodiment, the invalid text processing sentence is a pre-text processing sentence that has zero extracted entities and is not helpful for knowledge graph construction.

[0099] The beneficial effects of the above technology are: accurately obtaining all extracted entities and all extracted relations within all pre-text processing sentences of the source text based on all pre-text processing sentences of the source text and the preset large language model, obtaining all text processing sentences of the source text based on all extracted entities of all pre-text processing sentences, screening out pre-text processing sentences that are not helpful for knowledge graph construction in all pre-text processing sentences, and reducing the complexity of subsequent processing. Embodiment 5:

[0100] On the basis of Example 4, the knowledge graph construction method based on the large language model obtains all first-determined similar entity groups of the source text based on all extracted entities of the sentence processing of all texts of the source text, including:

[0101] Taking any two different extracted entities from all extracted entities of all text processing sentences of the source text as a group of entity groups, obtaining all group entity groups;

[0102] All entity groups in the source text that contain overlapping characters between two extracted entities are regarded as all first verification entity groups of the source text;

[0103] Obtain the frequency of each word in the source text, use the frequency of each word as the vector element representation of the corresponding word, and obtain the vector representation of each extracted entity in each first verification entity group based on the vector element representation of each word;

[0104] Based on the vector representations of the two extracted entities in the first verification entity group and all invalid text processing sentences of the source text, the judgment substitution value between the two extracted entities in the first verification entity group is obtained, which is:

[0105] ;

[0106] in, is the decision substitution value between two extracted entities in the first verification entity group currently being calculated, is the total number of words in the source text, is the sum of the word counts of all invalid text processing sentences in the source text, The first extracted entity in the currently calculated validation entity group. vector elements, The second extracted entity in the currently calculated validation entity group. vector elements, The number of words in the extracted entity with fewer words in the currently calculated verification entity group, is the natural logarithm, and the value of the natural constant e is 2.718;

[0107] All first verification entity groups whose judgment substitution values ​​are greater than a preset judgment substitution value threshold are regarded as the first judgment similar entity groups of the source text.

[0108] In this embodiment, the overlapping characters are repeated characters existing between two extracted entities.

[0109] In this embodiment, the first verification entity group is a group of all entities that contain overlapping characters between two extracted entities.

[0110] In this embodiment, the word frequency is the number of times each word in the source text appears in the source text.

[0111] In this embodiment, the vector representation of the extracted entity is a vector group representation obtained by taking the frequency of each word as the vector element representation of the corresponding word and taking the order of the corresponding words in the extracted entity as the vector element order.

[0112] In this embodiment, the judgment replacement value between two extracted entities in the first verification entity group is a degree value obtained based on the vector representation of the two extracted entities in the first verification entity group and all invalid text processing sentences of the source text, which can reflect whether the two extracted entities in the corresponding first verification entity group can be preliminarily integrated and classified.

[0113] In this embodiment, the preset determination substitution value threshold is a preset determination substitution value threshold used to determine whether the first verification entity group is the first determination similar entity group of the source text.

[0114] The beneficial effects of the above technology are: all the first-judgment similar entity groups of the source text are obtained based on all the extracted entities of all the text processing sentences of the source text, and the entities representing the same meanings are effectively preliminarily integrated and classified based on the repeated words between different extracted entities, thereby reducing the complexity of subsequent processing. This embodiment provides a specific method for obtaining all the first-judgment similar entity groups of the source text based on all the extracted entities of all the text processing sentences of the source text. Embodiment 6:

[0115] On the basis of Example 5, the knowledge graph construction method based on the large language model processes all text sentences and all first-determined similar entity groups of the source text to obtain all text sentence groups of the source text, including:

[0116] Determine the two extracted entities in each first similarity group as first entities of the same type, and aggregate all the extracted entities of the same type in the source text as first entities of the same type as the first similarity group;

[0117] The extracted entity with the largest number of occurrences in the source text among all the extracted entities in the first similar determination group is taken as the first replacement entity, and all the first replacement entities are used to replace all the remaining extracted entities in the first similar determination group except the corresponding first replacement entity in all the text processing sentences of the source text, to obtain all the text sentences of the source text;

[0118] If all the extracted entities in the first similar determination group have the same number of occurrences in the source text, the extracted entity that first appears in the source text among all the extracted entities in the first similar determination group is taken as the first replacement entity, and all the first replacement entities are used to replace all the remaining extracted entities in the first similar determination group except the corresponding first replacement entity in all the text processing sentences of the source text, so as to obtain all the text sentences of the source text;

[0119] Each text sentence of the source text and the corresponding adjacent previous text sentence and the corresponding adjacent next text sentence are combined to obtain all text sentence groups.

[0120] In this embodiment, the first same category determination similarity group is that all extracted entities in the source text are first same category entities.

[0121] The beneficial effect of the above technology is: based on all text processing sentences and all first-judgment similar entity groups of the source text, all text sentence groups of the source text are obtained, which is convenient for subsequent extraction and reclassification of entities based on the semantic structure and contextual relationship of the sentences in the text sentence groups. This embodiment provides a specific method for obtaining all text sentence groups of the source text based on all text processing sentences and all first-judgment similar entity groups of the source text. Embodiment 7:

[0122] On the basis of Example 5, the knowledge graph construction method based on the large language model obtains all second judgment similar entity groups of the source text based on all text sentence groups of the source text, including:

[0123] Obtain all extracted entities of each text sentence in each text sentence group based on a preset large language model;

[0124] Based on the vector element representation of each word, the vector representation of all extracted entities of each text sentence in each text sentence group is obtained, and any two different extracted entities in each text sentence group are taken as a set of comparison groups to obtain all comparison groups, wherein the two extracted entities in each comparison group are comparison entities;

[0125] Obtain the sum of the number of times the two comparison entities of each comparison group appear in the corresponding text sentence group as the calculation number of the corresponding comparison group;

[0126] Based on the vector representation of the two extracted entities in each alignment group and the number of calculations of the corresponding alignment group, the calculated substitution value between the two extracted entities in the corresponding alignment group is obtained, which is:

[0127] ;

[0128] in, is the calculated substitution value between two extracted entities in the currently calculated alignment group, is the number of calculations of the currently calculated alignment group, is the sum of the number of all extracted entities in all text sentences in the text sentence group corresponding to the currently calculated comparison group, The first extracted entity in the currently calculated alignment group vector elements, The second extracted entity in the currently calculated alignment group. vector elements, The number of words in the extracted entity with fewer words in the currently calculated comparison group, is the natural logarithm, and the value of the natural constant e is 2.718;

[0129] All comparison groups whose calculated substitution values ​​are greater than a preset calculated substitution value threshold are taken as all second-determined similar entity groups of the source text.

[0130] In this embodiment, the calculated substitution value between two extracted entities in a comparison group is obtained based on the vector representation of the two extracted entities in each comparison group and the number of calculations of the corresponding comparison group, and can reflect the degree value of whether the two extracted entities in the corresponding comparison group can be reintegrated and classified.

[0131] In this embodiment, the preset calculated replacement value threshold is a preset value that the corresponding calculated replacement value must be greater than when the comparison group is determined to be the second determined similar entity group.

[0132] The beneficial effects of the above technology are: all second-determined similar entity groups of the source text are obtained according to all text sentence groups of the source text, the accuracy of the classification of the extracted entities is further improved according to the semantic structure and contextual relationship, and it is ensured that the extracted entities with the same meaning are classified into the same group, which facilitates the accuracy of the knowledge graph construction. This embodiment provides a specific method for obtaining all second-determined similar entity groups of the source text based on all text sentence groups of the source text. Embodiment 8:

[0133] On the basis of Example 7, the knowledge graph construction method based on the large language model obtains all standard extraction entities of all text processing sentences of the source text based on all second judgment similar entity groups of the source text, including:

[0134] Determine the two extracted entities in each second similarity group as second similar entities to each other, and aggregate all the extracted entities in the source text that are second similar entities to each other as a second similarity determination group;

[0135] The extracted entity with the highest number of occurrences in the source text among all the extracted entities in the second similar determination group is regarded as the second replacement entity, and all the second replacement entities are used to replace all the remaining extracted entities in the second similar determination group except the corresponding second replacement entity in all the text processing sentences of the source text, to obtain all the replaced text processing sentences;

[0136] If all the extracted entities in the second similar determination group have the same number of occurrences in the source text, the extracted entity that first appears in the source text among all the extracted entities in the second similar determination group is taken as the second replacement entity, and all the second replacement entities are used to replace all the remaining extracted entities in the second similar determination group except the corresponding second replacement entity in all the text processing sentences of the source text, to obtain all the replaced text processing sentences;

[0137] All extracted entities in each replaced text processing sentence are used as standard extracted entities of the corresponding text processing sentence.

[0138] In this embodiment, the second same type determination similarity group is that all extracted entities in the source text are second same type entities.

[0139] The beneficial effect of the above technology is: all standard extraction entities of all text processing sentences of the source text are obtained according to all second-determination similar entity groups of the source text, which facilitates the accurate acquisition of subsequent knowledge graph construction results. This embodiment provides a specific method for obtaining all standard extraction entities of all text processing sentences of the source text based on all second-determination similar entity groups of the source text. Embodiment 9:

[0140] Based on Example 1, the knowledge graph construction method based on the large language model, S4: obtaining the knowledge graph construction result based on all standard extraction entities of all text processing sentences of the source text and extraction relations in all pre-text processing sentences, including:

[0141] Simplifying the extraction relations in all pre-text processing sentences based on all standard extraction entities of all text processing sentences of the source text to obtain all simplified extraction relations;

[0142] All standard extracted entities of all text processing sentences of the source text are taken as nodes, and all simplified extracted relations are taken as relation edges to obtain the knowledge graph construction result.

[0143] In this embodiment, all extraction relations in all pre-text processing sentences are simplified based on all standard extraction entities of all text processing sentences of the source text to obtain all simplified extraction relations, namely:

[0144] The extraction relationships of all replaced extraction entities are retained on the corresponding replaced and currently retained standard extraction entities, and the original extraction relationships of the standard extraction entities and the retained extraction relationships of the replaced extraction entities are summarized as simplified extraction relationships between all standard extraction entities.

[0145] The beneficial effects of the above technology are: the knowledge graph construction result is obtained according to all standard extraction entities of all text processing sentences of the source text and the extraction relations within all pre-text processing sentences, which simplifies the knowledge graph and improves the accuracy of knowledge graph construction.

[0146] Embodiment 10:

[0147] The present invention provides a knowledge graph construction system based on a large language model, which is used to execute any one of the knowledge graph construction methods based on a large language model in embodiments 1 to 9, referring to Figure 2 ,include:

[0148] A preprocessing module, used for performing data preprocessing on the source text, obtaining all source text sentences of the source text, and obtaining all pre-text processed sentences of the source text based on all source text sentences of the source text;

[0149] An extraction module, used for obtaining all extraction entities and all extraction relations in all pre-text processing sentences of the source text based on all pre-text processing sentences of the source text and a preset large language model, and obtaining all text processing sentences of the source text based on all extraction entities of all pre-text processing sentences;

[0150] A calculation module, configured to obtain all first-determined similar entity groups of the source text based on all extracted entities of all text processing sentences of the source text, obtain all text sentence groups of the source text based on all text processing sentences of the source text and all first-determined similar entity groups, obtain all second-determined similar entity groups of the source text based on all text sentence groups of the source text, and obtain all standard extracted entities of all text processing sentences of the source text based on all second-determined similar entity groups of the source text;

[0151] A construction module is used to obtain a knowledge graph construction result based on all standard extracted entities of all text processing sentences of the source text and the extracted relations within all pre-text processing sentences.

[0152] The beneficial effects of the above technology are as follows: all first-determination similar entity groups of the source text are obtained according to all extracted entities of all text processing sentences of the source text, entities with the same representation meaning are effectively preliminarily integrated and classified, reducing the complexity of subsequent processing, and all text sentence groups of the source text are obtained according to all text processing sentences of the source text and all first-determination similar entity groups, which is convenient for subsequent re-classification of extracted entities according to the semantic structure and contextual relationship of the sentences in the text sentence groups, and all second-determination similar entity groups of the source text are obtained according to all text sentence groups of the source text, so as to further improve the accuracy of classification of extracted entities according to semantic structure and contextual relationship, ensure that extracted entities with the same meaning are classified into the same group, and facilitate the accuracy of knowledge graph construction, and all standard extracted entities of all text processing sentences of the source text are obtained according to all second-determination similar entity groups of the source text, so as to facilitate the accurate acquisition of subsequent knowledge graph construction results, and the knowledge graph construction results are obtained according to all standard extracted entities of all text processing sentences of the source text and the extraction relationships within all pre-text processing sentences, so as to simplify the knowledge graph and improve the efficiency of knowledge graph construction.

[0153] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A knowledge graph construction method based on a large language model, characterized in that: include: S1: performing data preprocessing on the source text to obtain all source text sentences of the source text, and obtaining all pre-text processed sentences of the source text based on all source text sentences of the source text; S2: based on all pre-text processing sentences of the source text and a preset large language model, all extracted entities and all extracted relations in all pre-text processing sentences of the source text are obtained, and based on all extracted entities of all pre-text processing sentences, all text processing sentences of the source text are obtained; S3: based on all extracted entities of all text processing sentences of the source text, all first-determined similar entity groups of the source text are obtained, and based on all text processing sentences of the source text and all first-determined similar entity groups, all text sentence groups of the source text are obtained, based on all text sentence groups of the source text, all second-determined similar entity groups of the source text are obtained, and based on all second-determined similar entity groups of the source text, all standard extracted entities of all text processing sentences of the source text are obtained; S4: Obtain the knowledge graph construction result based on all standard extracted entities of all text processing sentences of the source text and the extracted relations within all pre-text processing sentences; Wherein, based on all text processing sentences of the source text and all first determined similar entity groups, all text sentence groups of the source text are obtained, including: Determine the two extracted entities in each first similarity group as first entities of the same type, and aggregate all the extracted entities of the same type in the source text as first entities of the same type as the first similarity group; The extracted entity with the largest number of occurrences in the source text among all the extracted entities in the first similar determination group is taken as the first replacement entity, and all the first replacement entities are used to replace all the remaining extracted entities in the first similar determination group except the corresponding first replacement entity in all the text processing sentences of the source text, to obtain all the text sentences of the source text; If all the extracted entities in the first similar determination group have the same number of occurrences in the source text, the extracted entity that first appears in the source text among all the extracted entities in the first similar determination group is taken as the first replacement entity, and all the first replacement entities are used to replace all the remaining extracted entities in the first similar determination group except the corresponding first replacement entity in all the text processing sentences of the source text, so as to obtain all the text sentences of the source text; Each text sentence of the source text and the corresponding adjacent previous text sentence and the corresponding adjacent next text sentence are combined to obtain all text sentence groups.

2. The method for constructing a knowledge graph based on a large language model according to claim 1, characterized in that: S1: Perform data preprocessing on the source text to obtain all source text sentences of the source text, and obtain all pre-text processed sentences of the source text based on all source text sentences of the source text, including: Receive the source text uploaded to the knowledge graph construction system, and use all sentence symbols in the source text as sentence markers, segment the source text based on all sentence markers, and obtain all source text sentences of the source text; All pre-text processing sentences of the source text are obtained based on all source text sentences of the source text.

3. The method for constructing a knowledge graph based on a large language model according to claim 2, characterized in that: All pre-text processing sentences of the source text are obtained based on all source text sentences of the source text, including: Eliminate the removable words in each source text sentence of the source text to obtain a text-removed sentence corresponding to each source text sentence; Select all the texts to remove all the unknown words in the sentences, and use all the texts before each unknown word in the source text as the analysis text corresponding to the unknown word; Based on each unknown word and the corresponding analysis text and the unknown word analysis model, a replacement word for the corresponding unknown word is obtained, and all unknown words in all text-eliminating sentences in the source text are replaced with corresponding replacement words to obtain all pre-text-processed sentences of the source text.

4. The method for constructing a knowledge graph based on a large language model according to claim 1, characterized in that: S2: Based on all pre-text processing sentences of the source text and the preset large language model, all extracted entities and all extracted relations in all pre-text processing sentences of the source text are obtained, and all text processing sentences of the source text are obtained based on all extracted entities of all pre-text processing sentences, including: Obtain all extracted entities and all extracted relations of each pre-text processing sentence of the source text based on a preset large language model; Treat the pre-text processing sentence with zero number of extracted entities in the source text as an invalid text processing sentence; All pre-text processing sentences in the source text except all invalid text sentences are taken as text processing sentences of the source text.

5. The method for constructing a knowledge graph based on a large language model according to claim 4, characterized in that: All the extracted entities of the sentences are processed based on all the texts of the source text to obtain all the first-determined similar entity groups of the source text, including: Taking any two different extracted entities from all extracted entities of all text processing sentences of the source text as a group of entity groups, obtaining all group entity groups; All entity groups in the source text that contain overlapping characters between two extracted entities are regarded as all first verification entity groups of the source text; Obtain the frequency of each word in the source text, use the frequency of each word as the vector element representation of the corresponding word, and obtain the vector representation of each extracted entity in each first verification entity group based on the vector element representation of each word; Based on the vector representations of the two extracted entities in the first verification entity group and all invalid text processing sentences of the source text, the judgment substitution value between the two extracted entities in the first verification entity group is obtained, which is: ; in, is the decision substitution value between two extracted entities in the first verification entity group currently being calculated, is the total number of words in the source text, is the sum of the word counts of all invalid text processing sentences in the source text, The first extracted entity in the currently calculated validation entity group. vector elements, The second extracted entity in the currently calculated validation entity group. vector elements, The number of words in the extracted entity with fewer words in the currently calculated verification entity group, is the natural logarithm, and the value of the natural constant e is 2.718; All first verification entity groups whose judgment substitution values ​​are greater than a preset judgment substitution value threshold are regarded as the first judgment similar entity groups of the source text.

6. The method for constructing a knowledge graph based on a large language model according to claim 5, characterized in that: Obtaining all second-determined similar entity groups of the source text based on all text sentence groups of the source text, including: Obtain all extracted entities of each text sentence in each text sentence group based on a preset large language model; Based on the vector element representation of each word, the vector representation of all extracted entities of each text sentence in each text sentence group is obtained, and any two different extracted entities in each text sentence group are taken as a set of comparison groups to obtain all comparison groups, wherein the two extracted entities in each comparison group are comparison entities; Obtain the sum of the number of times the two comparison entities of each comparison group appear in the corresponding text sentence group as the calculation number of the corresponding comparison group; Based on the vector representation of the two extracted entities in each alignment group and the number of calculations of the corresponding alignment group, the calculated substitution value between the two extracted entities in the corresponding alignment group is obtained, which is: ; in, is the calculated substitution value between two extracted entities in the currently calculated alignment group, is the number of calculations of the currently calculated alignment group, is the sum of the number of all extracted entities in all text sentences in the text sentence group corresponding to the currently calculated comparison group, The first extracted entity in the currently calculated alignment group vector elements, The second extracted entity in the currently calculated alignment group. vector elements, The number of words in the extracted entity with fewer words in the currently calculated comparison group, is the natural logarithm, and the value of the natural constant e is 2.718; All comparison groups whose calculated substitution values ​​are greater than a preset calculated substitution value threshold are taken as all second-determined similar entity groups of the source text.

7. The method for constructing a knowledge graph based on a large language model according to claim 6, characterized in that: All standard extraction entities of all text processing sentences of the source text are obtained based on all second judgment similar entity groups of the source text, including: Determine the two extracted entities in each second similarity group as second similar entities to each other, and aggregate all the extracted entities in the source text that are second similar entities to each other as a second similarity determination group; The extracted entity with the highest number of occurrences in the source text among all the extracted entities in the second similar determination group is regarded as the second replacement entity, and all the second replacement entities are used to replace all the remaining extracted entities in the second similar determination group except the corresponding second replacement entity in all the text processing sentences of the source text, to obtain all the replaced text processing sentences; If all the extracted entities in the second similar determination group have the same number of occurrences in the source text, the extracted entity that first appears in the source text among all the extracted entities in the second similar determination group is taken as the second replacement entity, and all the second replacement entities are used to replace all the remaining extracted entities in the second similar determination group except the corresponding second replacement entity in all the text processing sentences of the source text, to obtain all the replaced text processing sentences; All extracted entities in each replaced text processing sentence are used as standard extracted entities of the corresponding text processing sentence.

8. The method for constructing a knowledge graph based on a large language model according to claim 1, characterized in that: S4: Obtain the knowledge graph construction results based on all standard extracted entities of all text processing sentences of the source text and the extracted relations within all pre-text processing sentences, including: Simplifying the extraction relations in all pre-text processing sentences based on all standard extraction entities of all text processing sentences of the source text to obtain all simplified extraction relations; All standard extracted entities of all text processing sentences of the source text are taken as nodes, and all simplified extracted relations are taken as relation edges to obtain the knowledge graph construction result.

9. A knowledge graph construction system based on a large language model, characterized in that: A method for constructing a knowledge graph based on a large language model according to any one of claims 1 to 8, comprising: A preprocessing module, used for performing data preprocessing on the source text, obtaining all source text sentences of the source text, and obtaining all pre-text processed sentences of the source text based on all source text sentences of the source text; An extraction module, used for obtaining all extraction entities and all extraction relations in all pre-text processing sentences of the source text based on all pre-text processing sentences of the source text and a preset large language model, and obtaining all text processing sentences of the source text based on all extraction entities of all pre-text processing sentences; A calculation module, configured to obtain all first-determined similar entity groups of the source text based on all extracted entities of all text processing sentences of the source text, obtain all text sentence groups of the source text based on all text processing sentences of the source text and all first-determined similar entity groups, obtain all second-determined similar entity groups of the source text based on all text sentence groups of the source text, and obtain all standard extracted entities of all text processing sentences of the source text based on all second-determined similar entity groups of the source text; A construction module, used for obtaining a knowledge graph construction result based on all standard extracted entities of all text processing sentences of the source text and extracted relations within all pre-text processing sentences; Wherein, based on all text processing sentences of the source text and all first determined similar entity groups, all text sentence groups of the source text are obtained, including: Determine the two extracted entities in each first similarity group as first entities of the same type, and aggregate all the extracted entities of the same type in the source text as first entities of the same type as the first similarity group; The extracted entity with the largest number of occurrences in the source text among all the extracted entities in the first similar determination group is taken as the first replacement entity, and all the first replacement entities are used to replace all the remaining extracted entities in the first similar determination group except the corresponding first replacement entity in all the text processing sentences of the source text, to obtain all the text sentences of the source text; If all the extracted entities in the first similar determination group have the same number of occurrences in the source text, the extracted entity that first appears in the source text among all the extracted entities in the first similar determination group is taken as the first replacement entity, and all the first replacement entities are used to replace all the remaining extracted entities in the first similar determination group except the corresponding first replacement entity in all the text processing sentences of the source text, so as to obtain all the text sentences of the source text; Each text sentence of the source text and the corresponding adjacent previous text sentence and the corresponding adjacent next text sentence are combined to obtain all text sentence groups.

Citation Information

Patent Citations

  • Knowledge graph construction method and system based on large language model

    CN117150050A

  • Medical knowledge graph building method and device

    CN113590817A

  • Knowledge graph construction method and device, equipment and storage medium

    CN117910563A