A method for building a deep learning model to structure financial text into tables
Through the joint model fusion of multiple tasks, financial text is directly converted into tabular data, which solves the problems of error transmission and resource waste in the existing technology, improves accuracy and reduces costs, and achieves commercialization standards in the financial field.
Patent Information
- Application Number
- CN202110415793.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-19
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-04-19
AI Technical Summary
The existing technology has error propagation problems, resource waste, low efficiency, inability to share parameters, difficulty in classifying hierarchical intentions, and high rule design costs when structuring financial text into tables, resulting in insufficient accuracy and difficulty in maintenance.
A joint model is used to integrate text information extraction, table relationship judgment and row information prediction into a multi-task model. It encodes and combines through multi-level model structures to directly convert unstructured text into tabular data, reducing error transmission and improving accuracy.
It improves the accuracy by 3-5 percentage points, reduces error propagation problems, realizes commercial standard table structuring, and reduces development and maintenance costs.
Smart Images

Figure CN113326676B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information extraction and conversion, and in particular to a method for establishing a deep learning model for structuring financial text into a table. Background Art
[0002] In natural language processing, common tasks are to classify text or extract information. Another type of problem is to extract and identify structural information such as tables in documents.
[0003] In the financial and other fields, there are some more in-depth technical needs, such as converting unstructured text directly into tables. Figure 1 As shown in the figure, it is a first-level bid modification data, which means "cancel the bond [02XX City Investment MTN002] with a bid of 2.64%; at the same time, change the 100 million yuan of funds with a bid of 2.78 to 40 million yuan with a bid of 2.83 and 60 million yuan with a bid of 2.96". We abstract this problem into a problem of structuring unstructured text information into tabular data. In terms of semantic understanding, this is not just a simple text classification or recognition of intent. It requires the integration of various elements and multiple intents. Figure 1 In the current field of text processing, this is a very difficult technical problem, involving a series of technical problems.
[0004] There is currently no ready-made unified technology for organizing text into tables. The main approach is to split it into multiple subtasks, and then handle such problems in a pipeline format. First, a text classification model is used to classify and judge the overall intent of the question (taking the above example as an example, judging whether the user's intention is to bid, change the bid, or withdraw the bid). Secondly, information extraction is performed, using the "Named Entity Recognition (NER)" technology to extract the various elements in the text (taking the above example as an example, extracting elements such as bond name, mark position, scalar, etc.), and finally, through a series of rules, the elements are arranged (for example, according to the position of the element before and after the word change), and combined into a table.
[0005] First of all, the pipeline processing method has a major flaw, which is the error transmission problem. In the process of structuring text into a table, three models are needed, one is intent classification, the second is feature extraction, and the third is feature structuring into a table. In the middle, the number of rows in the table (which is uncertain) needs to be considered. With the current better model algorithm, the accuracy is about 95%. After the three models are integrated through the pipeline, the final accuracy is about 80%-85%. In order to achieve commercial use or improve the accuracy, a series of various rules are needed to correct and some fault-tolerant designs; secondly, the second flaw of using the pipeline is that intent classification, feature extraction, and table structuring are all text encoding at the bottom layer, but because they are divided into multiple subtasks, each task must encode the text separately, which is a waste of technical resources and reduces the efficiency of structuring; secondly, it is impossible to share relevant parameters to achieve the effect of improving the prediction accuracy; the subtask of intent judgment is a multi-level classification problem; the first level classification is to judge whether to bid, modify or withdraw, and the second level classification is for the intention of modification, and it is also necessary to judge the elements before and after the modification. The existing classification model cannot solve this hierarchical intent classification problem very well. There is currently no relevant deep learning algorithm model for structuring into tables. To a large extent, manual methods are still used to sort out structured logical rules and reorder elements according to the rules. The solution based on the rule engine requires a lot of manpower costs, and it cannot guarantee the comprehensiveness of the rules. There are still many problems that the rules cannot cover. Secondly, due to the diversity of people's expressions, the rules not only cannot cover everything, but also interfere and conflict with each other, which is easy to appear. Finally, the development cost and maintenance cost are very high. For the rules sorted out in the early stage, each new rule must consider whether it is effective and the impact on the previous rules; the development and maintenance costs are extremely high. Summary of the invention
[0006] The purpose of the present invention is to provide a method for establishing a deep learning model that structures financial text into a table in view of the defects and shortcomings of the prior art, so as to solve the problems raised in the above-mentioned background technology. The present invention adopts the idea of a joint model, and integrates multiple tasks such as text information extraction, table relationship judgment, and whether a column of information is formed into a multi-task model. Through one model, multiple subtasks are solved by one model, and finally a standard table structure information is formed. First, preprocessing is performed to clean the original text, and the table information is organized into a data form for model training. Secondly, a multi-level model structure is used to encode the text to realize element extraction in the text. Then, the extracted elements are combined in the form of table columns to form multiple row information. The elements of each row are secondary encoded and classified to determine whether it is valid row information, and finally the text is structured in a table. The present invention is to construct a set of multi-level complex models to achieve the goal of structuring text into a table in one model. The learning and training process of the algorithm model is as follows: Figure 2 As shown, the present invention proposes a multi-task neural network, which directly converts unstructured text into tabular data through a model, and reaches the commercial standard in the field of financial data. Compared with the Pipeline form, it is improved by 3-5 percentage points and reduces the error transmission problem of the pipeline.
[0007] To achieve the above-mentioned purpose, the present invention includes the following technical solutions: step one, preprocessing, data cleaning, text segmentation, forming characters and words, table row labels; step two, word vectorization; step three, character encoding layer; step four, connection layer of character encoding and word encoding; step five, prediction of column information; step six, preprocessing of row information prediction; step seven, prediction of row information; step eight, setting of total loss function.
[0008] The first step of the above-mentioned preprocessing and data cleaning is to clean and replace irregular data. For example, "full-width and half-width conversion" is used to remove special symbols such as "emoticons", etc., and a multi-dimensional word segmentation method is established to segment text information. The first dimension is to divide the text into short sentences by obvious separators such as "spaces, commas, semicolons, Tab keys", etc. The second dimension is to use regular expressions to extract "characters, numbers" and other elements in the text, and segment short sentences into words with a granularity of "characters and numbers". The third is to use Jieba word segmentation to make a finer-grained segmentation of characters and numbers, thereby forming three granularity words, namely word c ,word m ,word s, corresponding to the word information of three granularities. Since the table information is an N*M two-dimensional information, this scheme splits the two-dimensional information into two-dimensional sub-tasks. For the information in any cell, it is divided into the prediction of column position and row position. The column position is associated with the column name information, that is, the task of named entity recognition. Each element is labeled as "column name" information. For the labeling of row information, we label the information of each row as a "0 / 1" classification problem. When it meets all the information of the table row, it is labeled as "1", and when it does not meet the label, it is labeled as "0".
[0009] The second step is based on word c ,word m ,word s , three different scales of word segmentation, the word segmentation is fused with the word position information and then vectorized. First, word2vec (including but not limited to) is used to vectorize word segmentation of different scales, obtain the vector features of each word segmentation, and integrate the position structure information of the word segmentation. This scheme encodes the structure of the position of each word segmentation. In the case of only one or more lines of text, the position information of each word in the text is constructed, and the position information of each word segmentation in the row and column of the text is represented by a connection matrix. The connection matrix is defined as A[i,j]=1 (when the vertical positions of two words are the same, or they are adjacent to each other on the left and right), otherwise A[i,j]=0. There are three different granularities of word segmentation, so there are three different connection matrices Ac[i,j], Am[i,j] and As[i,j]. GCN is used to train the word segmentation information vectorization; since each text has three different granularities of word segmentation, we use the following GCN formula:
[0010]
[0011] in, A is the adjacency matrix, I is the identity matrix; Used for normalization H (t) , H (t+1) Respectively represent the codes of each node in the graph at the t and t+1 layers; W (l) is the parameter to be learned; H (0) =X, where X is the initial input. The three word vectors are encoded using the GCN feature extraction formula to obtain the vector encodings of three words with different granularities, namely H c , H m and H s .
[0012] In the above step 3, the character layer is encoded by using the pre-trained Albert model, on which a BiLSTM layer is spliced as the embedding matrix TE.
[0013] In the fourth step, the encoding matrix TE of each word is formed after character encoding. The three different granularity word segmentation vectors are used to form the word encoding. We use the GAT algorithm to merge the word segmentation encoding and the character encoding, and directly splice the word segmentation to the back of the character. Assuming that the length of the character is N and the number of word segments is M, we construct an (N+M)*(N+M) adjacency matrix K. When the word contains the information of the character, K[i,j]=1, otherwise K[i,j]=0. Based on the three different word segmentations, three domain matrices K are constructed. c , K m and K s , using the GAT algorithm, the word segmentation and character encoding are concatenated, where the GAT operation method is as follows: In the GAT operation, the input of the tth layer is a point set F t ={f1,f2,...,f N}, there is also an adjacency matrix G, using GAT with multiple heads, the main calculation formula is as follows:
[0014]
[0015]
[0016] Among them, f′ i ∈R F represents the input feature of node i; f′ j ∈R F represents the output feature of node j; || represents the concatenation operation; σ represents the nonlinear activation function; v i represents the adjacent vertices of i; Representation Node
[0017] The weight of the edge connecting i and node j; W k ∈R F ' ×F Represents the linear transformation matrix, which is used to linearly transform features.
[0018] Sexual transformation; and They are the weight parameters of the forward feedback neural network; G is used to mask α k Corresponding position.
[0019] The output of the last layer is obtained through t=1, 2, ..., N respectively, and then the result of the final AF corresponding to the GAT is calculated:
[0020]
[0021] According to the above formula, three different word segmentation and character fusion vector matrices Q are obtained c ,Q m and Q s .
[0022] The three vector matrices ①②③ are combined and then fused with the character vector for the second time. The aggregation formula is:
[0023] Z=W1H+W2Q c +W3Q m +W4Q s
[0024] Where W1, W2, W3, and W4 are the parameter matrices to be trained, and H is the final vector matrix that forms the character.
[0025] The step 5 performs a series of annotations on the text, similar to the task of "named entity recognition", and annotates the characters of the text in the form of BIO; and uses the cross entropy function (categorical loss) to train the column information, and its loss function is defined as NER_loss.
[0026] The step 6 extracts the character vector based on the result of column information prediction. Considering the needs of downstream tasks, the character information determined as entities is extracted. Considering the different lengths of each Chinese word; to form the basic vector information for row information prediction, we use the mean method to aggregate the character vectors contained in each word. The formula is: Thus, we obtain the word vector of each column, and make editable combinations of each column information to form row information. This process is an editable process. For general domains, we can directly use the method of freely combining each column information to form various combinations of row information. The combination formula is as follows: Assuming there are n columns, we can extract M words from a text. i The entity information of the i-th column, then the total SUM = M1*M2*...*M n Combination information of the row, supplementary information: for special private fields, some rules of the field can be added to form the row information combination. The formation of mandatory row information complies with the rules of the field. This is a freely editable module.
[0027] The step 7 first encodes each word vector of the randomly combined rows, and uses the vector of each word formed as the node vector of the Graph network. Secondly, this scheme uses the GAT operation again to encode and learn the column information in each freely combined row. The operation method is the same as step 4, and the only difference from step 4 is the adjacency matrix G; thereby forming the vector information R of each row. During the training process, since the row information is randomly combined, when the "randomly combined row" is in the "labeled" row information, the result is 1, otherwise it is 0, which is consistent with the pre-processed row information. By comparing the "randomly combined prediction" and the "labeled 0 / 1", the cross entropy function (categorical loss) is used to train and learn the row information, and its loss is defined as structure_loss.
[0028] In the step eight, the loss functions of the columns and rows are weighted to obtain the total loss function Loss=NER_loss+α*structure_loss, which is used as the total loss function of the model, wherein α is an adjustable hyperparameter. Based on the loss function, the model is trained; finally, the result of the model is obtained.
[0029] The working principle of the present invention is as follows: it adopts the idea of a joint model, integrates multiple tasks such as text information extraction, table relationship judgment, whether to form a column of information, etc. into a multi-task model, and solves multiple subtasks through one model to finally form standard table structure information. First, preprocessing is performed to clean the original text and organize the table information into a data form for model training. Secondly, a multi-level model structure is used to encode the text to realize element extraction in the text. The extracted elements are then combined in the form of table columns to form multiple row information. The elements of each row are secondary encoded and classified to determine whether they are valid row information, and finally the table structuring of the text is realized.
[0030] After adopting the above technical solution, the beneficial effect of the present invention is: through a model, unstructured text is directly converted into tabular data, which meets the commercial standards in the financial data field. Compared with the Pipeline form, it is improved by 3-5 percentage points and reduces the problem of error transmission in the pipeline. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0032] Figure 1 It is a structural diagram for directly converting unstructured text into tables in the traditional financial field;
[0033] Figure 2 It is a structural diagram of the learning and training process of the algorithm model of the present invention;
[0034] Figure 3 This is the architecture diagram of the deep learning model for structuring text into a table based on graph attention in the present invention. DETAILED DESCRIPTION
[0035] See also Figure 1 to Figure 3 As shown, the present invention includes the following technical solutions: step one, preprocessing, data cleaning, text segmentation, forming characters and words, table row labels; step two, word vectorization; step three, character encoding layer; step four, connection layer of character encoding and word encoding; step five, prediction of column information; step six, preprocessing of row information prediction; step seven, prediction of row information; step eight, setting of total loss function.
[0036] Furthermore, the step 1 is preprocessing, data cleaning, cleaning and replacing irregular data. For example, "full-width and half-width conversion", special symbols such as "emoticons" are removed, and a multi-dimensional word segmentation method is established to segment text information. The first dimension is to divide the text into short sentences through obvious separators such as "spaces, commas, semicolons, Tab keys", etc. The second dimension is to use regular expressions to extract "characters, numbers" and other elements in the text, and segment short sentences into words with a granularity of "characters and numbers". The third is to use Jieba word segmentation to make finer-grained segmentation of characters and numbers, thereby forming three granularity words, namely word c ,word m ,word s , corresponding to the word information of three granularities. Since the table information is an N*M two-dimensional information, this scheme splits the two-dimensional information into two-dimensional sub-tasks. For the information in any cell, it is divided into the prediction of column position and row position. The column position is associated with the column name information, that is, the task of named entity recognition. Each element is labeled as "column name" information. For the labeling of row information, we label the information of each row as a "0 / 1" classification problem. When it meets all the information of the table row, it is labeled as "1", and when it does not meet the label, it is labeled as "0".
[0037] Furthermore, the step 2 is based on word c ,word m ,word s, three different scales of word segmentation, the word segmentation is fused with the word position information and then vectorized. First, word2vec (including but not limited to) is used to vectorize word segmentation of different scales, obtain the vector features of each word segmentation, and integrate the position structure information of the word segmentation. This scheme encodes the structure of the position of each word segmentation. In the case of only one or more lines of text, the position information of each word in the text is constructed, and the position information of each word segmentation in the row and column of the text is represented by a connection matrix. The connection matrix is defined as A[i,j]=1 (when the vertical positions of two words are the same, or they are adjacent to each other on the left and right), otherwise A[i,j]=0. There are three different granularities of word segmentation, so there are three different connection matrices Ac[i,j], Am[i,j] and As[i,j]. GCN is used to train the word segmentation information vectorization; since each text has three different granularities of word segmentation, we use the following GCN formula:
[0038]
[0039] in, A is the adjacency matrix, I is the identity matrix; Used to normalize
[0040] Chemical A; H (t) , H (t+1) Respectively represent the codes of each node in the graph at the t and t+1 layers; W (l) is the parameter to be learned; H (0) =X, where X is the initial input. The three word vectors are encoded using the GCN feature extraction formula to obtain the vector encodings of three words with different granularities, namely H c , H m and H s .
[0041] Furthermore, in step 3, the encoding of the character layer adopts a pre-trained Albert model, on which a BiLSTM layer is spliced as the embedding matrix TE.
[0042] Furthermore, in step 4, the encoding matrix TE of each word is formed after character encoding, and the encoding of the word is formed after the three different granularity word segmentation vectors. We use the GAT algorithm to merge the word segmentation encoding and character encoding, and directly splice the word segmentation to the back of the character. Assuming that the length of the character is N and the number of word segments is M, we construct an (N+M)*(N+M) adjacency matrix K. When the word contains the information of the character, K[i,j]=1, otherwise K[i,j]=0. Based on the three different word segmentations, three domain matrices K are constructed. c , K m and K s, using the GAT algorithm, the word segmentation and character encoding are concatenated, where the GAT operation method is as follows: In the GAT operation, the input of the tth layer is a point set F t ={f1,f2,...,f N}, there is also an adjacency matrix G, using GAT with multiple heads, the main calculation formula is as follows:
[0043]
[0044]
[0045] Among them, f′ i ∈R F represents the input feature of node i; f′ j ∈R F represents the output feature of node j; || represents the concatenation operation; σ represents the nonlinear activation function; v i represents the adjacent vertices of i; represents the weight of the edge connecting node i and node j; W k ∈R F′×F Represents the linear transformation matrix, which is used to perform linear transformation on features; and They are the weight parameters of the forward feedback neural network; G is used to mask α k Corresponding position.
[0046] The output of the last layer is obtained through t=1, 2, ..., N respectively, and then the result of the final AF corresponding to the GAT is calculated:
[0047]
[0048] According to the above formula, three different word segmentation and character fusion vector matrices Q are obtained c ,Q m and Q s .
[0049] Combine the three vector matrices ①②③ and fuse them with the character vector for the second time. The aggregation formula is: Z=W1H+W2Q c +W3Q m +W4Q s
[0050] Where W1, W2, W3, and W4 are the parameter matrices to be trained, and H is the final vector matrix that forms the character.
[0051] Furthermore, the step five performs a series of annotations on the text, similar to the task of "named entity recognition", and annotates the characters of the text in the form of BIO; and uses the cross entropy function (categorical loss) to train the column information, and its loss function is defined as NER_loss.
[0052] Furthermore, in step 6, character vectors are extracted based on the results of column information prediction. Considering the needs of downstream tasks, character information determined as entities is extracted. Considering the different lengths of each Chinese word, in order to form basic vector information for row information prediction, we use mean
[0053] The method aggregates the character vectors contained in each word, and the formula is Thus, we obtain the word vector of each column, and make editable combinations of each column information to form row information. This process is an editable process. For general domains, we can directly use the method of freely combining each column information to form various combinations of row information. The combination formula is as follows: Assuming there are n columns, we can extract M words from a text. i The entity information of the i-th column, then the total SUM = M1*M2*...*M n Combination information of the row, supplementary information: for special private fields, some rules of the field can be added to form the row information combination. The formation of mandatory row information complies with the rules of the field. This is a freely editable module.
[0054] Furthermore, the step seven first encodes each word vector of the randomly combined rows, and the vector of each word formed is used as the node vector of the Graph network. Secondly, this scheme again adopts the GAT operation to encode and learn the column information in each freely combined row. The operation method is the same as step four, and the only difference from step four is the adjacency matrix G; thereby forming the vector information R of each row. During the training process, since the row information is randomly combined, when the "randomly combined row" is in the "labeled" row information, the result is 1, otherwise it is 0, which is consistent with the pre-processed row information. By comparing the "randomly combined prediction" and the "labeled 0 / 1", the cross entropy function (categorical loss) is used to train and learn the row information, and its loss is defined as structure_loss.
[0055] Furthermore, in the step eight, the loss functions of the columns and rows are weighted to obtain a total loss function Loss=NER_loss+α*structure_loss, which is used as the total loss function of the model, wherein α is an adjustable hyperparameter. Based on the loss function, the model is trained; finally, the result of the model is obtained.
[0056] Furthermore, the present invention adopts jieba word segmentation and adds a feature dictionary to perform multi-granularity word segmentation, and adopts word2vec for vectorization. Other word vectorization and word segmentation methods, as well as new technologies that will appear in the future, may be adopted. Currently, financial data is tabulated, but this technical patent is not limited to financial data and can be applied to any other task that requires structuring a text into a table.
[0057] The working principle of the present invention is as follows: it adopts the idea of a joint model, integrates multiple tasks such as text information extraction, table relationship judgment, whether to form a column of information, etc. into a multi-task model, and solves multiple subtasks through one model to finally form standard table structure information. First, preprocessing is performed to clean the original text and organize the table information into a data form for model training. Secondly, a multi-level model structure is used to encode the text to realize element extraction in the text. The extracted elements are then combined in the form of table columns to form multiple row information. The elements of each row are secondary encoded and classified to determine whether they are valid row information, and finally the table structuring of the text is realized.
[0058] After adopting the above technical solution, the beneficial effect of the present invention is: through a model, unstructured text is directly converted into tabular data, which meets the commercial standards in the financial data field. Compared with the Pipeline form, it is improved by 3-5 percentage points and reduces the problem of error transmission in the pipeline.
[0059] The above description is only used to illustrate the technical solution of the present invention rather than to limit it. Other modifications or equivalent substitutions made to the technical solution of the present invention by ordinary technicians in this field should be included in the scope of the claims of the present invention as long as they do not depart from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for establishing a deep learning model for structuring financial text into a table, characterized by: It includes the following technical solutions: Step 1, preprocessing, data cleaning, text segmentation, forming characters and words, table row labels; Step 2, word vectorization; Step 3, character encoding layer; Step 4, connection layer of character encoding and word encoding; Step 5, prediction of column information; Step 6, preprocessing of row information prediction; Step 7, prediction of row information; Step 8, setting of total loss function; The first step of the described step is preprocessing and data cleaning, cleaning and replacing irregular data, including "full-width and half-width conversion" and removing special symbols including "emoticons"; establishing a multi-dimensional word segmentation method to segment text information. The first dimension is through "space, comma, semicolon, Tab key" obvious separators"; dividing the text into short sentences, the second dimension is to use regular expressions to extract the "characters and numbers" elements in the text, and segment the short sentences into words with a granularity of "characters and numbers". The third is to use Jieba word segmentation to make a finer granularity segmentation of characters and numbers, thereby forming three granularity words, namely word c ,word m ,word s , corresponding to the three granularity word information, since the table information is an N*M two-dimensional information, the two-dimensional information is split into two-dimensional sub-tasks. For the information in any cell, it is divided into the prediction of the column position and the prediction of the row position. The column position is associated with the column name information, that is, the task of named entity recognition. Each element is labeled as "column name" information. For the labeling of row information, the information of each row is labeled as a "0 / 1" classification problem. When it meets all the information of the table row, it is labeled as "1", and when it does not meet the label, it is labeled as "0"; The second step is based on word c ,word m ,word s , three different scales of word segmentation, the word segmentation is fused with the word position information and then vectorized. First, word2vec is used to vectorize word segmentation of different scales, obtain the vector features of each word segmentation, integrate the position structure information of the word segmentation, and perform structural encoding on the position of each word segmentation. In the case of only one or more lines of text, the position information of each word in the text is constructed, and the adjacency matrix is used to represent the position information of each word segmentation in the row and column of the text. The adjacency matrix is defined as A[i,j]=1 when two words have the same vertical position or are adjacent to each other, otherwise A[i,j]=0. There are three different granularities of word segmentation, so there are three different adjacency matrices Ac[i,j], Am[i,j] and As[i,j]. GCN is used to train the word segmentation information vectorization; since each text has three different granularities of word segmentation, the following GCN formula is used: in, A is the adjacency matrix, I is the identity matrix; Used for normalization H (t) , H (t+1) Respectively represent the codes of each node in the graph at the t and t+1 layers; W (t) is the parameter to be learned; H (0) =X, where X is the initial input. The three word vectors are encoded using the GCN feature extraction formula to obtain the vector encodings of three words with different granularities, namely H c , H m and H s ; In step 3, the encoding of the character layer uses the pre-trained Albert model, and a BiLSTM layer is spliced on it as the embedding matrix TE; In the fourth step, the encoding matrix TE of each word is formed after character encoding. The three different granularity word segmentation vectors are used to form the word encoding. The GAT algorithm is used to merge the word segmentation encoding and the character encoding. The word segmentation is directly spliced to the back of the character. Assuming that the length of the character is N and the number of word segments is M, an (N+M)*(N+M) adjacency matrix K is constructed. When the word contains the information of the character, K[i,j]=1, otherwise K[i,j]=0. Based on the three different word segmentations, three domain matrices K are constructed. c , K m and K s , using the GAT algorithm, the word segmentation and character encoding are concatenated, where the GAT operation method is as follows: In the GAT operation, the input of the tth layer is a point set F t ={f1,f2,...,f N }, there is also an adjacency matrix G, using GAT with multiple heads, the calculation formula is as follows: Among them, f' i ∈R F represents the input feature of node i; f' j ∈R F’ represents the output feature of node j; || represents the concatenation operation; σ represents the nonlinear activation function; v i represents the adjacent vertices of i; represents the weight of the edge connecting node i and node j; W k ∈R F ‘×F Represents the linear transformation matrix, which is used to perform linear transformation on features; and They are the weight parameters of the forward feedback neural network; G is used to mask α k corresponding position; The output of the last layer is obtained through t=1, 2, ..., N respectively, and then the result of the final AF corresponding to the GAT is calculated: According to the above formula, three different word segmentation and character fusion vector matrices Qc, Qm and Qs are obtained; Combine the three vector matrices ①②③ and fuse them with the character vector for the second time. The aggregation formula is: Z=W1H+W2Q c +W3Q m +W4Q s Where W1, W2, W3, W4 are the parameter matrices to be trained, and H is the final vector matrix forming the character; The step 5 performs a series of annotations on the text, annotating the characters of the text in the form of BIO; and uses a cross entropy function to train the column information, and its loss function is defined as NER_loss; The step 6 extracts the character vector based on the result of the column information prediction; considering the needs of downstream tasks, the character information determined as entities is extracted, and considering the different lengths of each Chinese word; in order to form the basic vector information for row information prediction, the mean method is used to aggregate the character vectors contained in each word, and the formula is: Thus, we obtain the word vector of each column, and make editable combinations of each column information to form row information. This process is an editable process. For general domains, we directly use the method of freely combining each column information to form various combinations of row information. Assuming there are n columns, we can extract M words from a text. i The entity information of the i-th column, then the total SUM = M1*M2*...*M n Combination information of the row, supplementary information: for special private fields, some rules of the field are added to the formation of row information combination, forcing the formation of row information to comply with the rules of the field. This is a freely editable module; The step 7 first encodes each word vector of the randomly combined row, based on the vector of each word formed, as the node vector of the Graph network, and again uses the GAT operation to encode and learn the column information in each freely combined row. The operation method is the same as step 4, and the only difference from step 4 is the adjacency matrix G. Thus, the vector information R of each row is formed. During the training process, since the row information is randomly combined, when the "randomly combined row" is in the "labeled" row information, the result is 1, otherwise it is 0, which is consistent with the pre-processed row information. By comparing the "randomly combined prediction" and the "labeled 0 / 1", the cross entropy function is used to train and learn the row information, and its loss is defined as structure_loss; The loss functions of the columns and rows in step eight are weighted to obtain a total loss function Loss = NER_loss + α * structure_loss, which is used as the total loss function of the model, where α is an adjustable hyperparameter. Based on the total loss function, the model is trained; finally, the model result is obtained.
Citation Information
Patent Citations
A text implication relation recognition method based on multi-granularity information fusion
CN109299262A
Chinese relationship extraction method
CN110334354A
Chinese text-oriented end-to-end entity relationship joint extraction method
CN110472235A
Natural language training method, system and device for joint learning and storage medium
CN111309915A
Method and system for joint named entity recognition and relation extraction using convolutional neural network
US20200065374A1
