Method and device for generating cross-border ethnic cultural text summaries by integrating domain word information

By integrating domain word information, a cross-border ethnic cultural field dictionary and text abstract data set is constructed, and a summary is generated using a lookup table and pointer network, the problem of lack of domain word information in cross-border ethnic cultural text abstracts is solved, and the representation ability of domain words in the text and the expression of the abstract is improved.

CN114969314BActive Publication Date: 2025-04-11KUNMING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210739660.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-28
Publication Date
2025-04-11
Estimated Expiration
2042-06-28

AI Technical Summary

Technical Problem

The lack of domain word information in the text summary of cross-border ethnic cultural texts leads to insufficient representation ability of domain word information in the text.

Method used

By integrating domain word information, a cross-border national cultural domain dictionary and text summary data set is constructed, and a table lookup method is used to match text and domain words in the dictionary, and a total encoding vector is generated. Then, the synonym distribution is calculated using the pointer network and attention mechanism to generate the final summary distribution.

Benefits of technology

It has improved the ability to represent domain words in cross-border national cultural texts, enhanced the reflection of national cultural characteristics in text abstracts, and alleviated the problem of loss of domain word information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114969314B_ABST
    Figure CN114969314B_ABST
Patent Text Reader

Abstract

The present invention relates to a method and device for generating a cross-border ethnic cultural text summary incorporating domain word information, and belongs to the field of natural language processing technology. The present invention comprises the steps of: preprocessing cross-border ethnic cultural text data; representing cross-border ethnic cultural text features incorporating a cross-border ethnic cultural domain dictionary; training a cross-border ethnic cultural text summary model based on a pointer network; and generating a cross-border ethnic cultural text summary. According to the above steps, a cross-border ethnic cultural text summary generation device incorporating domain word information is manufactured by modularizing the functions. Compared with the general text summary method, the present invention effectively improves the accuracy of the cross-border ethnic cultural summary.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method and device for generating a cross-border ethnic cultural text summary by incorporating domain word information, and belongs to the technical field of natural language processing. Background Art

[0002] Cross-border ethnic cultural summarization refers to the task of generating summaries with ethnic cultural characteristics from cross-border ethnic cultural text data using text summarization technology, which plays an important supporting role in further conducting cross-border ethnic cultural big data correlation analysis research.

[0003] Text summarization technology is used to automatically generate text summaries related to cross-border ethnic culture from the Internet, reducing the time researchers spend manually extracting and processing information. Incorporating domain word information into the text summary generation model can solve the problem of lack of domain word information in cross-border ethnic culture text summaries. Incorporating domain word information into the text summary generation model can achieve better results and enhance the representation ability of domain word information in the text. There are a large number of domain words in cross-border ethnic cultural data. For example, "Buddha's Birthday" is another name for "Water Splashing Festival". They are domain words with similar semantics. The text summary generation method that incorporates domain word information can achieve better results. Summary of the invention

[0004] The present invention provides a method and device for generating a cross-border ethnic cultural text summary incorporating domain word information, so as to improve the representation capability of domain words in the cross-border ethnic cultural text and enhance the representation of the cross-border ethnic cultural text incorporating domain word information.

[0005] The technical solution of the present invention is: in the first aspect, a method for generating a cross-border ethnic cultural text summary incorporating domain word information is provided, and the specific steps of generating a cross-border ethnic cultural text summary incorporating domain word information are as follows:

[0006] Step 1. Preprocessing of cross-border ethnic cultural text summary data: Due to the lack of text summary data sets and domain dictionaries in the field of cross-border ethnic culture, the present invention constructed a cross-border ethnic cultural text summary data set of 5112 with summaries and a domain dictionary of 3217 entries through manual annotation. And according to the different topics involved in the text, it is divided into 8 types such as customs, costumes, religious beliefs, festivals, etc. The specific annotation principle is to add the cross-border ethnic cultural domain word information contained in the text on the basis of the text title, so that the cross-border ethnic cultural summary can better reflect the characteristics of cross-border ethnic culture than the summary of ordinary text. In the experiment, 4112 text data were selected as the training set, and the remaining 1000 text data were selected as the test set. This data set and domain dictionary played a good supporting role in the test of the text summary generation model;

[0007] Step 2: Encode the cross - border ethnic culture domain dictionary and the input text respectively, and use the method of looking up the table to match the text with the domain words in the dictionary. To enhance the representation ability of the cross - border ethnic culture domain word information in the text, fuse the dictionary encoding and the text encoding at the output part of the encoder to obtain the total encoding vector.

[0008] Step 3: Generation of cross - border ethnic culture text summary based on pointer network: Decode the obtained encoding vector, use the attention mechanism in the decoding module to calculate the synonym probability of the domain words in the original text and the similar domain words in the dictionary to obtain the synonym distribution, and then jointly use the synonym distribution and the probability distribution of the original text decoding through the pointer network to generate the final summary distribution, and further obtain the cross - border ethnic culture text summary.

[0009] As a preferred solution of the present invention, the specific steps of the said Step 1 are as follows:

[0010] Step 1.1: Crawl the ethnic culture data on the cross - border ethnic culture websites, pre - process the data such as removing duplicates and filtering special characters, and mark the corresponding reference summary for each cross - border ethnic culture text. Each summary consists of the title of the text and the domain word information content contained in the text. The manually constructed cross - border ethnic culture text summary data set has 5,112 texts, and the average number of sentences per text is 6 - 8 sentences. These domain texts involve 8 types such as customs, costumes, religious beliefs, festivals, etc., as shown in Table 1 specifically:

[0011] Table 1 Analysis of cross - border ethnic culture domain word types

[0012] Data Types Data volume custom 537 apparel 307 religion 324 Art 673 diet 421 festival 2k architecture 303 Song and Dance 694 total 5.112k

[0013] Step 1.2: Use the cross - border ethnic culture domain text data obtained in Step 1.1 to automatically extract domain words. Based on the domain word segmentation method, find the frequency of the strings obtained by statistically combining multiple characters, and set an appropriate threshold to discover new words. In the given cross - border ethnic culture - related corpus, extract all the strings whose occurrence frequency exceeds the set threshold, and then calculate the cohesion degree of the words. In order to more accurately extract the words composed of three or more characters, such as words like "赶花街" (Going to the Flower Street) and "菠萝煮饭" (Pineapple Cooked Rice), the calculation process of the cohesion degree defined between three characters is as follows.

[0014]

[0015] Among them, a, b, and c are adjacent characters in the corpus, α represents a preset coagulation threshold. The number of times the string abc appears in pairs is counted to obtain its frequency P(abc), and then the frequencies P(a), P(b), and P(c) of characters a, b, and c are counted respectively. For words composed of multiple characters, a relatively high coagulation threshold is generally set to prevent words such as "hulusheng" from being incorrectly segmented into "hulu" and "sheng". The complete algorithm steps are as follows:

[0016] Statistics: Set different string lengths n, count the strings composed of n characters, set the coagulation threshold according to the string length n. The larger the number of characters, the larger the threshold is set. Then calculate the coagulation degree between strings, and only retain the strings with a coagulation degree higher than the threshold to form a set G;

[0017] Segmentation: Remove duplicates and filter special characters from the cross-border ethnic culture corpus, and then use the obtained set above to segment each corpus and count the frequencies of the strings. The segmentation rule is that if the string in the corpus appears in set G, this string is not segmented. For example, for "xiangboluo zhufan", as long as "boluo" and "zhufan" are in set G, but "boluo zhufan" is not in set G, then "boluo zhufan" remains;

[0018] Screening: Filter out the strings with a lower coagulation degree in the segmentation step. For words with a string length greater than n, judge whether the string is in G. If it does not exist, filter it out. Finally, sort the words obtained after screening according to the word frequency, and extract the top 20 words with the highest frequency.

[0019] The domain dictionary contains words related to festivals, architecture, religion, diet, and literature and art in cross-border ethnic cultures. For example, cross-border ethnic culture words such as "dinggana (literature and art), qudanta (architecture), pahazhulisai (diet), duanmaguan (customs), gaguanglu (festival)".

[0020] Step1.3: Use a pre-trained language model to perform character vector representation on the cross-border ethnic culture text, and then input it into the Transformer Encoder layer to obtain the vector representation of each character in the input text. For example, the text "lemongrass grilled fish" is represented as E = c [CLS] ,c 香 ,c 茅 ,c 草 ,c 烤 ,c 鱼 ,c [SEP] , where c [CLS] and c [SEP]Is a special marking vector for the text. For the input vector, the mutual relationship between each word in the text is calculated using the Multi-Head Self-Attention mechanism. The calculation process is as follows:

[0021]

[0022] MHA = Concat(head1,...,head k )W O

[0023] head i = Attention(QW i Q ,KW i k ,VW i V )

[0024] Among them, W i Q ,W i K ,W i V represents the W Q ,W K ,W V matrix of the i-th Head, W O is the additional weight matrix, d k is the dimension of the input word vector, and Softmax is the normalization operation. Through a series of normalization and linear processing, the output of the Transformer Encoder of the input text can be obtained.

[0025] In order to enhance the attention to domain words in the text encoding process, cross-border ethnic culture domain dictionary information is added at the encoding end of the model, and the CBOW strategy in word2vec is used to encode the domain dictionary to obtain the embedding T` of the dictionary. For the domain word α i in the dictionary, the output word vector t i , , where D1 represents the word2vec dimension size, and t i represents the word vector of the i-th word in the dictionary. For example, for the domain word "Flower Street Festival", after encoding by word2vec, the word vector of "Flower Street Festival" is obtained, and the calculation process is as follows:

[0026] t i = word2vecα i

[0027] As a preferred solution of the present invention, the specific steps of the Step2 are as follows:

[0028] Step 2.1. Vectorized feature representation of cross-border ethnic cultural domain dictionary and input text: Use the CBOW strategy in word2vec to encode the domain dictionary to obtain the dictionary embedding; output the word vector for the domain vocabulary contained in the dictionary; given a set of cross-border ethnic cultural text data, use Transformer to encode it, where the input vector uses a multi-head self-attention mechanism to calculate the relationship between each word in the text and other words; the words in the dictionary embedding are obtained by matching the words in the input sentence with the dictionary.

[0029] Step 2.2, Acquisition of text vectors enhanced by domain dictionary information: The cross-border ethnic cultural domain dictionary encoding is integrated with the original text encoding to enhance the text vector's ability to represent cross-border ethnic domain vocabulary; the idea of ​​the domain dictionary lookup is to match each word in the input text with all possible similar words in the dictionary, and then concatenate the word vectors of all matched words with the text encoding vector; add all matched word embedding sequences to generate the domain word information of the entire text, and add it to the embedding of each word in the original text, and finally input the fused text total vector Z as the decoding vector to the decoding end for subsequent calculation and processing. The calculation process is as follows;

[0030]

[0031] Z i =T′W1+x i W2+b1

[0032] Among them, Z i represents the output hidden state of the i-th word, , is a parameter matrix used to assign weights to dictionary encoding and full-text encoding, b1 is a bias parameter, T` represents the embedding of the dictionary, t i Represents the word vector of the i-th word in the dictionary.

[0033] For example, the input text S is "Bai Shuang Nan is the New Year of the Dai people. People will smear white mud on each other to celebrate during the festival." The result after word segmentation is recorded as S′=(s1,s2,s3,...,s n ), the word embedding obtained is recorded as X′=(x1,x2,x3,...,x n ), , where L represents the sequence length and D2 represents the dimension of word embedding. Then, using s i The dictionary is used to look up the words "Bai Shuang Nan, Water Splashing Festival, White Mud, Dai Nationality", etc., which are recorded as T = (t1, t2, t3, ..., t m), then add each domain word embedding obtained by looking up the table to get the domain word embedding T′, and then add T′ to x i The calculation process is shown below.

[0034]

[0035] Z i =T′W1+x i W2+b1

[0036] Among them, Z i represents the output hidden state of the i-th word, , is a parameter matrix used to assign weights to dictionary encoding and full-text encoding, and b1 is a bias parameter.

[0037] The text input at the encoding end and the dictionary are calculated through the encoder to obtain the output hidden state Z. The calculation process is as follows.

[0038] Z=(z1,z2,z3,...,z n )

[0039] As a preferred embodiment of the present invention, the specific steps of Step 3 are:

[0040] Step 3.1. Input the cross-border ethnic cultural text feature vector Z that incorporates domain word information into the traditional Transformer decoder to extract context-dependent feature information and generate a probability distribution that integrates domain word information to alleviate the problem of domain word information loss in cross-border ethnic cultural text summaries. Considering the synonymous relationship between cross-border ethnic cultural domain words, the attention mechanism is used in the decoding module to calculate the probability of synonyms, and then the synonym distribution is obtained to assist in generating domain words that are more in line with the original context semantics. The calculation process is as follows;

[0041]

[0042] in, represents the probability of synonym distribution, G1 represents the hidden state of the domain word in the original text, represents the embedding of the candidate word G2 in the dictionary, and Attention represents the calculation of attention;

[0043] Step 3.2, in order to better generate cross-border ethnic cultural text summaries, the idea of ​​pointer network is adopted at the decoding end, and the synonym distribution in Step 3.1 is combined with the probability distribution of fusion domain word information to generate the final summary; the pointer network is used to alleviate the problem of generating errors in unregistered words and domain words. The calculation process is as follows;

[0044]

[0045] Among them, P(ω) represents the probability of the final generation of the summary words, P gen represents the generation probability of summary words at time step t, represents the output of the encoder-decoder attention, Indicates words in the dictionary of cross-border ethnic culture ω vocab The probability of mapping to the original word ω, P N (ω) represents the probability of the word generated by the decoding end of the model;

[0046] In order to enable the model to learn how to generate cross-border ethnic cultural text summaries, the cross entropy loss function is used to pull in the probability distribution of the model prediction value and the true label. The specific calculation method is as follows;

[0047]

[0048] Among them, P t It represents the probability that the model predicts the correct result at time t, T represents the length of the summary, and ε is a hyperparameter.

[0049] In a second aspect, an embodiment of the present invention further provides a device for generating a cross-border ethnic cultural text summary incorporating domain word information, the device comprising a module for executing the method of the first aspect.

[0050] The beneficial effects of the present invention are:

[0051] 1. The present invention integrates domain word information into the text summary generation model, and uses domain dictionaries to enhance the representation ability of cross-border ethnic cultural texts on domain words, so that the model can achieve better results in cross-border ethnic cultural text summary generation, alleviating the problem of loss of ethnic cultural characteristic words in the summary text.

[0052] 2. The present invention calculates the synonym probabilities of domain words in the original text and similar domain words in the dictionary to obtain synonym distribution, and then guides the generation of summaries through a pointer network to enhance the model's ability to generate words that conform to the text context. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 This is an example diagram of the fusion of the domain dictionary and the input text encoding in the present invention;

[0054] Figure 2 This is a framework diagram of cross-border ethnic cultural entity recognition based on word set feature weighting in the present invention;

[0055] Figure 3 It is the overall flow chart of the present invention;

[0056] Figure 4A schematic diagram of a method and device for generating a cross-border ethnic cultural text summary that incorporates domain word information in the present invention. DETAILED DESCRIPTION

[0057] Example 1: Figure 1-Figure 4 As shown, a method for generating a cross-border ethnic cultural text summary by incorporating domain word information is described. The specific steps of the method for generating a cross-border ethnic cultural text summary by incorporating domain word information are as follows:

[0058] Step 1. Due to the lack of entity datasets in the field of cross-border ethnic culture, this paper constructs a cross-border ethnic cultural text summary dataset of 5112 pieces with abstracts and a domain dictionary of 3217 pieces through manual annotation. This dataset and domain dictionary play a good supporting role in the test of text summary generation model; and the text is divided into several types according to the different topics involved. The specific annotation principle is to add the cross-border ethnic cultural domain word information contained in the text on the basis of the text title;

[0059] Step 2: Encode and train the cross-border ethnic cultural domain dictionary and input text respectively, and use the table lookup method to match the text with the domain words in the dictionary; in order to enhance the representation ability of the cross-border ethnic cultural domain word information in the text, the dictionary encoding and text encoding are fused in the output part of the encoder to obtain the total encoding vector.

[0060] Step 3. Decode the encoding vector obtained above, and use the encoding and decoding attention mechanism to calculate the synonym probability of the domain words in the original text and the similar domain words in the dictionary to obtain the synonym distribution, and then use the pointer network to combine the synonym distribution with the probability distribution of the original text decoding to generate the final summary distribution, and then obtain the cross-border ethnic cultural text summary.

[0061] As a preferred embodiment of the present invention, the specific steps of Step 1 are:

[0062] Step 1.1. By crawling the ethnic cultural data from cross-border ethnic cultural websites, the data is pre-processed by removing duplicates and filtering special characters. Each cross-border ethnic cultural text is annotated with a corresponding reference summary. The manually constructed cross-border ethnic cultural text summary dataset contains 5112 texts, with an average of 6 to 8 sentences per text.

[0063] Step 1.2. Use the cross - ethnic - culture - field text data obtained in Step 1.1 for automatically extracting domain words. Based on the segmented domain words, new words are discovered by counting the frequencies of strings obtained from multiple character combinations and setting appropriate thresholds. In the given cross - ethnic - culture - related corpus, extract all strings whose occurrence frequencies exceed the set threshold, and then calculate the cohesion degree of words. To more accurately extract words composed of three or more characters, such as words like "Gan Huajie" (Going to the Flower Street) and "Pineapple Cooked Rice", the calculation process of the cohesion degree defined between three characters is as follows.

[0064]

[0065] Among them, a, b, and c are adjacent characters in the corpus, α represents the pre - set cohesion degree threshold. Count the number of times the string abc appears in pairs to obtain its frequency P(abc), and then separately count the frequencies P(a), P(b), and P(c) of characters a, b, and c. Generally, a relatively high cohesion degree threshold is set for words composed of multiple characters to prevent words like "Hulusheng" (Gourd Reed Pipe) from being wrongly segmented into "Hulu" (Gourd) and "Sheng" (Reed Pipe). The complete algorithm steps are as follows:

[0066] Statistics: Set different string lengths n, count the strings composed of n characters, set the cohesion degree threshold according to the string length n. The larger the number of characters, the larger the threshold is set. Then calculate the cohesion degree between strings, and only retain the strings higher than the cohesion degree threshold to form a set G;

[0067] Segmentation: De - duplicate and filter special characters from the cross - ethnic - culture corpus, and then use the set obtained above to segment each corpus and count the frequencies of strings. The segmentation rule is that if a string in the corpus appears in set G, this string is not segmented. For example, for "Fragrant Pineapple Cooked Rice", as long as "Pineapple" and "Cooked Rice" are in set G, but "Pineapple Cooked Rice" is not in set G, then "Pineapple Cooked Rice" is still retained;

[0068] Screening: Filter out the strings with lower cohesion degrees in the segmentation step. For words with a string length greater than n, judge whether the string is in G. If it does not exist, filter it out. Finally, sort the words obtained after screening according to the word frequency and extract the top 20 words with higher frequencies.

[0069] The cross - ethnic - culture - field dictionary involves 8 types such as festivals, religions, architectures, etc. There are approximately 200 pieces of data with similar semantics but inconsistent expressions. For example, "Kaimen Jie" (Opening the Door Festival) is the name celebrated by the Dai people in China, while people in countries such as Thailand and Laos mostly call it "Chu Xia Jie" (End of the Rains Retreat Festival), and at the same time, a small number of people call it "Chu Wa Jie" (Going into the Vassa). Other similar domain words are shown in Table 2.

[0070] Table 2 Vocabulary styles in the field of cross-border ethnic culture

[0071] Domain Vocabulary Other Names Water Splashing Festival Baishuangnan (Laos), Buddha's Birthday (Vietnam), Songkran Festival (Thailand) Open Door Festival Chuwa Festival (Dehong), Chuxia Festival (Laos) Call Valley Soul Summon the Valley Soul (Alias) wedding Jin Qian (alias) Closing Day Haowasa (alias), Jinwa (Dehong) Flower Street Festival Flower Street (Alias)

[0072] Step 1.3: Use the pre-trained language model to represent the cross-border ethnic cultural text as a character vector, and then input it into the Transformer Encoder layer to obtain the vector representation of each character of the input text. For example, the text "Lemongrass Grilled Fish" is represented as E=c after the elements of the three Embeddings are bitwise added. [CLS] ,c 香 ,c 茅 ,c 草 ,c 烤 ,c 鱼 ,c [SEP] , where c [CLS] and c [SEP] is a special tag vector of the text. For the input vector, Multi-Head Self-Attention is used to calculate the relationship between each word in the text and other words. The calculation process is as follows:

[0073]

[0074] MHA=Concat(head1,...,head k )W O

[0075]

[0076] in, represents the W of the i-th Head Q ,W K ,W V Matrix, W O is the additional weight matrix, d k is the dimension of the input word vector, and Softmax is a normalization operation. After a series of normalization and linear processing, the Transformer Encoder output of the input text can be obtained.

[0077] In order to enhance the focus on domain words in the text encoding process, the cross-border ethnic cultural domain dictionary information is added to the encoding end of the model, and the CBOW strategy in word2vec is used to encode the domain dictionary to obtain the dictionary embedding T`. i , output word vector t i , Where D1 represents the word2vec dimension size, t iThe word vector representing the i-th word in the dictionary. For example, for the domain vocabulary "Huajie Festival", after encoding by word2vec, the word vector of "Huajie Festival" is obtained, and the calculation process is as follows:

[0078] t i = word2vecα i

[0079] As a preferred solution of the present invention, the specific steps of the said Step2 are as follows:

[0080] Step2.1. Vectorized feature representation of the cross-border ethnic culture domain dictionary and the input text: The CBOW strategy in word2vec is used to encode the domain dictionary to obtain the embedding of the dictionary; for the domain vocabulary contained in the dictionary, the word vector is output; given a set of cross-border ethnic culture text data, it is encoded by Transformer, and the input vector calculates the mutual relationship between each word in the text and other words by using the multi-head self-attention mechanism;

[0081] Step2.2. Obtaining the text vector enhanced by the domain dictionary information: The encoding of the cross-border ethnic culture domain dictionary is fused with the encoding of the original text to enhance the representation ability of the text vector for the cross-border ethnic domain vocabulary; among them, the look-up table idea of the domain dictionary is to match each word in the input text with all possible similar words in the dictionary, and then splice the word vectors of all the matched words with the text encoding vector; add all the matched word embedding sequences to generate the domain word information of the entire text, and add it to the embedding of each word in the original text. Finally, the fused text total vector Z is used as the decoding vector and input to the decoding end for subsequent calculation processing, and the calculation process is as follows;

[0082]

[0083] Z i = T′W1 + x i W2 + b1

[0084] Among them, Z i represents the output hidden state of the i-th word, is the parameter matrix, used to allocate the weights of the dictionary encoding and the full text encoding, b1 is the bias parameter, T` represents the embedding of the dictionary, and t i represents the word vector of the i-th word in the dictionary.

[0085] For example, the input text S is "Bai Shuangnan is the Dai New Year, and people will smear white mud on each other to celebrate during the festival period." The result after word segmentation is recorded as S′ = (s1, s2, s3,..., s n ), and the obtained word embeddings are recorded as X′ = (x1, x2, x3,..., x n ), , where L represents the sequence length and D2 represents the dimension of word embedding. Then, using s i The dictionary is used to look up the words "Bai Shuang Nan, Water Splashing Festival, White Mud, Dai Nationality", etc., which are recorded as T = (t1, t2, t3, ..., t m ), then add each domain word embedding obtained by looking up the table to get the domain word embedding T′, and then add T′ to x i The calculation process is shown below.

[0086]

[0087] Z i =T′W1+x i W2+b1

[0088] Among them, Z i represents the output hidden state of the i-th word, is a parameter matrix used to assign weights to dictionary encoding and full-text encoding, and b1 is a bias parameter.

[0089] The text input at the encoding end and the dictionary are calculated through the encoder to obtain the output hidden state Z. The calculation process is as follows.

[0090] Z=(z1,z2,z3,...,z n )

[0091] As a preferred embodiment of the present invention, the specific steps of Step 3 are:

[0092] Step 3.1. Input the cross-border ethnic cultural text feature vector Z that incorporates domain word information into the traditional Transformer decoder to extract context-dependent feature information and generate a probability distribution that integrates domain word information to alleviate the problem of domain word information loss in cross-border ethnic cultural text summaries. Considering the synonymous relationship between cross-border ethnic cultural domain words, the attention mechanism is used in the decoding module to calculate the probability of synonyms, and then the synonym distribution is obtained to assist in generating domain words that are more in line with the original context semantics.

[0093] Specifically, the feature vector Z that incorporates the domain word information in Step 2.1 is used as the input of the decoder for subsequent calculations. The calculation principle of the encoder-decoder attention mechanism in the decoder is similar to the multi-head self-attention mechanism on the encoder side. The difference is that the Key value and Value value in the encoder-decoder attention module come from the encoder, which allows the model to learn as much information as possible about the entire text during the calculation process and enhance the quality of subsequent summary generation. Since the encoder-decoder attention is a multi-head attention, we take the average value of the head as the output The calculation process is as follows:

[0094]

[0095] in, Represents the hidden state of the qth word under the hth head.

[0096] In this module, calculating the synonym probability between the original domain word and the word in the dictionary is an important task. The idea is to select the correct domain word based on the context. The specific process is that we first limit the number of candidate words in the cross-border ethnic cultural domain dictionary to within m, and then we use the multi-head attention mechanism to use the hidden state of the domain word G1 in the original text as the query vector, and the corresponding candidate word embedding in the dictionary as the key vector and value vector to calculate the synonym distribution probability. The calculation process is as follows:

[0097]

[0098] in, is the embedding of the candidate word G2 in the dictionary. Finally, the average value calculated by multi-head attention is taken as the final synonym probability. Because the hidden state of word G1 is obtained by the encoder through self-attention, the model can select the correct domain word based on understanding the context. For example: the input text is "Thailand's Songkran Festival is the New Year of the Thai people. It comes on April 13th every year and lasts for three days." The domain vocabulary in the text is "Songkran Festival". Through the domain word attention calculation and the probability of vocabulary in the cross-border ethnic culture domain dictionary, the probability of its three synonyms is obtained, "Songkran Festival 0.38, Songkran Festival 0.52, Baishuangnan 0.10". After comparing the numerical values, it is believed that "Songkran Festival" has the largest probability proportion, indicating that "Songkran Festival" is more suitable for the context of the current text. In this way, the synonym distribution of the current text will be generated according to the calculation result, providing a basis for the subsequent selection of the pointer network.

[0099] Step 3.2: In order to better generate cross-border ethnic cultural text summaries, the idea of ​​pointer network is adopted at the decoding end, combining the synonym distribution in Step 3.1 with the probability distribution of fusion domain word information to generate the final summary;

[0100] Specifically, the pointer network is used to select the decoding distribution to enhance the model's ability to generate words that conform to the text context. Use U as the hidden state of the decoder at time step t and calculate the generation probability P at time step t. gen , where P gen ∈(0,1). gen The calculation process is as follows.

[0101] P gen =σ(W 4 (W 3 U+b1)+b2)

[0102] in, is the learning parameter, b2∈R is the bias vector, σ is the sigmoid function. In the decoding process, P gen It acts as a soft switch to choose whether to generate a word from the decoder or copy a word from the dictionary. Therefore, the probability of generating a word P(ω) is calculated as follows.

[0103]

[0104] in represents the probability of mapping a word in the dictionary of cross-border ethnic culture to the original word ω, P N (ω) represents the probability of the word generated by the decoding end of the model, Represents the output of the encoder-decoder attention obtained in Step 3.1.

[0105] In order to illustrate the effect of the present invention, the present invention conducted the following comparative experiment, and the experimental data used were a manually annotated dataset of cross-border ethnic cultural text summaries and an open source THUCNews dataset.

[0106] The evaluation indicators used are Rouge-1, Rouge-2, and Rouge-L in ROUGE (Recall Oriented Under study for Gisting Evaluation) to evaluate the model. Among them, Rouge-N mainly calculates the recall rate on N-gram. The calculation process is as follows:

[0107]

[0108] The denominator is the number of n-grams in the reference summary, that is, C(n-gram) in the formula; the numerator is the number of n-grams shared by the reference summary and the generated summary, that is, C match (n-gram), {RefSum} represents the reference summary. Rouge-L considers the longest common subsequence of the reference summary and the generated summary. The calculation process is as follows.

[0109]

[0110]

[0111]

[0112] Wherein, RefSum represents the reference summary, len(RefSum) represents the length of the reference summary, CreSum represents the generated summary, and len(CreSum) represents the length of the generated summary.

[0113] LCS(RefSum,CreSum) represents the longest common subsequence of the reference summary and the generated summary. Rlcs and Plcs represent the calculated recall and precision, respectively. Flcs is the Rouge-L value.

[0114] In order to verify the effect of the cross-border ethnic culture text summary generation model that integrates this field information proposed in this paper, the following comparative experiments are designed for analysis. The method is compared with Lead-1-First, TextRank, Pointer, RNN Context, Unlim, and ATS. The specific experimental results are shown in Table 3.

[0115] Table 3 Comparative experiments of different methods

[0116] Method Name R-1(%) R-2(%) RL(%) Lead-1-First 23.53 11.68 22.83 TextRank 23.86 11.54 22.46 Pointer 24.64 12.71 23.36 RNN Context 24.01 12.56 23.12 Unlim 25.83 12.61 24.37 ATS 25.57 12.96 24.64 Method of the present invention 26.62 13.63 25.41

[0117] Experiments show that by incorporating the information of the cross-border ethnic cultural dictionary at the encoding end and fusing the synonym distribution of the dictionary with the probability distribution of the original text vector based on the pointer network at the decoding end, compared with the Lead-1-First, TextRank, Pointer, RNN Context, Unlim, and ATS models, the model's ability to represent domain vocabulary and the probability of generating correct domain vocabulary can be effectively improved, proving the effectiveness of the method of the present invention for cross-border ethnic cultural text summarization.

[0118] Table 4 compares the effects of using word2vec to encode the cross-border ethnic cultural domain dictionary for model training and using glove and random initialization to encode the two domain dictionaries on the experimental results.

[0119] Table 4 Effect of domain dictionary encoding method on the model

[0120] Dictionary encoding method R-1(%) R-2(%) RL(%) GloVe 26.31 13.47 24.86 Random Initialization 22.57 11.43 21.11 word2vec (method of the present invention) 26.62 13.62 25.41

[0121] The experimental results show that the effect of randomly initializing the model parameters is relatively poor, indicating that the random initialization method for dictionary encoding cannot enable the model to learn more sufficient domain vocabulary knowledge; word2vec encoding is slightly better than GloVe encoding, because GloVe is mainly based on the encoding idea of ​​global word frequency statistics, which mainly captures some semantic characteristics between words, while word2vec is encoded from the context information of the word and added to a total vector for representation, which can enable the model to better enhance the vocabulary representation ability according to the context of the domain vocabulary in the text, so the present invention adopts word2vec to encode the cross-border ethnic cultural domain dictionary.

[0122] According to the concept of the present invention, in a second aspect, an embodiment of the present invention further provides a device for generating a cross-border ethnic cultural text summary incorporating domain word information, the device comprising the following integrated modules:

[0123] Cross-border ethnic culture text summary data preprocessing module: used to construct a cross-border ethnic culture text summary dataset and domain dictionary with summaries, and divide the text into several types according to the different topics involved. The specific annotation principle is to add cross-border ethnic culture domain word information contained in the text based on the text title;

[0124] The cross-border ethnic cultural text feature representation module that incorporates domain word information is used to encode the cross-border ethnic cultural domain dictionary and the input text respectively, and use the table lookup method to match the text with the domain words in the dictionary; the dictionary encoding and the text encoding are merged at the output part of the encoder to obtain the total encoding vector;

[0125] Cross-border ethnic cultural text summary generation module based on pointer network: used to decode the obtained encoding vector, use the attention mechanism in the decoding module to calculate the synonym probability of the domain words in the original text and the similar domain words in the dictionary to obtain the synonym distribution, and then use the pointer network to combine the synonym distribution with the probability distribution of the original text decoding to generate the final summary distribution, and then obtain the cross-border ethnic cultural text summary.

[0126] In a feasible implementation, the pointer network-based cross-border ethnic cultural text summary generation module also includes: deploying the trained model to the local server, converting the model into an application interface through Sanic technology, realizing direct calling of the model through the web page, and outputting the generated summary to the front-end interface for display.

[0127] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.

Claims

1. A method for generating a cross-border ethnic cultural text summary by incorporating domain word information, characterized by: The specific steps of the cross-border ethnic cultural text summary generation method incorporating domain word information are as follows: Step 1. Preprocessing of cross-border ethnic cultural text summary data: Construct a cross-border ethnic cultural text summary dataset and domain dictionary with summary, and divide it into several types according to the different topics involved in the text. The specific annotation principle is to add cross-border ethnic cultural domain word information contained in the text based on the text title; Step 2: Encode the cross-border ethnic cultural domain dictionary and input text respectively, and use the table lookup method to match the text with the domain words in the dictionary; merge the dictionary encoding and text encoding in the output part of the encoder to obtain the total encoding vector; Step 3, cross-border ethnic cultural text summary generation based on pointer network: decode the obtained encoding vector, use the attention mechanism in the decoding module to calculate the synonym probability of the domain words in the original text and the similar domain words in the dictionary to obtain the synonym distribution, and then use the pointer network to combine the synonym distribution with the probability distribution of the original text decoding to generate the final summary distribution, and then obtain the cross-border ethnic cultural text summary; The specific steps of Step 1 are: Step 1.1, cross-border ethnic culture data was obtained through cross-border ethnic culture websites, and the data was pre-processed by removing duplicates and filtering special characters, and then the cross-border ethnic culture texts with abstracts were manually annotated. Each abstract consists of the title of the text and the domain word information contained in the text; Step 1.2, based on the cross-border ethnic culture field text data obtained in Step 1.1, automatically extract the field words; use the segmentation-based field word method to discover new words by counting the frequency of strings obtained by combining multiple characters and setting thresholds; in the given cross-border ethnic culture-related corpus, extract all strings whose frequency exceeds the set threshold, and then calculate the degree of cohesion of the words; in order to more accurately extract words composed of three or more characters, the calculation process of the cohesion defined between three characters is as follows; Among them, a, b, and c are adjacent characters in the corpus, and α represents a preset solidification threshold. The number of times the string abc appears in pairs is counted to obtain its frequency P(abc), and then the frequencies of characters a, b, and c are counted respectively, P(a), P(b), and P(c); a high solidification threshold is set for words composed of multiple characters, and the domain dictionary contains words related to festivals, architecture, religion, food, and literature and art in cross-border ethnic cultures; Step 1.3: Use the pre-trained language model to represent the cross-border ethnic cultural text as a character vector, and then input it into the Transformer Encoder layer to obtain the vector representation of each character of the input text; for the input vector, use the Multi-Head Self-Attention mechanism to calculate the relationship between each word in the text and other words. The calculation process is as follows: MHA=Concat(head1,...,head k )W O Among them, W i Q , W i V represents the W of the i-th Head Q ,W K ,W V Matrix, W O is the additional weight matrix, d k is the dimension of the input word vector, Softmax is the normalization operation, and the Transformer Encoder output of the input text is obtained after a series of normalization and linear processing; In order to enhance the attention to domain words in the text encoding process, the cross-border ethnic cultural domain dictionary information is added to the encoding end of the model, and the CBOW strategy in word2vec is used to encode the domain dictionary to obtain the dictionary embedding T`; for the domain words α contained in the dictionary i , output word vector Where D1 represents the word2vec dimension size, t i Represents the word vector of the i-th word in the dictionary. The calculation process is as follows: i =word2vecα i ; The specific steps of Step 2 are: Step 2.1, vectorized feature representation of cross-border ethnic cultural domain dictionary and input text: Use the CBOW strategy in word2vec to encode the domain dictionary to obtain the dictionary embedding; output the word vector for the domain vocabulary contained in the dictionary; given a set of cross-border ethnic cultural text data, use Transformer to encode it, where the input vector uses a multi-head self-attention mechanism to calculate the relationship between each word in the text and other words; Step 2.2, Acquisition of text vectors enhanced by domain dictionary information: The cross-border ethnic cultural domain dictionary encoding is integrated with the original text encoding to enhance the text vector's ability to represent cross-border ethnic domain vocabulary; the idea of ​​the domain dictionary lookup is to match each word in the input text with all possible similar words in the dictionary, and then concatenate the word vectors of all matched words with the text encoding vector; add all matched word embedding sequences to generate the domain word information of the entire text, and add it to the embedding of each word in the original text, and finally input the fused text total vector Z as the decoding vector to the decoding end for subsequent calculation and processing. The calculation process is as follows; From i =T′W1+x i W2+b1 Among them, Z i represents the output hidden state of the i-th word, is a parameter matrix used to assign weights to dictionary encoding and full-text encoding, b1 is a bias parameter, T` represents the embedding of the dictionary, t i Represents the word vector of the i-th word in the dictionary; The specific steps of Step 3 are: Step 3.

1. Input the cross-border ethnic cultural text feature vector Z that incorporates domain word information into the traditional Transformer decoder to extract context-dependent feature information and generate a probability distribution that integrates domain word information to alleviate the problem of domain word information loss in cross-border ethnic cultural text summaries. Considering the synonymous relationship between cross-border ethnic cultural domain words, the attention mechanism is used in the decoding module to calculate the probability of synonyms, and then the synonym distribution is obtained to assist in generating domain words that are more in line with the original context semantics. The calculation process is as follows; in, represents the probability of synonym distribution, G1 represents the hidden state of the domain word in the original text, represents the embedding of the candidate word G2 in the dictionary, and Attention represents the calculation of attention; Step 3.2, in order to better generate cross-border ethnic cultural text summaries, the idea of ​​pointer network is adopted at the decoding end, and the synonym distribution in Step 3.1 is combined with the probability distribution of fusion domain word information to generate the final summary; the pointer network is used to alleviate the problem of generating errors in unregistered words and domain words. The calculation process is as follows; Among them, P(ω) represents the probability of the final generation of the summary words, P gen represents the generation probability of summary words at time step t, represents the output of the encoder-decoder attention, Indicates words in the dictionary of cross-border ethnic culture ω vocab The probability of mapping to the original word ω, P N (ω) represents the probability of the word generated by the decoding end of the model; In order to enable the model to learn how to generate cross-border ethnic cultural text summaries, the cross entropy loss function is used to pull in the probability distribution of the model prediction value and the true label. The specific calculation method is as follows; Among them, P t It represents the probability that the model predicts the correct result at time t, T represents the length of the summary, and ε is a hyperparameter.

2. A device for generating a cross-border ethnic cultural text summary by incorporating domain word information, characterized in that: The method comprises modules for executing the method as claimed in claim 1.