A method, device and apparatus for constructing a causal relationship determination model

By generating statement vectors and training causal relationship determination models, the problem of low causal relationship recognition rate in the prior art is solved, especially in identifying implicit causal relationships, and higher recognition accuracy is achieved.

CN112329478BActive Publication Date: 2025-02-25BEIJING XUEZHITU NETWORK TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011379460.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-30
Publication Date
2025-02-25
Estimated Expiration
2040-11-30

AI Technical Summary

Technical Problem

In the prior art, causal relationship recognition mainly relies on template matching, making it difficult to identify implicit causal relationships, resulting in a low recognition rate.

Method used

By obtaining the original corpus, filtering candidate text, generating statement vectors using word vectors and word vectors, and training the causal relationship determination model based on these vectors to improve the accuracy of causal relationship recognition.

Benefits of technology

The recognition rate of implicit causality is improved, semantics can be analyzed more accurately, and text data with implicit causality can be identified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112329478B_ABST
    Figure CN112329478B_ABST
Patent Text Reader

Abstract

The present application provides a method, device and equipment for constructing a causal relationship determination model. The method includes: obtaining an original corpus; the original corpus includes at least one first candidate text; screening second candidate texts in the original corpus according to a target event causal relationship template; for each second candidate text, determining the sentence vector of the second candidate text according to the word vector of each word and the character vector of each character in the second candidate text; training the causal relationship determination model to be trained based on the sentence vector of each second candidate text to obtain a trained causal relationship determination model. The present application first improves the accuracy of expressing semantics by using both characters and words as representations of semantics, and then can effectively identify texts with implicit causal relationships by analyzing semantics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning technology, and in particular to a method, device and equipment for constructing a causal relationship determination model. Background Art

[0002] The causal relationship in Chinese contains many characteristics. First, Chinese corpus is sparse, fragmented, and implicit. Second, an event can be a cause or a result in different contexts. Therefore, it is difficult to identify causal relationships.

[0003] In the prior art, causal relationships are mainly identified through template matching methods. Although the template matching method has a high accuracy rate in identifying causal relationships, it can only identify explicit causal relationships, and the recognition rate of implicit causal relationships is low. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a method, device and equipment for constructing a causal relationship determination model, which solves the problem of low recognition rate of text with implicit causal relationship in the prior art.

[0005] In a first aspect, an embodiment of the present application provides a method for constructing a causal relationship determination model, the method comprising:

[0006] Acquire an original corpus; the original corpus includes at least one first candidate text;

[0007] Selecting a second candidate text in the original corpus according to the target event causal relationship template;

[0008] For each second candidate text, determine a sentence vector of the second candidate text according to the word vector of each word and the character vector of each character in the second candidate text;

[0009] The causal relationship determination model to be trained is trained based on the sentence vector of each second candidate text to obtain a trained causal relationship determination model.

[0010] Optionally, the step of training the causal relationship determination model to be trained based on the sentence vector of each second candidate text to obtain the trained causal relationship determination model includes:

[0011] For each sentence vector of the second candidate text, the sentence vector of the second candidate text is input as a positive sample to the causal relationship determination model to be trained, and the causal relationship label of the second candidate text is input as a negative sample to the causal relationship determination model to be trained, and the causal relationship determination model to be trained is trained;

[0012] For each sentence vector of the second candidate text, the output result obtained by inputting the positive sample into the causal relationship determination model to be trained is compared with the causal relationship label, and the training accuracy of the causal relationship determination model to be trained is determined according to the comparison result. When the training accuracy reaches the preset accuracy value, the training ends and a trained causal relationship determination model is obtained.

[0013] Optionally, for each second candidate text, determining the sentence vector of the second candidate text according to the word vector of each word and the character vector of each character in the second candidate text includes:

[0014] For each second candidate text, a sentence vector of the second candidate text is generated through an attention mechanism based on the word vector and character vector corresponding to the second candidate text.

[0015] Optionally, the method further includes:

[0016] Acquire a set of texts to be recognized; the set of texts to be recognized includes at least one text to be recognized;

[0017] Each of the to-be-recognized texts is input into a trained causal relationship determination model, and a target text having a target causal relationship is determined according to an output result of the trained causal relationship determination model.

[0018] Optionally, before each of the to-be-recognized texts is input into the trained target causal relationship determination model, the method further includes:

[0019] For each text to be recognized, a sentence vector of the text to be recognized is determined based on the word vector of each word and the character vector of each character in the text to be recognized.

[0020] Optionally, the step of inputting each of the to-be-recognized texts into a trained causal relationship determination model, and determining a target text having a target causal relationship according to an output result of the trained causal relationship determination model, comprises:

[0021] The sentence vectors corresponding to each of the to-be-recognized texts are respectively input into the trained causal relationship determination model, and the target text with the target causal relationship is determined according to the output result of the trained causal relationship determination model.

[0022] Optionally, the trained causal relationship determination model includes a feature extraction layer and a discrimination layer; each of the to-be-recognized texts is input into the trained causal relationship determination model, and a target text having a target causal relationship is determined according to an output result of the trained causal relationship determination model, including:

[0023] For each of the texts to be recognized, input the text to be recognized into the feature extraction layer to obtain the semantic features of the text to be recognized;

[0024] For each of the texts to be recognized, the semantic features of the text to be recognized are input into the discrimination layer to determine whether the text to be recognized is a target text having a target causal relationship.

[0025] Optionally, the step of inputting the text to be recognized into the feature extraction layer to obtain semantic features of the text to be recognized includes:

[0026] Inputting the text to be recognized into the multiple filters in the feature extraction layer respectively to obtain the filtering result corresponding to each filter;

[0027] The filtering result with the highest repetition rate among the multiple filtering results is determined as the semantic feature of the text to be recognized.

[0028] In a second aspect, an embodiment of the present application provides a device for constructing a causal relationship determination model, the device comprising:

[0029] Acquisition module: used for acquiring an original corpus; the original corpus includes at least one first candidate text;

[0030] Matching module: used for selecting the second candidate text in the original corpus according to the target event causal relationship template;

[0031] A generating module: for determining, for each second candidate text, a sentence vector of the second candidate text according to a word vector of each word and a character vector of each character in the second candidate text;

[0032] Determination module: used for training the causal relationship determination model to be trained based on the sentence vector of each second candidate text to obtain a trained causal relationship determination model.

[0033] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the method.

[0034] The method for constructing a causal relationship determination model proposed in the embodiment of the present application first improves the accuracy of semantic expression by using both character vectors and word vectors as the representation form of semantic expression. Furthermore, when identifying causal relationships, texts with implicit causal relationships can be effectively identified by analyzing semantics.

[0035] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0037] Figure 1 A flow chart of a method for constructing a causal relationship determination model provided by an embodiment of the present invention;

[0038] Figure 2 A flowchart of a method for determining a target text having a target causal relationship by using a causal relationship determination model provided by an embodiment of the present invention;

[0039] Figure 3 A schematic diagram of a flow chart of a device for constructing a causal relationship determination model provided by an embodiment of the present invention;

[0040] Figure 4 A schematic diagram of the structure of a computer program 400 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0042] It will be apparent to those skilled in the art that the general principles defined herein may be applied to other embodiments and application scenarios without departing from the spirit and scope of the present application. Although the present application is mainly described around determining the position of a tracked object, it should be understood that this is only an exemplary embodiment.

[0043] In the prior art, the recognition and extraction of causal relationships are mainly based on template matching. However, the causal relationship recognition method based on template matching uses manually formulated templates, which has low recognition efficiency and high labor costs. In addition, it can only recognize explicit causal relationships, and implicit causal relationships are difficult to recognize. Therefore, only using the causal relationship recognition method based on template matching will lead to the problem of low recognition rate of implicit causal relationships.

[0044] Therefore, in order to solve the problem that the recognition rate of implicit causal relationships is low due to the causal relationship recognition method based only on template matching, the embodiment of the present application provides a method for constructing a causal relationship determination model, such as Figure 1 As shown, the following steps are included:

[0045] S101, obtaining an original corpus; the original corpus includes at least one first candidate text;

[0046] S102, selecting a second candidate text in the original corpus according to the target event causal relationship template;

[0047] S103, for each second candidate text, determining a sentence vector of the second candidate text according to a word vector of each word and a character vector of each character in the second candidate text;

[0048] S104, training the causal relationship determination model to be trained based on the sentence vector of each second candidate text to obtain a trained causal relationship determination model.

[0049] In the above step S101, the original corpus is data stored in the form of text. For example, documents in a library database, various reports, various website text information, etc. The original corpus includes at least one first candidate text. The first candidate text is a text data in the original corpus in units of one item.

[0050] In specific implementation, the original corpus can use a crawler program written in Python to crawl text data from websites in a specific field, and store the crawled text data in a local database to form the original corpus. For example, you can crawl websites in the stock field and websites in the fund field, and store the obtained text data in a local database to form the original corpus.

[0051] In the above step S102, the target event causal relationship template is screened by manually designing adaptive matching rules. The second candidate text refers to the text data with causal relationship corresponding to the target event screened from the original raw material set by the adaptive matching rules.

[0052] In the specific implementation, the second candidate text is screened in the original corpus according to the designed adaptive matching rules, and the screened text data that meets the adaptive matching rules is used as the second candidate text. Among them, the design process of the adaptive matching rules can be divided into four steps, for example: the first step: define the type of the original corpus to obtain a structured target event type. For example, if the current original corpus is text data in the financial field, our goal is to identify the event of the establishment of a certain company so that we can understand the latest trends in the market. Then the structured target event type obtained can be "company establishment". The second step: based on the structured target event type, establish the core trigger dictionary corresponding to each target event type. For example: according to the target event type "company establishment" in the first step above, then according to "company establishment", the determined core trigger word can be "establishment", and then the core trigger word dictionary is constructed through the core trigger word "establishment". The third step: based on the core trigger word dictionary of each target event type, a core trigger word synonym dictionary of each target event type is established through a synonym forest and a word embedding model. For example: in the second step above, the core trigger word may be "established", then according to the synonym forest and word embedding model, the core trigger word "established" is expanded, and the expansion result may be: "founded", "created", etc. Among them, the word embedding model may be a word2vec model. Step 4: Based on the core trigger dictionary of each target event type and the core trigger word synonym dictionary of each target event type, an adaptive matching rule is designed. For example: the adaptive matching rule is to divide the modules according to the subject, predicate, object, attributive, adverbial, and complement in Chinese grammar, and the core trigger word "established" and the core trigger word synonyms "founded", "created", etc. obtained in the second and third steps above are used as predicate modules to design adaptive matching rules.

[0053] In the above step S103, the sentence vector of the second candidate text refers to a vectorized value generated by fusion of the word vector of each word and the word vector of each character in the second candidate text by assigning weights through the attention mechanism, with the word vector as the unit. The word vector refers to the vectorized value representing each word in the second candidate text. The word vector refers to the vectorized value representing each character in the second candidate text.

[0054] In the above step S104, the causal relationship determination model is a model designed based on a neural network algorithm to automatically extract text data features. The causal relationship determination model is used to automatically identify text data with causal relationships corresponding to the target event according to the target event. The causal relationship determination model starts training by inputting the sentence vector of each second candidate text, and learns the ability to automatically identify causal relationships. Applying the causal relationship determination model in the original corpus can efficiently complete the recognition task, which is conducive to saving human resources.

[0055] Through the above four steps, the present application first screens out a large number of accurate second candidate texts containing causal relationships in the original corpus through the target event causal relationship model, and uses them as training corpus for the causal relationship determination model, and effectively improves the training effect of the causal relationship determination model through high-quality training corpus. In constructing the causal relationship determination model, firstly, using word vectors as units, the word vectors of each word in the second candidate text and the word vectors of each character are assigned weights through the attention mechanism to generate sentence vectors, thereby improving the accuracy of the semantic expression of each second candidate text, which is beneficial to improve the recognition rate of texts with implicit causal relationships through more accurate semantic expressions when identifying causal relationships.

[0056] When faced with massive amounts of text data, causal relationships are automatically identified through a trained causal relationship determination model, which effectively reduces human resources and also improves the recognition rate of texts with implicit causal relationships. Therefore, the present application provides a method for training a causal relationship model, the method comprising:

[0057] Step 1041: for each sentence vector of the second candidate text, input the sentence vector of the second candidate text as a positive sample to the causal relationship determination model to be trained, and input the causal relationship label of the second candidate text as a negative sample to the causal relationship determination model to be trained, and train the causal relationship determination model to be trained;

[0058] Step 1042, for each sentence vector of the second candidate text, the output result of inputting the positive sample into the causal relationship determination model to be trained is compared with the causal relationship label, and the training accuracy of the causal relationship determination model to be trained is determined according to the comparison result. When the training accuracy reaches the preset accuracy value, the training ends and a trained causal relationship determination model is obtained.

[0059] When the above step 1042 is implemented, the causal relationship determination model training process can be as follows: for example, the preset accuracy value is 70%; the positive sample is input into the causal relationship determination model to be trained to obtain 100 output results, among which when the correct output results are 70, the wrong output results are 30, and the calculated accuracy is 70%. According to the accuracy rate, it can be determined that the causal relationship determination model has reached the preset accuracy value, and then the training is stopped.

[0060] In the process of training the causal relationship determination model, the sentence vector of the second candidate text is used as a positive sample input to start training the causal relationship determination model, that is, the higher the accuracy of the sentence vector of each second candidate text generated, the better the training effect of the causal relationship determination model. Therefore, the present invention provides a method for determining the sentence vector of the second candidate text, the method comprising:

[0061] Step 1031: For each second candidate text, based on the word vectors and character vectors corresponding to the second candidate text, generate a sentence vector of the second candidate text through an attention mechanism.

[0062] In the above Step 1031, the attention mechanism is used to assign weights to the word vectors and character vectors corresponding to the second candidate text, so that the second candidate text generates a more discriminative sentence vector. For example: Generate a sentence vector A of the second candidate text through the attention mechanism, and its weight is 0.6; Generate a sentence vector B of the second candidate text through the attention mechanism, and its weight is 0.2; By analyzing and comparing, sentence vector A of the second candidate text is more discriminative in the process of identifying causal relationships. The process of generating the sentence vector of the second candidate text can be divided into three steps. For example: The first step: Cut each second candidate text separately at the word level and the character level; The second step: Through a word embedding model, generate corresponding word vectors and character vectors according to each cut second candidate text; Among them, the word embedding model can be the skip-gram model in word2vec technology; The third step: Based on the word vectors and character vectors corresponding to each second candidate text, assign weights through the attention mechanism and fuse them to generate a sentence vector in units of word vectors.

[0063] In specific implementation, a sentence vector with both words and characters as semantic representation forms can express semantics more accurately. The process of generating the sentence vector of each second candidate text can be exemplified as follows:

[0064] First, use the skip-gram model to cut the second candidate text data, for example: "restrictive", at the word level to generate a corresponding word vector representation A1. Among them, A1 represents the vectorized value of the word "restrictive" generated by cutting the second candidate text data.

[0065] Use the skip-gram model to cut the second candidate text at the character level to generate corresponding character vectors: A2, A3, A4. Among them, A2 represents the character vector of the character "xian" generated by cutting the second candidate text data; A3 represents the character vector of the character "zhi" generated by cutting the second candidate text data; A4 represents the character vector of the character "xing" generated by cutting the second candidate text data.

[0066] Through the attention mechanism to assign weights and normalization operations, generate a fused sentence vector A. Among them, {A1, A2, A3, A4} ∈ A, and A represents the sentence vector of the second candidate text data "restrictive".

[0067] By generating more discriminative sentence vectors through the attention mechanism, the causal relationship model can gain focus when identifying causal relationships, and can effectively identify text data with implicit causal relationships. Figure 2 As shown, the present invention provides a method for determining a target text having a target causal relationship by using a causal relationship determination model, the method comprising:

[0068] S201, obtaining a set of texts to be recognized; the set of texts to be recognized includes at least one text to be recognized;

[0069] S202, input each of the to-be-identified texts into a trained causal relationship determination model, and determine a target text having a target causal relationship according to an output result of the trained causal relationship determination model.

[0070] In the above step S201, the set of texts to be recognized may be derived from the original corpus. The set of texts to be recognized includes at least one text to be recognized. The text to be recognized refers to a piece of text data in the set of texts to be recognized, in units of pieces.

[0071] In the above step S202, the target text refers to text data with causal relationship identified from the text to be identified by the trained causal relationship determination model.

[0072] In the process of target text recognition, the trained causal relationship determination model is used to automatically perform recognition tasks in the text to be recognized. The causal relationship determination model can accurately combine semantics to effectively recognize the text to be recognized with implicit causal relationships. The causal relationship determination model performs the recognition task. First, the vector of the text to be recognized must be digitized before it is input to start the recognition task. Therefore, the present application provides a method for generating a sentence vector of a text to be recognized, the method comprising:

[0073] Step 2011, for each text to be recognized, determine the sentence vector of the text to be recognized based on the word vector of each word and the character vector of each character in the text to be recognized.

[0074] In the above step 2011, the sentence vector of the text to be recognized refers to a vectorized value generated by fusion of the word vector of each word and the character vector of each character in the text to be recognized in units of word vectors through the attention mechanism to assign weights.

[0075] By inputting the generated sentence vector of each text to be recognized into the trained causal relationship determination model, the semantics can be accurately analyzed and the target text with causal relationship can be efficiently recognized. Therefore, the specific method of identifying the target text with causal relationship from the text to be recognized includes:

[0076] Step 20111, input the sentence vector corresponding to each of the to-be-recognized texts into the trained causal relationship determination model respectively, and determine the target text with the target causal relationship according to the output result of the trained causal relationship determination model.

[0077] In the above step 20111, the target text with the target causal relationship can be identified according to the output result of the causal relationship determination model. The causal relationship determination model includes a feature extraction layer and a discriminant layer. The causal relationship determination model extracts features from the sentence vector corresponding to the text to be identified through the feature extraction layer, inputs the extracted features into the discriminant layer for identification, and determines the text to be identified where the sentence vector whose identification result meets the threshold is located as the target text.

[0078] By performing feature extraction and recognition on each text to be recognized through the feature extraction layer and the discrimination layer of the causal relationship determination model, the text data with the target causal relationship can be efficiently determined. Among them, the method of efficiently determining the target text through the feature extraction layer and the discrimination layer of the causal relationship determination model includes:

[0079] Step 2021, for each of the texts to be recognized, input the text to be recognized into the feature extraction layer to obtain the semantic features of the text to be recognized;

[0080] Step 2022: for each of the texts to be recognized, input the semantic features of the text to be recognized into the discrimination layer to determine whether the text to be recognized is a target text having a target causal relationship.

[0081] In the above step 221, the function of the feature extraction layer is to filter the sentence vector of the text to be recognized through multiple different filters to extract semantic features. The semantic feature can be a vector sequence.

[0082] In the above step 2022, the role of the discriminant layer is to identify the semantic features of the text to be identified through a normalization operation and output a recognition result, and to determine the text to be identified whose recognition result meets the threshold as a target text. For example, when the recognition result of the semantic feature of the text to be identified is 1, the text to be identified is determined to be a target text with a target causal relationship.

[0083] For each text to be recognized, using multiple different filters to extract semantic features can effectively improve the accuracy of the semantic features of each text to be recognized. Therefore, the present application provides a method for extracting semantic features of a text to be recognized, the method comprising:

[0084] Step 20211, inputting the text to be recognized into multiple filters in the feature extraction layer respectively, and obtaining filtering results corresponding to each filter;

[0085] Step 20212: determine the filtering result with the highest repetition rate among the multiple filtering results as the semantic feature of the text to be recognized.

[0086] In the above step 20211, a filter is used to extract features of the text to be recognized, and the extraction result can be obtained by the following formula:

[0087] C i =f(w*X (i:i+h-1) + b);

[0088] Among them, w represents a filter, C i represents a feature vector generated by filtering the filter and the i-th vector of the sentence vector of the text to be recognized, x represents a sentence vector of the text to be recognized, i represents the i-th sentence vector of the text to be recognized, b represents a hyperparameter, f is a nonlinear function, such as Sigmoid function, Relu function, etc., and h is the step size of the sliding window in the causal relationship determination model.

[0089] In the above step 20212, multiple extraction results can be obtained by performing feature extraction on the text to be recognized through multiple different filters. For the multiple extraction results, the feature with the highest repetition rate in the multiple extraction results is determined as the semantic feature of the text to be recognized. For example: by using three different filters Q, filter W, filter E, feature extraction is performed on a text to be recognized C respectively, and the extraction results are as follows:

[0090] The extraction result of the first filter Q is: [a, b, c], where [a, b, c] is a vector sequence extracted by filter Q for the text to be recognized C, and a, b, and c are respectively a feature vector in the vector sequence.

[0091] The extraction result of the second filter W is: [a, b], where [a, b] is a vector sequence extracted by the filter W for the text to be recognized C, and a and b are feature vectors in the vector sequence respectively.

[0092] The extraction result of the third filter E is: [a, b, d], where [a, b, d] is a vector sequence extracted by the filter E for the text to be recognized C, and a, b, d are feature vectors in the vector sequence. The feature vector with the highest repetition rate among the multiple extraction results is determined as the semantic feature of the text to be recognized, so the semantic feature of the text to be recognized C can be determined as: [a, b].

[0093] The method for constructing a causal relationship determination model proposed in the embodiment of the present application improves the accuracy of the semantics expressed by the sentence vector by using both character vectors and word vectors as the representation form of expressing semantics. In addition, different filters are used to extract the semantic features of the sentence vector, which improves the accuracy of the semantic features. Therefore, when identifying causal relationships, by more accurately analyzing the semantics, not only can text data with explicit causal sentences be efficiently identified, but also the recognition rate of text data with implicit causal relationships can be improved.

[0094] The present application embodiment provides a device for constructing a causal relationship determination model, such as Figure 3 As shown, the device comprises:

[0095] The acquisition module 301 is used to acquire an original corpus; the original corpus includes at least one first candidate text.

[0096] Matching module 302: used for selecting second candidate texts in the original corpus according to the target event causal relationship template.

[0097] Generating module 303: for determining, for each second candidate text, a sentence vector of the second candidate text according to the word vector of each word and the character vector of each character in the second candidate text.

[0098] Determination module 304: used for training the causal relationship determination model to be trained based on the sentence vector of each second candidate text to obtain a trained causal relationship determination model.

[0099] Optionally, the determining module 304 further includes:

[0100] The first unit is used to input the sentence vector of each second candidate text as a positive sample into the causal relationship determination model to be trained, and input the causal relationship label of the second candidate text as a negative sample into the causal relationship determination model to be trained, so as to train the causal relationship determination model to be trained.

[0101] The second unit is used to input the positive sample into the causal relationship determination model to be trained for each sentence vector of the second candidate text, compare the output result with the causal relationship label, determine the training accuracy of the causal relationship determination model to be trained according to the comparison result, and when the training accuracy reaches a preset accuracy value, the training ends to obtain a trained causal relationship determination model.

[0102] Optionally, the generating module 303 includes:

[0103] The third unit is used to generate a sentence vector of each second candidate text through an attention mechanism based on the word vector and character vector corresponding to the second candidate text.

[0104] Optionally, the device for constructing a causal relationship determination model further includes:

[0105] The second acquisition module is used to acquire a set of texts to be recognized; the set of texts to be recognized includes at least one text to be recognized.

[0106] The second determination module is used to input each of the to-be-recognized texts into a trained causal relationship determination model, and determine a target text having a target causal relationship according to an output result of the trained causal relationship determination model.

[0107] Optionally, the second acquisition module further includes:

[0108] The fourth unit is used to determine, for each text to be recognized, a sentence vector of the text to be recognized according to the word vector of each word and the character vector of each character in the text to be recognized.

[0109] Optionally, the fourth unit further includes:

[0110] The first subunit is used to input the sentence vector corresponding to each of the to-be-recognized texts into the trained causal relationship determination model, and determine the target text with the target causal relationship according to the output result of the trained causal relationship determination model.

[0111] Optionally, the second determining module includes:

[0112] The fifth unit is used for inputting each of the texts to be recognized into the feature extraction layer to obtain the semantic features of the texts to be recognized.

[0113] The sixth unit is used for inputting the semantic features of each of the texts to be recognized into the discrimination layer to obtain whether the text to be recognized is a target text having a target causal relationship.

[0114] Optionally, the fifth unit further includes:

[0115] The second subunit is used to input the text to be recognized into the multiple filters in the feature extraction layer respectively to obtain the filtering result corresponding to each filter.

[0116] The third subunit is used to determine the filtering result with the highest repetition rate among the multiple filtering results as the semantic feature of the text to be recognized.

[0117] Corresponds to Figure 1A method for constructing a causal relationship determination model in the present application embodiment further provides a computer device 400, such as Figure 4 As shown, the device includes a memory 401, a processor 402, and a computer program stored in the memory 401 and executable on the processor 402, wherein the processor 402 implements the above-mentioned method for constructing a causal relationship determination model when executing the above-mentioned computer program.

[0118] Specifically, the above-mentioned memory 401 and processor 402 can be general-purpose memory and processor, which are not specifically limited here. When the processor 402 runs the computer program stored in the memory 401, it can execute the above-mentioned method of constructing a causal relationship determination model, thereby solving the problem of low recognition rate of implicit causal relationships in the prior art.

[0119] Corresponds to Figure 1 A method for constructing a causal relationship determination model, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned method for constructing a causal relationship determination model are executed.

[0120] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is run, it can execute the above-mentioned method of constructing a causal relationship determination model to solve the problem of low recognition rate of implicit causal relationships in the prior art. The present application first uses characters and words as representation forms for expressing semantics at the same time, and uses different filters to extract semantic features. When identifying causal relationships, it improves the recognition rate of implicit causal relationships by more accurately analyzing semantics.

[0121] In the embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0122] 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 solution of this embodiment.

[0123] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0124] If the function 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 present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. 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, etc. Various media that can store program codes.

[0125] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0126] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should all be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for constructing a causal relationship determination model, characterized in that: include: Acquire an original corpus; the original corpus includes at least one first candidate text; Selecting a second candidate text in the original corpus according to the target event causal relationship template; For each second candidate text, determine a sentence vector of the second candidate text according to the word vector of each word and the character vector of each character in the second candidate text; Training the causal relationship determination model to be trained based on the sentence vector of each second candidate text to obtain a trained causal relationship determination model; The step of determining, for each second candidate text, a sentence vector of the second candidate text according to a word vector of each word and a character vector of each character in the second candidate text includes: For each second candidate text, based on the word vector and character vector corresponding to the second candidate text, generate a sentence vector of the second candidate text through an attention mechanism; The step of training the causal relationship determination model to be trained based on the sentence vector of each second candidate text to obtain a trained causal relationship determination model includes: For each sentence vector of the second candidate text, the sentence vector of the second candidate text is input as a positive sample to the causal relationship determination model to be trained, and the causal relationship label of the second candidate text is input as a negative sample to the causal relationship determination model to be trained, and the causal relationship determination model to be trained is trained; For each sentence vector of the second candidate text, the output result obtained by inputting the positive sample into the causal relationship determination model to be trained is compared with the causal relationship label, and the training accuracy of the causal relationship determination model to be trained is determined according to the comparison result. When the training accuracy reaches the preset accuracy value, the training ends and a trained causal relationship determination model is obtained.

2. The method according to claim 1, characterized in that The method further comprises: Acquire a set of texts to be recognized; the set of texts to be recognized includes at least one text to be recognized; Each of the to-be-recognized texts is input into a trained causal relationship determination model, and a target text having a target causal relationship is determined according to an output result of the trained causal relationship determination model.

3. The method according to claim 2, characterized in that Before each of the to-be-recognized texts is input into the trained target causal relationship determination model, the method further includes: For each text to be recognized, a sentence vector of the text to be recognized is determined based on the word vector of each word and the character vector of each character in the text to be recognized.

4. The method according to claim 3, characterized in that Inputting each of the to-be-recognized texts into a trained causal relationship determination model, and determining a target text having a target causal relationship according to an output result of the trained causal relationship determination model, including: The sentence vectors corresponding to each of the to-be-recognized texts are respectively input into the trained causal relationship determination model, and the target text with the target causal relationship is determined according to the output result of the trained causal relationship determination model.

5. The method according to claim 2, characterized in that: The trained causal relationship determination model includes a feature extraction layer and a discrimination layer; each of the to-be-recognized texts is input into the trained causal relationship determination model, and a target text having a target causal relationship is determined according to an output result of the trained causal relationship determination model, including: For each of the texts to be recognized, input the text to be recognized into the feature extraction layer to obtain the semantic features of the text to be recognized; For each of the texts to be recognized, the semantic features of the text to be recognized are input into the discrimination layer to determine whether the text to be recognized is a target text having a target causal relationship.

6. The method according to claim 5, characterized in that The step of inputting the text to be recognized into the feature extraction layer to obtain the semantic features of the text to be recognized includes: Inputting the text to be recognized into the multiple filters in the feature extraction layer respectively to obtain the filtering result corresponding to each filter; The filtering result with the highest repetition rate among the multiple filtering results is determined as the semantic feature of the text to be recognized.

7. A device for constructing a causal relationship determination model, characterized in that: include: Acquisition module: used for acquiring an original corpus; the original corpus includes at least one first candidate text; Matching module: used for selecting the second candidate text in the original corpus according to the target event causal relationship template; A generating module: for determining, for each second candidate text, a sentence vector of the second candidate text according to a word vector of each word and a character vector of each character in the second candidate text; Determination module: used for training the causal relationship determination model to be trained based on the sentence vector of each second candidate text to obtain a trained causal relationship determination model; The determining module further includes: The first unit is used for inputting the sentence vector of each second candidate text as a positive sample into the causal relationship determination model to be trained, and inputting the causal relationship label of the second candidate text as a negative sample into the causal relationship determination model to be trained, so as to train the causal relationship determination model to be trained; The second unit is used for comparing the output result obtained by inputting the positive sample into the causal relationship determination model to be trained with the causal relationship label for each sentence vector of the second candidate text, and determining the training accuracy of the causal relationship determination model to be trained according to the comparison result. When the training accuracy reaches a preset accuracy value, the training ends and a trained causal relationship determination model is obtained; The generating module comprises: The third unit is used to generate a sentence vector of each second candidate text through an attention mechanism based on the word vector and character vector corresponding to the second candidate text.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Text semantic matching method and apparatus

    CN108132931A

  • Deep learning method for recognizing cause-effect relationship of contradictory dispute event

    CN111709244A

  • Chinese text matching method and system

    CN111914067A