Method, device and equipment for identifying event causal relationship of Chinese text
By combining convolutional neural network, bidirectional long and short-term memory network and attention mechanism in Chinese text processing, Chinese text is recognized and marked verbatim, comprehensive features of the full text are generated and causal prediction is carried out, and the problem of poor causal extraction effect in Chinese text is solved, achieving higher causal recognition accuracy and feature extraction integrity.
Patent Information
- Application Number
- CN202510228228.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-03-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The causal extraction effect in Chinese text is slightly worse than that in English relationship extraction, and there are problems such as fuzzy identification of causal boundaries and insufficient text representation ability.
Convolutional neural network and bidirectional long and short-term memory network are combined with attention mechanism, and the Chinese text is recognized and marked verbatim, comprehensive features are generated in the full text, and causal annotation sequence is generated through conditional random fields to make causal prediction.
It significantly improves the model's ability to identify causal relationships and the integrity and accuracy of causal feature extraction, and solves the problems of fuzzy recognition of causal relationship boundaries and insufficient text representation ability.
Smart Images

Figure CN119720951A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of text processing technology, and in particular, to a method, device and equipment for identifying event causal relationships in Chinese text. Background Art
[0002] Texts are usually composed of multiple events, which revolve around the same topic and are interconnected through various semantic relationships such as causal relationships and temporal relationships. Among them, the causal relationship of events is a particularly common and important relationship, which reflects the understanding and reasoning ability of knowledge. Causal relationships reveal the sequence of events and are the key to understanding the dynamic evolution of events. Accurately and efficiently understanding the causal relationship of events in texts is of great practical significance for analyzing the evolution path of events, predicting future development trends, and supporting higher-level text processing applications. For example, in the field of medicine, causal analysis can be used to infer the potential causes of the development of a disease; in the field of finance, it can predict the driving factors of market changes; in the field of artificial intelligence, it helps to build more intelligent reasoning and decision-making systems.
[0003] There are three main methods for identifying event causal relationships: rule-based methods, statistical methods, and deep learning-based methods. Rule-based methods use pattern matching to extract causal relationships and manually formulate rules based on text structure features. Although they have high accuracy, they have poor generalization and portability. Although statistical methods overcome the problem of relying on domain rules by abstracting text features, they require complex feature engineering and rely heavily on the quality of the annotated corpus. In addition, artificial feature engineering will bring additional noise, thus affecting the extraction accuracy. Deep learning-based methods can automatically learn text features from natural language texts, effectively solving problems such as cross-domain extraction and manual intervention. In recent years, a large number of studies have emerged using deep learning technology to extract causal relationships in texts, and have achieved certain results.
[0004] The research on causal relationship extraction in the Chinese field started late, and its semantic relationship is more complex than that in English. Chinese causal relationship extraction requires data preprocessing, including syntactic analysis, part-of-speech tagging, word segmentation, etc. There are problems such as fuzzy causal relationship boundary identification and insufficient text representation capabilities. There will be many errors in the processing process, and these errors will cause error cascades, which leads to the fact that the effect of Chinese causal relationship extraction is often slightly worse than that of English relationship extraction.
[0005] At present, there is an urgent need for a method to identify event causal relationships in Chinese text, so as to solve the problem of difficulty in identifying causal relationship boundaries by adopting a new encoding method, improve the model's ability to identify causal relationships, and greatly improve the completeness and accuracy of the model's causal feature extraction. Summary of the invention
[0006] In order to solve the problems of inaccurate intent recognition and low multi-path retrieval efficiency in business question-and-answer systems in the prior art, the embodiments of this specification provide a method, device and equipment for event causal relationship recognition in Chinese text. Combined with the attention mechanism, the model can more accurately identify and focus on key information in the text, and solve the problem of information loss during the information extraction process; by setting a fusion function based on causal association word information, the specific causal relationship recognition weights are strengthened, the model's ability to recognize causal relationships is improved, and the completeness and accuracy of the model's causal feature extraction are greatly improved.
[0007] The specific technical solutions of the embodiments of this specification are as follows:
[0008] On the one hand, the embodiments of this specification provide a method for identifying causal relationships of events in Chinese text, including:
[0009] Acquire Chinese text to be recognized, and recognize and annotate the Chinese text word by word;
[0010] Encode each word in the Chinese text according to the annotation to generate a text code;
[0011] A convolutional neural network is used to mine local features of the text encoding, and a bidirectional long short-term memory network is used to mine context features of the text encoding;
[0012] The local features and the context feature vector are integrated to construct a full-text comprehensive feature representing the Chinese text;
[0013] A causal relationship annotation sequence is generated according to the comprehensive features of the full text through a conditional random field to perform causal relationship prediction.
[0014] Furthermore, encoding each word in the Chinese text according to the annotation further includes:
[0015] Performing word segmentation processing on the Chinese text according to the annotation;
[0016] According to the word segmentation processing result, obtaining the position information and context information of each word in the Chinese text;
[0017] Generate a word embedding vector for each word based on the position information and context information of each word;
[0018] The embedding vectors of each word in the same sentence are integrated into a feature vector matrix as the text encoding of the sentence.
[0019] Furthermore, encoding each word in the Chinese text according to the annotation further includes:
[0020] According to the word segmentation result, each word in the sentence is represented by wi Represents, then the sentence S={w1,w2,…,w n}, the word embedding vector generated by the model is represented as the text encoding matrix V, which is expressed as:
[0021] ,
[0022] Among them, SEP is the sentence start label; v is the word vector generated by the model; n is the sequence length; 512 is the word vector dimension; CLS is the sentence end label; index is the position index.
[0023] Furthermore, using a convolutional neural network to mine the local features of the text encoding further includes:
[0024] Extracting local dependencies in a sentence based on the text encoding and context information in each word embedding vector;
[0025] An attention mechanism is introduced to perform weighted processing on the local dependencies to generate local features of the text encoding.
[0026] Furthermore, using a convolutional neural network to mine the local features of the text encoding further includes:
[0027] The convolutional neural network is divided into a convolution layer and a pooling layer;
[0028] The convolution layer extracts local dependencies in the sentence through multi-layer convolution operations;
[0029] The pooling layer performs feature dimension reduction, and the formula is:
[0030] ,
[0031] ,
[0032] in, Indicates that from The local features extracted by the three groups of convolution kernels; V represents the text encoding matrix; Max represents the maximum pooling operation, Conv represents the convolution operation; L represents the output feature matrix, which is formed by concatenating the convolution results of the three groups of convolution kernels; Respectively represent the local features extracted by three groups of convolution kernels, Concat represents the connection operation, The feature vectors obtained by different convolution kernels are concatenated together along the feature dimension.
[0033] Furthermore, using a convolutional neural network to mine the local features of the text encoding further includes:
[0034] The attention mechanism is also combined to weight local features and enhance the recognition of important feature information;
[0035] The extracted local dependency feature is expressed as,
[0036] ,
[0037] ,
[0038] Among them, Attention(Q, K, V) represents the core operation of the attention mechanism; T represents the transpose operation of the matrix; SoftMax is the activation function, , , is a trainable parameter matrix; Represents the dimension of the local feature vector; Represents the final extracted local dependency features.
[0039] Furthermore, using a bidirectional long short-term memory network to mine the contextual features of the text encoding further includes:
[0040] The bidirectional long short-term memory network calculates the embedding vector of each word in the text encoding through forward and backward LSTM, and combines the attention mechanism to weight and generate the context feature.
[0041] Furthermore, using a bidirectional long short-term memory network to mine the contextual features of the text encoding further includes:
[0042] The vector matrix V is used as input, and the two forward and reverse LSTMs process the text encoding respectively to obtain the context feature , similarly introduces the attention mechanism, then the context feature vector It is expressed as:
[0043] ,
[0044] in, , , is a trainable parameter matrix.
[0045] Furthermore, fusing the local features and the context feature vector to construct a comprehensive feature representing the full text of the Chinese text further includes:
[0046] According to the causal annotation, the feature weights of the significant boundary feature words in the causal relationship are adjusted , combined with the linear weighting method, the feature representation vector of the full text is constructed as:
[0047] ,
[0048] Among them, f represents the feature representation vector of the full text, is the feature weight, the sentence sequence length is n, are the local features and context features of the i-th sequence respectively.
[0049] Furthermore, generating a causal relationship annotation sequence according to the comprehensive features of the full text through a conditional random field, and performing causal relationship prediction further includes:
[0050] According to the comprehensive features of the full text of the Chinese text and the dependency structure between the causal annotations, the causal relationship annotation sequence is decoded to output an optimal label sequence;
[0051] Assume that the sequence Given an input sentence The label sequence of , the CRF score of the sequence is calculated as:
[0052] ,
[0053] in, Indicates that the i-th character in the sentence is The predicted probability of the label, It is a weighted combination of the extracted local features and context features, and the formula is:
[0054] ,
[0055] in, is the local eigenvector of the ith position, is the context feature vector of the ith position, , is a trainable weight matrix, which is used to weight local features and context features respectively, and b is a bias term;
[0056] Representation Tags To Tags The transition probability is dynamically adjusted to adapt to the specific context, and the formula is:
[0057] ,
[0058] in, is the context feature vector of the i-1th and i-th positions, , is a trainable transfer weight matrix, is the bias term of the transfer, and SoftMax is the activation function.
[0059] On the other hand, the embodiment of this specification also provides a device for identifying causal relationships of events in Chinese text, the device comprising:
[0060] A data annotation module is used to obtain Chinese text to be recognized, recognize and annotate the Chinese text word by word;
[0061] A text encoding module, used for encoding each word in the Chinese text according to the annotation to generate a text encoding;
[0062] A feature extraction module, used to mine local features of the text encoding using a convolutional neural network and to mine context features of the text encoding using a bidirectional long short-term memory network;
[0063] A feature fusion module, used for fusing the local features with the context feature vector to construct a full-text comprehensive feature representing the Chinese text;
[0064] The text decoding module is used to generate a causal relationship annotation sequence according to the comprehensive features of the full text through a conditional random field to perform causal relationship prediction.
[0065] On the other hand, an embodiment of the present specification further provides a computer device, including a memory, a processor, and a computer program stored in the memory, and the processor implements the above method when executing the computer program.
[0066] On the other hand, an embodiment of the present specification further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0067] Finally, the embodiments of this specification also provide a computer program product, wherein the computer program product includes a computer program, and the computer program implements the above method when executed by a processor.
[0068] Using the embodiment of this specification, a Chinese event causal relationship recognition algorithm based on feature weighting is provided. This scheme obtains the Chinese text to be recognized, recognizes and annotates the Chinese text word by word. Compared with the traditional text encoding model, recognition and annotation have significant advantages in semantic representation ability, and can efficiently and accurately capture the potential information of the sentence based on large-scale training data, and then encode each word in the text according to the annotation to generate text encoding; by masking the entire word, the model can more comprehensively understand the semantic association in the context, and improve the processing effect and accuracy of the Chinese text; then a convolutional neural network is used to mine the local features of the text encoding, and a bidirectional long short-term memory network is used to mine the context features of the text encoding; wherein, the convolution layer uses three groups of convolution kernels of different sizes to capture the local patterns and key information in the text with a multi-scale receptive field; and the bidirectional long short-term memory network can not only obtain the forward context dependency features, but also capture the reverse dependency information at the same time. Then the local features and context feature vectors are fused to construct the full-text comprehensive features representing the Chinese text; by fusing different types of features, the model can model the deep information of the text more comprehensively, thereby improving the accuracy and robustness of causal relationship extraction. Finally, the conditional random field is used to generate a causal relationship annotation sequence based on the comprehensive features of the full text to perform causal relationship prediction. In this way, the conditional random field can not only take into account the local prediction results, but also globally optimize the prediction of labels, further improve the prediction credibility and robustness of the model, and ensure the high quality of the causal relationship extraction results. By effectively capturing the semantic information of words and their contextual context, deeply exploring the relationship between text features, it helps machines understand and analyze complex texts more efficiently and accurately. Compared with traditional methods, this manual has significant innovations in the field of causal relationship extraction, aiming to comprehensively improve the accuracy and adaptability of the model's causal relationship recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the embodiments of this specification 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 embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0070] Figure 1 It is a schematic diagram of an implementation system of a method for identifying causal relationships of events in Chinese text in an embodiment of this specification;
[0071] Figure 2 It is a schematic diagram of the flow of the method for identifying the event causal relationship of Chinese text in the embodiment of this specification;
[0072] Figure 3It is a schematic diagram showing the recognition results of each word in the embodiment of this specification marked one by one;
[0073] Figure 4 The figure is a schematic diagram of the process of encoding each word in the Chinese text according to the annotation in the embodiment of this specification;
[0074] Figure 5 The figure is a schematic diagram of a process of using a convolutional neural network to mine the local features of the text encoding in an embodiment of this specification;
[0075] Figure 6 Shown is a schematic diagram of the overall structure of the model in the embodiment of this specification;
[0076] Figure 7 The figure shows a specific structural diagram of the device for identifying the event causal relationship of Chinese text in this embodiment;
[0077] Figure 8 The figure is a schematic diagram of the structure of a computer device in an embodiment of the present specification.
[0078]
Description of the accompanying drawings
[0079] 101. Terminal;
[0080] 102. Server;
[0081] 701. Data annotation module;
[0082] 702. Text encoding module;
[0083] 703. Feature extraction module;
[0084] 704, feature fusion module;
[0085] 705. Text decoding module;
[0086] 802. Computer equipment;
[0087] 804. Processing equipment;
[0088] 806. Storage resources;
[0089] 808, drive system;
[0090] 810, input / output module;
[0091] 812. Input device;
[0092] 814. Output device;
[0093] 816. Presentation equipment;
[0094] 818. Graphical user interface;
[0095] 820, network interface;
[0096] 822, communication link;
[0097] 824. Communication bus. DETAILED DESCRIPTION
[0098] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of this specification.
[0099] It should be noted that the terms "first", "second", etc. in the description and claims of the embodiments of this specification and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of this specification described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0100] It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of the embodiments of this specification comply with the relevant provisions of national laws and regulations.
[0101] It should be noted that in the embodiments of this specification, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.
[0102] like Figure 1The diagram of the implementation system of a method for identifying causal relationships of events in Chinese text in an embodiment of the specification is shown, including a terminal 101 and a server 102. The terminal 101 and the server 102 can communicate through a network, and the network can include a local area network (Local Area Network, referred to as LAN), a wide area network (Wide Area Network, referred to as WAN), the Internet or a combination thereof, and is connected to a website, a user device (such as a computing device) and a back-end system. Optionally, the server 102 can be a node of a cloud computing system, or each server can be a separate cloud computing system, including multiple computers interconnected by a network and working as a distributed processing system.
[0103] Terminal 101 obtains the Chinese text to be recognized and sends it to server 102. Server 102 recognizes the Chinese text word by word and generates text encoding based on word segmentation, uses convolutional neural network and bidirectional long short-term memory network to mine text features, and finally generates a causal relationship annotation sequence based on the comprehensive features of the full text through conditional random field, and returns the causal relationship prediction result to the user through terminal 101 to complete the causal prediction.
[0104] In addition, it should be noted that Figure 1 What is shown is only one application environment provided by the embodiment of this specification. In actual application, other application environments may also be included, and this specification does not limit it.
[0105] In response to the problems existing in the prior art, the embodiments of this specification provide a method for identifying event causal relationships in Chinese text. By segmenting and recognizing the input Chinese text word by word, each word in the text is encoded in a targeted manner. By fusing a bidirectional long short-term memory network and a convolutional neural network, the model's ability to capture local and global features in long texts is improved. Combined with the attention mechanism, the model can more accurately identify and focus on key information in the text, solving the problem of information loss during the information extraction process. In the process of information fusion, by setting a fusion function based on causal association word information, the specific causal relationship recognition weights are strengthened, the model's ability to recognize causal relationships is improved, and the model's integrity and accuracy in extracting causal features is greatly improved.
[0106] In the embodiments of this specification, Figure 2 The figure shows a flow chart of the method for identifying causal relationships of events in Chinese text in the embodiment of this specification. The figure describes the process of identifying causal relationships of events in Chinese text. The order of steps listed in the embodiment is only one way of executing the steps among many, and does not represent the only execution order. When the system or device product is executed in practice, it can be executed in the order of the method shown in the embodiment or the accompanying drawings or in parallel. Specifically, Figure 2As shown, the method may include:
[0107] Step 201: obtaining Chinese text to be recognized, and recognizing and marking the Chinese text word by word;
[0108] Step 202: Encode each word in the Chinese text according to the annotation to generate a text code;
[0109] Step 203: using a convolutional neural network to mine local features of the text encoding, and using a bidirectional long short-term memory network to mine context features of the text encoding;
[0110] Step 204: Fusing the local features and the context feature vector to construct a comprehensive feature representing the full text of the Chinese text;
[0111] Step 205: Generate a causal relationship annotation sequence according to the comprehensive features of the full text through a conditional random field to perform causal relationship prediction.
[0112] Using the embodiment of this specification, a Chinese event causal relationship recognition algorithm based on feature weighting is provided. This scheme obtains the Chinese text to be recognized, recognizes and annotates the Chinese text word by word. Compared with the traditional text encoding model, recognition and annotation have significant advantages in semantic representation ability, and can efficiently and accurately capture the potential information of the sentence based on large-scale training data, and then encode each word in the text according to the annotation to generate text encoding; by masking the entire word, the model can more comprehensively understand the semantic association in the context, and improve the processing effect and accuracy of the Chinese text; then a convolutional neural network is used to mine the local features of the text encoding, and a bidirectional long short-term memory network is used to mine the context features of the text encoding; wherein, the convolution layer uses three groups of convolution kernels of different sizes to capture the local patterns and key information in the text with a multi-scale receptive field; and the bidirectional long short-term memory network can not only obtain the forward context dependency features, but also capture the reverse dependency information at the same time. Then the local features and context feature vectors are fused to construct the full-text comprehensive features representing the Chinese text; by fusing different types of features, the model can model the deep information of the text more comprehensively, thereby improving the accuracy and robustness of causal relationship extraction. Finally, the conditional random field is used to generate a causal relationship annotation sequence based on the comprehensive features of the full text to perform causal relationship prediction. In this way, the conditional random field can not only take into account the local prediction results, but also globally optimize the prediction of labels, further improve the prediction credibility and robustness of the model, and ensure the high quality of the causal relationship extraction results. By effectively capturing the semantic information of words and their contextual context, deeply exploring the relationship between text features, it helps machines understand and analyze complex texts more efficiently and accurately. Compared with traditional methods, this manual has significant innovations in the field of causal relationship extraction, aiming to comprehensively improve the accuracy and adaptability of the model's causal relationship recognition.
[0113] The prior art mainly uses the causal recognition model BERT+BiLSTM+CRF based on sequence annotation, which can efficiently extract causal relationships from texts, combining the powerful pre-trained feature representation ability of BERT, the context capture ability of BiLSTM, and the global optimization ability of CRF in sequence annotation tasks. However, although the BERT+BiLSTM+CRF model performs well in causal relationship recognition tasks, it still has some limitations, especially in Chinese text processing, which may face specific challenges. Chinese lacks explicit word boundaries, and the model may be affected by the word segmentation tool during processing. If the word segmentation is wrong or the granularity is inconsistent, it may affect the contextual understanding of the model. The pre-trained corpus of the existing BERT model may not be enough to cover the diversity in the Chinese context, especially professional fields or dialect texts. For the specific context of causality, there may be a lack of sufficient pre-training knowledge support. Therefore, in the embodiment of this specification, BERT uses the WordPiece word segmentation algorithm to segment Chinese text at the character level or subword level. For example, Chinese sentences are segmented into single Chinese characters or a small number of multi-word combinations. This method adapts to unknown and low-frequency words and avoids an overly large vocabulary, but the subwords or words after splitting lack semantic integrity, especially for fixed phrases or complex proper nouns in Chinese, the semantic representation is easily destroyed. It solves the problem that BiLSTM still cannot transmit the information of the starting point of the sequence well for overly long sequences, the feature extraction ability is not strong enough, and the way of outputting spliced forward and backward fusion features is not good enough, which easily causes feature loss.
[0114] According to an embodiment of the present specification, in order to solve the shortcomings of the existing methods in extracting causal relationships from Chinese texts, the present specification proposes an improved model and innovatively adopts a new annotation method to respectively annotate the start word (B), middle word (M) and end word (E) of the cause and result events to solve the problem of fuzzy identification of causal relationship boundaries. Among them, C represents the cause event, R represents the result event, and O represents an irrelevant word. The specific annotation meanings are shown in Table 1.
[0115] Table 1 Marking meaning
[0116]
[0117] Through the prediction sequence in Table 1, each character in the Chinese text is identified and each character is labeled according to the recognized meaning, such as Figure 3 As shown, the predicted sequence is marked one by one according to the recognition result of each word, so that the boundary of causal recognition is accurate to each word, so as to solve the problem of fuzzy recognition of causal relationship boundary in the prior art.
[0118] According to an embodiment of the present specification, in order to accurately identify each word in the Chinese text, it is ensured that the sub-words or single characters after being split do not lack semantic integrity, such as Figure 4 As shown, encoding each word in the Chinese text according to the annotation further includes:
[0119] Step 401: performing word segmentation processing on the Chinese text according to the annotation;
[0120] Step 402: Obtaining position information and context information of each word in the Chinese text according to the word segmentation processing result;
[0121] Step 403: Generate a word embedding vector corresponding to each word according to the position information and context information of each word;
[0122] Step 404: Integrate each word embedding vector in the same sentence into a feature vector matrix as the text encoding of the sentence.
[0123] According to an embodiment of the present specification, in order to improve the semantic understanding and extraction capability of Chinese text, encoding each word in the Chinese text according to the annotation further includes:
[0124] According to the word segmentation result, each word in the sentence is represented by w i Represents, then the sentence S={w1,w2,…,w n}, the word embedding vector generated by the model is represented as the text encoding vector matrix V, which is expressed as:
[0125] ,
[0126] Among them, SEP is the sentence start label; v is the word vector generated by the model; n is the sequence length; 512 is the word vector dimension; CLS is the sentence end label; index is the position index.
[0127] Specifically, first, the Chinese text data with causal relationship annotation is input into the deep learning model for encoding. The model embeds the text after word segmentation into a vector representation containing position information and context information. Compared with the traditional text encoding model, it adopts a structure similar to the BERT (Bidirectional Encoder Representations from Transformers) architecture, but introduces a full-word masking strategy during the training process, and masks the entire word in the pre-training stage. It has significant advantages in semantic representation ability and can efficiently and accurately capture the potential information of the sentence based on large-scale training data. At the same time, the entire word is masked during training instead of masking a part of the vocabulary alone. In this way, the model can more comprehensively understand the semantic association in the context and improve the processing effect and accuracy of Chinese text. Compared with the traditional masking method, it can enable the model to better capture the overall meaning of the vocabulary during the learning process, thereby improving the semantic understanding and extraction ability of Chinese text.
[0128] In one embodiment of the present specification, in order to enable the model to more accurately identify and focus on the key information in the text, a more robust structure is designed, such as Figure 5 As shown, using a convolutional neural network to mine the local features of the text encoding further includes:
[0129] Step 501: extracting local dependencies in the sentence according to the text encoding and context information in each word embedding vector;
[0130] Step 502: Introduce an attention mechanism to perform weighted processing on the local dependencies to generate local features of the text encoding.
[0131] Specifically, convolutional neural network (CNN), CNN consists of convolutional layers and pooling layers. The convolutional layer uses three groups of convolution kernels of different sizes to capture local patterns and key information in the text with multi-scale receptive fields. Through multi-layer convolution operations, CNN can effectively extract local dependencies in sentences, and is particularly suitable for capturing short-distance entity relationships. In order to further enhance the expressive power of local features, the present invention introduces an attention mechanism, which enables the model to perform weighted processing on local features, focusing on enhancing the recognition of important features, so that the model can focus on key information in the text more accurately.
[0132] Furthermore, using a convolutional neural network to mine the local features of the Chinese text further includes:
[0133] The convolutional neural network is divided into a convolution layer and a pooling layer;
[0134] The convolution layer extracts local dependencies in the sentence through multi-layer convolution operations;
[0135] The pooling layer performs feature dimension reduction, and the formula is:
[0136] ,
[0137] ,
[0138] in, Indicates that from The local features extracted by the three groups of convolution kernels; V represents the text encoding matrix; Max represents the maximum pooling operation, Conv represents the convolution operation; L represents the output feature matrix, which is formed by concatenating the convolution results of the three groups of convolution kernels; Respectively represent the local features extracted by three groups of convolution kernels, Concat represents the connection operation, The feature vectors obtained by different convolution kernels are concatenated together along the feature dimension.
[0139] In order to further enhance the expressive power of local features, the embodiment of this specification combines the attention mechanism and introduces it into the feature extraction process. This mechanism can perform weighted processing on local features and focus on enhancing the recognition of important feature information, so that the model can more accurately identify and focus on key information in the text. The local dependency feature finally extracted is expressed as:
[0140]
[0141]
[0142] Among them, Attention(Q, K, V) represents the core operation of the attention mechanism. The output is obtained by calculating the similarity between the query and the key, and then weighting the value according to the similarity. T represents the transpose operation of the matrix; the SoftMax activation function converts the dot product result into a probability distribution, so that the weight of each part is between 0 and 1, and the sum is 1. , , It is a trainable parameter matrix that corresponds to the linear transformation of the three features of query, key and value. These matrices are adaptively learned and updated through training so that the model can more effectively extract and match key information in local features. Represents the dimension of the local feature vector. It is the final extracted local dependency feature representation.
[0143] In one embodiment of the present specification, in order to improve the overall text comprehension ability, using a bidirectional long short-term memory network to mine the contextual features of the text encoding further includes:
[0144] The bidirectional long short-term memory network calculates the embedding vector of each word in the text encoding through forward and backward LSTM, and combines the attention mechanism to weight and generate the context feature.
[0145] The vector matrix V is used as input, and the two forward and reverse LSTMs process the text encoding respectively to obtain the context feature , similarly introduces the attention mechanism, then the context feature vector It is expressed as:
[0146] ,
[0147] in, , , is a trainable parameter matrix.
[0148] Specifically, BiLSTM is used to capture contextual features in the data. BiLSTM performs calculations through forward and backward LSTMs to ensure that information can be extracted from both ends of the sequence. Through this bidirectional structure, the model can not only obtain forward contextual dependency features, but also capture reverse dependency information at the same time, thereby enhancing the breadth and depth of text understanding. Similar to feature extraction in CNN, BiLSTM also combines the attention mechanism to weight contextual features to highlight key contextual dependencies. This process enables the model to accurately identify and focus on key semantic relationships in long texts, improving the overall text comprehension ability.
[0149] Traditional models in the prior art often face problems such as insufficient adaptability and information loss when processing long texts, resulting in performance degradation. Therefore, this specification combines a bidirectional long short-term memory network with a convolutional neural network, and introduces an attention mechanism, so that the model can more accurately identify and focus on key information in the text, thereby designing a more robust structure. This method gives full play to the strengths of BiLSTM in capturing global features of sequences, combines the advantages of CNN in efficiently extracting local features, and enhances the weighted processing of important information through the attention mechanism, significantly improving the model's ability to comprehensively capture local and global features in long texts. When faced with complex texts, the model can still achieve efficient and accurate recognition effects.
[0150] In one embodiment of the present specification, after the feature extraction layer completes the extraction of local features and context features, it is also necessary to fuse these two types of feature vectors to construct a representative full-text comprehensive feature representation. Fusing the local features and context feature vectors to construct a full-text comprehensive feature representation of the Chinese text further includes:
[0151] Furthermore, according to the causal annotation, the model's ability to capture key semantic units is improved through a feature-weighted causal relationship optimization method. Adjust the feature weights of significant boundary feature words in the causal relationship , the model can emphasize the characteristic words with significant causal relationships in the sentence and enhance the discrimination of causal relationships. Combined with the linear weighting method, the feature representation vector of the full text is constructed as:
[0152] ,
[0153] Among them, f represents the feature representation vector of the full text, is the feature weight, the sentence sequence length is n, are the local features and context features of the i-th sequence respectively.
[0154] Among them, the fusion feature not only enables the model to simultaneously utilize short-distance local dependencies and long-distance contextual dependencies, but also better captures the semantic relationship of the text as a whole. By fusing different types of features, the model can more comprehensively model the deep-level information of the text, thereby improving the accuracy and robustness of causal relationship extraction. The introduction of the CR-BMEO annotation scheme makes the model clearer and more accurate in identifying causal relationship boundaries. Combined with the above structural design, it effectively improves the accuracy and robustness of causal relationship extraction, which is especially suitable for the recognition of complex causal relationships in Chinese text.
[0155] In one embodiment of the present specification, in order to generate a globally optimal label sequence, a causal relationship label sequence is generated according to the comprehensive features of the full text through a conditional random field, and causal relationship prediction further includes:
[0156] According to the comprehensive features of the full text of the Chinese text and the dependency structure between the causal annotations, the causal relationship annotation sequence is decoded to output an optimal label sequence;
[0157] According to the comprehensive features of the full text of the Chinese text and the dependency structure between the causal annotations, the causal relationship annotation sequence is decoded to output an optimal label sequence;
[0158] Assume that the sequence Given an input sentence The label sequence of , the CRF score of the sequence is calculated as:
[0159] ,
[0160] in, Indicates that the i-th character in the sentence is The predicted probability of the label, It is a weighted combination of extracted local features and contextual features;
[0161] This can more accurately capture the dependency between labels and inputs. The specific calculation formula is as follows:
[0162] ,
[0163] in, is the local feature vector of the ith position (feature extracted by CNN), is the context feature vector of the ith position (feature extracted by BiLSTM), , is a trainable weight matrix, which is used to weight local features and context features respectively, and b is a bias term.
[0164] Representation Tags To Tags In order to make the model fully utilize context information, we can introduce context features (output from BiLSTM) into the calculation of the transition score. This can enhance the dependency between labels, making the transition score not just a static probability between label pairs, but also dynamically adjusted to adapt to the specific context. The specific calculation is as follows:
[0165] ,
[0166] in, is the context feature vector of the i-1th and i-th positions, , is a trainable transfer weight matrix, is the bias term of the transfer, and SoftMax is the activation function.
[0167] Specifically, the conditional random field (CRF) is a sequence labeling model that is good at handling dependencies between structured data. Use the conditional random field (CRF) for the final causal relationship prediction. CRF can generate the globally optimal label sequence by considering the dependencies between adjacent labels. In the causal relationship extraction task, CRF can effectively utilize the contextual relationship between labels to ensure the consistency and accuracy of the prediction results. Specifically, CRF decodes each text sequence based on the feature information output by the feature fusion layer and the dependency structure between labels, thereby outputting the optimal causal relationship labeling sequence. In this way, CRF can not only take into account local prediction results, but also globally optimize label predictions, further improve the prediction credibility and robustness of the model, and ensure the high quality of causal relationship extraction results.
[0168] For example, causal relationship recognition usually requires labeling causal components from the text, such as causal trigger words, cause phrases, and result phrases. Therefore, a causal relationship labeling scheme is designed at the encoding layer. Through the encoding layer, the text after word segmentation is embedded into a vector representation containing position information and context information, which constructs a label sequence with causal relationships. In order for the CRF model to effectively identify causal relationships, it is necessary to obtain the features of each word. Features are particularly important for causal relationship recognition. Feature extraction and feature fusion realize the extraction of word feature information. The features here include part of speech, syntax, semantics, position, and context dependency features. CRF learns the conditional probability between each word and the features of its context, and then outputs the label of each word, which realizes cause and effect recognition.
[0169] In one embodiment of the present specification, the overall structure of the model is as follows: Figure 6 As shown in the figure, it includes four parts: encoding layer, feature extraction layer, feature fusion layer and decoding layer. First, the Chinese text data with causal relationship annotation is input into the deep learning model based on the pre-trained Transformer architecture, using a structure similar to the BERT (Bidirectional Encoder Representations from Transformers) architecture, but introducing a full-word masking strategy during the training process. The entire word is masked in the pre-training stage, which is different from the traditional BERT model that only masks vocabulary fragments. This masking strategy enables the model to capture more comprehensive vocabulary information during the learning process, and masks the overall meaning of each word during training, further enhancing its understanding and reasoning ability of Chinese text, especially in sentences with rich semantic associations. This method not only enables the model to obtain the contextual information of vocabulary more accurately, but also effectively avoids the semantic loss problem that may be caused by traditional character-level masking, significantly improving the semantic representation and processing effect of Chinese text.
[0170] For example, judicial documents record the trial process and results of the case. Compared with online encyclopedias, news information and other texts, judicial documents have unique characteristics. Its formal structure is fixed, and the language expression is standardized and formalized, with single and accurate semantics. In particular, the judgment part occupies a dominant position in the judicial document, and the description of the facts of the case and the reasons for the judgment is also more detailed. These characteristics make judicial documents more valuable in related technical research, especially in the identification and analysis of causal relationships, and can provide richer and more reliable data support for related research. Therefore, this embodiment will focus on the identification of causal entities in judicial documents:
[0171] First, the CR-BMEO annotation scheme is used to annotate the text data;
[0172] Secondly, the Chinese text data with causal relationship annotation is input into the deep learning model for encoding, and the text after word segmentation is embedded into a vector representation containing position information and context information. The corresponding word embedding vector is generated according to the position information and context of the characters, and each word in the sentence input to this layer is represented by w i Represents, then the sentence S={w1,w2,…,w n The vector generated by the model is represented by a matrix V, which is expressed as formula (1):
[0173] , (1)
[0174] Where n is the sequence length, 512 is the word vector dimension, SEP is the sentence start label, CLS is the sentence end label, index is the position index, and v is the word vector generated by the model. Each input sentence can be converted into a corresponding feature vector matrix through formula (1);
[0175] Then, CNN and BiLSTM are used to mine the local features and context features of the data respectively. After the convolution operation, the pooling layer further reduces the feature dimension and reduces the computational complexity while retaining important information. Through the pooling operation, the model can reduce the computational overhead while avoiding overfitting, ensuring that the extracted local features have good robustness. The extracted local features are shown in equations (2) and (3):
[0176] (2)
[0177] (3)
[0178] Among them, Max represents the maximum pooling operation, Conv represents the convolution operation, and the final output feature matrix L is formed by splicing the convolution results of three groups of convolution kernels. This splicing strategy can make full use of the features extracted by convolution kernels of different scales and improve the model's perception of complex text structures.
[0179] At the same time, in order to further improve the expressive power of local features, the attention mechanism is introduced into the feature extraction process, and the local features are weighted to enhance the recognition of important feature information, so that the model can more accurately identify and focus on the key information in the text. The final extracted local dependency feature representation is shown in Equation (4) and Equation (5).
[0180] (4)
[0181] (5)
[0182] in, , , It is a trainable parameter matrix corresponding to the linear transformation of the three features of query, key and value. Represents the dimension of the local feature vector. is the local dependency feature finally extracted.
[0183] BiLSTM is used to capture contextual features in the data. Two LSTMs are used to perform calculations in the forward and reverse directions respectively, ensuring that information can be extracted from both ends of the sequence. Taking the vector matrix V generated by the encoding layer as input, the two LSTMs process the text sequence separately, and then concatenate the feature vectors captured in these two directions to form a complete contextual feature representation. Similar to convolutional neural networks, the attention mechanism is used to highlight key contextual dependencies and obtain the final context feature vector , as shown in formula (6).
[0184] (6)
[0185] in, , , is a trainable parameter matrix.
[0186] Then, in the feature fusion process, for the significant boundary feature words in the causal relationship, the feature weights are adjusted , giving it a higher weight, combined with the linear weighting method, further highlighting the key semantic features in the sentence. The distinguishability of causal relationship features is enhanced, enabling the model to capture core semantic units more accurately, thereby improving the ability to recognize complex causal relationships. The calculation formula is as follows:
[0187] (7)
[0188] Among them, f represents the feature representation vector of the full text, is the feature weight, the sentence sequence length is n, are the local features and context features of the i-th sequence respectively.
[0189] Finally, assuming the sequence Given an input sentence The label sequence of , the CRF score of the sequence is calculated as shown in formula (8):
[0190] (8)
[0191] in, Indicates that the i-th character in the sentence is The predicted probability of the label, It is a weighted combination of extracted local features and contextual features;
[0192] This can more accurately capture the dependency between labels and inputs. The specific calculation formula is as follows:
[0193] ,
[0194] in, is the local feature vector of the ith position (feature extracted by CNN), is the context feature vector of the ith position (feature extracted by BiLSTM), , is a trainable weight matrix, which is used to weight local features and context features respectively, and b is a bias term.
[0195] Representation Tags To Tags In order to make the model fully utilize context information, we can introduce context features (output from BiLSTM) into the calculation of the transition score. This can enhance the dependency between labels, making the transition score not just a static probability between label pairs, but also dynamically adjusted to adapt to the specific context. The specific calculation is as follows:
[0196] ,
[0197] in, is the context feature vector of the i-1th and i-th positions, , is a trainable transfer weight matrix, is the bias term of the transfer, and SoftMax is the activation function. The specific parameter settings of the model are shown in Table 2:
[0198] Table 2 Model specific parameter settings
[0199]
[0200] In order to verify the effectiveness of the model, the embodiment of this specification obtains 5,000 criminal judgment documents and performs model training and evaluation compared with the baseline model. The experimental results of different models are shown in Table 3:
[0201] Table 3 Comparison of experimental results of different models
[0202]
[0203] Compared with the Bert-BiLSTM-CRF and Bert-BiGRU-CRF models in the prior art, this embodiment has achieved significant performance improvements, with accuracy rates increased by 8.1% and 10.5%, recall rates increased by 9.3% and 10.6%, and F1 values increased by 8.7% and 10.5%. Overall, through multi-faceted technical improvements, the causal relationship of the text is better captured, which significantly improves the accuracy, robustness, and adaptability of the model, and has broad application prospects.
[0204] As an example of this specification, please refer to Figure 7 The figure shows a specific structural diagram of the device for identifying event causal relationships in Chinese text in this embodiment.
[0205] The data annotation module 701 is used to obtain Chinese text to be recognized, recognize and annotate the Chinese text word by word;
[0206] A text encoding module 702, used to encode each word in the Chinese text according to the annotation to generate a text code;
[0207] A feature extraction module 703 is used to mine local features of the text encoding using a convolutional neural network and to mine context features of the text encoding using a bidirectional long short-term memory network;
[0208] A feature fusion module 704 is used to fuse the local features and the context feature vector to construct a comprehensive feature representing the full text of the Chinese text;
[0209] The text decoding module 705 is used to generate a causal relationship annotation sequence according to the comprehensive features of the full text through a conditional random field to perform causal relationship prediction.
[0210] Since the principle of solving the problem by the above device is similar to that of the above method, the implementation of the above system can refer to the implementation of the above method, and the repeated parts will not be repeated.
[0211] like Figure 8 The figure is a schematic diagram of the structure of a computer device according to an embodiment of the present specification. The computer device according to the embodiment of the present specification can run the method according to the embodiment of the present specification.
[0212] The computer device 802 may include one or more processing devices 804, such as one or more central processing units (CPUs), each of which may implement one or more hardware threads. The computer device 802 may also include any storage resources 806 for storing any type of information such as code, settings, data, etc. Without limitation, for example, the storage resources 806 may include any one or more combinations of the following: any type of RAM, any type of ROM, a flash memory device, a hard disk, an optical disk, etc. More generally, any storage resource may use any technology to store information.
[0213] Further, any storage resource may provide volatile or non-volatile retention of information.
[0214] Further, any storage resource may represent a fixed or removable component of the computer device 802. In one case, when the processing device 804 executes the associated instructions stored in any storage resource or combination of storage resources, the computer device 802 may perform any operation of the associated instructions. The computer device 802 also includes one or more drive systems 808 for interacting with any storage resource, such as a hard disk drive system, an optical disk drive system, etc.
[0215] The computer device 802 may also include an input / output module 810 (I / O) for receiving various inputs (via input devices 812) and for providing various outputs (via output devices 814). A specific output mechanism may include a presentation device 816 and an associated graphical user interface 818 (GUI). In other embodiments, the input / output module 810 (I / O), the input device 812, and the output device 814 may not be included, and the computer device 802 may be used as a computer device in a network. The computer device 802 may also include one or more network interfaces 820 for exchanging data with other devices via one or more communication links 822. One or more communication buses 824 couple the components described above together.
[0216] The communication link 822 may be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 822 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc. governed by any protocol or combination of protocols.
[0217] The embodiments of the present specification also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0218] The embodiments of the present specification also provide a computer-readable instruction, wherein when a processor executes the instruction, the program therein causes the processor to execute the above method.
[0219] It should be understood that in the various embodiments of the present specification, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present specification.
[0220] It should also be understood that in the embodiments of this specification, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the embodiments of this specification generally indicates that the associated objects before and after are in an "or" relationship.
[0221] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of this specification can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of this specification.
[0222] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0223] In the several embodiments provided in the embodiments of this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.
[0224] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this specification.
[0225] In addition, each functional unit in each embodiment of the present specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0226] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of this specification is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the embodiment of this specification. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0227] The embodiments of this specification use specific embodiments to illustrate the principles and implementation methods of the embodiments of this specification. The description of the above embodiments is only used to help understand the methods and core ideas of the embodiments of this specification. At the same time, for those skilled in the art, according to the ideas of the embodiments of this specification, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the embodiments of this specification.
Claims
1. A method for identifying causal relationships of events in Chinese text, characterized in that: The method comprises, Acquire Chinese text to be recognized, and recognize and annotate the Chinese text word by word; Encode each word in the Chinese text according to the annotation to generate a text code; A convolutional neural network is used to mine local features of the text encoding, and a bidirectional long short-term memory network is used to mine context features of the text encoding; The local features and the context feature vector are integrated to construct a full-text comprehensive feature representing the Chinese text; A causal relationship annotation sequence is generated according to the comprehensive features of the full text through a conditional random field to perform causal relationship prediction.
2. The method for identifying causal relationships of events in Chinese text according to claim 1, characterized in that: Encoding each word in the Chinese text according to the annotation further includes: Performing word segmentation processing on the Chinese text according to the annotation; According to the word segmentation processing result, obtaining the position information and context information of each word in the Chinese text; Generate a word embedding vector for each word based on the position information and context information of each word; The embedding vectors of each word in the same sentence are integrated into a feature vector matrix as the text encoding of the sentence.
3. The method for identifying causal relationships of events in Chinese text according to claim 2, characterized in that: Encoding each word in the Chinese text according to the annotation further includes: According to the word segmentation result, each word in the sentence is represented by w i Represents, then the sentence S={w1,w2,…,w n }, the word embedding vector generated by the model is represented as the text encoding vector matrix V, which is expressed as: , Among them, SEP is the sentence start label; v is the word vector generated by the model; n is the sequence length; 512 is the word vector dimension; CLS is the sentence end label; index is the position index.
4. The method for identifying causal relationships of events in Chinese text according to claim 3, characterized in that: Using a convolutional neural network to mine the local features of the text encoding further includes: Extracting local dependencies in a sentence based on the text encoding and context information in each word embedding vector; An attention mechanism is introduced to perform weighted processing on the local dependencies to generate local features of the text encoding.
5. The method for identifying causal relationships of events in Chinese text according to claim 4, characterized in that: Using a convolutional neural network to mine the local features of the text encoding further includes: The convolutional neural network is divided into a convolution layer and a pooling layer; The convolution layer extracts local dependencies in the sentence through multi-layer convolution operations; The pooling layer performs feature dimension reduction, and the formula is: , , in, Indicates that from The local features extracted by the three groups of convolution kernels; V represents the text encoding matrix; Max represents the maximum pooling operation, Conv represents the convolution operation; L represents the output feature matrix, which is formed by concatenating the convolution results of the three groups of convolution kernels; Respectively represent the local features extracted by three groups of convolution kernels, Concat represents the connection operation. The feature vectors obtained by different convolution kernels are concatenated together along the feature dimension.
6. The method for identifying causal relationships of events in Chinese text according to claim 5, characterized in that: Using a convolutional neural network to mine the local features of the text encoding further includes: The attention mechanism is also combined to weight local features and enhance the recognition of important feature information; The extracted local dependency feature is expressed as, , , Among them, Attention(Q, K, V) represents the core operation of the attention mechanism; T represents the transpose operation of the matrix; SoftMax is the activation function, , , is a trainable parameter matrix; Represents the dimension of the local feature vector; Represents the final extracted local dependency features.
7. The method for identifying causal relationships of events in Chinese text according to claim 6, characterized in that: Using a bidirectional long short-term memory network to mine the contextual features of the text encoding further includes: The bidirectional long short-term memory network calculates the embedding vector of each word in the text encoding through forward and backward LSTM, and combines the attention mechanism to weight and generate the context feature.
8. The method for identifying causal relationships of events in Chinese text according to claim 7, characterized in that: Using a bidirectional long short-term memory network to mine the contextual features of the text encoding further includes: The vector matrix V is used as input, and the two forward and reverse LSTMs process the text encoding respectively to obtain the context feature , similarly introduces the attention mechanism, then the context feature vector It is expressed as: , in, , , is a trainable parameter matrix.
9. The method for identifying causal relationships of events in Chinese text according to claim 8, characterized in that: The step of fusing the local feature and the context feature vector to construct a comprehensive feature representing the full text of the Chinese text further includes: According to the causal annotation, the feature weights of the significant boundary feature words in the causal relationship are adjusted , combined with the linear weighting method, the feature representation vector of the full text is constructed as: , Among them, f represents the feature representation vector of the full text, is the feature weight, the sentence sequence length is n, are the local features and context features of the i-th sequence respectively.
10. The method for identifying causal relationships of events in Chinese text according to claim 9, characterized in that: Generating a causal relationship annotation sequence according to the comprehensive features of the full text through a conditional random field, and performing causal relationship prediction further includes: According to the comprehensive features of the full text of the Chinese text and the dependency structure between the causal annotations, the causal relationship annotation sequence is decoded to output an optimal label sequence; Assume that the sequence Given an input sentence The label sequence of , the CRF score of the sequence is calculated as: , in, Indicates that the i-th character in the sentence is The predicted probability of the label, It is a weighted combination of the extracted local features and context features, and the formula is: , in, is the local eigenvector of the ith position, is the context feature vector of the ith position, , is a trainable weight matrix, which is used to weight local features and context features respectively, and b is a bias term; Representation Tags To Tags The transition probability is dynamically adjusted to adapt to the specific context, and the formula is: , in, is the context feature vector of the i-1th and i-th positions, , is a trainable transfer weight matrix, is the bias term of the transfer, and SoftMax is the activation function.
11. A device for identifying causal relationships of events in Chinese text, characterized in that: The device comprises: A data annotation module is used to obtain Chinese text to be recognized, recognize and annotate the Chinese text word by word; A text encoding module, used for encoding each word in the Chinese text according to the annotation to generate a text encoding; A feature extraction module, used to mine local features of the text encoding using a convolutional neural network and to mine context features of the text encoding using a bidirectional long short-term memory network; A feature fusion module, used for fusing the local features with the context feature vector to construct a full-text comprehensive feature representing the Chinese text; The text decoding module is used to generate a causal relationship annotation sequence according to the comprehensive features of the full text through a conditional random field to perform causal relationship prediction.
12. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 10 is implemented.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
14. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Text causal relationship automatic extraction method fusing convolutional neural network and recurrent neural network
CN110704890A
Feature and attention mechanism fusion-based event joint extraction system
CN114298053A
Named entity recognition method and device based on hybrid lattice self-attention network
CN114429132A
Event joint extraction model and method combined with sequence labeling
CN114818721A
Document-level event causal relationship identification method and system, medium, equipment and terminal
CN115577678A
Cited By
Text consanguinity determination method and device, equipment and medium
CN114638302A
A text blood relationship determination method, device, equipment and medium
CN114638302B
Civil case cause prediction method based on large model
CN120123517A
Event context analysis method based on causal relationship
CN120278281A