Text framework semantic analysis method
Through the end-to-end framework semantic analysis model, combining context encoder and table encoder, the task design and highlight vectors are combined into word knowledge, which solves the problems of incomplete semantic expression and error accumulation in the existing technology, and improves the framework semantics Accuracy and efficiency of analysis.
Patent Information
- Application Number
- CN202311751757.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-19
- Publication Date
- 2024-12-20
AI Technical Summary
The existing framework semantic analysis methods cannot fully express semantics, and the multi-stage identification strategy leads to the accumulation of errors, and cannot effectively utilize the knowledge in FrameNet, affecting the performance of the model.
Adopt end-to-end framework semantic analysis model, including context encoder, table encoder, area detection module and classification module, integrate word knowledge through highlighting vectors, merge tasks into one-stage tasks, share table encoder, and reduce error accumulation , and use multi-layer convolutional networks and feedforward neural networks for feature mapping and filtering.
Accurate detection of target words and arguments is achieved, the capture of semantic dependencies is enhanced, the accuracy and efficiency of framework semantic analysis is improved, error accumulation problems are reduced, and model performance is improved.
Smart Images

Figure CN119167939A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text analysis, and in particular to a text frame semantic analysis method. Background Art
[0002] Frame semantic analysis is a shallow semantic analysis method based on Frame Semantics, a theory proposed by the famous American linguist Charles J. Fillmore in the 1970s. Frame semantics emphasizes the use of empirical methods to discover the relationship between language and human experience, explores the semantic structure of the surface of sentences from the perspective of human cognition, and connects abstract human cognitive schemas with the context of vocabulary to understand the semantics of vocabulary. Its core idea is that the meaning of a word should be properly understood in a set of conceptual structures or experience spaces that it may activate. In other words, frame semantics believes that to understand the meaning of words, one must first have a conceptual structure, that is, a semantic frame.
[0003] Early studies only focused on a single task among the three subtasks of frame semantic analysis. If you want to complete the automatic analysis of the frame semantic roles of text, you need to build models for the three subtasks TI, FI, and FSRL respectively, and then execute them in sequence. The error propagation problem is more prominent, and the execution efficiency is not high, which is not convenient for downstream tasks and cannot meet the needs of downstream tasks for frame semantic analysis. In recent years, end-to-end joint modeling methods have received widespread attention. The representative work is the graph-based end-to-end frame semantic analysis method proposed by Lin et al., which has achieved the best performance so far.
[0004] Lin et al. proposed a graph-based end-to-end framework semantic analysis method and built an analysis model FParser, which achieved the best performance at present. However, this method has the following three obvious shortcomings:
[0005] (1) FParser uses the pre-trained model BERT to model the context of the text, and adopts a boundary-based span representation that cannot capture the complex semantic dependencies between the target word and the argument. This method concatenates the representations of the boundary words of the target word and the argument as the feature representation for role classification, without modeling the fine-grained semantic relationship between the target word and the words within the argument. In frame semantic analysis, arguments can be words, phrases, or clauses. Using only the representation of boundary words cannot fully express the semantics of the argument, nor is it conducive to the model capturing the semantic dependencies between the target word and the argument.
[0006] (2) FParser regards frame semantic analysis as a graph construction process. It first uses a classification module to identify partial target words, complete target words, arguments, and other spans from all possible span combinations (continuous text fragments in a sentence), and uses the identified spans as nodes in the graph. Another classification module is used to identify which partial target word pairs can constitute the full target word, and then a frame prediction model is used to predict the frame that the target word can evoke; a role prediction module is used to predict the frame semantic role corresponding to the argument. This multi-stage recognition strategy will lead to error accumulation problems. Generally speaking, the more stages there are, the more serious the error accumulation problem is, which is not conducive to improving the recognition performance of the model.
[0007] (3) The rich knowledge in FrameNet is not effectively utilized. For example, the word-meta associated with a frame is very valuable for guiding the model to perform object recognition. Existing studies only use the mapping between word-meta and frame for frame filtering in FI, but do not incorporate this valuable knowledge into the context encoder to enhance the performance of FI and FSRL subtasks.
[0008] In summary, the existing FParser technology has the problem of being unable to fully express semantics and the multi-stage recognition strategy leading to error accumulation. Summary of the invention
[0009] In order to overcome the shortcomings of the above-mentioned prior art that cannot fully express semantics and the multi-stage recognition strategy will lead to error accumulation, the main purpose of the present invention is to provide a text frame semantic analysis method.
[0010] To achieve the above object, the present invention adopts the following technical solution, a text frame semantic analysis method, comprising the following steps:
[0011] Building an end-to-end frame semantic analysis model, wherein the frame semantic analysis model includes a context encoder, a table encoder, a region detection module, and a classification module;
[0012] Input the text to be processed into the context encoder to obtain the output matrix H;
[0013] The output matrix H is used as the input of the table encoder to obtain a three-dimensional data table;
[0014] The potential target word detection module and the potential argument detection module in the region detection module respectively take the three-dimensional data table as input, and after synchronous processing, respectively obtain the corresponding potential target vocabulary region and potential argument region;
[0015] The potential target words are used as inputs of the frame classification in the classification module, and the frame classification is scored and filtered to obtain the best possible arousal frame of the potential target words;
[0016] The potential argument region is used as the input of the role classification in the classification module, and at the same time, the potential target word is encoded as the input of the role classification. The role classification simultaneously calculates the potential argument region and the encoded potential target word's optimal possible framework, and after screening and filtering, obtains the framework that the potential argument is most likely to arouse, and then obtains the framework semantic analysis result of the text to be processed.
[0017] The processing process of the context encoder on the text to be processed includes the following steps:
[0018] Classify and annotate the text to be processed, convert each word in the text to be processed into a word unit representation, and obtain a word unit library;
[0019] Initialize a vector of all zeros with a length equal to the number of words, and then search the word library one by one to see if each word in the form of a word exists; if it exists, the value of the corresponding position in the vector is changed to 1, and the vector obtained after the processing is completed is called a salience vector;
[0020] The classified and annotated text to be processed and the saliency vector are used as the input of the BERT model, and the output matrix H is obtained.
[0021] The processing process of the table encoder on the output matrix H includes the following steps:
[0022] Use the Biaffine network to encode the input H and obtain a three-dimensional table. The calculation formula is as follows:
[0023]
[0024]
[0025] Among them, U, V, b are model parameters, gelu(.) is the excitation function, This is a vector concatenation operation, outputting the result is a three-dimensional matrix;
[0026] A multi-layer convolutional network CNN is used to perform convolution operations on the three-dimensional table, where the calculation formula of the convolution operation is as follows:
[0027]
[0028]
[0029]
[0030]
[0031] Among them, each group of operations consists of three convolution operations and one summation operation. The convolution kernels of the three convolution operations are 5, 3 and 1 respectively, and ReLU(.) is the activation function.
[0032] The potential target area detection takes a three-dimensional table as input and outputs a two-dimensional table; each cell in the two-dimensional table corresponds to a score value, which is mapped to a scalar value by the vector of the corresponding position in the three-dimensional table through a linear neural network, and its calculation formula is as follows:
[0033]
[0034]
[0035] Among them, linear(.) is a linear neural network, c ij is the vector at the position of the i-th row and j-th column in the three-dimensional table. sigmoid(.) is a normalization function that maps the scalar value output by the linear network to between 0 and 1. The two formulas obtain two values respectively, one is the unit of the cell as the upper left cell of the region, and the other is the score of the cell as the lower right cell. The threshold is set to 0.5, that is, when the score exceeds 0.5, the cell is the upper left cell or the lower right cell.
[0036] The potential argument region detection takes a three-dimensional table as input and outputs a two-dimensional table. Each cell in the two-dimensional table corresponds to a score value, which is mapped to a scalar value by the vector at the corresponding position in the three-dimensional table through a linear neural network. The calculation formula is as follows:
[0037]
[0038]
[0039] Among them, linear(.) is a linear neural network, c ij is the vector at the position of the i-th row and j-th column in the three-dimensional table. Sigmoid(.) is a normalization function that maps the scalar value output by the linear network to between 0 and 1. The two formulas obtain two values respectively, one is the unit of the cell as the upper left cell of the region, and the other is the score of the cell as the lower right cell. The threshold is set to 0.5, that is, when the score exceeds 0.5, the cell is the upper left cell or the lower right cell.
[0040] The steps of the framework classification include:
[0041] The feature representation of the potential target word region is obtained and then fed into the feedforward neural network FFN, which maps the features into scores on the frame set. The calculation process is as follows:
[0042]
[0043] p f (f r(a,b,c,d) )=FFN(J a,b,c,d )
[0044] Among them, c ab and c cd are the vector representations of the cells in the upper left corner and the lower right corner of the region, respectively. Mp(.) is the maximum pooling operation on the region. This is a vector concatenation operation.
[0045] Extract the words or phrases corresponding to the potential target word region in the original text, and use these words or phrases to retrieve the frame set fl that they may stimulate in the frame knowledge base abcd ; Known is the set of all frames in the knowledge base, including empty frames, fl abcd is a subset of the framework set; v f is a length The values of the elements in the vectors with the same number of elements are:
[0046]
[0047] The frame classification module predicts the frame triggered by the potential target word, and converts the vector v f As a filter, it filters out frames that are unlikely to be triggered by the current potential target word; f The element values corresponding to these frame positions are negative infinity. After passing the softmax function, the output probability value is very small.
[0048] The calculation formula for the frame that the potential target word is most likely to arouse is as follows:
[0049]
[0050] The step of role classification comprises:
[0051] Obtain feature representations of the potential argument region and then feed them into a feed-forward neural network FFN, which maps the features into scores on the role set;
[0052] Since the role classification depends on the frame classification, when predicting the role, it is necessary to encode the frame predicted by the frame classification module. This encoding is used as the input of the role classification and fed into FFN together with the feature representation of the potential argument region. The calculation process is as follows:
[0053]
[0054] p r (f r(a,b,c,d) )=FFN(f r(a,b,c,d) )
[0055] Among them, c ab and c cd are the vector representations of the cells in the upper left corner and the lower right corner of the region, respectively. Mp(.) is the maximum pooling operation on the region. It is a vector concatenation operation;
[0056] Extract all roles R of frame f predicted by the frame classification model f ; Known is the set of all frames in the knowledge base, including empty roles, R f is a subset of it; v r is a length The values of the elements in the vectors with the same number of elements are:
[0057]
[0058] When the role classification module predicts the role of the potential argument region, the vector v is used r作为一个 Filters, the filtering principle is similar to that in the framework classification;
[0059] The frame that is most likely to be aroused by the potential argument region can be calculated by the following formula:
[0060]
[0061] A loss function is also included, the loss function includes a loss for potential region identification and a classification loss, and the formula of the loss function is as follows:
[0062]
[0063] Among them, the potential region recognition loss is composed of the potential target region L t and the potential argument region L a The recognition loss is divided into two parts, each of which consists of the upper left corner cell recognition loss and the lower right corner cell recognition loss. CE(.) represents the binary cross entropy loss function, and the potential area recognition loss formula is as follows:
[0064]
[0065]
[0066]
[0067] The classification loss includes two parts: framework classification loss and role classification loss. The loss function adopts cross entropy loss, and the formula is as follows:
[0068]
[0069]
[0070]
[0071] Among them, G t and G a Represent the potential target area and potential argument area respectively.
[0072] Compared with the prior art, the beneficial effects of the present invention are:
[0073] 1. The present invention provides a method for comprehensively utilizing deep learning and table interaction information, which can be used to accurately detect potential target words and arguments in text. While achieving efficient region detection, the method further identifies potential regions through a classification module, and has broad application prospects.
[0074] 2. Based on the context encoding of the text using BERT, a table encoder is used to further encode the semantic information between words and spans in the text, so that the interaction between the target words and arguments is further strengthened, which is conducive to the model capturing the semantic dependency relationship between the target words and arguments.
[0075] 3. In terms of task design, the frame semantic analysis task is designed as two one-stage tasks. Specifically, TI and FI are merged into one one-stage task, namely the frame classification task, and argument recognition and FSRL are merged into one one-stage task, namely the role classification task, which reduces the error accumulation problem caused by multi-stage recognition. Accordingly, in terms of model design, a frame classification task module and a role classification task module are designed. The two modules share a table encoder, and the role classification task module depends on the output of the frame classification task module to model the feature of role-dependent frames.
[0076] 4. In order to make better use of the association between word-meta and frame in the frame semantic knowledge base, a word-meta knowledge fusion method based on salience vector is proposed. That is, according to the association between each word in the text and the word-meta in the frame knowledge base, a salience vector is constructed to highlight the importance of those words that may be the target words in the encoding, thereby integrating word-meta knowledge into the model, thereby enhancing the performance of the model TI recognition and then the performance of the shadow FSRL subtask. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 It is a schematic diagram of the structure of the model of the present invention;
[0078] Figure 2 It is a schematic diagram of three example sentence samples corresponding to the present invention. DETAILED DESCRIPTION
[0079] The present invention will be further described below in conjunction with the accompanying drawings and implementation modes.
[0080] Embodiment 1:
[0081] See also Figure 1-2 , a text frame semantic analysis method, comprising the following steps:
[0082] Building an end-to-end frame semantic analysis model, wherein the frame semantic analysis model includes a context encoder, a table encoder, a region detection module, and a classification module;
[0083] Input the text to be processed into the context encoder to obtain the output matrix H;
[0084] The output matrix H is used as the input of the table encoder to obtain a three-dimensional data table;
[0085] The potential target word detection module and the potential argument detection module in the region detection module respectively take the three-dimensional data table as input, and after synchronous processing, respectively obtain the corresponding potential target vocabulary region and potential argument region;
[0086] The potential target words are used as inputs of the frame classification in the classification module, and the frame classification is scored and filtered to obtain the best possible arousal frame of the potential target words;
[0087] The potential argument region is used as the input of the role classification in the classification module, and at the same time, the potential target word is encoded as the input of the role classification. The role classification simultaneously calculates the potential argument region and the encoded potential target word's optimal possible framework, and after screening and filtering, obtains the framework that the potential argument is most likely to arouse, and then obtains the framework semantic analysis result of the text to be processed.
[0088] Among them, the process of the context encoder on the text to be processed includes the following steps:
[0089] Classify and annotate the text to be processed, convert each word in the text to be processed into a word unit representation, and obtain a word unit library;
[0090] Initialize a vector of all zeros with a length equal to the number of words, and then search the word library one by one to see if each word in the form of a word exists; if it exists, the value of the corresponding position in the vector is changed to 1, and the vector obtained after the processing is completed is called a salience vector;
[0091] The classified and annotated text to be processed and the saliency vector are used as the input of the BERT model, and the output matrix H is obtained.
[0092] And, the processing process of the table encoder on the output matrix H includes the following steps:
[0093] Use the Biaffine network to encode the input H and obtain a three-dimensional table. The calculation formula is as follows:
[0094]
[0095]
[0096] Among them, U, V, b are model parameters, gelu(.) is the excitation function, This is a vector concatenation operation, outputting the result is a three-dimensional matrix;
[0097] A multi-layer convolutional network CNN is used to perform convolution operations on the three-dimensional table, where the calculation formula of the convolution operation is as follows:
[0098]
[0099]
[0100]
[0101]
[0102] Among them, each group of operations consists of three convolution operations and one summation operation. The convolution kernels of the three convolution operations are 5, 3 and 1 respectively, and ReLU(.) is the activation function.
[0103] Potential target area detection takes a three-dimensional table as input and outputs a two-dimensional table; each cell in the two-dimensional table corresponds to a score value, which is mapped to a scalar value by the vector of the corresponding position in the three-dimensional table through a linear neural network. The calculation formula is as follows:
[0104]
[0105]
[0106] Among them, linear(.) is a linear neural network, c ij is the vector at the position of the i-th row and j-th column in the three-dimensional table. sigmoid(.) is a normalization function that maps the scalar value output by the linear network to between 0 and 1. The two formulas obtain two values respectively, one is the unit of the cell as the upper left cell of the region, and the other is the score of the cell as the lower right cell. The threshold is set to 0.5, that is, when the score exceeds 0.5, the cell is the upper left cell or the lower right cell.
[0107] Potential argument region detection takes a three-dimensional table as input and outputs a two-dimensional table. Each cell in the two-dimensional table corresponds to a score value, which is mapped to a scalar value by the vector of the corresponding position in the three-dimensional table through a linear neural network. The calculation formula is as follows:
[0108]
[0109]
[0110] Among them, linear(.) is a linear neural network, c ij is the vector at the position of the i-th row and j-th column in the three-dimensional table. Sigmoid(.) is a normalization function that maps the scalar value output by the linear network to between 0 and 1. The two formulas obtain two values respectively, one is the unit of the cell as the upper left cell of the region, and the other is the score of the cell as the lower right cell. The threshold is set to 0.5, that is, when the score exceeds 0.5, the cell is the upper left cell or the lower right cell.
[0111] The steps of framework classification include:
[0112] The feature representation of the potential target word region is obtained and then fed into the feedforward neural network FFN, which maps the features into scores on the frame set. The calculation process is as follows:
[0113]
[0114] p f (f r(a,b,c,d) )=FFN(f a,b,c,d )
[0115] Among them, c ab and c cdare the vector representations of the cells in the upper left corner and the lower right corner of the region, respectively. Mp(.) is the maximum pooling operation on the region. This is a vector concatenation operation.
[0116] Extract the words or phrases corresponding to the potential target word region in the original text, and use these words or phrases to retrieve the frame set fl that they may stimulate in the frame knowledge base abcd ; Known is the set of all frames in the knowledge base, including empty frames, fl abcd is a subset of the framework set; v f is a length The values of the elements in the vectors with the same number of elements are:
[0117]
[0118] When the frame classification module predicts the frame evoked by the potential target word, the vector v f As a filter, it filters out frames that are unlikely to be triggered by the current potential target word; f The element values corresponding to these frame positions are negative infinity. After passing the softmax function, the output probability value is very small.
[0119] The formula for calculating the frame that a potential target word is most likely to evoke is as follows:
[0120]
[0121] The steps of role classification include:
[0122] Obtain feature representations of the potential argument region and then feed them into a feed-forward neural network FFN, which maps the features into scores on the role set;
[0123] Since the role classification depends on the frame classification, when predicting the role, it is necessary to encode the frame predicted by the frame classification module. This encoding is used as the input of the role classification and fed into FFN together with the feature representation of the potential argument region. The calculation process is as follows:
[0124]
[0125] p r (f r(a,b,c,d) )=FFN(f r(a,b,c,d) )
[0126] Among them, c ab and c cd are the vector representations of the cells in the upper left corner and the lower right corner of the region, respectively. Mp(.) is the maximum pooling operation on the region. It is a vector concatenation operation;
[0127] Provide all roles R of frame f predicted by the frame classification model f ; Known is the set of all frames in the knowledge base, including empty roles, R f is a subset of it; v r is a length The values of the elements in the vectors with the same number of elements are:
[0128]
[0129] When the role classification module predicts the role of the potential argument region, the vector v is used r As a filter, the filtering principle is similar to that in the framework classification described;
[0130] The frame that is most likely to be evoked by a potential argument region can be calculated by the following formula:
[0131]
[0132] A loss function is also included, the loss function includes a loss for potential region identification and a classification loss, and the formula of the loss function is as follows:
[0133]
[0134] Among them, the potential region recognition loss is composed of the potential target region L t and the potential argument region L a The recognition loss is divided into two parts, each of which consists of the upper left corner cell recognition loss and the lower right corner cell recognition loss. CE(.) represents the binary cross entropy loss function, and the potential area recognition loss formula is as follows:
[0135]
[0136]
[0137]
[0138] The classification loss includes two parts: frame classification loss and role classification loss. The loss function adopts cross entropy loss, and the formula is as follows:
[0139]
[0140]
[0141]
[0142] Among them, Gt and G a Represent the potential target area and potential argument area respectively.
[0143] Embodiment 2:
[0144] See also Figure 1-2 Based on Example 1, as another possible implementation scheme of the present invention, the text frame semantic analysis method proposed by the present invention is end-to-end, and specifically includes the following steps. First, a frame semantic analysis model for text is constructed. The model TE-FParser consists of four modules: context encoder, table encoder, region detection module and classification module, and the overall structure of the model is Figure 1 As shown:
[0145] The context encoder uses the BERT model based on the deep transformer structure, which has a strong representation capability for text context modeling and is a widely used text context modeling tool. The model takes text as output and outputs a vectorized representation of the text. Based on the text input, the present invention adds a salience vector to emphasize the possible correspondence between words in the text and word units in the framework semantic knowledge base. The specific steps are:
[0146] (1) Use part-of-speech tagging tools to perform word segmentation, lemmatization, and part-of-speech tagging on the text to be processed, converting each word in the text into a lemma representation, that is, in the form of "lemma.part-of-speech", such as processing "She stopped the project" into "She.p stop.v the.aproject.n".
[0147] (2) Initialize a vector of all zeros with a length equal to the number of words, and then search the word gram library of the framework knowledge one by one to see if each word in the form of a word exists. If it does exist, the value of the corresponding position in the vector is changed to 1. The vector obtained after the processing is completed is called a salience vector.
[0148] (3) The original text to be processed is converted into BERT's annotated input and input into the BERT model together with the saliency vector. The output matrix H of the BERT model is the context encoding result of the text.
[0149] The purpose of using the table encoder is to further capture the information interaction between words and spans, and provide better representation for candidate target words and argument recognition. The table encoder receives the output matrix H of the context encoder as its input. First, the biaffine neural network Biaffine is used to realize the interaction between vectors in H, and the matrix H is converted into a three-dimensional table representation. The purpose is to realize the interaction between words; then a multi-layer convolutional network CNN is used to calculate on the table, and the result is a table representation with the same size as the original table. The purpose is to realize the information interaction between spans. The specific steps are:
[0150] Use the Biaffine network to encode the input H. The calculation formula is as follows:
[0151]
[0152]
[0153] Among them, U, V, b are model parameters, gelu(.) is the excitation function, This is a vector concatenation operation, outputting the result is a three-dimensional matrix.
[0154] (2) Use a multi-layer convolutional network (CNN) to perform convolution operations on the table. The following formula is a set of calculation formulas for convolution operations:
[0155] Each group of operations consists of three convolution operations and one summation operation. The convolution kernels of the three convolution operations are 5, 3, and 1, respectively, in order to encode span features of different lengths. LN(.) is a layer normalization function, and ReLU(.) is an activation function. The present invention uses multiple groups of convolutions, where l represents each group of convolutions. The dimension and size of the three-dimensional table (also called a three-dimensional tensor) obtained after multiple groups of convolutions remain unchanged.
[0156] Region detection consists of two modules, one is the potential target word detection module, and the other is the potential argument detection module. The two detection modules share the output of the table encoder. In other words, both modules use the output of the table encoder as the input of the module, that is, the input is a three-dimensional table. For the sake of convenience, we make an analogy between a three-dimensional table and a two-dimensional table. Each cell in a two-dimensional table can generally store a value. A three-dimensional table can be regarded as a vector stored in each cell in a two-dimensional table, where each vector represents the interactive information between two words in the corresponding row and column. Region detection is essentially to score each vector, and determine which cells can be used as the upper left corner cell and lower right corner cell of the two regions to be identified (potential target word region and potential argument-free region) according to the score. A region can be determined based on an upper left corner cell and a lower right corner cell. As shown in the figure, the two upper cells (2,5) and (2,5) can determine a potential argument region "hand in" with a size of one cell; the two cells (2,6) and (5,8) can determine a potential argument region "to the supplier".
[0157] The goal of potential target region detection is to identify the region that is potential (most likely) the target word. The input of the module is a three-dimensional table. The output is a two-dimensional table, as shown on the left side of the figure. Each cell in the table corresponds to a score value, which is mapped to a scalar value by the vector of the corresponding position in the three-dimensional table through the linear neural network. The calculation formula is as follows:
[0158] Among them, linear(.) is a linear neural network, c ij is the vector at the position of the i-th row and j-th column in the three-dimensional table, and sigmoid(.) is a normalization function that maps the scalar value output by the linear network to between 0 and 1. The two formulas respectively obtain two values, one for the cell as the upper left corner cell of the region, and the other for the score of the cell as the lower right corner cell. Generally, the threshold is set to 0.5, that is, when the score exceeds 0.5, the cell can be the upper left corner cell or the lower right corner cell.
[0159] The process of potential argument region detection is similar to that of potential target detection, and the scoring formula is as follows:
[0160]
[0161]
[0162] The two detection modules have similar processes and use similar scoring methods, but the parameters in the linear neural network are different. In other words, the scoring function parameters used by the two modules are independent of each other, that is, the parameters are not shared. In addition, the two modules are executed in parallel.
[0163] It should be noted that since the detection of two boundary cells in the region detection is independent of each other, any upper left corner cell that meets the scoring threshold requirement and any lower right corner cell that meets the conditions on the right or lower right side of it can be combined into one region. This will inevitably involve the problem of region intersection, and there are many potential regions identified, so further identification is required in the classification module. The accompanying drawings are only for the convenience of explaining the concept of the region referred to in the present invention, and only the regions marked in the labeled data that the model hopes to be able to identify are listed.
[0164] The classification module consists of two parts: one is the frame classification module, which predicts the frame evoked by the potential target word, including the empty frame (cannot evoke any frame); the other is the role classification module, which predicts the role type played by the potential argument in the frame, including the empty role (does not play any role).
[0165] For frame classification, first, the feature representation of the potential target word region is obtained and then fed into the feedforward neural network FFN, which maps the features into scores on the frame set. The calculation process is as follows:
[0166]
[0167] p f (f r(a,b,c,d) )=FFN(f a,b,c,d )
[0168] Among them, c ab and c cd are the vector representations of the cells in the upper left corner and the lower right corner of the region, respectively. Mp(.) is the maximum pooling operation on the region. This is a vector concatenation operation.
[0169] Secondly, extract the words or phrases corresponding to the potential target word region in the original text, and use these words or phrases to retrieve the frame set fl that they may provoke in the frame knowledge base abcd Known is the set of all frames in the knowledge base (including empty frames), fl abcd is a subset of it; v f is a length The values of the elements in the vectors with the same number of elements are:
[0170]
[0171] When the frame classification module predicts the frame evoked by the potential target word, the vector v f It is used as a filter to filter out frames that are unlikely to be triggered by the current potential target word. The filtering strategy is to make the model predict extremely small probability values on these frames, because v f The element values corresponding to these frame positions are negative infinity. After passing the softmax function, the output probability value will be very small.
[0172] Finally, the frame that the potential target word is most likely to evoke can be calculated by the following formula:
[0173]
[0174] For role classification, first, we obtain the feature representation of the potential argument region and then feed it into the feed-forward neural network FFN, which maps the features into scores on the role set. Since roles depend on frames, when predicting roles, we encode the frames predicted by the frame classification module. This encoding is used as another important feature for role classification and is sent to FFN together with the regional feature representation. The calculation process is as follows:
[0175]
[0176] p r (f r(a,b,c,d) )=FFN(f r(a,b,c,d) )
[0177] Among them, c ab and c cd are the vector representations of the cells in the upper left corner and the lower right corner of the region, respectively. Mp(.) is the maximum pooling operation on the region. This is a vector concatenation operation.
[0178] Secondly, extract all roles R of frame f predicted by the frame classification model from the frame knowledge base f Known is the set of all frames in the knowledge base (including empty roles), R f is a subset of it; v r is a length The values of the elements in the vectors with the same number of elements are:
[0179]
[0180] When the role classification module predicts the role of the latent argument, the vector v r Used as a filter, the filtering principle is similar to the framework filtering principle.
[0181] Finally, the frame that a potential argument is most likely to evoke can be calculated using the following formula:
[0182]
[0183] Regarding model training, the loss function consists of two parts: one is the loss of potential area recognition, and the other is the classification loss. The formula is as follows:
[0184]
[0185] Among them, the potential region recognition loss is composed of the potential target region L t and the potential argument region L a The recognition loss consists of two parts, each of which consists of the upper left corner cell recognition loss and the lower right corner cell recognition loss. CE(.) represents the binary cross entropy loss function. The potential area recognition loss formula is as follows:
[0186] The classification loss consists of two parts: frame classification loss and role classification loss. The loss function uses cross entropy loss, and the formula is as follows:
[0187]
[0188]
[0189]
[0190] Among them, G t and G a Represent the potential target area and potential argument area respectively.
[0191] Compared with the most advanced end-to-end frame semantic analysis model FParser, the semantic analysis performance of the present invention has been greatly improved, and the operating efficiency has also exceeded FParser. Using the method proposed in the present invention, a model TE-FParser (also known as EFSP-TE) is trained on the publicly released frame semantic analysis datasets FrameNet1.5 and FrameNet1.7, and the results on the standard test set are as follows:
[0192]
[0193] The three columns Target, Frame, and Role in the table represent the precision, recall, and F1 values of target word recognition, frame recognition, and role classification, respectively. The comprehensive performance (F1) of TE-FParser in these three aspects far exceeds that of FParser. In order to illustrate the advantages of TE-FParser, we tried different table encoding methods (OneRel and BDTF) and model structures (pipeline and single). The results show that the method proposed in this paper is the best method in terms of performance.
[0194] In terms of operating efficiency, TE-FParser also has a clear advantage over FParser, and can analyze more sentences per unit time. The results are shown in the following table:
[0195]
[0196] Frame semantic analysis is widely used in natural language processing tasks such as machine reading comprehension, automatic summarization, text generation, and event extraction. Studies have shown that frame semantic information can significantly improve the performance of these tasks and is a basic technology for improving the level of language intelligence. Especially in the era of large language models, fine-grained frame semantic information can make up for the shortcomings of large language models in semantic understanding and reasoning.
[0197] See also Figure 2 , for three example sentences, the three results corresponding to each pair are: standard result, TE-FParser analysis result and FParser analysis result. Each result contains several frame semantic structure information, and the representation format of each frame semantic structure information is: (target word, frame) {argument 1: role 1, argument 2: role 2, ..., argument n: role n}. The results show that although TE-FParser still has a certain gap with the standard results, it has significant advantages over FParser.
[0198] It should be noted that, in the present invention, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0199] The above embodiments are merely examples of the present invention and do not limit the protection scope of the present invention. All designs that are the same or similar to the present invention fall within the protection scope of the present invention.
Claims
1. A text frame semantic analysis method, characterized in that: The following steps are involved: Building an end-to-end frame semantic analysis model, wherein the frame semantic analysis model includes a context encoder, a table encoder, a region detection module, and a classification module; Input the text to be processed into the context encoder to obtain the output matrix H; The output matrix H is used as the input of the table encoder to obtain a three-dimensional data table; Input a three-dimensional data table, and after synchronous processing by the potential target word detection module and the potential argument detection module in the region detection module, respectively obtain corresponding potential target vocabulary regions and potential argument regions; The potential target word is used as an input of the frame classification in the classification module, and the frame classification is scored and filtered to obtain the optimal possible arousal frame of the potential target word; The potential argument region and the optimal possible arousal framework of the potential target word are encoded and used as inputs for role classification in the classification module. The potential argument region and the optimal possible arousal framework of the encoded potential target word are simultaneously calculated through the role classification in the classification module, and after screening and filtering, the framework that is most likely to be aroused by the potential argument is obtained, thereby obtaining the framework semantic analysis result of the text to be processed.
2. A text frame semantic analysis method according to claim 1, characterized in that: The processing process of the context encoder on the text to be processed includes the following steps: Classify and annotate the text to be processed, including word segmentation and part-of-speech tagging, convert each word in the text to be processed into a lemma representation, and obtain a lemma library; Initialize a vector of all zeros with a length equal to the number of words, and then search the word library one by one to see if each word in the form of a word exists; if it exists, the value of the corresponding position in the vector is changed to 1, and the vector obtained after the processing is completed is called a salience vector; The classified and annotated text to be processed and the saliency vector are used as the input of the BERT model, and the output matrix H is obtained.
3. A text frame semantic analysis method according to claim 1, characterized in that: The processing process of the table encoder on the output matrix H includes the following steps: Use the Biaffine network to encode the input H and obtain a three-dimensional table. The calculation formula is as follows: Among them, U, V, b are model parameters, gelu(.) is the excitation function, This is a vector concatenation operation, outputting the result is a three-dimensional matrix; Use a multi-layer convolutional network CNN to perform convolution operations on a three-dimensional table. The calculation formula for the convolution operation is as follows: (I have lost the three formulas for convolution, which are in the handout) Among them, each group of operations consists of three convolution operations and one summation operation. The convolution kernels of the three convolution operations are 5, 3 and 1 respectively, and ReLU(.) is the activation function.
4. A text frame semantic analysis method according to claim 1, characterized in that: The potential target area detection takes a three-dimensional table as input and outputs a two-dimensional table; each cell in the two-dimensional table corresponds to a score value, which is mapped to a scalar value by the vector of the corresponding position in the three-dimensional table through a linear neural network, and its calculation formula is as follows: Among them, linear(.) is a linear neural network, ci j is the vector at the position of the i-th row and j-th column in the three-dimensional table. sigmoid(.) is a normalization function that maps the scalar value output by the linear network to between 0 and 1. The two formulas obtain two values respectively, one is the unit of the cell as the upper left cell of the region, and the other is the score of the cell as the lower right cell. The threshold is set to 0.5, that is, when the score exceeds 0.5, the cell is the upper left cell or the lower right cell.
5. A text frame semantic analysis method according to claim 1, characterized in that: The potential argument region detection takes a three-dimensional table as input and outputs a two-dimensional table. Each cell in the two-dimensional table corresponds to a score value, which is mapped to a scalar value by the vector at the corresponding position in the three-dimensional table through a linear neural network. The calculation formula is as follows: Among them, linear(.) is a linear neural network, c ij is the vector at the position of the jth column in the i-th row in the three-dimensional table, sigmoid(.) is the normalization function, which maps the scalar value output by the linear neural network to between 0 and 1, and the two formulas obtain two values respectively, one is the unit of the cell as the upper left cell of the region, and the other is the score of the cell as the lower right cell. The threshold is set to 0.5, that is, when the score exceeds 0.5, the cell is the upper left cell or the lower right cell.
6. A text frame semantic analysis method according to claim 1, characterized in that: The steps of the framework classification include: The feature representation of the potential target word region is obtained and then fed into the feedforward neural network FFN, which maps the features into scores on the frame set. The calculation process is as follows: p f (f r(a,b,c,d) )=FFN(f a ,b,c,d) Among them, c ab and c cd are the vector representations of the cells in the upper left corner and the lower right corner of the region, respectively. Mp(.) is the maximum pooling operation on the region. This is a vector concatenation operation. Extract the words or phrases corresponding to the potential target word region in the original text, and use these words or phrases to retrieve the frame set fl that they may provoke in the frame knowledge base abcd ; Known is the set of all frames in the knowledge base, including empty frames, fl abcd is a subset of the framework set; v f is a length The values of the elements in the vectors with the same number of elements are: The frame classification module predicts the frame triggered by the potential target word, and converts the vector v f As a filter, it filters out frames that are unlikely to be triggered by the current potential target word; f The element values corresponding to these frame positions are negative infinity. After passing the softmax function, the output probability value is very small. The calculation formula for the frame that the potential target word is most likely to arouse is as follows: Among them, the Softmax() function converts real values into probability distributions, and the rgmax() function finds the position or number of the value with the largest probability value from the probability distribution; the softmax() function receives a set of numbers, and the number at which position in the set of numbers has the largest probability value is obtained through the argmax() function.
7. A text frame semantic analysis method according to claim 1, characterized in that: The step of role classification comprises: Obtain feature representations of the potential argument region and then feed them into a feed-forward neural network FFN, which maps the features into scores on the role set; Since the role classification depends on the frame classification, when predicting the role, it is necessary to encode the frame predicted by the frame classification module. This encoding is used as the input of the role classification and fed into FFN together with the feature representation of the potential argument region. The calculation process is as follows: p r (d r(a,b,c,d) )=FFN(f r(a,b,c,d) ) Among them, c ab and c cd are the vector representations of the cells in the upper left corner and the lower right corner of the region, respectively. Mp(.) is the maximum pooling operation on the region. It is a vector concatenation operation; Extract all roles R of frame f predicted by the frame classification model f ; Known is the set of all frames in the knowledge base, including empty roles, R f is a subset of it; v r is a length The values of the elements in the vectors with the same number of elements are: When the role classification module predicts the role of the potential argument region, the vector vr 作为一个 Filters, the filtering principle is similar to that in the framework classification; The frame that is most likely to be aroused by the potential argument region can be calculated by the following formula:
8. A text frame semantic analysis method according to claim 1, characterized in that: A loss function is also included, the loss function includes a loss for potential region identification and a classification loss, and the formula of the loss function is as follows: Among them, the potential region recognition loss is composed of the potential target region L t and the potential argument region L a The recognition loss is divided into two parts, each of which consists of the upper left corner cell recognition loss and the lower right corner cell recognition loss. CE(.) represents the binary cross entropy loss function, and the potential area recognition loss formula is as follows: The classification loss includes two parts: framework classification loss and role classification loss. The loss function adopts cross entropy loss, and the formula is as follows: Among them, G t and G a Represent the potential target area and potential argument area respectively.
