A method for constructing a knowledge graph of urban relics integrating event extraction technology, a cultural relic data management system, and a readable storage medium
By integrating event extraction technology, combining named entity recognition and event extraction technology assisted by large language model, a knowledge map of urban sites is constructed, which solves the problem of lack of historical event description in cultural relics knowledge maps, and achieves deeper event correlation mining and higher The accuracy of the extraction meets the needs of in-depth research and display of the value of cultural relics.
Patent Information
- Application Number
- CN202411474080.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2044-10-22
AI Technical Summary
In the current research on cultural relics knowledge graphs, the main focus is on the description of the attributes of the cultural relics themselves, and the integration and analysis of information such as historical events, character relationships, and social backgrounds behind the cultural relics are relatively insufficient, resulting in insufficient depth and breadth of urban ruins knowledge graphs. , it is difficult to meet the needs of in-depth research and comprehensive display of the value of cultural relics.
The urban site knowledge graph construction method adopts the fusion event extraction technology, and obtains historical event information related to the site through named entity recognition and large language model-assisted event extraction technology, combines the site with related historical events to build a knowledge graph to increase knowledge The entity and relationship of the graph.
By digging deeper into the relationship between event elements, we reduce our dependence on manual design rules, improve the accuracy of event extraction tasks, enrich the content of cultural relics knowledge graph, and reveal the deep connection between cultural relics and historical events. , meets the needs of in-depth research and comprehensive display of the value of cultural relics.
Smart Images

Figure CN119003794B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of computer natural language processing, event extraction and knowledge graph construction, and in particular to a method for constructing an urban ruins knowledge graph integrating event extraction technology, a cultural relic data management system and a readable storage medium. Background Art
[0002] Event Extraction (EE) is a key technology in the field of natural language processing (NLP), which aims to automatically identify and extract structured event information from text data.
[0003] Event extraction technology has gone through several stages of development from pattern matching to machine learning and deep learning. Currently, deep learning-based methods have become mainstream. These methods can automatically learn feature representations in text and improve the accuracy and efficiency of event extraction. For example, the commonly used ones are:
[0004] Pattern matching-based method: Matching event information in text through manually or automatically constructed event patterns. This method has a high accuracy rate, but relies on a lot of manual labor and is difficult to cover all types of events.
[0005] Machine learning-based methods: Use classifiers or sequence labeling models to automatically identify event information in text. Commonly used machine learning models include support vector machines (SVMs) and conditional random fields (CRFs).
[0006] Methods based on deep learning: including convolutional neural networks (CNN), recurrent neural networks (RNN), and attention mechanisms. These models can automatically learn feature representations in text and improve the accuracy and efficiency of event extraction.
[0007] Knowledge graphs are often referred to as knowledge domain visualization or knowledge domain mapping maps. They are a series of graphics that show the development process and structural relationship of knowledge. They use visualization technology to describe knowledge resources and their carriers, and to mine, analyze, construct, draw and display knowledge and their interrelationships. Knowledge graphs have several core features and have been applied:
[0008] Multidisciplinary integration: combines the theories and methods of multiple disciplines such as applied mathematics, graphics, information visualization technology, and information science.
[0009] Visual display: Use visual maps to vividly display the core structure, development history, frontier fields and overall knowledge architecture of the discipline.
[0010] Revealing the dynamic development laws: Revealing the dynamic development laws of the knowledge field through data mining, information processing, knowledge measurement and graphics drawing.
[0011] As a structured semantic knowledge base, knowledge graph organizes complex knowledge in a visual and structured way to facilitate computer program understanding, storage and retrieval. In recent years, with the development and application of artificial intelligence technology, knowledge graph, as one of the key technologies, has been widely used in intelligent search, intelligent question and answer, personalized recommendation, content distribution and other fields.
[0012] However, according to investigations and studies, the current research on cultural relics knowledge graphs mainly focuses on the description of the attributes of the cultural relics themselves, such as age, type, material, artistic style, etc., while the integration and analysis of information such as historical events, character relationships, and social background behind the cultural relics is relatively insufficient. As a unique type of cultural relic, the historical events and character relationships behind urban ruins are often more complex and diverse. The limitations of traditional methods have led to the lack of depth and breadth in their knowledge graphs, making it difficult to meet the needs of in-depth research and comprehensive display of the value of cultural relics, and they are no longer adapted to the needs of today's social development. Therefore, it is urgent to study a new urban ruins knowledge graph construction method and cultural relics data management system, which can not only enrich the content of the cultural relics knowledge graph, but also reveal the deep connection between cultural relics and historical events, solve the problems encountered in the current construction of cultural relics knowledge graphs, and have sufficient research significance and use value.
[0013] It should be noted that the above introduction to the technical background is only for the convenience of providing a clear and complete description of the technical solutions of the present invention and for the convenience of understanding by those skilled in the art. It cannot be considered that the above technical solutions are well known to those skilled in the art simply because they are described in the technical background section of the present invention. Summary of the invention
[0014] The purpose of the present invention is to provide a method for constructing a knowledge graph of urban ruins, a cultural relics data management system and a computer-readable storage medium that integrate event extraction technology. By means of continuous retrieval, enrichment and improvement, on the basis of named entity recognition of unearthed cultural relics information in digital resources, a large language model-assisted event extraction technology is adopted to obtain historical event information related to the ruins, and the ruins are combined with related historical events to construct a knowledge graph, and the entities and relationships of the knowledge graph are increased, so that it can more comprehensively express urban ruins-type cultural relics and the history and culture behind them, so as to better record the historical stories behind the cultural relics. The RoBERTa-BiLSTM-CRF model is used as the main framework, and a large language model is introduced to extract event reasoning information and entity information, and external supplementary features are constructed. Compared with traditional technologies, the relationship between event elements is more deeply explored, the dependence on manually designed rules is reduced, and the accuracy of event extraction tasks is greatly improved, providing researchers and the public with more intuitive and detailed knowledge resources, which has important research significance and use value.
[0015] To achieve the above object, the present invention provides the following technical solutions:
[0016] The present invention provides a method for constructing an urban ruins knowledge graph integrating event extraction technology, comprising the following steps:
[0017] S1: Collect and organize archaeological excavation results and historical documents of urban ruins to obtain urban ruins text data, which includes ruins name data, age data, geographical location data, composition data, surveying and mapping record data, image record data, archaeological excavation data, unearthed cultural relics data, relevant person data, and relevant event data; the unearthed cultural relics data includes multiple dimensional information, each of which includes: name, age, unearthed location, description, measurement, material, decoration, and image record;
[0018] S2: Construction of seed word library of cultural relics and historical events;
[0019] The seed word library construction of the cultural relics and historical events includes:
[0020] S21: initial seed word library selection: refer to the existing word library in the field of unearthed cultural relics and archaeological excavation and perform manual screening as the initial seed word library;
[0021] S22: constructing a final seed word library in the field of cultural relics and historical events; including: expanding the initial seed word library, and after the expansion, adding and modifying it in combination with expert evaluation to obtain a final seed word library in the field of cultural relics and historical events;
[0022] S3: Named entity recognition: Take the archaeological excavation results and historical documents of urban ruins as the original text, and implement named entity recognition for entity types related to urban ruins and historical events, including: the name of unearthed cultural relics, age, material, shape, name of people, place name, organization. The specific steps of named entity recognition include:
[0023] S31: preprocessing: preprocessing the original text;
[0024] S32: annotating the preprocessed original text, clarifying the entity type to be identified, and obtaining annotated data;
[0025] S33: using the preprocessed original text and the annotated text as input to a named entity recognition model, using the annotated data as a result, training the model, using the trained model to process the unannotated descriptions of unearthed cultural relics, outputting the named entity recognition results, and completing the named entity recognition of the unearthed cultural relics;
[0026] S4: The event extraction technology using large language models (LLMs) to generate external supplementary features is used to extract event information from the original text after the named entity recognition in step S3, and convert it into structured data; the event extraction model includes: RoBERTa semantic representation model, BiLSTM feature extraction model and CRF classification model, using LLMs to extract event reasoning information and entity information as external supplementary features, and using the reasoning and context understanding capabilities of LLMs to assist the RoBERTa-BiLSTM-CRF model to realize event extraction, specifically including:
[0027] S41: Extract event reasoning information and entity information with the help of LLMs, build external supplementary features, the model mines explicit and implicit associations between event elements, extracts event reasoning information, and builds event reasoning features. Event elements are named entities. LLMs are used to directly extract entities from sentences and build entity features.
[0028] In the process of event reasoning information extraction, the thinking chain is the main method. Before outputting the final answer, the RoBERTa-BiLSTM-CRF model explicitly outputs the intermediate step-by-step reasoning steps. The prompt for event reasoning information extraction consists of three parts: event e, document M, and event element r. The prompt for event reasoning information extraction is input into the large language model to obtain event reasoning information Fr. The event reasoning information Fr includes the event element extraction steps, the correlation analysis between elements, and the preliminary element extraction conclusion; the document M is the original text without named entity recognition;
[0029] In the entity feature extraction process, an entity feature prompt is designed, wherein the entity feature prompt includes a sentence s in the document, and the entity feature prompt is input into the large language model to obtain entity information Fe;
[0030] The event reasoning information Fr and the entity information Fe are input into the RoBERTa-BiLSTM-CRF model for encoding to obtain the reasoning feature fr and the entity feature fe respectively, in preparation for event element extraction;
[0031] S42: Perform feature extraction on the original text after the named entity recognition in step S3 to obtain the word vector of the perceived event type, and associate the event type with the trigger word detection task.
[0032] First, the original text information after the named entity recognition in step S3 is passed through the RoBERTa-BiLSTM-CRF model to obtain the corresponding word vector as the input of the overall model, the attention score is calculated for model learning, the event type is classified, and the event type word embedding c is obtained;
[0033] The event type word embedding c is used as the associated data to obtain the text word embedding G of the perceived event type. type , the specific calculation formula is:
[0034] G type =CLN(c,h i )
[0035]
[0036] γ c =W γ c+b γ
[0037] β c =W β c+b β
[0038] c represents the event type word embedding, h i represents the word vector, μ and σ are represented by h i The mean and variance of W γ , b γ , W β , b β is the learnable parameter matrix;
[0039] S43: Text word embedding G based on the perceived event type type , complete event type and trigger word detection, including:
[0040] In the first step, the original text after named entity recognition in step S3 is input into the RoBERTa model, and then the model input vector x=[w1,w2,...,w N ], the Transformer in the middle layer performs feature extraction and outputs the following dynamic word vector H representing the event type:
[0041] H = BERT(x) = [h1,h2,...,h N ]∈R N*d
[0042] h i represents the word vector, R is the real number domain, d represents the embedding dimension of the word vector space, and its value is 768. N represents the number of tokens contained in the input original text, and its value range is 1 to 512. The output contains the prior semantic knowledge obtained by the model in the pre-training stage to solve the overfitting problem caused by insufficient corpus.
[0043] In the second step, the BiLSTM layer processes the dynamic word vector H to capture the word sequence and context features. BiLSTM operates bidirectionally, integrating both the preceding and subsequent information into each word vector to enhance the ability to understand the text. It measures the similarity between the input sentence and each event type in the event space to obtain the probability that the sentence belongs to different event types. The model uses random initialization to obtain the word embedding vector C∈R of all event types in the dataset. |C|×d , where |C| represents the number of event types, d represents the embedding dimension of the word vector space, the dynamic word vector H represents the event type, and the model designs the similarity measurement function δ(c,h i ), measure the embedding c of each event type word and the vector h of each word in the input text i The degree of association is obtained by getting each word vector h i For the weight matrix of different event types, the specific calculation formula is:
[0044]
[0045] In the above formula, v, W, and U represent the trainable parameter matrices, [;] represents the concatenation operation of the matrix, |·| represents the calculation of the absolute value, and ⊙ represents the dot product calculation of the matrix. The final calculation result δ(c,h i ), represents the weight distribution of each position in the input text word vector for the current event type word embedding c, and performs a softmax function on the calculation result to obtain a word vector s representing the event type c , the specific calculation formula is:
[0046]
[0047] The third step is to transform the word vector s representing the event type into c The similarity is measured with all event type spaces, and multiple classification of sentence event types is performed through the fully connected layer to finally obtain the event type classification result; the text word embedding G of the perceived event type is used type Perform encoding calculation to obtain the word vector representation Z of the event trigger word type , to obtain the word vector representation Z of the event trigger word type , the specific formula is:
[0048] Z type =SelfAttention(G type )
[0049] A pair of binary classifiers is used to predict the start and end positions of the event trigger word respectively. The end positions of the nearest neighbors of each start position are combined into a set of position pairs to form the entire trigger word to identify the trigger word position in the sentence. The specific calculation formula is:
[0050]
[0051] Indicates the start and end markers of the trigger word position. and To calculate the weight matrix of the trigger word start position marker and end position marker, The feature vector representing the perceived event type of the i-th token, and Bias items for calculating the start and end position markers of trigger words;
[0052] S44: Event element extraction and element role identification. All element roles appearing in the original text are counted to obtain a predefined element role set. The event elements and element role information in the original text are mapped into a matrix form. The matrix rows represent each type of role, and the matrix columns represent the position mark of each type of role. Each sentence in the original text is encoded by RoBERTa to obtain a sentence feature fs. The sentence feature fs contains the direct features of the event. The event reasoning feature fr and the entity feature fe are fused with the sentence feature fs to allow the model to learn the global semantics of the text and the association between event elements to obtain the fused feature Ms. Finally, the sigmoid function is used as a binary classifier to predict the position mark of the element in each type of element role. The specific calculation formula is:
[0053]
[0054] in, and Respectively represent the element start and end position markers predicted by the model, and is the feature vector of the kth position in the fusion feature Ms;
[0055] Finally, the binary cross entropy is used to calculate the loss at the start and end positions, and the two are added together to get the total loss. The specific calculation formula is:
[0056]
[0057] L=L s +L e
[0058] in, and The markers representing the actual start and end positions of the element, L s and L e Respectively represent the loss functions of the starting and ending positions of the element, and L is the total loss;
[0059] S45: integrating and storing the event extraction results, combining the obtained event type, event trigger word, event element and element role into an output statement containing overlapping information, combining into a Json object information and storing it;
[0060] S5: Build a knowledge graph and visualize it;
[0061] The entity information of unearthed cultural relics obtained through the named entity recognition process in step S3 and the event information obtained through the event extraction technology in step S4 are relationally modeled to construct a knowledge graph of urban ruins and perform visual display.
[0062] Optionally, the S1 collects and organizes archaeological excavation results and historical documents of urban ruins, and the process of obtaining urban ruins text data also includes data expansion and data cleaning. Data expansion includes crawling encyclopedia data using crawler technology to supplement the urban ruins text data.
[0063] Optionally, S2 is based on a subdivided domain vocabulary library, which focuses on the name, age, material, shape and historical events of unearthed cultural relics.
[0064] Optionally, the S31 preprocessing includes text cleaning and word segmentation. The first step is to clean the text and remove irrelevant characters and punctuation marks. The second step is to perform word segmentation to segment continuous text strings into independent words or phrases, and to perform part-of-speech tagging on the segmented words and phrases. A part-of-speech tag, such as verb, noun, or adjective, is assigned to each word or phrase to provide auxiliary information for entity recognition. Regarding word segmentation, the HanLP word segmentation tool is used to perform word segmentation. Before word segmentation, the seed word library of the cultural relics and historical events constructed in step S2 is input into the HanLP dictionary to supplement and improve the word library. The continuous text string is then input into HanLP to be segmented into independent words or phrases.
[0065] Optionally, the S32 performs on the original text after preprocessing to clarify the entity type that needs to be identified, including: annotating the text using the BIOES annotation method, clarifying the entity type that needs to be identified, and obtaining annotation data, wherein "B" represents the start character of the entity, "I" represents the internal character of the entity, "O" represents the non-entity character, "E" represents the end character of the entity, and "S" represents a single-word entity.
[0066] Optionally, the Neo4j Bloom tool is used in S5 for visualization.
[0067] The present invention also provides a cultural relic data management system, which applies the urban ruins knowledge graph construction method of the above-mentioned fusion event extraction technology when running, including an unearthed cultural relic data management module, an unearthed cultural relic data review module, an unearthed cultural relic image search module, an unearthed cultural relic image marking module and a system management module that are interconnected:
[0068] The unearthed cultural relics data management module includes keyword search and result export, cultural relics picture and detailed description display, cultural relics data addition and modification, and cultural relics data deletion, so as to realize the four sub-functions of keyword search and result export, cultural relics picture and detailed description display, cultural relics data addition and modification, and cultural relics data deletion;
[0069] The unearthed cultural relics data review module includes data upload application, data viewing application, retrieval application, administrator approval application, and deletion application, so as to realize the function of reviewing the cultural relics data uploaded by users, manage the cultural relics data, and realize the functions of data upload, viewing and retrieval application, administrator approval application, and deletion application;
[0070] The unearthed cultural relics image search module includes a text-based image search mode and an image-based image search mode;
[0071] The unearthed cultural relics picture marking module is used to realize the function of semantically marking the picture content. The user creates a project and imports the picture set that needs to be marked, and semantically marks the pictures. The cultural relics data management system provides a variety of marking modes, including label marking mode, identification box marking mode, and closed curve marking mode;
[0072] The system management module is accessible only to administrators, and the management and maintenance of the cultural relics data management system is achieved through the system management module, including the management and maintenance of pages, accounts, data, logs, and permission content.
[0073] The present invention also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the method for constructing an urban ruins knowledge graph integrating the above-mentioned event extraction technology is implemented.
[0074] In summary, the present invention provides a method for constructing an urban ruins knowledge graph that integrates event extraction technology. On the basis of extracting the entities of unearthed cultural relics from urban ruins, combined with event extraction technology, the RoBERTa-BiLSTM-CRF model is used as the main framework, and a large language model is introduced to extract event reasoning information and entity information, and external supplementary features are constructed. Compared with traditional technologies, the association between event elements is more deeply excavated, the dependence on manually designed rules is reduced, and the accuracy of event extraction tasks is greatly improved. The above model identifies the procedural knowledge in archaeological achievements and literature, and sorts out historical events related to the ruins, which helps to enrich the content of the cultural relics knowledge graph, increase the entities and relationships of the knowledge graph, and enable it to more comprehensively express urban ruins cultural relics and the history and culture behind them, which has important research significance and use value.
[0075] Preferably, the preprocessing of step S31 includes text cleaning and word segmentation. The first step is to clean the text and remove irrelevant characters and punctuation marks. The second step is to perform word segmentation to segment continuous text strings into independent words or phrases, and to perform part-of-speech tagging on the segmented words and phrases. A part-of-speech tag, such as verb, noun, or adjective, is assigned to each of the words or phrases to provide auxiliary information for entity recognition. Regarding word segmentation, the HanLP word segmentation tool is used for word segmentation. Before word segmentation, the seed word library of the cultural relics and historical events constructed in step S2 is input into the HanLP dictionary to supplement and improve the word library. The continuous text string is then input into HanLP and segmented into independent words or phrases. The introduction of this method can provide auxiliary information for subsequent entity recognition, and can make the semantics of the processing results clearer and the processing speed faster.
[0076] Preferably, the dynamic word vector H is processed by the BiLSTM layer to capture the word sequence and context features. The model uses random initialization to obtain the word embedding vector C∈R of all event types in the dataset.|C|×d , where |C| represents the number of event types, d represents the embedding dimension of the word vector space, the dynamic word vector H represents the event type, and the model designs the similarity measurement function δ(c,h i ), measure the embedding c of each event type word and the vector h of each word in the input text i The degree of association is obtained by getting each word vector h i The weight matrices for different event types show that BiLSTM operates in a bidirectional manner, integrating both preceding and subsequent information into each word vector to enhance the ability to understand the text, measure the similarity between the input sentence and each event type in the event space, and obtain the probability that the sentence belongs to different event types. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0078] Figure 1 It is a flow chart of the method for constructing an urban ruins knowledge graph integrating event extraction technology in an embodiment of the present invention.
[0079] Figure 2 This is a cultural relics data management system module of the embodiment of the present invention Figure 1 .
[0080] Figure 3 This is a cultural relics data management system module of the embodiment of the present invention Figure 2 . DETAILED DESCRIPTION
[0081] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0082] As a structured semantic knowledge base, knowledge graph organizes complex knowledge in a visual and structured way to facilitate computer program understanding, storage and retrieval. In recent years, with the development and application of artificial intelligence technology, knowledge graph, as one of the key technologies, has been widely used in intelligent search, intelligent question and answer, personalized recommendation, content distribution and other fields.
[0083] However, according to investigations and studies, the current research on cultural relics knowledge graphs mainly focuses on the description of the attributes of the cultural relics themselves, such as age, type, material, artistic style, etc., while the integration and analysis of information such as historical events, character relationships, and social background behind the cultural relics is relatively insufficient. As a unique type of cultural relic, the historical events and character relationships behind urban ruins are often more complex and diverse. The limitations of traditional methods have led to the lack of depth and breadth in their knowledge graphs, making it difficult to meet the needs of in-depth research and comprehensive display of the value of cultural relics, and they are no longer adapted to the needs of today's social development. Therefore, it is urgent to study a new urban ruins knowledge graph construction method and cultural relics data management system, which can not only enrich the content of the cultural relics knowledge graph, but also reveal the deep connection between cultural relics and historical events, solve the problems encountered in the current construction of cultural relics knowledge graphs, and have sufficient research significance and use value.
[0084] The present invention provides a method for constructing a knowledge graph of urban ruins that integrates event extraction technology. The present invention aims to extract the entities of unearthed cultural relics from urban ruins, combine event extraction technology, use the RoBERTa-BiLSTM-CRF model as the main framework, introduce a large language model to extract event reasoning information and entity information, and construct external supplementary features. Compared with traditional technologies, it can more deeply explore the relationship between event elements, reduce dependence on manually designed rules, and greatly improve the accuracy of event extraction tasks. The above model identifies procedural knowledge in archaeological findings and literature, and sorts out historical events related to the ruins, which helps to enrich the content of the cultural relics knowledge graph, increase the entities and relationships of the knowledge graph, and enable it to more comprehensively express urban ruins cultural relics and the history and culture behind them. The method for constructing a knowledge graph of urban ruins that integrates event extraction technology of the present invention is specifically as follows Figure 1-3 As shown, the following steps are included:
[0085] S1: Collect and organize archaeological excavation results and historical documents of urban ruins to obtain urban ruins text data, which includes ruins name data, age data, geographical location data, composition data, surveying and mapping record data, image record data, archaeological excavation data, unearthed cultural relics data, relevant person data, and relevant event data; the unearthed cultural relics data includes multiple dimensional information, each dimensional information includes: name, age, unearthed location, description, measurement, material, decoration, image record, etc.;
[0086] S2: Construction of seed word library of cultural relics and historical events;
[0087] The seed word library construction of cultural relics and historical events includes:
[0088] S21: initial seed word library selection: refer to the existing word library in the field of unearthed cultural relics and archaeological excavation and perform manual screening as the initial seed word library;
[0089] S22: constructing a final seed word library in the field of cultural relics and historical events; including: expanding the initial seed word library, and after the expansion, adding and modifying it in combination with expert evaluation to obtain a final seed word library in the field of cultural relics and historical events;
[0090] S3: Named entity recognition: Take the archaeological excavation results and historical documents of urban ruins as the original text, and implement named entity recognition for entity types related to urban ruins and historical events, including: the name of unearthed cultural relics, age, material, shape, name of people, place name, organization. The specific steps of named entity recognition include:
[0091] S31: preprocessing; preprocessing the original text;
[0092] S32: annotating the preprocessed original text, clarifying the entity type to be identified, and obtaining annotated data;
[0093] S33: using the preprocessed original text and the annotated text as input to a named entity recognition model, using the annotated data as a result, training the model, using the trained model to process the unannotated descriptions of unearthed cultural relics, outputting the named entity recognition results, and completing the named entity recognition of the unearthed cultural relics;
[0094] S4: The event extraction technology using large language models (LLMs) to generate external supplementary features is used to extract event information from the original text after the named entity recognition in step S3, and convert it into structured data; the event extraction model includes: RoBERTa semantic representation model, BiLSTM feature extraction model and CRF classification model, using LLMs to extract event reasoning information and entity information as external supplementary features, and using the reasoning and context understanding capabilities of LLMs to assist the RoBERTa-BiLSTM-CRF model to realize event extraction, specifically including:
[0095] S41: Extract event reasoning information and entity information with the help of LLMs, build external supplementary features, the model mines explicit and implicit associations between event elements, extracts event reasoning information, and builds event reasoning features. Event elements are named entities. LLMs are used to directly extract entities from sentences and build entity features.
[0096] In the process of event reasoning information extraction, the thinking chain is the main method. Before outputting the final answer, the RoBERTa-BiLSTM-CRF model explicitly outputs the intermediate step-by-step reasoning steps. The prompt for event reasoning information extraction consists of three parts: event e, document M, and event element r. The prompt for event reasoning information extraction is input into the large language model to obtain event reasoning information Fr. The event reasoning information Fr includes the event element extraction steps, the correlation analysis between elements, and the preliminary element extraction conclusion; the document M is the original text without named entity recognition;
[0097] In the process of entity feature extraction, an entity feature prompt is designed, and the entity feature prompt contains a sentence s in the document. The entity feature prompt is input into the large language model to obtain entity information Fe;
[0098] The event reasoning information Fr and entity information Fe are input into the RoBERTa-BiLSTM-CRF model for encoding to obtain the reasoning feature fr and entity feature fe respectively, in preparation for event element extraction;
[0099] S42: Perform feature extraction on the original text after named entity recognition in step S3 to obtain word vectors of perceived event types, and associate event types with trigger word detection tasks.
[0100] First, the original text information after named entity recognition in step S3 is passed through the RoBERTa-BiLSTM-CRF model to obtain the corresponding word vector as the input of the overall model, and the attention score is calculated for model learning, and the event type is classified to obtain the event type word embedding c;
[0101] Take the event type word embedding c as the associated data and obtain the text word embedding G of the perceived event type type , the specific calculation formula is:
[0102] G type =CLN(c,h i )
[0103]
[0104] γ c =W γ c+b γ
[0105] β c =W β c+b β
[0106] c represents the event type word embedding, h i represents the word vector, μ and σ are represented by h i The mean and variance of Wγ , b γ , W β , b β is the learnable parameter matrix;
[0107] S43: Text word embedding G based on perceived event type type , complete event type and trigger word detection, including:
[0108] In the first step, the original text after named entity recognition in step S3 is input into the RoBERTa model, and then the model input vector x=[w1,w2,...,w N ], the Transformer in the middle layer performs feature extraction and outputs the following dynamic word vector H representing the event type:
[0109] H = BERT(x) = [h1,h2,...,h N ]∈R N*d
[0110] h i represents the word vector, R is the real number domain, d represents the embedding dimension of the word vector space, and its value is 768. N represents the number of tokens contained in the input original text, and its value range is 1 to 512. The output contains the prior semantic knowledge obtained by the model in the pre-training stage to solve the overfitting problem caused by insufficient corpus.
[0111] In the second step, the BiLSTM layer processes the dynamic word vector H to capture the word sequence and context features. BiLSTM operates bidirectionally, integrating both the preceding and subsequent information into each word vector to enhance the ability to understand the text. It measures the similarity between the input sentence and each event type in the event space to obtain the probability that the sentence belongs to different event types. The model uses random initialization to obtain the word embedding vector C∈R of all event types in the dataset. |C|×d , where |C| represents the number of event types, d represents the embedding dimension of the word vector space, the dynamic word vector H represents the event type, and the model designs the similarity measurement function δ(c,h i ), measure the embedding c of each event type and the vector h of each word in the input text i The degree of association is obtained by getting each word vector h i For the weight matrix of different event types, the specific calculation formula is:
[0112]
[0113] In the above formula, v, W, and U represent the trainable parameter matrices, [;] represents the concatenation operation of the matrix, |·| represents the calculation of the absolute value, and ⊙ represents the dot product calculation of the matrix. The final calculation result δ(c,h i ), represents the weight distribution of each position in the input text word vector for the current event type word embedding c, and performs a softmax function on the calculation result to obtain the word vector s representing the event type c , the specific calculation formula is:
[0114]
[0115] The third step is to use the word vector s representing the event type c The similarity is measured with all event type spaces, and multiple classification of sentence event types is performed through the fully connected layer to finally obtain the event type classification result; the text word embedding G of the perceived event type is used type Perform encoding calculation to obtain the word vector representation Z of the event trigger word type , to obtain the word vector representation Z of the event trigger word type , the specific formula is:
[0116] Z type =SelfAttention(G type )
[0117] A pair of binary classifiers is used to predict the start and end positions of the event trigger word respectively. The end positions of the nearest neighbors of each start position are combined into a set of position pairs to form the entire trigger word to identify the trigger word position in the sentence. The specific calculation formula is:
[0118]
[0119] Indicates the start and end markers of the trigger word position. and To calculate the weight matrix of the trigger word start position marker and end position marker, The feature vector representing the perceived event type of the i-th token, and Bias items for calculating the start and end position markers of trigger words;
[0120] S44: Event element extraction and element role identification. All element roles appearing in the original text are counted to obtain a predefined element role set. The event elements and element role information in the original text are mapped into a matrix form. The matrix rows represent each type of role, and the matrix columns represent the position mark of each type of role. Each sentence in the original text is encoded by RoBERTa to obtain the sentence feature fs. The sentence feature fs contains the direct features of the event. The event reasoning feature fr and the entity feature fe are fused with the sentence feature fs to allow the model to learn the global semantics of the text and the association between event elements to obtain the fused feature Ms. Finally, the sigmoid function is used as a binary classifier to predict the position mark of the element in each type of element role. The specific calculation formula is:
[0121]
[0122] in, and Respectively represent the element start and end position markers predicted by the model, and is the feature vector of the kth position in the fusion feature Ms;
[0123] Finally, the binary cross entropy is used to calculate the loss at the start and end positions, and the two are added together to get the total loss. The specific calculation formula is:
[0124]
[0125] L=L s +L e
[0126] in, and The markers representing the actual start and end positions of the element, L s and L e Respectively represent the loss functions of the starting and ending positions of the element, and L is the total loss;
[0127] S45: integrating and storing the event extraction results, combining the obtained event type, event trigger word, event element and element role into an output statement containing overlapping information, combining into a Json object information and storing it;
[0128] S5: Build a knowledge graph and visualize it;
[0129] The entity information of unearthed cultural relics obtained through the named entity recognition process in step S3 and the event information obtained through the event extraction technology in step S4 are relationally modeled to construct a knowledge graph of urban ruins and perform visual display.
[0130] It should be noted that each dimensional information includes: name, age, unearthed location, description, measurement, material, pattern, image record, etc., but is not limited to name, age, unearthed location, description, measurement, material, pattern, image record. This is only a specific embodiment of the present invention and may also include other reasonable module information, all within the protection scope of the present invention.
[0131] In a specific embodiment of the present invention, step S1 collects and organizes archaeological excavation results and historical documents of urban ruins. The process of obtaining urban ruins text data also includes data expansion and data cleaning. Data expansion includes using crawler technology to crawl encyclopedia data to supplement the urban ruins text data.
[0132] It should be noted that the similarity between the word vector representing the event type and the entire event type space is measured, and the sentence event type is multi-classified through the fully connected layer. After the event type classification result is finally obtained, in order to obtain the word vector representation of the event trigger word, the self-attention mechanism is used to encode and calculate the word vector of the perceived event type to obtain the word vector representation of the event trigger word.
[0133] The preprocessed original text and the annotated text are used as input to the named entity recognition model, and the annotated data is used as the result. The model is trained, and the trained model is used to process the unannotated descriptions of unearthed cultural relics, and the named entity recognition results are output to complete the named entity recognition of the unearthed cultural relics; wherein, the model is used to predict the processed original text to obtain the prediction result, and the prediction result is compared with the data annotation, thereby greatly improving the accuracy of model recognition. After the model is trained to a good degree, the output obtained by the model is used as the final result of named entity recognition.
[0134] There are various methods for expanding the initial seed word library, which are intended to increase the vocabulary in the word library through different approaches and strategies, and improve the coverage and accuracy of the word library. The following are methods that can be used in the present invention:
[0135] 1. Expansion based on synonyms and antonyms
[0136] Synonym expansion: Use a synonym dictionary or online tool to find synonyms for each word in the initial seed vocabulary and add them to the vocabulary. This method can quickly increase the number of related words.
[0137] Antonym expansion: Although antonyms are semantically opposite to the original words, they still belong to the same semantic field, so in some scenarios, the expansion of antonyms also makes sense.
[0138] 2. Expansion based on word form changes
[0139] Generate new words using the rules of word form changes (such as the tense changes of verbs, the singular and plural changes of nouns, etc.). This method is suitable for languages with rich word form changes, such as English.
[0140] 3. Extensions based on related concepts
[0141] Domain knowledge expansion: Based on the domain to which the initial seed vocabulary belongs, the domain knowledge base or expert knowledge is used to expand the relevant vocabulary. For example, in the medical field, medical terms can be expanded by consulting medical dictionaries or medical literature.
[0142] Context expansion: By analyzing the context of the initial seed vocabulary in the text, relevant words are extracted. This method requires the use of natural language processing techniques such as text mining and semantic analysis.
[0143] 4. Methods based on statistics and machine learning
[0144] Co-occurrence analysis: Using the co-occurrence information of words in the corpus, find other words that frequently co-occur with the words in the initial seed word library and use them as expanded words. This method is based on statistical principles and can discover potential connections between words.
[0145] Word vector technology: Use word vectors (such as Word2Vec, GloVe, etc.) to represent the semantic relationship between words, and calculate the similarity between word vectors to find other words with similar semantics to the words in the initial seed word library. This method can capture the deep semantic connection between words.
[0146] 5. Expansion based on user feedback
[0147] In actual applications, the vocabulary can be expanded through user feedback. For example, when a user searches or enters a certain word, the system can recommend related words for the user to choose, and update and expand the vocabulary based on the user's click behavior.
[0148] 6. Leverage external resources
[0149] Specialized dictionaries and term bases: These resources usually contain a large number of specialized words and terms and are very useful for expanding the vocabulary in a specific field.
[0150] Web crawlers and APIs: By writing web crawler programs or calling relevant API interfaces, you can crawl a large number of words and phrases from the Internet as a source of vocabulary expansion. However, you need to pay attention to the quality and copyright issues of the data.
[0151] In summary, expanding the initial seed vocabulary requires combining a variety of methods and strategies. You can choose the appropriate method according to actual needs and continuously optimize and adjust the vocabulary content.
[0152] In order to identify the position of the trigger word in the sentence, in a specific embodiment of the present invention, a pair of binary classifiers is used to predict the start position and end position of the event trigger word respectively, and the end position of the nearest neighbor of each start position is combined into a group of position pairs to constitute the entire trigger word.
[0153] In a specific embodiment of the present invention, step S2 in the urban ruins knowledge graph construction method integrating event extraction technology is based on a subdivided domain vocabulary library, which focuses on the name, age, material, shape and historical events of unearthed cultural relics.
[0154] In a specific embodiment of the present invention, the preprocessing of step S31 includes text cleaning and word segmentation. The first step is to clean the text and remove irrelevant characters and punctuation marks. The second step is to perform word segmentation to segment continuous text strings into independent words or phrases, and to perform part-of-speech tagging on the segmented words and phrases. A part-of-speech tag, such as verb, noun, or adjective, is assigned to each word or phrase to provide auxiliary information for entity recognition. Regarding word segmentation, the HanLP word segmentation tool is used for word segmentation. Before word segmentation, the seed word library of the cultural relics and historical events constructed in step S2 is input into the HanLP dictionary to supplement and improve the word library. The continuous text string is then input into the HanLP and segmented into independent words or phrases. The introduction of this method can provide auxiliary information for subsequent entity recognition, and can make the semantics of the processing results clearer and the processing speed faster.
[0155] In a specific embodiment of the present invention, in a method for constructing a knowledge graph of urban ruins that integrates event extraction technology, step S32 is performed on the original text after preprocessing to clarify the entity type that needs to be identified, including: annotating the text using the BIOES annotation method to clarify the entity type that needs to be identified, and obtaining annotation data, wherein "B" represents the start character of the entity, "I" represents the internal character of the entity, "O" represents a non-entity character, "E" represents the end character of the entity, and "S" represents a single-word entity.
[0156] Taking the text in the archaeological data of urban ruins, "Pottery lid bean M775:6, total height 28.8 cm, mouth diameter 16.5 cm, belly diameter 18.6 cm, bottom diameter 11.6 cm, lid height 10 cm, lid diameter 19.2 cm" as an example, the description and annotation data of the cultural relics are explained:
[0157] Among them, the description of the cultural relic "Pottery Covered Bean M775:6" is "total height 28.8 cm, diameter 16.5 cm, belly diameter 18.6 cm, bottom diameter 11.6 cm, lid height 10 cm, lid diameter 19.2 cm", and the corresponding annotation data is "B-cultural relic name I-cultural relic name EB-cultural relic number I-cultural relic number I-cultural relic number I-cultural relic number I-cultural relic number E-OOOOOOOO, OOOOOOOO, OOOOOOOO, OOOOOOOO, OOOOOOOO".
[0158] It should be noted that the event extraction task involves the following important components: event type, event trigger, event element and element role. Event type refers to the specific event type to which the event belongs. Event trigger is the most iconic word in the sentence that best represents the occurrence of event activities, reflecting the most important feature of the event type, usually dominated by verbs. Event elements refer to the relevant participants in the event activities, usually entities or entity attribute words such as people, time, and place in the sentence, and are an important part of the event. Element role refers to the relevant component role played by the constituent elements of the event under certain event categories, usually divided into subjects, objects, events, places and other related roles. The original data of this article is document type. For the document-level event extraction (D-EE) task, traditional methods often rely on predefined rules or features, cannot handle complex contextual relationships, and usually have the problem of cross-event element confusion. Pre-trained LLMs have rich semantic knowledge. By providing some hints or guidance to LLMs, they can accurately extract event and entity information and infer events or entity relationships that are not explicitly mentioned from the context. However, due to the hallucination problem of LLMs, directly using them for event extraction may lead to serious accuracy problems, such as generating parameters outside the context. This paper introduces LLMs to extract event reasoning information and entity information as external supplementary features, making full use of the reasoning and context understanding capabilities of LLMs to assist the RoBERTa-BiLSTM-CRF model in event extraction.
[0159] In summary, the present invention is a method for constructing a knowledge graph of urban ruins that integrates event extraction technology. The present invention aims to extract the entities of unearthed cultural relics from urban ruins, combine event extraction technology, use the RoBERTa-BiLSTM-CRF model as the main framework, introduce a large language model to extract event reasoning information and entity information, and construct external supplementary features. Compared with traditional technologies, it digs deeper into the relationship between event elements, reduces dependence on manually designed rules, and effectively improves the accuracy of event extraction tasks. The above model identifies procedural knowledge in archaeological findings and literature, and sorts out historical events related to the ruins, which helps to enrich the content of the cultural relics knowledge graph, increase the entities and relationships of the knowledge graph, and enable it to more comprehensively express urban ruins cultural relics and the history and culture behind them.
[0160] In order to improve the display effect, in a specific embodiment of the present invention, the Neo4j Bloom tool is used for visualization in step S5. Neo4j Bloom is a powerful graph data visualization tool that can help users explore, analyze and display data in the Neo4j graph database in an intuitive and convenient way.
[0161] Input the above text and prompt into the large language model and get the following answer:
[0162] To find the complete information of the extracted event in the sentence, you can follow the steps below:
[0163] By introducing a large language model and adopting the mode of thought chain analysis, the information contained in the event can be extracted, including event trigger words, event types, event elements, element roles and other related elements. At the same time, LLMs can connect the context, fully capture the semantic features, and further deduce the implicit information in the event, such as the time and place of the event in the above event.
[0164] For entity feature extraction, we also design a prompt, which contains a sentence s in the document, such as: "You are an expert in the field of entity extraction. Now you are asked to extract the sentence <s>Extract all entities from the text. " Input the prompt into the large language model to obtain the entity information Fe. The large language model has learned a wealth of language patterns in the pre-training stage and has a large amount of general knowledge, which can effectively identify entities in the text, such as time, person, place, etc.
[0165] Taking the text in the archaeological data of urban ruins "The iron ratchet is a tool similar to a gear, but it is not a real gear for transmission, but a mechanical component for braking." as an example, the entity feature extraction is explained:
[0166] Input the above text and prompt into the large language model and get the following answer:
[0167] Analyzing this text, we can get the following entities
[0168] Entity 1: Iron ratchet, defined as an object similar to a gear, used as a mechanical component for braking.
[0169] Entity 2: Gear, defined as a mechanical component used for transmission.
[0170] Entity 3: Mechanical component, used for braking.
[0171] Further get the relationship between entities:
[0172] Entity 1 Iron Ratchet and Entity 2 Gear: The Iron Ratchet is similar to a gear, but it is not a real gear used for transmission.
[0173] Entity 1 Iron Ratchet and Entity 3 Mechanical Component: The Iron Ratchet is a mechanical component used for braking.
[0174] Entity 2 gears and entity 3 mechanical components: gears are mechanical components for transmission, while iron ratchets are mechanical components for braking.
[0175] Through the understanding ability of LLMs, all entities appearing in a sentence can be identified, and the attributes of each entity can be accurately analyzed, and the relationship between entities can be obtained through reasoning.
[0176] The above event reasoning information Fr and entity information Fe are input into the model for encoding to obtain reasoning features fr and entity features fe respectively, in preparation for subsequent event element extraction.
[0177] It should be noted that the visualization display tool is not limited to the Neo4j Bloom tool, and other types of tools may also be used. This is only a specific embodiment of the present invention, and other reasonable tools are also within the specific protection scope of the present invention.
[0178] like Figure 2-3 As shown, the present invention is a cultural relic data management system, which applies the urban ruins knowledge graph construction method of the above-mentioned fusion event extraction technology when running, including an unearthed cultural relic data management module 1, an unearthed cultural relic data review module 2, an unearthed cultural relic image search module 3, an unearthed cultural relic image marking module 4 and a system management module 5 which are interconnected:
[0179] The unearthed cultural relics data management module 1 includes keyword search and result export, cultural relics picture and detailed description display, cultural relics data addition and modification, and cultural relics data deletion, so as to realize the four sub-functions of keyword search and result export, cultural relics picture and detailed description display, cultural relics data addition and modification, and cultural relics data deletion;
[0180] The unearthed cultural relics data review module 2 includes data upload application, data viewing application, retrieval application, administrator approval application, and deletion application, so as to realize the function of reviewing the cultural relics data uploaded by users, manage the cultural relics data, and realize the functions of data upload, viewing and retrieval application, administrator approval application, and deletion application;
[0181] Unearthed cultural relics image search module 3, including text-based image search and image-based image search modes;
[0182] The unearthed cultural relics picture marking module 4 is used to realize the function of semantically marking the picture content. The user creates a project and imports the picture set that needs to be marked, and semantically marks the pictures. The cultural relics data management system provides a variety of marking modes, including label marking mode, identification box marking mode, and closed curve marking mode;
[0183] System management module 5: The system management module is accessible only to administrators. The management and maintenance of the cultural relics data management system is achieved through the system management module 5, including the management and maintenance of pages, accounts, data, logs, and permission content.
[0184] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for constructing an urban ruins knowledge graph integrating the above-mentioned event extraction technology.
[0185] It should be noted that regarding the process of clarifying the construction goals, first of all, it is necessary to clarify the goals of constructing the knowledge graph of urban relics, including but not limited to: comprehensively recording key information such as historical events, people, and places of urban relics. Establishing the relationship between entities to form a structured knowledge network. Providing data support for the protection, research, and cultural dissemination of urban relics. These are all tasks that need to be operated and completed.
[0186] Regarding data collection, there can be many sources and channels, such as:
[0187] Historical documents: Collect historical documents, archaeological reports, academic papers, etc. about urban sites.
[0188] Network data: obtain relevant information from the Internet, social media, government websites and other channels.
[0189] Field research: obtain first-hand information through field visits, interviews, etc.
[0190] In the process of building the knowledge graph, for relationship extraction, it is necessary to establish the association relationship between entities, such as "site-construction time", "site-discoverer", "site-historical event", etc. These relationships constitute the skeleton of the knowledge graph.
[0191] Regarding knowledge representation, graph structures (such as RDF, Neo4j, etc.) can be used to represent entities, attributes, and relationships in the knowledge graph. Each entity is a node, and the relationship is the edge connecting the nodes.
[0192] When constructing the urban ruins knowledge graph, in addition to associating cultural relics and events, the present invention also needs to associate information from multiple aspects to form a comprehensive and in-depth knowledge system. The following are some key elements that together constitute the rich content of the urban ruins knowledge graph. Basic information of the ruins:
[0193] Geographical location: including longitude and latitude, administrative division, surrounding geographical environment, etc.
[0194] Historical evolution: the origin, development, changes and important historical nodes of the site.
[0195] Site types: such as ancient city sites, palace sites, tomb sites, etc. Different types of sites have different characteristics and values.
[0196] Cultural relics and relics:
[0197] Unearthed Cultural Relics: Detailed description of various cultural relics unearthed from the site, including their material, age, production process, cultural significance, etc.
[0198] Relic structure: The layout of the site, architectural remains, roads, water systems, etc., reflect the spatial organization and lifestyle of ancient society.
[0199] Historical events and figures:
[0200] Relevant historical events: important historical events directly or indirectly related to the site, which have had a profound impact on the formation, development or abandonment of the site.
[0201] Historical figures: Historical figures related to the site, including builders, users, protectors, etc. Their activities and behaviors add a humanistic touch to the site.
[0202] Cultural and social background:
[0203] Cultural background: The cultural background of the area where the site is located, including religious beliefs, customs, artistic styles, etc. This background information helps to understand the cultural connotation of the site.
[0204] Socio-economic conditions: The socio-economic structure, production and living style, population distribution, etc. of the period in which the site is located reflect the overall appearance of ancient society.
[0205] It should be noted that regarding the data preprocessing process: first, the collected data needs to be cleaned to remove duplicate, erroneous and irrelevant information. Secondly, data standardization needs to be performed, such as unified naming specifications, time formats, etc. Finally, what needs to be done is to convert unstructured or semi-structured text data into structured data for subsequent processing.
[0206] In summary, the present invention adopts event extraction technology to obtain historical events related to the site on the basis of named entity recognition of unearthed cultural relics in the urban site information, and constructs a knowledge graph by identifying and associating the site with the historical events, and then designs and builds a data management system for unearthed cultural relics in the urban site. The purpose of the present invention is to solve the problem of lack of historical event description in the knowledge graph of cultural relics, which is a new method for constructing a knowledge graph of urban sites. On the basis of named entity recognition of unearthed cultural relics information in digital resources, the method adopts event extraction technology assisted by a large language model to obtain historical events related to the site, extracts historical event information related to urban sites, and combines the site with related historical events to construct a knowledge graph, so as to better record the historical stories behind the cultural relics, and provide researchers and the public with more intuitive and detailed knowledge resources. On this basis, the urban site cultural relics data management system is designed and built, so that researchers and the public can quickly obtain detailed information on unearthed cultural relics, and the digitized cultural relics data also allows researchers to access and analyze cultural relics data without geographical restrictions. At the same time, the system can also help the public better understand and learn cultural relics knowledge.
[0207] In a specific embodiment of the present invention, S31 preprocessing includes text cleaning and word segmentation. The first step is to clean the text and remove irrelevant characters and punctuation marks. The second step is to perform word segmentation, segmenting the continuous text string into independent words or phrases, and perform part-of-speech tagging on the segmented words and phrases. Each word or phrase is assigned a part-of-speech tag, such as verb, noun, adjective, to provide auxiliary information for entity recognition. Regarding word segmentation, the HanLP word segmentation tool is used for word segmentation. Before word segmentation, the seed word library of cultural relics and historical events constructed in step S2 is input into the HanLP dictionary to supplement and improve the word library, and then the continuous text string is input into HanLP to be segmented into independent words or phrases. It should be noted that the purpose of this step is to remove noise and invalid information, decompose the text into meaningful words, and help the subsequent model to better learn and identify cultural relic entities.
[0208] In the specific embodiment of the present invention, in the process of event reasoning information extraction, the thinking chain is mainly used. Before outputting the final answer, the RoBERTa-BiLSTM-CRF model explicitly outputs the intermediate step-by-step reasoning steps. The prompt for event reasoning information extraction consists of three parts: event e, document M, and event element r, such as: "document <m>There are some <e>Events, how to find out about events <e>Elements in <r>? Please use the thinking chain method to reason and answer step by step; "Enter the prompt into the large language model, such as ChatGPT, to obtain the event reasoning information Fr, which includes the event element extraction steps, element correlation analysis and preliminary element extraction conclusions;
[0209] In a specific embodiment of the present invention, during the entity feature extraction process, an entity feature prompt is designed, and the entity feature prompt includes a sentence s in the document, such as: "You are an expert in the field of entity extraction, and now you are required to extract the entity feature from the sentence <s>Extract all entities from the text. " Input the prompt into the large language model to obtain the entity information Fe. ChatGPT has learned a rich language pattern in the pre-training stage and has a lot of general knowledge. It can effectively identify entities in the text, such as time, people, places, etc.
[0210] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.< / s> < / r> < / e> < / e> < / m> < / s>
Claims
1. A method for constructing a knowledge graph of urban relics integrating event extraction technology, characterized in that: The steps include: S1: Collect and organize archaeological excavation results and historical documents of urban ruins to obtain urban ruins text data, which includes ruins name data, age data, geographical location data, composition data, surveying and mapping record data, image record data, archaeological excavation data, unearthed cultural relics data, relevant person data, and relevant event data; The data of unearthed cultural relics include multiple dimensions of information, each of which includes: name, age, unearthed location, description, measurement, material, pattern, and image record; S2: Construction of seed word library of cultural relics and historical events; The seed word library construction of the cultural relics and historical events includes: S21: initial seed word library selection: refer to the existing word library in the field of unearthed cultural relics and archaeological excavation and perform manual screening as the initial seed word library; S22: constructing a final seed word library in the field of cultural relics and historical events; including: expanding the initial seed word library, and after the expansion, adding and modifying it in combination with expert evaluation to obtain a final seed word library in the field of cultural relics and historical events; S3: Named entity recognition: Take the archaeological excavation results and historical documents of urban ruins as the original text, and implement named entity recognition for entity types related to urban ruins and historical events, including: the name of unearthed cultural relics, age, material, shape, name of people, place name, organization. The specific steps of named entity recognition include: S31: preprocessing: preprocessing the original text; S32: annotating the preprocessed original text, clarifying the entity type to be identified, and obtaining annotated data; S33: using the preprocessed original text and the annotated text as input to a named entity recognition model, using the annotated data as a result, training the model, using the trained model to process the unannotated descriptions of unearthed cultural relics, outputting the named entity recognition results, and completing the named entity recognition of the unearthed cultural relics; S4: The event extraction technology using large language models (LLMs) to generate external supplementary features is used to extract event information from the original text after the named entity recognition in step S3, and convert it into structured data; the event extraction model includes: RoBERTa semantic representation model, BiLSTM feature extraction model and CRF classification model, using LLMs to extract event reasoning information and entity information as external supplementary features, and using the reasoning and context understanding capabilities of LLMs to assist the RoBERTa-BiLSTM-CRF model to realize event extraction, specifically including: S41: Extract event reasoning information and entity information with the help of LLMs, build external supplementary features, the model mines explicit and implicit associations between event elements, extracts event reasoning information, and builds event reasoning features. Event elements are named entities. LLMs are used to directly extract entities from sentences and build entity features. In the process of event reasoning information extraction, the thinking chain is the main method. Before outputting the final answer, the RoBERTa-BiLSTM-CRF model explicitly outputs the intermediate step-by-step reasoning steps. The prompt for event reasoning information extraction consists of three parts: event e, document M, and event element r. The prompt for event reasoning information extraction is input into the large language model to obtain event reasoning information Fr. The event reasoning information Fr includes the event element extraction steps, the correlation analysis between elements, and the preliminary element extraction conclusion; the document M is the original text without named entity recognition; In the entity feature extraction process, an entity feature prompt is designed, wherein the entity feature prompt includes a sentence s in the document, and the entity feature prompt is input into the large language model to obtain entity information Fe; The event reasoning information Fr and the entity information Fe are input into the RoBERTa-BiLSTM-CRF model for encoding to obtain the reasoning feature fr and the entity feature fe respectively, in preparation for event element extraction; S42: extracting features from the original text after the named entity recognition in step S3, obtaining a word vector of the perceived event type, and associating the event type with the trigger word detection task; First, the original text information after the named entity recognition in step S3 is passed through the RoBERTa-BiLSTM-CRF model to obtain the corresponding word vector as the input of the overall model, the attention score is calculated for model learning, the event type is classified, and the event type word embedding c is obtained; The event type word embedding c is used as the associated data to obtain the text word embedding G of the perceived event type. type , the specific calculation formula is: G type =CLN(c,h i ) c c =W γ c+b γ b c =W β c+b β c represents the event type word embedding, h i represents the word vector, μ and σ are represented by h i The mean and variance of W γ 、b γ , W β 、b β is the learnable parameter matrix; S43: Text word embedding G based on the perceived event type type , complete event type and trigger word detection, including: In the first step, the original text after named entity recognition in step S3 is input into the RoBERTa model, and then the model input vector x=[w1,w2,...,w N ], the Transformer in the middle layer performs feature extraction and outputs the following dynamic word vector H representing the event type: H=BERT(x)=[h1,h2,...,h N ]∈R N*d h i represents the word vector, R is the real number domain, d represents the embedding dimension of the word vector space, and its value is 768. N represents the number of tokens contained in the input original text, and its value range is 1 to 512. The output contains the prior semantic knowledge obtained by the model in the pre-training stage to solve the overfitting problem caused by insufficient corpus. In the second step, the BiLSTM layer processes the dynamic word vector H to capture the word sequence and context features. BiLSTM operates bidirectionally, integrating both the preceding and subsequent information into each word vector to enhance the ability to understand the text. It measures the similarity between the input sentence and each event type in the event space to obtain the probability that the sentence belongs to different event types. The model uses random initialization to obtain the word embedding vector C∈R of all event types in the dataset. |C|×d , where |C| represents the number of event types, d represents the embedding dimension of the word vector space, the dynamic word vector H represents the event type, and the model designs the similarity measurement function δ(c,h i ), measure the embedding c of each event type word and the vector h of each word in the input text i The degree of association is obtained by getting each word vector h i For the weight matrix of different event types, the specific calculation formula is: In the above formula, v, W, and U represent the trainable parameter matrices, [;] represents the concatenation operation of the matrix, |·| represents the calculation of the absolute value, and ⊙ represents the dot product calculation of the matrix. The final calculation result δ(c,h i ), represents the weight distribution of each position in the input text word vector for the current event type word embedding c, and performs a softmax function on the calculation result to obtain a word vector s representing the event type c , the specific calculation formula is: The third step is to transform the word vector s representing the event type into c The similarity is measured with all event type spaces, and multiple classification of sentence event types is performed through the fully connected layer to finally obtain the event type classification result; the text word embedding G of the perceived event type is used type Perform encoding calculation to obtain the word vector representation Z of the event trigger word type , to obtain the word vector representation Z of the event trigger word type , the specific formula is: Z type =SelfAttention(G type ) A pair of binary classifiers is used to predict the start and end positions of the event trigger word respectively. The end positions of the nearest neighbors of each start position are combined into a set of position pairs to form the entire trigger word to identify the trigger word position in the sentence. The specific calculation formula is: Indicates the start and end markers of the trigger word position. and To calculate the weight matrix of the trigger word start position mark and end position mark, The feature vector representing the perceived event type of the i-th token, and Bias items for calculating the start and end position markers of trigger words; S44: Event element extraction and element role identification. All element roles appearing in the original text are counted to obtain a predefined element role set. The event elements and element role information in the original text are mapped into a matrix form. The matrix rows represent each type of role, and the matrix columns represent the position mark of each type of role. Each sentence in the original text is encoded by RoBERTa to obtain a sentence feature fs. The sentence feature fs contains the direct features of the event. The event reasoning feature fr and the entity feature fe are fused with the sentence feature fs to allow the model to learn the global semantics of the text and the association between event elements to obtain the fused feature Ms. Finally, the sigmoid function is used as a binary classifier to predict the position mark of the element in each type of element role. The specific calculation formula is: in, and Respectively represent the element start and end position markers predicted by the model, and is the feature vector of the kth position in the fusion feature Ms; Finally, the binary cross entropy is used to calculate the loss at the start and end positions, and the two are added together to get the total loss. The specific calculation formula is: L=L s +L e in, and The markers representing the actual start and end positions of the element, L s and L e Respectively represent the loss functions of the starting and ending positions of the element, and L is the total loss; S45: integrating and storing the event extraction results, combining the obtained event type, event trigger word, event element and element role into an output statement containing overlapping information, combining into a Json object information and storing it; S5: Build a knowledge graph and visualize it; The entity information of unearthed cultural relics obtained through the named entity recognition process in step S3 and the event information obtained through the event extraction technology in step S4 are relationally modeled to construct a knowledge graph of urban ruins and perform visual display.
2. The method for constructing a knowledge graph of urban ruins by integrating event extraction technology according to claim 1 is characterized in that: The S1 collects and organizes the archaeological excavation results and historical documents of urban ruins. The process of obtaining urban ruins text data also includes data expansion and data cleaning. Data expansion includes using crawler technology to crawl encyclopedia data to supplement the urban ruins text data.
3. The method for constructing a knowledge graph of urban ruins by integrating event extraction technology according to claim 1 is characterized in that: The S2 is based on a subdivided domain vocabulary library, which focuses on the name, age, material, shape and historical events of unearthed cultural relics.
4. The method for constructing a knowledge graph of urban ruins by integrating event extraction technology according to claim 1 is characterized in that: The S31 preprocessing includes text cleaning and word segmentation. The first step is to clean the text and remove irrelevant characters and punctuation marks. The second step is to perform word segmentation to segment the continuous text string into independent words or phrases, and to perform part-of-speech tagging on the segmented words and phrases. A part-of-speech tag, such as verb, noun, or adjective, is assigned to each of the words or phrases to provide auxiliary information for entity recognition. Regarding word segmentation, the HanLP word segmentation tool is used for word segmentation. Before word segmentation, the seed word library of the cultural relics and historical events constructed in step S2 is input into the HanLP dictionary to supplement and improve the word library. The continuous text string is then input into HanLP to be segmented into independent words or phrases.
5. The method for constructing a knowledge graph of urban ruins by integrating event extraction technology according to claim 1 is characterized in that: The S32 performs the preprocessed original text to clarify the entity type that needs to be identified, including: annotating the text using the BIOES annotation method, clarifying the entity type that needs to be identified, and obtaining annotation data, wherein "B" represents the start character of the entity, "I" represents the internal character of the entity, "O" represents the non-entity character, "E" represents the end character of the entity, and "S" represents a single-word entity.
6. The method for constructing a knowledge graph of urban ruins by integrating event extraction technology according to claim 1 is characterized in that: The S5 uses the Neo4j Bloom tool for visualization.
7. A cultural relics data management system, characterized in that: The method for constructing an urban ruins knowledge graph integrating the event extraction technology described in any one of claims 1 to 6 is applied during the operation of the cultural relics data management system, comprising an unearthed cultural relics data management module (1), an unearthed cultural relics data review module (2), an unearthed cultural relics image search module (3), an unearthed cultural relics image marking module (4) and a system management module (5) which are interconnected: The unearthed cultural relics data management module (1) includes keyword search and result export, cultural relics picture and detailed description display, cultural relics data addition and modification, and cultural relics data deletion, so as to realize the four sub-functions of keyword search and result export, cultural relics picture and detailed description display, cultural relics data addition and modification, and cultural relics data deletion; The unearthed cultural relics data review module (2) includes data upload application, data viewing application, search application, administrator approval application, and deletion application, so as to realize the function of reviewing the cultural relics data uploaded by the user, manage the cultural relics data, and realize the functions of data upload, viewing and search application, administrator approval application, and deletion application; The unearthed cultural relics image search module (3) includes a text-based image search mode and an image-based image search mode; The unearthed cultural relics picture marking module (4) is used to realize the function of semantically marking the picture content. The user creates a project and imports the picture set that needs to be marked to perform semantic marking on the pictures. The cultural relics data management system provides multiple marking modes, including label marking mode, identification box marking mode, and closed curve marking mode; The system management module (5) is accessible only to administrators, and the management and maintenance of the cultural relics data management system is achieved through the system management module (5), including the management and maintenance of pages, accounts, data, logs, and permission content.
8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, which, when executed by a processor, implements the method for constructing an urban ruins knowledge graph integrating the event extraction technology described in any one of claims 1 to 6.
Citation Information
Patent Citations
Document-level event argument extraction method based on sequence labeling
CN113591483A
Financial news event element extraction method and system based on feature enhancement
CN117763148A