A Chinese dialogue semantic role labeling method and system
By introducing knowledge graph enhancement and lightweight model technology into the semantic role annotation task, and combining the index encoder and the self-attention model for joint training, the problem of high computational cost of the traditional model is solved and the performance of Chinese dialogue semantic role annotation is improved.
Patent Information
- Application Number
- CN202210258857.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-16
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-03-16
AI Technical Summary
Implementing semantic role annotation tasks based on traditional algorithms or models has the problem of huge training costs and high model memory usage, making it difficult to effectively reduce computational costs and improve model performance at the same time.
By introducing the knowledge graph for data enhancement, a lightweight associated entity knowledge enhancement model is constructed, and the index encoder and the self-attention SRL model are combined for joint training to reduce the number of model parameters and improve performance.
It is possible to improve the performance of Chinese dialogue semantic role annotation while reducing the computational cost of the model. The model performance is improved through joint training of multiple enhanced data sets and the overall parameter amount is reduced.
Smart Images

Figure CN114625830B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a method and system for labeling Chinese dialogue semantic roles. Background Art
[0002] Natural language analysis technology can be roughly divided into three levels: lexical analysis, syntactic analysis, and semantic analysis. Semantic Role Labeling (SRL) is a way to achieve shallow semantic analysis. SRL focuses on the predicate of a sentence and does not conduct in-depth analysis of the semantic information contained in the sentence. It only analyzes the relationship between each component and the predicate in the sentence, that is, the predicate-argument structure of the sentence, and uses semantic roles to describe these structural relationships. It is an important intermediate step in many natural language understanding tasks (such as information extraction, paragraph analysis, deep question answering, etc.). With the development of deep learning technology, many scholars have also begun to study deep SRL. However, implementing SRL tasks based on traditional algorithms or models has problems such as huge training costs or excessive model memory usage. Summary of the invention
[0003] In order to solve the above technical problems, the purpose of the present invention is to provide a Chinese dialogue semantic role labeling method and system, which can reduce the computational cost of the model while improving the performance of the model.
[0004] The first technical solution adopted by the present invention is: a Chinese dialogue semantic role labeling method, comprising the following steps:
[0005] Performing associated entity enhancement processing on the conversation text data in the data set to obtain an enhanced data set;
[0006] Input the enhanced dataset into the lightweight associated entity enhancement model and output word vectors rich in external knowledge;
[0007] Construct an index encoder based on the data samples labeled with the semantic roles of the dialogue and output an index vector;
[0008] Concatenate the word vector rich in external knowledge with the index vector to obtain a concatenated vector;
[0009] The concatenated vector is input into the pre-built semantic role labeling layer to obtain the semantic role labeling result.
[0010] Further, the step of performing associated entity enhancement processing on the conversation text data in the data set to obtain an enhanced data set specifically includes:
[0011] Acquire a Chinese conversation dataset from the Internet and perform data cleaning on the Chinese conversation dataset to obtain a cleaned dataset;
[0012] The conversation text data in the cleaned data set is requested for knowledge triples from the knowledge graph library, and the associated entity enhancement processing is performed to obtain an enhanced data set.
[0013] Furthermore, the step of requesting knowledge triples from the knowledge graph library for the conversation text data in the cleaned data set and performing related entity enhancement processing to obtain an enhanced data set specifically includes:
[0014] Initiate a request to the knowledge graph library for the conversation text data in the cleaned data set to obtain the corresponding knowledge triples;
[0015] Extract and process the corresponding knowledge triples to obtain related entities;
[0016] The conversation text data and associated entities in the cleaned data set are stored in a local file in a key-value pair format and constructed into an associated entity dictionary.
[0017] Construct an associated entity lookup table based on the associated entity dictionary;
[0018] The conversation text data in the dataset is enhanced based on the associated entity lookup table to obtain an enhanced dataset.
[0019] Furthermore, the step of inputting the enhanced data set into the lightweight associated entity enhancement model and outputting a word vector rich in external knowledge specifically includes:
[0020] The RoBERTa pre-trained model of the BERT architecture is used as a word vector encoder to build an associated entity knowledge enhancement model;
[0021] The associated entity knowledge enhancement model is adaptively modified and lightweighted in turn, a lightweight associated entity knowledge enhancement model is constructed, and the enhanced dataset is input into the lightweight associated entity enhancement model to output a word vector rich in external knowledge.
[0022] Furthermore, the step of adaptively modifying and lightweighting the associated entity knowledge enhancement model in sequence, constructing a lightweight associated entity knowledge enhancement model, inputting the enhanced data set into the lightweight associated entity enhancement model, and outputting a word vector rich in external knowledge specifically includes:
[0023] Adaptively modifying the input layer of the associated entity knowledge enhancement model based on soft position coding to obtain a modified input layer;
[0024] Obtain the relationship between the conversation text data and the associated entities in the cleaned data set and combine them with hard position coding to construct a visibility matrix;
[0025] Adaptively modify the BERT encoder layer based on the visible matrix to obtain a modified BERT encoder layer;
[0026] The modified BERT encoder layer is lightweighted to obtain a lightweight K-BERT encoder layer;
[0027] Combining the modified input layer and the lightweight K-BERT encoder layer, a lightweight associative entity knowledge enhancement model is constructed;
[0028] The enhanced dataset is processed with two word order encodings and input into a lightweight associated entity knowledge enhancement model to output a word vector rich in external knowledge. The two word order encodings include hard position encoding and soft position encoding.
[0029] Furthermore, the step of performing two word order encoding processes on the enhanced dataset and inputting the enhanced model into a lightweight associated entity knowledge enhancement model to output a word vector rich in external knowledge specifically includes:
[0030] Based on the enhanced data set, the lightweight associated entity enhancement model is trained for multiple generations, and the knowledge related to the request entity in the enhanced data set is enhanced to obtain an enhanced data set;
[0031] By searching for all request entities in each sentence data, a corresponding associated entity is randomly taken out from the enhanced data set and inserted after the request entity to obtain an enhanced sentence;
[0032] Encode the enhanced sentences in two word orders to obtain the position index corresponding to each word;
[0033] The enhanced sentences, soft position encoding indexes and visibility matrices are input into the lightweight associative entity knowledge enhancement model, and word vectors rich in external knowledge are output.
[0034] Furthermore, the step of constructing an index encoder based on the data samples labeled with the dialogue semantic roles and outputting an index vector specifically includes:
[0035] Perform entity enhancement on the data samples labeled with the semantic roles of the dialogue to obtain a sentence sequence enhanced with associated entities;
[0036] For the sentence sequence enhanced with associated entities, a dialogue turn index and a predicate position index are established respectively, and two index encoders are constructed using two fully connected layers to obtain an index encoder and a predicate position index encoder respectively.
[0037] Input the dialogue turn index and predicate position index into the dialogue turn index encoder and the predicate position index encoder respectively to obtain the dialogue turn embedding vector and the predicate position embedding vector;
[0038] Combine the dialogue turn embedding vector and the predicate position embedding vector to get the index vector.
[0039] Furthermore, the semantic role labeling layer includes a self-attention layer and a softmax normalization layer. The step of inputting the concatenated vector into the pre-built semantic role labeling layer to obtain the semantic role labeling result specifically includes:
[0040] Perform feature capture processing on the concatenated vector based on the self-attention layer to obtain an output vector;
[0041] The output vector is normalized based on the softmax normalization layer, and the semantic role labeling result is output.
[0042] The second technical solution adopted by the present invention is: a Chinese dialogue semantic role labeling system, comprising:
[0043] A data enhancement module is used to perform associated entity enhancement processing on the conversation text data in the data set to obtain an enhanced data set;
[0044] The associated entity knowledge enhancement module is used to input the enhanced data set into the lightweight associated entity enhancement model and output word vectors rich in external knowledge;
[0045] The index encoder module is used to construct an index encoder based on the data samples labeled with the dialogue semantic roles and output an index vector;
[0046] The word vector and index vector concatenation module is used to concatenate the word vector rich in external knowledge with the index vector to obtain the concatenated vector;
[0047] The semantic role labeling prediction module is used to input the concatenated vector into the pre-built semantic role labeling layer to obtain the semantic role labeling result.
[0048] The beneficial effects of the method and system of the present invention are as follows: the present invention enhances the knowledge of the conversation text by introducing the associated entities of the knowledge graph, obtains the word vector rich in external knowledge by modifying the BERT encoder, and combines the index encoder module with the self-attention SRL model to perform Chinese text processing and data enhancement joint training, thereby realizing joint training of the model with multiple enhanced data sets, so that the performance of the model is better. In addition, the model of Chinese conversation semantic annotation is lightweight processed based on lightweight technology, thereby reducing the number of parameters of the overall model and reducing the computational cost of the model. Joint training of the model with multiple enhanced data sets can improve the performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a flowchart of the steps of a Chinese dialogue semantic role labeling method of the present invention;
[0050] Figure 2 It is a structural block diagram of a Chinese dialogue semantic role labeling system of the present invention;
[0051] Figure 3 It is an overall model diagram of a Chinese dialogue semantic role labeling method of the present invention;
[0052] Figure 4 is a schematic diagram of the associated entity knowledge enhancement module of the present invention;
[0053] Figure 5 It is a schematic diagram of the visible matrix designed by the present invention;
[0054] Figure 6 Schematic diagram of the lightweight K-BERT module of the present invention. DETAILED DESCRIPTION
[0055] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. The step numbers in the following embodiments are only provided for the convenience of explanation and description, and the order between the steps is not limited in any way. The execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0056] The present invention relies on the relatively mature semantic role labeling technology and utilizes model lightweight technology to perform Chinese text processing and data enhancement joint training through an index encoder module and a self-attention-based SRL model, which can reduce the actual running time of the model without increasing the computational cost.
[0057] Reference Figure 1 The present invention provides a Chinese dialogue semantic role labeling method, the method comprising the following steps:
[0058] S1. Performing associated entity enhancement processing on the conversation text data in the data set to obtain an enhanced data set;
[0059] S11, obtaining a Chinese conversation dataset from the Internet and performing data cleaning on the Chinese conversation dataset to obtain a cleaned dataset;
[0060] Specifically, the Chinese dialogue dataset to be processed is obtained from the Internet, and the dataset is cleaned to remove items with incorrect labels and items that do not meet the training requirements to obtain a training dataset that can be processed later. The associated entity knowledge enhancement model is constructed through the RoBERTa pre-trained model. The prediction output layer in the RoBERTa model is removed, leaving only the embedding layer (including token embedding / position embedding / segment embedding) and the encoder layer, and the first 6 encoder layers of the 12 encoder layers in the RoBERTa pre-trained model are retained to reduce the parameter scale of the model.
[0061] S12, requesting knowledge triples from the knowledge graph library for the conversation text data in the cleaned data set, and performing related entity enhancement processing to obtain an enhanced data set;
[0062] S121, initiating a request to the knowledge graph library for the conversation text data in the cleaned data set to obtain the corresponding knowledge triples;
[0063] S122, extracting and processing corresponding knowledge triples to obtain associated entities;
[0064] S123, storing the conversation text data and associated entities in the cleaned data set in a local file in a key-value pair format by line, and constructing an associated entity dictionary;
[0065] S124, constructing an associated entity lookup table according to the associated entity dictionary;
[0066] S125. Enhance the conversation text data in the data set based on the associated entity lookup table to obtain an enhanced data set.
[0067] Specifically, for each word in the data set, a knowledge triple is requested from the knowledge graph library. A large number of knowledge triples are requested, and the format is (request entity, relationship, associated entity). After filtering out the entries with low information content or that are not suitable for data enhancement according to certain rules, only the associated entity and the corresponding request entity are extracted in the key-value pair format of [request entity: [associated entity 1, associated entity 2, associated entity 3, ...]], and stored as a local file by line to obtain an associated entity dictionary. The request entity is used as the key in the dictionary, and the corresponding filtered and extracted multiple associated entities are stored in a set to ensure no duplication. The set corresponds to the request entity as the value in the associated entity dictionary. The associated entity dictionary file is read into the memory to form an associated entity lookup table. The conversation text data in the data set is enhanced based on the associated entity lookup table to obtain an enhanced data set.
[0068] S2, input the enhanced dataset into the lightweight associated entity enhancement model and output the word vector rich in external knowledge;
[0069] S21. Use the RoBERTa pre-trained model of the BERT architecture as a word vector encoder to build an associated entity knowledge enhancement model.
[0070] S22. Adaptively modify and lightweight the associated entity knowledge enhancement model in sequence, construct a lightweight associated entity knowledge enhancement model, input the enhanced data set into the lightweight associated entity enhancement model, and output a word vector rich in external knowledge.
[0071] S221, adaptively modifying the input layer of the associated entity knowledge enhancement model based on soft position coding to obtain a modified input layer;
[0072] S222, obtaining the relationship between the conversation text data and the associated entities in the cleaned data set and combining them with the hard position coding to construct a visible matrix;
[0073] Specifically, refer to Figure 5 , for sentences with associated entity enhancement, such as the following sentences,
[0074] After playing God of War, Sony especially liked the Greek myth of Atreus;
[0075] In the original sentence, the five words: played, god of war, special, like, and Atreus are mutually visible, and are reflected as solid circles in the visible matrix. Played, god of war, Sony, special, like, Atreus, and Greek mythology are sentences enhanced with associated entities, where Sony is the associated entity of god of war, and Greek mythology is the associated entity of Atreus. Associated entities are only mutually visible with their corresponding request entities, that is, associated entities are invisible to other words. For example, in the third row of the visible matrix, the word Sony is a solid circle only in the places of god of war and Sony itself, and all other positions are hollow circles. For example, hard position encoding is used to establish a visible matrix for the sentence sequence that enters the lightweight K-BERT encoder layer for attention value calculation. For the original sentence, the word vectors corresponding to each word need to calculate the attention value, that is, they are visible, while for the associated entities, they can only be mutually visible with their corresponding request entities. In the visible matrix, if the i-th row and the j-th column are solid circles, it means that word i and word j are mutually visible, and hollow circles indicate that they are invisible. For a visible matrix M, the elements in it are M ij , let the visible solid circle elements take the value of 0, and the invisible hollow circle elements take the value of -∞, the formula of the visible matrix is expressed as follows:
[0076]
[0077] In the above formula, Mij Represents the elements of the visible matrix;
[0078] S223, adaptively modifying the BERT encoder layer based on the visible matrix to obtain a modified BERT encoder layer;
[0079] S224, performing lightweight processing on the modified BERT encoder layer to obtain a lightweight K-BERT encoder layer;
[0080] S225. Combining the modified input layer and the lightweight K-BERT encoder layer, a lightweight associated entity knowledge enhancement model is constructed;
[0081] Specifically, the input layer and BERT encoder layer of the associated entity knowledge enhancement model are adaptively modified. The original position encoding is modified into soft position encoding, and the attention value of the BERT encoder layer is calculated in combination with the visible matrix. Only the first several layers of the 12 BERT encoder layers are retained to obtain a lightweight associated entity knowledge enhancement model.
[0082] S226. Perform two word order encoding processes on the enhanced data set and input it into a lightweight associated entity knowledge enhancement model to output a word vector rich in external knowledge. The two word order encodings include hard position encoding and soft position encoding.
[0083] S2261, training the lightweight associated entity enhancement model for multiple generations based on the enhanced data set, enhancing the knowledge related to the request entity in the enhanced data set, and obtaining an enhanced data set;
[0084] S2262, for each request entity, randomly take out a corresponding associated entity from the enhanced data set requested by all request entities in each search sentence data and insert it after the request entity to obtain an enhanced sentence;
[0085] S2263, performing two word order encoding on the enhanced sentence to obtain a position index corresponding to each word;
[0086] S2264. Input the enhanced sentence, soft position coding index and visible matrix into the lightweight associative entity knowledge enhancement model, and output the word vector rich in external knowledge.
[0087] Specifically, refer to Figure 4In the joint training method of associated entity enhancement, during model training, the model is trained for multiple generations (epochs) based on the enhanced data set. At the beginning of each epoch training, each word in each sentence data is used as a request entity to search the associated entity lookup table that has been read into the memory. If an associated entity set is requested, an associated entity is randomly read from the associated entity set corresponding to the request entity and directly inserted after the corresponding request entity. For example, in the sentence "I played God of War and I especially like Atreus", the requested entity requested from the knowledge graph library is God of War, and the returned knowledge triples are ["God of War", "Game Type", "Action Game"] or ["God of War", "Publishing Company", "Sony"], etc. The requested entity requested from the knowledge graph library is Atreus, and the returned knowledge triples are ["Atreus", "Mythology System", "Greek Mythology"], ["Atreus", "Children", "Agamemnon"] or ["Atreus", "Brothers and Sisters", "Thyestes"], etc. For the requested entity "God of War", the corresponding associated entities in the above two triples requested are "Action Game", "Sony", etc., so the enhanced sentences obtained when the associated entity is enhanced at the beginning of an epoch may have the following situations:
[0088] I played the God of War action game and particularly liked Atreus and Agamemnon;
[0089] I played the God of War action game and I particularly liked the Greek myth of Atreus;
[0090] After playing God of War, Sony especially liked the Greek myth of Atreus;
[0091] …
[0092] The words after each request entity in each enhanced sentence represent its corresponding associated entity. This enhancement method is similar to the way people use a pair of brackets to add additional information to a word when speaking or writing in daily life, such as playing God of War (action game), especially like Atreus (Greek mythology). Since new associated entity enhancement is performed at the beginning of each epoch, and each request entity is randomly enhanced with an associated entity, there is a high probability that the sentence after each enhancement is different from that enhanced in other epochs. In other words, a new enhanced dataset is used for each training. This enhancement method is not just a simple addition of noise or other data enhancement, but also an enhancement of knowledge closely related to the request entity in the training sample. After training for multiple epochs, it is equivalent to using multiple enhanced datasets to jointly train the model. After randomly taking out a corresponding associated entity from the associated entity set requested by all request entities in each sentence data and inserting it into the sentence sequence, the sentence sequence after the associated entity enhancement needs to be encoded in two word orders. The first word order encoding method is called hard position encoding. The specific encoding method is to encode the sentence sequence after the associated entity enhancement from the first word 0 to the end of the sentence. The second word order encoding method is called soft position encoding. The specific encoding method is to first perform hard position encoding on the original sentence sequence that has not been enhanced by the associated entity, and then encode the associated entity word order inserted after the request entity according to the corresponding request entity hard position encoding + 1. At this time, each request entity will have two words with the same word order encoding, one is the word that directly follows the request entity in the original sentence, and the other is the associated entity that has undergone data enhancement.
[0093] S3, construct an index encoder based on the data samples labeled with the dialogue semantic roles and output an index vector;
[0094] S31, performing associated entity enhancement on the data sample labeled with the dialogue semantic roles to obtain a sentence sequence enhanced with associated entities;
[0095] S32, respectively establishing a dialogue turn index and a predicate position index for the sentence sequence enhanced by the associated entity, and using two fully connected layers to respectively construct two index encoders to obtain an index encoder and a predicate position index encoder;
[0096] S33, inputting the dialogue turn index and the predicate position index into the dialogue turn index encoder and the predicate position index encoder respectively to obtain a dialogue turn embedding vector and a predicate position embedding vector;
[0097] S34, integrating the dialogue turn embedding vector and the predicate position embedding vector to obtain an index vector;
[0098] Specifically, refer to Figure 3, for the sentence sequence enhanced by the associated entity, the dialogue turn index and predicate position index are established respectively. For the dialogue turn index, if a dialogue text has K rounds, it will be encoded from K-1 to 0. For the example sentence, there are 3 rounds of dialogue, then all the words belonging to the first round of dialogue are marked with 2, the dialogues of the second round are marked with 1, and the dialogues of the third round are marked with 0; the predicate index marks which predicate is currently analyzed, the predicate is marked with 1, and other words are marked with 0. If the current predicate is "like", then the corresponding position is marked with 1, such as the following enhanced sentences:
[0099]
[0100] Since this paper deals with dialogue-level semantic role labeling, the concept of dialogue level is reflected in the first line of numbers below the text. This dialogue has three sentences, numbered 2, 1, and 0 from left to right. The semantic role labeling is related to the predicate position, so the 1 in the second line is used to mark the predicate position to be analyzed. These two lines of numbers are called dialogue turn index and predicate index respectively in this paper. After the dialogue turn index and predicate position index are input into the dialogue turn index encoder and predicate position index encoder respectively, the dialogue turn embedding vector V is obtained. Dialog and the predicate position embedding vector V Pred .
[0101] S4, concatenate the word vector rich in external knowledge with the index vector to obtain a concatenated vector;
[0102] Specifically, refer to Figure 6 , the visible matrix M constructed based on the hard position encoding index ij Add it to the encoder of the BERT model. The specific method is to calculate the Attention formula of the encoding layer in the original BERT model:
[0103]
[0104] Modified to the visible attention formula as shown below:
[0105]
[0106] In the above formula, Q represents the query vector, K represents the key vector, and d k represents the dimension of the key, M represents the visible matrix, and V represents the value vector;
[0107] Further calculations are performed to obtain the visible attention value. When the words are visible to each other, M ij = 0, it can be seen that the attention is the same as the traditional Attention, indicating that the Attention of two words can be calculated normally. When the words are not visible, M ij=-∞, it can be seen that the attention value is zero. The data set is split into multiple batches. The multiple text data of each batch and the modified word order soft coding index are first entered into the lightweight K-BERT module, and then the lightweight K-BERT word vector V is obtained after the modified coding layer is input into the module for calculation. K-BERT , the K-BERT word vector V K-BERT Concatenate it with the dialogue turn embedding vector and the predicate position embedding vector to get the concatenated vector.
[0108] Among them, one batch contains multiple segments of text data. During the processing and training process, the gradients obtained after the multiple segments of text data in each batch are parallelly forward propagated are then passed backward for training.
[0109] S5. Input the concatenated vector into the pre-built semantic role labeling layer to obtain the semantic role labeling result.
[0110] S51, performing feature capture processing on the concatenated vector based on the self-attention layer to obtain an output vector;
[0111] S52. Normalize the output vector based on the softmax normalization layer and output the semantic role labeling result.
[0112] Specifically, the concatenated vector H obtained by concatenating the three vectors is input into the downstream CSRL module. The concatenated vector H passes through N Self-Attention layers to capture different features in the sentence, including the shallow semantic features of this article. After the concatenated vector H passes through N Self-Attention layers, the output is C M Finally, it will pass through a multi-layer perceptron (MLP) with one hidden layer and output the final prediction result through Softmax normalization, as shown in the following formula:
[0113] MLP(C M )=W mlp C M +b mlp
[0114] Prediction = Softmax(MLP(C M ))
[0115] In the above formula, b mlp Represents the bias of the multilayer perceptron, W mlp Represents the weight of the multi-layer perceptron;
[0116] Reference Figure 2 , a Chinese dialogue semantic role labeling system, comprising:
[0117] A data enhancement module is used to perform associated entity enhancement processing on the conversation text data in the data set to obtain an enhanced data set;
[0118] The associated entity knowledge enhancement module is used to input the enhanced data set into the lightweight associated entity enhancement model and output word vectors rich in external knowledge;
[0119] The index encoder module is used to construct an index encoder based on the data samples labeled with the dialogue semantic roles and output an index vector;
[0120] The word vector and index vector concatenation module is used to concatenate the word vector rich in external knowledge with the index vector to obtain the concatenated vector;
[0121] The semantic role labeling prediction module is used to input the concatenated vector into the pre-built semantic role labeling layer to obtain the semantic role labeling result.
[0122] Specifically, the associated entity knowledge enhancement model is lightweighted to obtain word vectors rich in external knowledge. In order to allow the associated entities to only calculate the mutual attention values between their corresponding request entities when calculating the attention values of the word vectors at the encoder layer, the visible matrix is integrated with the encoder layer, and the dialogue turn vector and predicate position vector are generated by the index encoder module. The K-BERT word vector V K-BERT , the dialogue turn vector and the predicate position vector are input into the word vector and index vector concatenation module to obtain the concatenated vector, and the concatenated vector is further input into the semantic role labeling prediction module to output the semantic role labeling result.
[0123] The contents of the above method embodiments are all applicable to the present system embodiments. The functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0124] The above is a specific description of the preferred implementation of the present invention, but the invention is not limited to the embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A Chinese dialogue semantic role labeling method, characterized in that: The following steps are involved: Performing associated entity enhancement processing on the conversation text data in the data set to obtain an enhanced data set; Input the enhanced dataset into the lightweight associated entity enhancement model and output word vectors rich in external knowledge; Construct an index encoder based on the data samples labeled with the semantic roles of the dialogue and output an index vector; Concatenate the word vector rich in external knowledge with the index vector to obtain a concatenated vector; Input the concatenated vector into the pre-built semantic role labeling layer to obtain the semantic role labeling result; The step of inputting the enhanced data set into the lightweight associated entity enhancement model and outputting a word vector rich in external knowledge specifically includes: The RoBERTa pre-trained model of the BERT architecture is used as a word vector encoder to build an associated entity knowledge enhancement model; Adaptively modify and lightweight the associated entity knowledge enhancement model in turn, build a lightweight associated entity knowledge enhancement model, input the enhanced data set into the lightweight associated entity enhancement model, and output a word vector rich in external knowledge; The step of adaptively modifying and lightweighting the associated entity knowledge enhancement model in sequence, constructing a lightweight associated entity knowledge enhancement model, inputting the enhanced data set into the lightweight associated entity enhancement model, and outputting a word vector rich in external knowledge specifically includes: Adaptively modifying the input layer of the associated entity knowledge enhancement model based on soft position coding to obtain a modified input layer; Obtain the relationship between the conversation text data and the associated entities in the cleaned data set and combine them with hard position coding to construct a visibility matrix; Adaptively modify the BERT encoder layer based on the visible matrix to obtain a modified BERT encoder layer; The modified BERT encoder layer is lightweighted to obtain a lightweight K-BERT encoder layer; Combining the modified input layer and the lightweight K-BERT encoder layer, a lightweight associative entity knowledge enhancement model is constructed; The enhanced dataset is processed with two word order encodings and input into a lightweight associated entity knowledge enhancement model to output a word vector rich in external knowledge. The two word order encodings include hard position encoding and soft position encoding. The step of performing two word order encoding processes on the enhanced data set and inputting the enhanced data set into the lightweight associated entity knowledge enhancement model to output a word vector rich in external knowledge specifically includes: Based on the enhanced data set, the lightweight associated entity enhancement model is trained for multiple generations, and the knowledge related to the request entity in the enhanced data set is enhanced to obtain an enhanced data set; By searching for all request entities in each sentence data, a corresponding associated entity is randomly taken out from the enhanced data set and inserted after the request entity to obtain an enhanced sentence; Encode the enhanced sentences in two word orders to obtain the position index corresponding to each word; The enhanced sentences, soft position encoding indexes and visibility matrices are input into the lightweight associative entity knowledge enhancement model, and word vectors rich in external knowledge are output.
2. According to claim 1, a Chinese dialogue semantic role labeling method is characterized by: The step of performing associated entity enhancement processing on the conversation text data in the data set to obtain an enhanced data set specifically includes: Acquire a Chinese conversation dataset from the Internet and perform data cleaning on the Chinese conversation dataset to obtain a cleaned dataset; The conversation text data in the cleaned data set is requested for knowledge triples from the knowledge graph library, and the associated entity enhancement processing is performed to obtain an enhanced data set.
3. According to claim 2, a Chinese dialogue semantic role labeling method is characterized by: The step of requesting knowledge triples from the knowledge graph library for the conversation text data in the cleaned data set and performing associated entity enhancement processing to obtain an enhanced data set specifically includes: Initiate a request to the knowledge graph library for the conversation text data in the cleaned data set to obtain the corresponding knowledge triples; Extract and process the corresponding knowledge triples to obtain related entities; The conversation text data and associated entities in the cleaned data set are stored in a local file in a key-value pair format and constructed into an associated entity dictionary. Construct an associated entity lookup table based on the associated entity dictionary; The conversation text data in the dataset is enhanced based on the associated entity lookup table to obtain an enhanced dataset.
4. According to claim 3, a Chinese dialogue semantic role labeling method is characterized by: The step of constructing an index encoder based on the data samples labeled with the dialogue semantic roles and outputting an index vector specifically includes: Perform entity enhancement on the data samples labeled with the semantic roles of the dialogue to obtain a sentence sequence enhanced with associated entities; For the sentence sequence enhanced with associated entities, a dialogue turn index and a predicate position index are established respectively, and two index encoders are constructed using two fully connected layers to obtain an index encoder and a predicate position index encoder respectively. Input the dialogue turn index and predicate position index into the dialogue turn index encoder and the predicate position index encoder respectively to obtain the dialogue turn embedding vector and the predicate position embedding vector; Combine the dialogue turn embedding vector and the predicate position embedding vector to get the index vector.
5. According to claim 4, a Chinese dialogue semantic role labeling method is characterized by: The semantic role labeling layer includes a self-attention layer and a softmax normalization layer. The step of inputting the concatenated vector into the pre-built semantic role labeling layer to obtain the semantic role labeling result specifically includes: Perform feature capture processing on the concatenated vector based on the self-attention layer to obtain an output vector; The output vector is normalized based on the softmax normalization layer, and the semantic role labeling result is output.
6. A Chinese dialogue semantic role labeling system, characterized in that: The method for labeling Chinese dialogue semantic roles as claimed in claim 1 comprises the following modules: A data enhancement module is used to perform associated entity enhancement processing on the conversation text data in the data set to obtain an enhanced data set; The associated entity knowledge enhancement module is used to input the enhanced data set into the lightweight associated entity enhancement model and output word vectors rich in external knowledge; The index encoder module is used to construct an index encoder based on the data samples labeled with the dialogue semantic roles and output an index vector; The word vector and index vector concatenation module is used to concatenate the word vector rich in external knowledge with the index vector to obtain the concatenated vector; The semantic role labeling prediction module is used to input the concatenated vector into the pre-built semantic role labeling layer to obtain the semantic role labeling result.
