Cross-border ethnic cultural event retrieval method and device based on event element graph
By constructing a cross-border ethnic cultural event element map and using graph embedding and comparison learning methods, the problem of low correlation between cross-border ethnic cultural event retrieval results and query events is solved, which significantly improves the effect of event retrieval.
Patent Information
- Application Number
- CN202410812343.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-06-21
AI Technical Summary
In the field of cross-border ethnic culture, event search results are less correlated with query events, mainly due to the lack of sufficient event information in the query text, resulting in low correlation with query events.
By constructing a cross-border ethnic cultural event feature map, the event elements are fused with the query text, the graph embedding method is used to establish event association representation, and the model is optimized through comparative learning methods to increase the distance between the query and the related event documents in the semantic space.
By integrating external knowledge, expanding the semantic characteristics of query events, the effect of cross-border ethnic cultural event retrieval is significantly improved, allowing the model to retrieve more documents related to query.
Smart Images

Figure CN118585611B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method and device for searching cross-border ethnic cultural events based on an event element graph, and belongs to the technical field of natural language processing. Background Art
[0002] Event retrieval is the process of retrieving events related to user queries from a large amount of Internet texts. Cross-border ethnic cultural event retrieval is to find information about events that users care about from a large amount of cross-border ethnic cultural texts. The essence of the event retrieval task is to find the documents most relevant to the query. Therefore, the document retrieval method is sufficient to complete the event retrieval task. At present, using deep learning technology to complete document retrieval tasks has become the current mainstream method. The dense retrieval method based on contrastive learning uses the Approximate Nearest Neighbor (ANN) algorithm to negatively sample candidate documents, calculates the encoding of the documents in the previous round of training through an inference, and then updates the ANN index for negative sampling according to the encoding, and selects hard negative examples from them to update the model training. The negative samples selected in this way have a better distance between relevant and irrelevant documents in the semantic space than the negative sampling method within the batch, thereby improving the effect of the dense retrieval model. Construct positive and negative "query" samples based on contrastive learning; by optimizing the distance between the representations of these two positive and negative samples in the semantic space, the model's representation ability of text can be greatly improved, thereby improving the retrieval effect.
[0003] The above methods have been studied around general domain event retrieval and have achieved good results. However, there are still some difficulties in the event retrieval task in the cross-border ethnic culture field. In the cross-border ethnic culture event retrieval task, the text usually used for the query is some brief descriptions or keywords of certain events, and these brief descriptions or keywords often contain some domain entities, resulting in the retrieval results being mostly popular science texts about these domain entities, causing the cross-border ethnic culture event retrieval results to have a low relevance to the query event.
[0004] In view of the above problems, the present invention proposes a cross-border ethnic cultural event retrieval method based on event element graph. First, the event elements are extracted from the cross-border ethnic cultural events by the cross-border ethnic cultural event extraction method, and the event element graph is constructed as a gallery. For the query event text, the subgraph related to the event is retrieved from the gallery, and the queried subgraph representation is integrated into the query event text using the graph embedding method as the query representation for cross-border ethnic cultural event retrieval. By integrating external knowledge and expanding the semantic features of the query event, the model can retrieve more documents related to the query. On this basis, the comparative learning method is adopted to construct positive and negative sampling of documents for the "query", and the effect of cross-border ethnic cultural event retrieval is further improved by optimizing the distance between the "query" and related event documents in the semantic space. Summary of the invention
[0005] The present invention provides a cross-border ethnic cultural event retrieval method and device based on an event element graph to alleviate the problem of low relevance between cross-border ethnic cultural event retrieval results and query events, thereby improving the effect of cross-border ethnic cultural event retrieval.
[0006] The technical solution of the present invention is: in the first aspect, the present invention provides a cross-border ethnic cultural event retrieval method based on an event element graph, and the specific steps of the cross-border ethnic cultural event retrieval method based on an event element graph are as follows:
[0007] Step 1. Construction of cross-border ethnic document event dataset and data preprocessing: There is a lack of public cross-border ethnic document event extraction datasets on the Internet, and it is impossible to train event extraction models. Therefore, the present invention collects relevant data on cross-border ethnic groups and preprocesses the data, and finally constructs a cross-border ethnic cultural event retrieval dataset of 100,000.
[0008] Step 2, event element graph construction: The graph structure can better model the relationship between events, and the problem of low correlation between query events and search results in cross-border ethnic cultural event retrieval is solved by constructing a cross-border ethnic cultural event element graph.
[0009] Step 3. Training of cross-border ethnic cultural event retrieval model based on event element graph: To address the problem of low correlation between cross-border ethnic cultural event retrieval results and query events, the present invention uses a graph embedding method to establish event association relationship representation and uses a comparative learning method to optimize the model.
[0010] Step 4. Retrieval of cross-border ethnic cultural events based on event element graph: Save the trained end-to-end cross-border ethnic cultural event retrieval model of event element graph, encapsulate and deploy it on the server, establish an API for other applications to interact with the model, perform inference after data preprocessing, and realize automatic retrieval of cross-border ethnic cultural events based on event element graph.
[0011] As a preferred embodiment of the present invention, the specific steps of Step 1 are:
[0012] Step 1.1. In order to solve the lack of public cross-border ethnic document event retrieval data sets on the Internet, the present invention collects relevant data on cross-border ethnic groups, and a total of more than 20,000 relevant documents have been collected. However, the obtained cross-border ethnic cultural data structure still cannot meet the annotation needs. In the supervised cross-border ethnic cultural event retrieval model training, a certain scale of high-quality annotated data is required. For event retrieval tasks in specific fields, the annotation quality of the annotated data set has a great impact on the effect of the model retrieval event elements. Use the cross-border ethnic cultural field dictionary to segment the documents and remove meaningless stop words. Through data preprocessing, the text is segmented into sentences according to the document sequence, and finally the segmented sentences are used to construct the cross-border ethnic cultural event retrieval data set, and the segmented documents are used for cross-border ethnic cultural event retrieval data annotation. The documents are numbered, and finally more than 20,000 documents to be annotated are obtained.
[0013] Step 1.2, manually extract brief event descriptions from these documents as queries for the cross-border ethnic cultural event retrieval task, and then number these queries in a one-to-one correspondence with the documents to complete the annotation of the cross-border ethnic cultural event retrieval dataset. After completing the annotation of the cross-border ethnic cultural event retrieval dataset, we finally obtained a 100,000 cross-border ethnic cultural event retrieval extraction dataset;
[0014] As a preferred embodiment of the present invention, the specific steps of Step 2 are:
[0015] Step 2.1, in order to solve the problem of low correlation between query events and search results in cross-border ethnic cultural event retrieval, the present invention constructs a cross-border ethnic cultural event element graph, associates documents and event-related information, and integrates the event element graph with the query text through a graph embedding method to increase the event knowledge in the query text, thereby alleviating the above problem. The present invention first uses a cross-border ethnic cultural event extraction method to extract event information related to cross-border ethnic culture, and the formula is as follows:
[0016] {event1, event2, ..., event m} = event(doc)
[0017] event={t,(e1,r1),...,(e n ,r n )}
[0018] Among them, event represents the event, doc represents the document to be extracted, m represents the number of events extracted from the document, t represents the trigger word, e and r represent the event elements and their roles, and n refers to the number of event elements.
[0019] Step 2.2, based on the extraction of cross-border ethnic culture-related event information, a cross-border ethnic culture event element graph is constructed with documents, document release time, event trigger words and event elements as nodes, and event element roles and event correlation between documents as edges. In this graph, there are four types of edges: "document-document", "document-event trigger word", "document-release time" and "event trigger word-event element". Among them, the event trigger word and event element belonging to the same event are related by event role, and the "event trigger word-event element" edge is constructed; the event and document belonging to the same document are related by inclusion relationship, and the "document-event trigger word" edge is constructed; the release time and document are related by date, and the "document-release time" edge is constructed; between documents, the "document-document" edge is constructed by calculating their event correlation and taking it as the basis and taking time sequence as the relationship. The event element graph is fused with the query text through the graph embedding method to increase the event knowledge in the query text.
[0020] As a preferred embodiment of the present invention, the specific steps of Step 3 are:
[0021] Step 3.1, in order to solve the problem that the query text lacks sufficient event information, resulting in a low correlation between the model retrieval results and the query event. The present invention proposes a cross-border ethnic cultural event retrieval model based on an event element graph, by using two encoders to encode a batch of input "query-documents" respectively. Based on contrastive learning, firstly, a negative sampling within a batch is constructed, and the query text encoder and the candidate document encoder are optimized so that they can narrow the distance between the query and the positive example in the semantic space. Through the event relevance, the query is constructed for the query. The model distinguishes negative examples with high difficulty, and further optimizes the query text encoder and the candidate document encoder for the text representation, and obtains a query encoder and document encoder that have been strengthened twice. Then, the obtained encoding representation containing the event element graph information and the query text encoding are fused, and sent to a layer of neural network to extract important text features, and then the document encoding and the fused extracted text features are calculated for similarity to obtain the correlation between the query and the document. Finally, sorting is performed according to the relevance to obtain the results of cross-border ethnic cultural event retrieval.
[0022] Step 3.2: There are many domain entities in cross-border ethnic culture, and it is difficult to correctly segment them using existing word segmentation methods. In order to solve the problem of term mismatch between query and document, the present invention uses a dual encoder architecture as an encoder for cross-border ethnic cultural event retrieval. First, a candidate cross-border ethnic cultural document doc is input into the candidate document encoder E doc In the query, a d-dimensional vector representation is obtained, and then an index is established for the document encoding representation for retrieval. When a query is made, the query text encoder E is used query The query text q is represented as a d-dimensional vector, and then the first k documents are retrieved from the document set D according to the distance from the query text encoding in the semantic space. The function that measures the distance in the semantic space is as follows:
[0023] dis q,doc =E query (q)·E doc (doc)
[0024] Using two independent BERTs as encoders and taking the representation at the [CLS] token as the output of text encoding can improve the performance and generalization ability of the model while accelerating the training and inference process of the model.
[0025] Step 3.3, the traditional negative sampling method randomly selects several negative examples for each positive example, so that each positive example will have several corresponding negative examples. However, since the number of negative examples is usually much larger than the positive examples, this method will result in extremely high computational costs, thus affecting the training efficiency. Unlike the traditional negative sampling method, InBatchNegative Sampling limits the negative sampling process to each training batch, that is, the positive samples in each batch will be randomly generated with other samples in the batch. A certain number of negative samples are trained on the positive and negative samples in each batch. This can reduce the computational cost and better simulate the distribution of real data in each batch. Event relevance negative sampling. Although the number of negative samples can be increased by the method of in-batch negative sampling, most negative samples are easy to distinguish. However, for the training of dual encoders, it is important to obtain negative samples that are difficult for the model to distinguish. In order to obtain such negative samples, documents with a relatively high relevance to the query text event can be selected as negative samples. However, since the labeled data only labels a portion of the documents related to the query event, and not all documents related to the query event are labeled, directly using the above method may introduce erroneous negative samples (i.e., the query and the document are positively correlated, but not labeled with each other). The present invention uses the previous event correlation calculation method to construct positive and negative examples through two different negative sampling methods to optimize the model.
[0026] Step 3.4, for the negative samples (Hard Neg) with high difficulty in distinguishing obtained by the above method, the present invention performs secondary optimization on the dual encoder through a comparative learning method, and the training goal can be defined as making the similarity between "query-positive sample document" higher than that between "query-negative sample document", and the objective function can be expressed as the following formula:
[0027]
[0028] in, Represents a positive example document, Represents negative example documents, m represents the number of negative example samples, and exp() represents an exponential function with e as the base.
[0029] Step 3.5. After two optimizations of the dual encoder by contrastive negative sampling, the encoder is able to better represent the text of cross-border ethnic cultural events. Finally, the tag [CLS] is selected as the vector representation of the query and document.
[0030] Step 3.6, the present invention uses a cross-border ethnic cultural event element graph embedding module to search for relevant event element graphs from the event element graph library for the query text after word segmentation based on the words contained therein. If and only if more than half of the words after word segmentation are nodes in a certain event element graph, the graph is considered to be an event element graph related to the query text. The graph is sent to the trained graph encoder to obtain an event element graph representation X containing more event information. Graph . It is composed into a cross-border ethnic cultural event element library G containing a graphs = {g1,g2,...,g a}. For each event feature graph g in the gallery i , split it into two sub-graphs and Based on graph neural network, using contrastive learning method, the event feature graph encoder is trained by taking subgraphs from the same mother graph as positive samples and subgraphs from different mother graphs as negative samples. The relationship between nodes is expressed using the adjacency matrix formula as follows:
[0031]
[0032] Among them, θ represents the parameters that need to be trained, 1 [j≠2i-1] ∈{0,1} is a discriminant function, which takes the value of 1 when j≠2i-1, and T represents transpose.
[0033] Step 3.7: After the query text and candidate documents are passed through the trained query text encoder and candidate document encoder, the vector representation X of the query text is obtained. Query and the vector representation X of the candidate documentDoc . The vector representation of the query text is X Query and event feature graph feature X Graph After concatenating them, they are sent into a feedforward neural network (FNN). After a series of forward propagation, the fused query text encoding representation is obtained. The formula is as follows:
[0034]
[0035] Among them, X G+Q represents the fused query text encoding representation; σ() represents a nonlinear function; represents the concatenation operation; W,b is the weight matrix and bias term that need to be trained.
[0036] Step 3.8, encode the fused query text to represent X G+Q and the vector representation X of the candidate document Doc Perform similarity calculation sim() to obtain the relevance between the query and the document, as shown below:
[0037] X G+Q =sim(X G+Q ,X doc )
[0038] Finally, they are sorted according to relevance, and the top five documents with the highest ranking are taken as the results of cross-border ethnic cultural event retrieval.
[0039] As a preferred embodiment of the present invention, the specific steps of Step 4 are:
[0040] Step 4.1. Save the cross-border ethnic cultural event retrieval model as a ".pth" file, and load the model into memory based on the Web application Flask framework to avoid frequent model loading caused by request results and improve the running speed of the recognition model;
[0041] Step 4.2. Back-end development based on the Flask framework encapsulates the retrieval process of the cross-border ethnic cultural event retrieval model into a callable API interface and deploys it, thereby realizing the function of multiple concurrent requests on the Web port;
[0042] Step 4.3: On the Web side, call the cross-border ethnic cultural event retrieval model deployed on the server side to improve the retrieval effect.
[0043] In a second aspect, the present invention provides a cross-border ethnic cultural event retrieval device based on an event element graph, comprising a module for executing the method described in the first aspect.
[0044] The beneficial effects of the present invention are:
[0045] 1. The present invention proposes a cross-border ethnic cultural event retrieval method based on event element graph, which further improves the effect of cross-border ethnic cultural event retrieval by optimizing the distance between the "query" and related event documents in the semantic space.
[0046] 2. The present invention is based on the cross-border ethnic cultural event retrieval strategy of the event element graph. By constructing the event element graph as a graph library, the graph embedding method is used to integrate the queried subgraph representation into the query event text as the query representation for cross-border ethnic cultural event retrieval. By integrating external knowledge and expanding the semantic features of the query event, the model can retrieve more documents related to the query. On this basis, the comparative learning method is adopted to construct positive and negative sampling of documents for the "query", which alleviates the problem of low correlation between the cross-border ethnic cultural event retrieval results and the query event. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 This is a framework diagram of a cross-border ethnic cultural event retrieval model based on an event element graph in the present invention;
[0048] Figure 2 It is the event correlation negative sampling graph in the present invention;
[0049] Figure 3 The overall flow chart of cross-border ethnic cultural event retrieval based on event element graph in the present invention; DETAILED DESCRIPTION
[0050] Example 1: Figure 1-Figure 3 As shown, the cross-border ethnic cultural event retrieval method based on the event element graph, the specific steps of the cross-border ethnic cultural event retrieval method based on the event element graph are as follows:
[0051] Step 1. Construction of cross-border ethnic document event dataset and data preprocessing: There is a lack of public cross-border ethnic document event extraction datasets on the Internet, and it is impossible to train event extraction models. Therefore, the present invention collects relevant data on cross-border ethnic groups and preprocesses the data, and finally constructs a cross-border ethnic cultural event retrieval dataset of 100,000.
[0052] Step 2, event element graph construction: The graph structure can better model the relationship between events, and the problem of low correlation between query events and search results in cross-border ethnic cultural event retrieval is solved by constructing a cross-border ethnic cultural event element graph.
[0053] Step 3. Training of cross-border ethnic cultural event retrieval model based on event element graph: To address the problem of low correlation between cross-border ethnic cultural event retrieval results and query events, the present invention uses a graph embedding method to establish event association relationship representation and uses a comparative learning method to optimize the model.
[0054] Step 4. Retrieval of cross-border ethnic cultural events based on event element graph: Save the trained end-to-end cross-border ethnic cultural event retrieval model of event element graph, encapsulate and deploy it on the server, establish an API for other applications to interact with the model, perform inference after data preprocessing, and realize automatic retrieval of cross-border ethnic cultural events based on event element graph.
[0055] As a preferred embodiment of the present invention, the specific steps of Step 1 are:
[0056] Step 1.1. In order to solve the lack of public cross-border ethnic document event retrieval data sets on the Internet, the present invention collects relevant data on cross-border ethnic groups, and a total of more than 20,000 relevant documents have been collected. However, the obtained cross-border ethnic cultural data structure still cannot meet the annotation needs. In the supervised cross-border ethnic cultural event retrieval model training, a certain scale of high-quality annotated data is required. For event retrieval tasks in specific fields, the annotation quality of the annotated data set has a great impact on the effect of the model retrieval event elements. Use the cross-border ethnic cultural field dictionary to segment the documents and remove meaningless stop words. Through data preprocessing, the text is segmented into sentences according to the document sequence, and finally the segmented sentences are used to construct the cross-border ethnic cultural event retrieval data set, and the segmented documents are used for cross-border ethnic cultural event retrieval data annotation. The documents are numbered, and finally more than 20,000 documents to be annotated are obtained.
[0057] Step 1.2, manually extract brief event descriptions from these documents as queries for the cross-border ethnic cultural event retrieval task, and then number these queries in a one-to-one correspondence with the documents to complete the annotation of the cross-border ethnic cultural event retrieval dataset. After completing the annotation of the cross-border ethnic cultural event retrieval dataset, we finally obtained a 100,000 cross-border ethnic cultural event retrieval extraction dataset;
[0058] As a preferred embodiment of the present invention, the specific steps of Step 2 are:
[0059] Step 2.1, in order to solve the problem of low correlation between query events and search results in cross-border ethnic cultural event retrieval, the present invention constructs a cross-border ethnic cultural event element graph, associates documents and event-related information, and integrates the event element graph with the query text through a graph embedding method to increase the event knowledge in the query text, thereby alleviating the above problem. The present invention first uses a cross-border ethnic cultural event extraction method to extract event information related to cross-border ethnic culture, and the formula is as follows:
[0060] {event1, event2, ..., event m} = event(doc)
[0061] event={t,(e1,r1),...,(e n ,r n )}
[0062] Among them, event represents the event, doc represents the document to be extracted, m represents the number of events extracted from the document, t represents the trigger word, e and r represent the event elements and their roles, and n refers to the number of event elements.
[0063] Step 2.2, based on the extraction of cross-border ethnic culture-related event information, a cross-border ethnic culture event element graph is constructed with documents, document release time, event trigger words and event elements as nodes, and event element roles and event correlation between documents as edges. In this graph, there are four types of edges: "document-document", "document-event trigger word", "document-release time" and "event trigger word-event element". Among them, the event trigger word and event element belonging to the same event are related by event role, and the "event trigger word-event element" edge is constructed; the event and document belonging to the same document are related by inclusion relationship, and the "document-event trigger word" edge is constructed; the release time and document are related by date, and the "document-release time" edge is constructed; between documents, the "document-document" edge is constructed by calculating their event correlation and taking it as the basis and taking time sequence as the relationship. The event element graph is fused with the query text through the graph embedding method to increase the event knowledge in the query text.
[0064] As a preferred embodiment of the present invention, the specific steps of Step 3 are:
[0065] Step 3.1, in order to solve the problem that the query text lacks sufficient event information, resulting in a low correlation between the model retrieval results and the query event. The present invention proposes a cross-border ethnic cultural event retrieval model based on an event element graph, by using two encoders to encode a batch of input "query-documents" respectively. Based on contrastive learning, firstly, a negative sampling within a batch is constructed, and the query text encoder and the candidate document encoder are optimized so that they can narrow the distance between the query and the positive example in the semantic space. Through the event relevance, the query is constructed for the query. The model distinguishes negative examples with high difficulty, and further optimizes the query text encoder and the candidate document encoder for the text representation, and obtains a query encoder and document encoder that have been strengthened twice. Then, the obtained encoding representation containing the event element graph information and the query text encoding are fused, and sent to a layer of neural network to extract important text features, and then the document encoding and the fused extracted text features are calculated for similarity to obtain the correlation between the query and the document. Finally, sorting is performed according to the relevance to obtain the results of cross-border ethnic cultural event retrieval.
[0066] Step 3.2: There are many domain entities in cross-border ethnic culture, and it is difficult to correctly segment them using existing word segmentation methods. In order to solve the problem of term mismatch between query and document, the present invention uses a dual encoder architecture as an encoder for cross-border ethnic cultural event retrieval. First, a candidate cross-border ethnic cultural document doc is input into the candidate document encoder E doc In the query, a d-dimensional vector representation is obtained, and then an index is established for the document encoding representation for retrieval. When a query is made, the query text encoder E is used query The query text q is represented as a d-dimensional vector, and then the first k documents are retrieved from the document set D according to the distance from the query text encoding in the semantic space. The function that measures the distance in the semantic space is as follows:
[0067] dis q,doc =E query (q)·E doc (doc)
[0068] Using two independent BERTs as encoders and taking the representation at the [CLS] token as the output of text encoding can improve the performance and generalization ability of the model while accelerating the training and inference process of the model.
[0069] Step 3.3, the traditional negative sampling method randomly selects several negative examples for each positive example, so that each positive example will have several corresponding negative examples. However, since the number of negative examples is usually much larger than the positive examples, this method will result in extremely high computational costs, thus affecting the training efficiency. Unlike the traditional negative sampling method, InBatchNegative Sampling limits the negative sampling process to each training batch, that is, the positive samples in each batch will be randomly generated with other samples in the batch. A certain number of negative samples are trained on the positive and negative samples in each batch. This can reduce the computational cost and better simulate the distribution of real data in each batch. Event relevance negative sampling. Although the number of negative samples can be increased by the method of in-batch negative sampling, most negative samples are easy to distinguish. However, for the training of dual encoders, it is important to obtain negative samples that are difficult for the model to distinguish. In order to obtain such negative samples, documents with a relatively high relevance to the query text event can be selected as negative samples. However, since the labeled data only labels a portion of the documents related to the query event, and not all documents related to the query event are labeled, directly using the above method may introduce erroneous negative samples (i.e., the query and the document are positively correlated, but not labeled with each other). The present invention uses the previous event correlation calculation method to construct positive and negative examples through two different negative sampling methods to optimize the model.
[0070] Step 3.4, for the negative samples (Hard Neg) with high difficulty in distinguishing obtained by the above method, the present invention performs secondary optimization on the dual encoder through a comparative learning method, and the training goal can be defined as making the similarity between "query-positive sample document" higher than that between "query-negative sample document", and the objective function can be expressed as the following formula:
[0071]
[0072] in, Represents a positive example document, Represents negative example documents, m represents the number of negative example samples, and exp() represents an exponential function with e as the base.
[0073] Step 3.5. After two optimizations of the dual encoder by contrastive negative sampling, the encoder is able to better represent the text of cross-border ethnic cultural events. Finally, the tag [CLS] is selected as the vector representation of the query and document.
[0074] Step 3.6, the present invention uses a cross-border ethnic cultural event element graph embedding module to search for relevant event element graphs from the event element graph library for the query text after word segmentation based on the words contained therein. If and only if more than half of the words after word segmentation are nodes in a certain event element graph, the graph is considered to be an event element graph related to the query text. The graph is sent to the trained graph encoder to obtain an event element graph representation X containing more event information. Graph . It is composed into a cross-border ethnic cultural event element library G containing a graphs = {g1,g2,...,g a}. For each event feature graph g in the gallery i , split it into two sub-graphs and Based on graph neural network, using contrastive learning method, the event feature graph encoder is trained by taking subgraphs from the same mother graph as positive samples and subgraphs from different mother graphs as negative samples. The relationship between nodes is expressed using the adjacency matrix formula as follows:
[0075]
[0076] Among them, θ represents the parameters that need to be trained, 1 [j≠2i-1] ∈{0,1} is a discriminant function, which takes the value of 1 when j≠2i-1, and T represents transpose.
[0077] Step 3.7: After the query text and candidate documents are passed through the trained query text encoder and candidate document encoder, the vector representation X of the query text is obtained. Query and the vector representation X of the candidate document Doc . The vector representation of the query text is X Query and event feature graph feature X Graph After concatenating them, they are sent into a feedforward neural network. After a series of forward propagation, the fused query text encoding representation is obtained. The formula is as follows:
[0078]
[0079] Among them, X G+Q represents the fused query text encoding representation; σ() represents a nonlinear function; represents the concatenation operation; W,b is the weight matrix and bias term that need to be trained.
[0080] Step 3.8, encode the fused query text to represent X G+Q and the vector representation X of the candidate document Doc Perform similarity calculation to obtain the relevance between the query and the document, as shown below:
[0081] X G+Q=sim(X G+Q ,X doc )
[0082] Finally, they are sorted according to relevance, and the top five documents with the highest ranking are taken as the results of cross-border ethnic cultural event retrieval.
[0083] As a preferred embodiment of the present invention, the specific steps of Step 4 are:
[0084] Step 4.1. Save the cross-border ethnic cultural event retrieval model as a ".pth" file, and load the model into memory based on the Web application Flask framework to avoid frequent model loading caused by request results and improve the running speed of the recognition model;
[0085] Step 4.2. Back-end development based on the Flask framework encapsulates the retrieval process of the cross-border ethnic cultural event retrieval model into a callable API interface and deploys it, thereby realizing the function of multiple concurrent requests on the Web port;
[0086] Step 4.3: On the Web side, call the cross-border ethnic cultural event retrieval model deployed on the server side to improve the retrieval effect.
[0087] In order to verify the effectiveness of the cross-border ethnic cultural event retrieval method based on event factor graph proposed in this invention, a comparative experiment was conducted with four methods published in recent years. All methods used the cross-border ethnic cultural event retrieval dataset.
[0088] Table 1 Comparative experimental results
[0089]
[0090] The experiment is shown in Table 1. The method of the present invention is compared with the models DSSM (deep structure speech model), DPR (deep text retrieval model), ANCE (double tower model) and COIL (information retrieval model based on contextual inverted index) when all using cross-border ethnic cultural event retrieval data sets. Compared with the classic model DSSM, the method of the present invention is based on contrastive learning and uses two negative sampling methods to shorten the distance between related "query-document" pairs in the semantic space, and the NDGC value is increased by 9.05%. Compared with the DPR and ANCE models, the NDCG values of the method of the present invention are increased by 1.39% and 1.91% respectively. Because the method of the present invention incorporates the event element graph, the effect of cross-border ethnic cultural event retrieval is effectively improved by expanding the event knowledge in the query text. Compared with the COIL model, the NDCG index of the method of the present invention is increased by 1.07%. The COIL model establishes an inverted index by segmenting the context of the words. Since the domain entities in the cross-border ethnic cultural field have strong domain characteristics, the model will segment some entity words incorrectly when segmenting words, resulting in the COIL model being less effective than the method of the present invention.
[0091] Table 2 is an ablation experiment designed to verify the influence of different contrastive learning negative sampling methods on the effect of the present invention.
[0092] Table 2 Ablation experiment of the impact of different negative sampling methods on the model
[0093]
[0094] The experimental results show that after removing the negative sampling within the batch or the negative sampling of event correlation, the event retrieval effect of the method of the present invention has a certain decline, which has decreased by 1.38% and 2.12% respectively. This shows that the two methods of constructing negative samples have a certain effect on improving the performance of the model, which fully proves the effectiveness of the method of the present invention.
[0095] Table 3 is an ablation experiment designed to verify the impact of incorporating event feature graphs on the model. NDCG is the information retrieval index, and NDCG@5 means that only the first 5 rankings are correct.
[0096] Table 3 Ablation experiment on the impact of incorporating event feature graph on the model
[0097]
[0098] The experimental results show that the model effect of the method of the present invention decreases by 3.83% without the integration of event factor graph. This is because the event factor graph contains more event information, which has a greater impact on the effect of event retrieval. Through this experiment, it is verified that integrating event factor graph information into the query text has a strong effect on improving model performance.
[0099] According to the concept of the present invention, the present invention also provides a cross-border ethnic cultural event retrieval device based on an event element graph, the device comprising the following integrated modules:
[0100] Event element graph construction module: The event element graph is integrated with the query text through the graph embedding method to increase the event knowledge in the query text to alleviate the problem of low correlation between query events and retrieval results in cross-border ethnic cultural event retrieval;
[0101] Cross-border ethnic cultural event retrieval module based on event element graph: This module retrieves subgraphs related to the event from the image library, and uses graph embedding methods to integrate the queried subgraph representations into the query event text as the query representation for cross-border ethnic cultural event retrieval. By incorporating external knowledge and expanding the semantic features of the query event, the model can retrieve more documents related to the query;
[0102] Based on contrastive learning, we construct negative sampling within a batch and optimize the query text encoder and candidate document encoder to shorten the distance between the query and the positive example in the semantic space.
[0103] Cross-border ethnic cultural events retrieval module: deploy the model to the local server and convert the model into an application interface through Sanic technology. Call the model directly through the web page and output the retrieved cross-border ethnic cultural events to the front-end interface for display.
Claims
1. A cross-border ethnic cultural event retrieval method based on event element graph, characterized by: The specific steps of the method are as follows: Step 1: Construction of cross-border ethnic document event dataset and data preprocessing: By collecting network resources to construct relevant data of cross-border ethnic groups, and preprocessing the data, we finally build a cross-border ethnic cultural event retrieval dataset; Step 2: Event element graph construction: To address the problem of low correlation between query events and search results in cross-border ethnic cultural event retrieval, a cross-border ethnic cultural event element graph is constructed; Step 3: Training of cross-border ethnic cultural event retrieval model based on event element graph: To address the problem that cross-border ethnic cultural event retrieval results have low relevance to query events, a graph embedding method is used to establish event association relationship representation, and a contrastive learning method is used to optimize the model; A cross-border ethnic cultural event retrieval model based on event element graph is proposed. A batch of "query-document" input is encoded by query text encoder and candidate document encoder respectively. Based on contrastive learning, negative sampling within the batch is first constructed to optimize the query text encoder and candidate document encoder so that they can narrow the distance between the query and the positive example in the semantic space. Through event relevance, negative examples with high difficulty in distinguishing the query model are constructed. The representation of the text by the query text encoder and candidate document encoder is further optimized to obtain the query encoder and document encoder after two reinforcements. The obtained encoding representation containing event element graph information is then fused with the query text encoding and sent to a layer of neural network to extract important text features. The document encoding and the fused extracted text features are then calculated for similarity to obtain the relevance between the query and the document. Finally, the results of cross-border ethnic cultural event retrieval are obtained by sorting according to the relevance. Step 4. Retrieval of cross-border ethnic cultural events based on event element graph: Save the trained end-to-end cross-border ethnic cultural event retrieval model of event element graph, encapsulate and deploy it on the server, establish an API for other applications to interact with the model, perform inference after data preprocessing, and realize automatic retrieval of cross-border ethnic cultural events based on event element graph.
2. The cross-border ethnic cultural event retrieval method based on event element graph according to claim 1 is characterized by: The specific steps of Step 3 are: Step 3.1, by using the dual encoder architecture as the encoder for cross-border ethnic cultural event retrieval; first, a candidate cross-border ethnic cultural document doc is input into the candidate document encoder E doc In the process, a d-dimensional vector representation is obtained, and then an index is established for the document encoding representation for retrieval; when a query is performed, the query text encoder E is used query The query text q is represented as a d-dimensional vector, and then the first k documents are retrieved from the document collection according to the distance from the query text encoding in the semantic space; the function formula for measuring the distance in the semantic space is as follows: dis q,doc =E query (q)·E doc (doc) Use two independent BERTs as encoders and take the representation at the [CLS] token as the output of the text encoding; Step 3.2, using the event correlation calculation method, construct positive and negative examples through negative sampling method to optimize the model; Step 3.3, for the obtained negative samples, the dual encoder is optimized twice through the contrast learning method, and the training goal is defined as making the similarity between "query-positive sample document" higher than that between "query-negative sample document"; Step 3.4, after two optimizations of the dual encoder by contrastive negative sampling, the encoder is able to better represent the text of cross-border ethnic cultural events, and finally selects the tag [CLS] as the vector representation of the query and document; Step 3.5: Through the cross-border ethnic cultural event element graph embedding module, for the query text after word segmentation, according to the words contained in it, search for relevant event element graphs from the event element graph library. If and only if more than half of the words after word segmentation are nodes in a certain event element graph, the graph is considered to be an event element graph related to the query text; send the graph to the trained graph encoder to obtain the event element graph representation X containing more event information. Graph ; form a cross-border ethnic cultural event element library G containing a graphs G = {g1,g2,...,g a }; For each event feature graph g in the gallery i , split it into two sub-graphs and Based on graph neural network, using contrastive learning method, the event feature graph encoder is trained by taking subgraphs from the same parent graph as positive samples and subgraphs from different parent graphs as negative samples; Step 3.6: After the query text and candidate documents are passed through the trained query text encoder and candidate document encoder, the vector representation X of the query text is obtained. Query and the vector representation X of the candidate document Doc ; Represent the query text vector X Query and event feature graph feature X Graph Then, it is sent into a feedforward neural network, and after a series of forward propagation, the fused query text encoding representation X is obtained. G+Q ; Step 3.7, encode the fused query text to represent X G+Q and the vector representation X of the candidate document Doc Perform similarity calculation sim() to obtain the relevance between the query and the document, as shown below: X G+Q =yes(X G+Q ,X Doc ) Finally, they are sorted according to relevance, and the top five documents with the highest ranking are taken as the results of cross-border ethnic cultural event retrieval.
3. The cross-border ethnic cultural event retrieval method based on event element graph according to claim 1 is characterized by: The specific steps of Step 1 are: Step 1.1, obtain relevant data of cross-border ethnic groups, use the dictionary of cross-border ethnic culture to segment documents and remove meaningless stop words; through data preprocessing, segment the text into sentences according to the document sequence, and finally use the segmented sentences to build a cross-border ethnic cultural event retrieval data set, and the segmented documents are used for cross-border ethnic cultural event retrieval data annotation, and the documents are numbered, and finally a number of documents to be annotated are obtained; Step 1.
2. Manually extract brief event descriptions from these documents as queries for the cross-border ethnic cultural event retrieval task, and then number these queries in a one-to-one correspondence with the documents to complete the annotation of the cross-border ethnic cultural event retrieval dataset; after completing the annotation of the cross-border ethnic cultural event retrieval dataset, we finally obtain the cross-border ethnic cultural event retrieval extraction dataset.
4. The cross-border ethnic cultural event retrieval method based on event element graph according to claim 1 is characterized by: The specific steps of Step 2 are: Step 2.1, by constructing a cross-border ethnic cultural event element graph, the document and event related information are associated, and the event element graph is integrated with the query text through the graph embedding method to increase the event knowledge in the query text; first, the cross-border ethnic cultural event extraction method is used to extract the event information related to the cross-border ethnic culture. The formula is as follows: {event1,event2,...,event m }=event(doc) event={t,(e1,r1),...,(e n ,r n )} Among them, event represents the event, doc represents the document to be extracted, m represents the number of events extracted from the document; t represents the trigger word, e and r represent the event elements and their roles, and n refers to the number of event elements; Step 2.
2. On the basis of extracting event information related to cross-border ethnic culture, a cross-border ethnic cultural event element graph is constructed with documents, document release time, event trigger words and event elements as nodes, and the roles of event elements and event correlation between documents as edges. In this graph, there are four types of edges: "document-document", "document-event trigger word", "document-release time" and "event trigger word-event element". Among them, the event trigger word and event elements belonging to the same event are related by event roles to construct the "event trigger word-event element" edge, the event and document belonging to the same document are related by inclusion to construct the "document-event trigger word" edge, the release time and document are related by date to construct the "document-release time" edge; between documents, the "document-document" edge is constructed by calculating their event correlation and taking it as the basis and taking time sequence as the relationship; the event element graph is fused with the query text through the graph embedding method to increase the event knowledge in the query text and construct the cross-border ethnic cultural event element graph.
5. The cross-border ethnic cultural event retrieval method based on event element graph according to claim 1 is characterized by: The specific steps of Step 4 are: Step 4.
1. Save the cross-border ethnic cultural event retrieval model as a ".pth" file, and load the model into memory based on the Web application Flask framework to avoid frequent model loading caused by request results and improve the running speed of the recognition model; Step 4.
2. Back-end development based on the Flask framework encapsulates the retrieval process of the cross-border ethnic cultural event retrieval model into a callable API interface and deploys it, thereby realizing the function of multiple concurrent requests on the Web port; Step 4.3: On the Web side, call the cross-border ethnic cultural event retrieval model deployed on the server side to improve the retrieval effect.
6. A cross-border ethnic cultural event retrieval device based on event element graph, characterized in that: The method comprises a module for executing the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Knowledge representation enhancement-based low-resource cross-language text retrieval method and device
CN116680420A
Event knowledge integrated Chinese-cross cross-language event retrieval method
CN117009458A