CN112329478A - Method, device and equipment for constructing causal relationship determination model - Google Patents
Method, device and equipment for constructing causal relationship determination model Download PDFInfo
- Publication number
- CN112329478A CN112329478A CN202011379460.1A CN202011379460A CN112329478A CN 112329478 A CN112329478 A CN 112329478A CN 202011379460 A CN202011379460 A CN 202011379460A CN 112329478 A CN112329478 A CN 112329478A
- Authority
- CN
- China
- Prior art keywords
- text
- causal relationship
- determination model
- recognized
- relationship determination
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000001364 causal effect Effects 0.000 title claims abstract description 186
- 238000000034 method Methods 0.000 title claims abstract description 66
- 239000013598 vector Substances 0.000 claims abstract description 148
- 238000012549 training Methods 0.000 claims abstract description 34
- 238000012216 screening Methods 0.000 claims abstract description 8
- 238000000605 extraction Methods 0.000 claims description 29
- 238000001914 filtration Methods 0.000 claims description 14
- 230000007246 mechanism Effects 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 9
- 230000015654 memory Effects 0.000 claims description 8
- 230000000694 effects Effects 0.000 claims description 7
- 230000008569 process Effects 0.000 description 5
- 230000003044 adaptive effect Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000004927 fusion Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 238000010606 normalization Methods 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000012938 design process Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012886 linear function Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 239000002994 raw material Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/237—Lexical tools
- G06F40/242—Dictionaries
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/253—Grammatical analysis; Style critique
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/048—Activation functions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Computational Linguistics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Biomedical Technology (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Evolutionary Computation (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Biophysics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application provides a method, a device and equipment for constructing a causal relationship determination model. The method comprises the following steps: acquiring an original corpus set; the original corpus set comprises at least one first candidate text; screening a second candidate text in the original corpus according to a target event causal relationship template; for each second candidate text, determining a sentence vector of the second candidate text according to the word vector of each word and the word vector of each word in the second candidate text; and training the causal relationship determination model to be trained based on the statement vector of each second candidate text to obtain the trained causal relationship determination model. According to the method and the device, firstly, the words and the phrases are simultaneously used as the expression form of the expression semantics, so that the accuracy of the expression semantics is improved, and then the text with a recessive causal relationship can be effectively identified through analyzing the semantics.
Description
Technical Field
The invention relates to the technical field of deep learning, in particular to a method, a device and equipment for constructing a causal relationship determination model.
Background
The causal relationship of Chinese comprises a plurality of characteristics, firstly, Chinese linguistic data has value sparsity, fragmentity and impliedness; second, an event may be a cause or a result in different contexts. Therefore, causal relationship identification is difficult.
In the prior art, causal relationships are mainly identified through a template matching method, and although the causal relationships identified through the template matching method have high accuracy, only explicit causal relationships can be identified, and the implicit causal relationship identification rate is low.
Disclosure of Invention
In view of this, the present invention provides a method, an apparatus, and a device for constructing a cause-and-effect relationship determination model, which solve the problem in the prior art that the recognition rate of text determined to have an implicit cause-and-effect relationship is low.
In a first aspect, an embodiment of the present application provides a method for constructing a causal relationship determination model, where the method includes:
acquiring an original corpus set; the original corpus set comprises at least one first candidate text;
screening a second candidate text in the original corpus according to a target event causal relationship template;
for each second candidate text, determining a sentence vector of the second candidate text according to the word vector of each word and the word vector of each word in the second candidate text;
and training the causal relationship determination model to be trained based on the statement vector of each second candidate text to obtain the trained causal relationship determination model.
Optionally, the training of the causal relationship determination model to be trained based on the statement vector of each second candidate text to obtain the trained causal relationship determination model includes:
for each statement vector of a second candidate text, inputting the statement vector of the second candidate text into a to-be-trained causal relationship determination model as a positive sample, inputting a causal relationship label of the second candidate text into the to-be-trained causal relationship determination model as a negative sample, and training the to-be-trained causal relationship determination model;
and aiming at the statement vector of each second candidate text, comparing an output result obtained by inputting a positive sample into the to-be-trained causal relationship determination model with the causal relationship label, determining the training precision of the to-be-trained causal relationship determination model according to the comparison result, and finishing training when the training precision reaches a preset precision value to obtain the trained causal relationship determination model.
Optionally, the determining, for each second candidate text, a sentence vector of the second candidate text according to the word vector of each word and the word vector of each word in the second candidate text includes:
and for each second candidate text, generating a sentence vector of the second candidate text through an attention mechanism based on the word vector and the word vector corresponding to the second candidate text.
Optionally, the method further includes:
acquiring a text set to be recognized; the text set to be recognized comprises at least one text to be recognized;
and respectively inputting each text to be recognized into the trained causal relationship determination model, and determining a target text with a target causal relationship according to an output result of the trained causal relationship determination model.
Optionally, before each text to be recognized is input into the trained target causal relationship determination model, the method further includes:
and aiming at each text to be recognized, determining a sentence vector of the text to be recognized according to the word vector of each word and the word vector of each word in the text to be recognized.
Optionally, the respectively inputting each text to be recognized into the trained causal relationship determination model, and determining the target text with the target causal relationship according to the output result of the trained causal relationship determination model includes:
and respectively inputting the statement vector corresponding to each text to be recognized into the trained causal relationship determination model, and determining the target text with the target causal relationship according to the output result of the trained causal relationship determination model.
Optionally, the trained causal relationship determination model includes a feature extraction layer and a discrimination layer; inputting each text to be recognized into the trained causal relationship determination model respectively, and determining a target text with a target causal relationship according to an output result of the trained causal relationship determination model, wherein the steps of:
for each text to be recognized, inputting the text to be recognized to the feature extraction layer to obtain semantic features of the text to be recognized;
and inputting the semantic features of the text to be recognized to a discrimination layer aiming at each text to be recognized to obtain whether the text to be recognized is a target text with a target cause-and-effect relationship.
Optionally, the inputting the text to be recognized into the feature extraction layer to obtain the semantic features of the text to be recognized includes:
respectively inputting the texts to be recognized into a plurality of filters in the feature extraction layer to obtain a filtering result corresponding to each filter;
and determining the filtering result with the highest repetition rate in the plurality of filtering results as the semantic features of the text to be recognized.
In a second aspect, an embodiment of the present application provides an apparatus for constructing a causal relationship determination model, including:
an acquisition module: the method comprises the steps of obtaining an original corpus set; the original corpus set comprises at least one first candidate text;
a matching module: the method is used for screening a second candidate text in the original corpus according to a target event causal relationship template;
a generation module: for each second candidate text, determining a sentence vector of the second candidate text according to the word vector of each word and the word vector of each word in the second candidate text;
a determination module: and the causal relationship determination model is used for training the causal relationship determination model to be trained based on the statement vector of each second candidate text to obtain the trained causal relationship determination model.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the method.
According to the method for constructing the causal relationship determination model, firstly, the accuracy of semantic expression is improved by taking the word vector and the word vector as the expression form of the semantic expression at the same time. Furthermore, when the causal relationship is identified, the text with the recessive causal relationship can be effectively identified through semantic analysis.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a schematic flow chart of a method for constructing a causal relationship determination model according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart illustrating a method for determining a target text having a target causal relationship using a causal relationship determination model according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart illustrating an apparatus for constructing a causal relationship determination model according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer program 400 according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It will be apparent to those skilled in the art that the general principles defined herein may be applied to other embodiments and applications without departing from the spirit and scope of the application. Although the present application is primarily described in the context of determining a tracked object location, it should be understood that this is merely one exemplary embodiment.
In the prior art, the identification and extraction of the causal relationship are mainly based on template matching, but the causal relationship identification method based on template matching adopts manual template making, so that the identification efficiency is low, the labor cost is high, only the dominant causal relationship can be identified, and the recessive causal relationship is difficult to identify. Therefore, the problem of low implicit causal relationship identification rate is caused by only adopting the causal relationship identification method based on template matching.
Therefore, in order to solve the problem that the causal relationship identification method based on template matching only results in a low identification rate of implicit causal relationships, an embodiment of the present application provides a method for constructing a causal relationship determination model, as shown in fig. 1, including the following steps:
s101, acquiring an original corpus set; the original corpus set comprises at least one first candidate text;
s102, screening a second candidate text in the original corpus according to a target event causal relationship template;
s103, aiming at each second candidate text, determining a sentence vector of the second candidate text according to a word vector of each word and a word vector of each word in the second candidate text;
and S104, training the causal relationship determination model to be trained based on the statement vector of each second candidate text to obtain the trained causal relationship determination model.
In the above step S101, the original corpus is data stored in the form of text as data. For example: documents in a library database, various reports, various website text information and the like. At least a first candidate text is included in the original corpus. The first candidate text is a piece of text data in the original corpus in units of pieces.
In specific implementation, the original corpus can utilize a crawler program written in Python language to crawl website text data in a specific field, and the crawled text data is stored in a local database to form the original corpus. For example: the method can crawl websites in the stock field and websites in the fund field, and store the acquired text data into a local database to form an original corpus.
In step S102, the causal relationship template of the target event is manually designed to complete the screening task. The second candidate text is text data which is screened out from the original raw material set through the self-adaptive matching rule and has a causal relationship corresponding to the target event.
In specific implementation, the second candidate text is selected from the original corpus according to a designed adaptive matching rule, and the selected text data meeting the adaptive matching rule is used as the second candidate text. The design process of the adaptive matching rule can be divided into four steps, for example: the first step is as follows: and performing type definition on 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 that a company holds, so that we can understand the latest trends in the market. Then the structured target event type may be "company true". The second step is that: and establishing a core trigger dictionary corresponding to each target event type based on the structured target event types. For example: according to the target event type 'company is established' in the first step, the determined core trigger words can be established according to the 'company is established', and then a core trigger word dictionary is constructed through the 'establishment' of the core trigger words. The third step: and establishing the core trigger synonym dictionary of each target event type through the synonym forest and the word embedding model based on the core trigger dictionary of each target event type. For example: in the second step, the core trigger may be "true", and then the expansion is performed based on the core trigger "true" according to the synonym forest and the word embedding model, and the expansion result may be: "create", etc. Wherein the word embedding model may be a word2vec model. The fourth step: and designing an adaptive matching rule based on the core trigger dictionary of each target event type and the core trigger synonym dictionary of each target event type. For example: the self-adaptive matching rule is a module divided according to the main, predicate, object, fixed, shape and complement in Chinese grammar, and the self-adaptive matching rule is designed by taking the core trigger 'establishment' and the core trigger synonym 'creation' and the like obtained in the second step and the third step as predicate modules.
In step S103, the term vector of the second candidate text refers to a vectorized numerical value generated by assigning weight fusion by the attention mechanism based on the word vector of each word and the word vector of each word in the second candidate text in units of word vectors. The word vector refers to the vectorized numerical value characterizing each word in the second candidate text. The word vector refers to the vectorized numerical value characterizing each word in the second candidate text.
In step S104, the causal relationship determination model is a model designed based on a neural network algorithm and used for automatically extracting features of text data. The causal relationship determination model is used for automatically identifying text data with causal relationship corresponding to the target event according to the target event. The causal relationship determination model starts to be trained through input of the statement vector of each second candidate text, the capability of automatically identifying causal relationship is learned, the causal relationship determination model is applied to the original corpus in a centralized mode, the identification task can be efficiently completed, and the method is beneficial to saving of human resources.
Through the four steps, a large number of accurate second candidate texts containing causal relationships are screened out from the original corpus set through the target event causal relationship model, the second candidate texts are used as the training corpus of the causal relationship determination model, and the training effect of the causal relationship determination model is effectively improved through the high-quality training corpus. In the establishment of the causal relationship determination model, firstly, a word vector is taken as a unit, and a statement vector is generated by weight fusion according to the word vector of each word and the word vector of each word in the second candidate text through an attention mechanism, so that the semantic expression accuracy of each second candidate text is improved, and the identification rate of the text with the recessive causal relationship is improved through more accurate semantic expression during causal relationship identification.
When massive text data are faced, the causality is automatically identified through the trained causality determination model, so that the human resources are effectively reduced, and the identification rate of texts with recessive causality is improved. Accordingly, the present application provides a method of training a causal relationship model, the method comprising:
step 1041, for each statement vector of the second candidate text, inputting the statement vector of the second candidate text as a positive sample to the causal relationship determination model to be trained, inputting the causal relationship label of the second candidate text as a negative sample to the causal relationship determination model to be trained, and training the causal relationship determination model to be trained;
and 1042, aiming at the statement vector of each second candidate text, comparing an output result obtained by inputting a positive sample into the causal relationship determination model to be trained with the causal relationship label, determining the training precision of the causal relationship determination model to be trained according to the comparison result, and finishing training when the training precision reaches a preset precision value to obtain the trained causal relationship determination model.
When the above step 1042 is implemented, the causal relationship determination model training process may be as follows: for example, the preset precision value is 70%; inputting the positive samples into the causal relationship determination model to be trained to obtain 100 output results, wherein when the number of correct output results is 70, the number of incorrect output results is 30, the accuracy rate is 70% through calculation, and the training is stopped when the causal relationship determination model reaches a preset accuracy value according to the accuracy rate.
In the process of training the causal relationship determination model, the sentence vectors of the second candidate texts are input as positive samples to start training the causal relationship determination model, that is, the higher the accuracy of the generated sentence vector of each second candidate text is, the better the training effect of the causal relationship determination model is. Accordingly, the present invention provides a method of determining a second candidate text statement vector, the method comprising:
and 1031, for each second candidate text, generating a sentence vector of the second candidate text through an attention mechanism based on the word vector and the word vector corresponding to the second candidate text.
In step 1031, the attention mechanism is configured to assign weights to the word vectors and the word vectors corresponding to the second candidate text, so that the second candidate text generates more resolved sentence vectors. For example: generating a statement vector A of a second candidate text through an attention mechanism, wherein the weight of the statement vector A is 0.6; generating a statement vector B of a second candidate text through an attention mechanism, wherein the weight of the statement vector B is 0.2; comparing statement vector a of the second candidate text by analysis is more discriminative in 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 is as follows: cutting each second candidate text by taking a word as a unit and a character unit respectively; the second step is that: generating corresponding word vectors and character vectors according to each cut second candidate text through a word embedding model; wherein, the word embedding model can be a skip-gram model in the word2vec technology; the third step: and generating a statement vector taking the word vector as a unit through attention mechanism distribution weight fusion based on the word vector and the word vector corresponding to each second candidate text.
In specific implementation, the sentence vector in which the word and the phrase are simultaneously used as the representation semantic form can more accurately represent the semantic, and the sentence vector generation process of each second candidate text can be exemplified as follows:
firstly, a skip-gram model is used for second candidate text data such as: "restrictive," cutting in units of words to produce the corresponding word vector representation a 1. Where a1 represents a word generated from the second candidate text data cut: a "restrictive" vectorized value.
Cutting the second candidate text by taking the word as a unit through a skip-gram model to generate a corresponding word vector: a2, A3, a 4. Wherein, a2 represents a word vector of the "limited" word generated by cutting the second candidate text data; a3 denotes a word vector of the "system" word generated by cutting from the second candidate text data; a4 denotes a word vector of the "sex" word generated from the second candidate text data cut.
And (4) generating a fusional statement vector A by means of attention mechanism distribution weight and normalization operation. Where { A1, A2, A3, A4 }. epsilon.A, A represents the sentence vector of the second candidate text data "restrictive".
The statement vector with higher resolution is generated through an attention mechanism, so that a causal relationship model obtains a focus when a causal relationship is identified, and text data with a recessive causal relationship can be effectively identified. Thus, as shown in FIG. 2, the present invention provides a method for determining target text having target causal relationships using a causal relationship determination model, the method comprising:
s201, acquiring a text set to be identified; the text set to be recognized comprises at least one text to be recognized;
s202, inputting each object to be identified into the trained causal relationship determination model respectively, and determining a target text with a target causal relationship according to an output result of the trained causal relationship determination model.
In step S201, the text set to be recognized may be derived from the original corpus. The text set to be recognized comprises at least one text to be recognized. The text to be recognized refers to a piece of text data in the text set to be recognized by taking a piece as a unit.
In step S202, the target text refers to text data having a causal relationship, which is identified from the text to be identified by the trained causal relationship determination model.
In the identification process of the target text, an identification task is automatically carried out in the text to be identified through a trained causal relationship determination model, the causal relationship determination model can accurately and effectively identify the text to be identified with recessive causal relationship by combining semantics, and the causal relationship determination model carries out the identification task, firstly, the vector of the text to be identified is digitized and the identification task is carried out when the vector is input. Accordingly, the present application provides a method of generating a sentence vector of a text to be recognized, the method comprising:
step 2011, for each text to be recognized, determining a sentence vector of the text to be recognized according to the word vector of each word and the word vector of each word in the text to be recognized.
In the above step 2011, the sentence vector of the text to be recognized refers to a vectorized numerical value generated by assigning weight fusion by the attention mechanism based on the word vector of each word and the word vector of each word in the text to be recognized in units of word vectors.
The generated sentence vector of each text to be recognized is input into the trained causal relationship determination model, so that the target text with the causal relationship can be efficiently recognized by accurately analyzing the semantics. Therefore, the specific method for identifying the target text with the causal relationship from the text to be identified comprises the following steps:
step 20111, the statement vector corresponding to each text to be recognized is 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.
In step 20111, the target text with the target cause and effect relationship can be identified based on the output result of the cause and effect relationship determination model. The causal relationship determination model comprises a feature extraction layer and a discrimination layer, wherein the causal relationship determination model performs feature extraction on statement vectors corresponding to texts to be recognized through the feature extraction layer, inputs the extracted features into the discrimination layer for recognition, and determines texts to be recognized where the statement vectors with recognition results meeting a threshold are located as target texts.
The feature extraction and recognition are carried out on each text to be recognized through the feature extraction layer and the discrimination layer of the causal relationship determination model, and text data with target causal relationship can be determined efficiently. The method for efficiently determining the target text through the feature extraction layer and the discrimination layer of the causal relationship determination model comprises the following steps:
step 2021, inputting the text to be recognized to the feature extraction layer for each text to be recognized, so as to obtain semantic features of the text to be recognized;
step 2022, inputting the semantic features of the text to be recognized to a discrimination layer for each text to be recognized, so as to obtain whether the text to be recognized is a target text with a target causal relationship.
In the step 2021, the feature extraction layer is configured to extract semantic features by filtering the sentence vectors of the text to be recognized through a plurality of different filters. The semantic feature may be a sequence of vectors.
In the step 2022, the function of the discrimination layer is to recognize the semantic features of the text to be recognized through normalization operation and output the recognition result, and determine the text to be recognized whose recognition result meets the threshold as a target text. Such as: and when the recognition result of the semantic features of the text to be recognized is 1, determining that the text to be recognized is a target text with target cause-and-effect relationship.
Aiming at each text to be recognized, the accuracy of the semantic features of each text to be recognized can be effectively improved by adopting a plurality of different filters to extract the semantic features. Therefore, the present application provides a method for extracting semantic features of a text to be recognized, which includes:
step 20211, inputting the text to be recognized into the plurality of filters in the feature extraction layer, respectively, to obtain a filtering result corresponding to each filter;
step 20212, determining the filtering result with the highest repetition rate among the plurality of filtering results as the semantic feature of the text to be recognized.
In the step 20211, feature extraction is performed on the text to be recognized by using a filter, and the extraction result can be obtained by the following formula:
Ci=f(w*X(i:i+h-1)+b);
wherein w represents a filter, CiRepresenting a feature vector generated by filtering an ith vector of a text statement vector to be recognized through a filter, x representing a statement vector of a text to be recognized, i representing the ith statement vector of the text to be recognized, b representing a hyper-parameter, f being a non-linear function such as a Sigmoid function, a Relu function and the like, and h being a step size of a sliding window in the causal relationship determination model.
In step 20212, a plurality of extraction results may be obtained by performing feature extraction on the text to be recognized through a plurality of different filters, and for the plurality of extraction results, a feature with the highest repetition rate in the plurality of extraction results is determined as the semantic feature of the text to be recognized. For example: respectively extracting the features of a text C to be recognized through three different filters Q, W and E, wherein the extraction result is as follows:
the first filter Q extracts the result: and [ a, b, C ], wherein [ a, b, C ] is a vector sequence extracted by a filter Q aiming at the text C to be recognized, and a, b and C are respectively a feature vector in the vector sequence.
The second filter W extracts the result: and [ a, b ], wherein [ a, b ] is a vector sequence extracted by the filter W aiming at the text C to be recognized, and a and b are respectively a feature vector in the vector sequence.
The extraction result of the third filter E is: and [ a, b, d ], wherein [ a, b, d ] is a vector sequence extracted by a filter E aiming at the text C to be recognized, and a, b and d are respectively a feature vector in the vector sequence. Determining the feature vector with the highest repetition rate in the multiple extraction results as the semantic feature of the text to be recognized, so the semantic feature of the text C to be recognized can be determined as: [ a, b ].
According to the method for constructing the causal relationship determination model, the word vectors and the word vectors are simultaneously used as the expression forms of the expression semantics, so that the accuracy of the expression semantics of the statement vectors is improved. Moreover, different filters are adopted to extract semantic features of statement vectors, so that the accuracy of the semantic features is improved, and further, when causal relationship identification is carried out, text data with dominant causal sentences can be efficiently identified through more accurately analyzing semantics, and the identification rate of the text data with recessive causal relationship is improved.
An embodiment of the present application provides an apparatus for constructing a causal relationship determination model, as shown in fig. 3, the apparatus includes:
the acquisition module 301: the method comprises the steps of obtaining an original corpus set; the original corpus comprises at least one first candidate text.
The matching module 302: and the method is used for screening a second candidate text in the original corpus according to the causal relationship template of the target event.
The generation module 303: and the sentence vector of the second candidate text is determined according to the word vector of each word and the word vector of each word in the second candidate text for each second candidate text.
The determination module 304: and the causal relationship determination model is used for training the causal relationship determination model to be trained based on the statement vector of each second candidate text to obtain the trained causal relationship determination model.
Optionally, the determining module 304 further includes:
a first unit: and for each statement vector of the second candidate text, inputting the statement vector of the second candidate text to the causal relationship determination model to be trained as a positive sample, inputting the causal relationship label of the second candidate text to the causal relationship determination model to be trained as a negative sample, and training the causal relationship determination model to be trained.
A second unit: and comparing an output result obtained by inputting a positive sample into the to-be-trained causal relationship determination model with the causal relationship label aiming at the statement vector of each second candidate text, determining the training precision of the to-be-trained causal relationship determination model according to the comparison result, and finishing training when the training precision reaches a preset precision value to obtain the trained causal relationship determination model.
Optionally, the generating module 303 includes:
a third unit: and the sentence vector of the second candidate text is generated through an attention mechanism based on the word vector and the word vector corresponding to the second candidate text for each second candidate text.
Optionally, the apparatus for constructing a causal relationship determination model further includes:
a second obtaining module: the method comprises the steps of obtaining a text set to be recognized; the text set to be recognized comprises at least one text to be recognized.
A second determination module: and the method is used for respectively inputting each text to be recognized into the trained causal relationship determination model, and determining a target text with a target causal relationship according to an output result of the trained causal relationship determination model.
Optionally, the second obtaining module further includes:
a fourth unit: and determining a sentence vector of the text to be recognized according to the word vector of each word and the word vector of each word in the text to be recognized aiming at each text to be recognized.
Optionally, the fourth unit further includes:
a first subunit: and the sentence vectors corresponding to the texts to be recognized are respectively input into the trained causal relationship determination model, and the target texts with target causal relationships are determined according to the output result of the trained causal relationship determination model.
Optionally, the second determining module includes:
a fifth unit: and the semantic features of the text to be recognized are obtained by inputting the text to be recognized to a feature extraction layer aiming at each text to be recognized.
A sixth unit: and the semantic features of the text to be recognized are input to a discrimination layer aiming at each text to be recognized, so that whether the text to be recognized is a target text with a target cause-and-effect relationship is obtained.
Optionally, the fifth unit further includes:
a second subunit: and the text to be recognized is respectively input into the plurality of filters in the feature extraction layer to obtain a filtering result corresponding to each filter.
A third subunit: and the method is used for determining the filtering result with the highest repetition rate in the plurality of filtering results as the semantic feature of the text to be recognized.
Corresponding to a method for constructing a cause and effect determination model in fig. 1, an embodiment of the present application further provides a computer device 400, as shown in fig. 4, the device includes a memory 401, a processor 402, and a computer program stored on the memory 401 and executable on the processor 402, wherein the processor 402 implements the method for constructing a cause and effect determination model when executing the computer program.
Specifically, the memory 401 and the processor 402 can be general memories and processors, which are not limited in this embodiment, and when the processor 402 runs a computer program stored in the memory 401, the method for constructing the causal relationship determination model can be performed, so that the problem of low implicit causal relationship identification rate in the prior art is solved.
Corresponding to a method for constructing a causal relationship determination model in fig. 1, an embodiment of the present application further provides a computer readable storage medium having a computer program stored thereon, where the computer program is executed by a processor to perform the steps of the method for constructing a causal relationship determination model.
Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, and the like, and when a computer program on the storage medium is run, the method for constructing the causal relationship determination model can be executed to solve the problem of low recognition rate of the implicit causal relationship in the prior art.
In the embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus once an item is defined in one figure, it need not be further defined and explained in subsequent figures, and moreover, the terms "first", "second", "third", etc. are used merely to distinguish one description from another and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the present disclosure, which should be construed in light of the above teachings. Are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
1. A method of constructing a causal relationship determination model, comprising:
acquiring an original corpus set; the original corpus set comprises at least one first candidate text;
screening a second candidate text in the original corpus according to a target event causal relationship template;
for each second candidate text, determining a sentence vector of the second candidate text according to the word vector of each word and the word vector of each word in the second candidate text;
and training the causal relationship determination model to be trained based on the statement vector of each second candidate text to obtain the trained causal relationship determination model.
2. The method of claim 1, wherein training the causal relationship determination model to be trained based on the statement vector of each second candidate text to obtain the trained causal relationship determination model comprises:
for each statement vector of a second candidate text, inputting the statement vector of the second candidate text into a to-be-trained causal relationship determination model as a positive sample, inputting a causal relationship label of the second candidate text into the to-be-trained causal relationship determination model as a negative sample, and training the to-be-trained causal relationship determination model;
and aiming at the statement vector of each second candidate text, comparing an output result obtained by inputting a positive sample into the to-be-trained causal relationship determination model with the causal relationship label, determining the training precision of the to-be-trained causal relationship determination model according to the comparison result, and finishing training when the training precision reaches a preset precision value to obtain the trained causal relationship determination model.
3. The method of claim 1, wherein for each second candidate text, determining a sentence vector of the second candidate text according to a word vector of each word and a word vector of each word in the second candidate text comprises:
and for each second candidate text, generating a sentence vector of the second candidate text through an attention mechanism based on the word vector and the word vector corresponding to the second candidate text.
4. The method of claim 1, further comprising:
acquiring a text set to be recognized; the text set to be recognized comprises at least one text to be recognized;
and respectively inputting each text to be recognized into the trained causal relationship determination model, and determining a target text with a target causal relationship according to an output result of the trained causal relationship determination model.
5. The method according to claim 4, before inputting each text to be recognized into the trained target cause and effect determination model, further comprising:
and aiming at each text to be recognized, determining a sentence vector of the text to be recognized according to the word vector of each word and the word vector of each word in the text to be recognized.
6. The method according to claim 5, wherein the step of inputting each text to be recognized into the trained causal relationship determination model and determining the target text with the target causal relationship according to the output result of the trained causal relationship determination model comprises:
and respectively inputting the statement vector corresponding to each text to be recognized into the trained causal relationship determination model, and determining the target text with the target causal relationship according to the output result of the trained causal relationship determination model.
7. The method of claim 4, wherein the trained causal relationship determination model comprises a feature extraction layer and a discrimination layer; inputting each text to be recognized into the trained causal relationship determination model respectively, and determining a target text with a target causal relationship according to an output result of the trained causal relationship determination model, wherein the steps of:
for each text to be recognized, inputting the text to be recognized to the feature extraction layer to obtain semantic features of the text to be recognized;
and inputting the semantic features of the text to be recognized to a discrimination layer aiming at each text to be recognized to obtain whether the text to be recognized is a target text with a target cause-and-effect relationship.
8. The method according to claim 7, wherein the inputting the text to be recognized into the feature extraction layer to obtain semantic features of the text to be recognized comprises:
respectively inputting the texts to be recognized into a plurality of filters in the feature extraction layer to obtain a filtering result corresponding to each filter;
and determining the filtering result with the highest repetition rate in the plurality of filtering results as the semantic features of the text to be recognized.
9. An apparatus for constructing a causal relationship determination model, comprising:
an acquisition module: the method comprises the steps of obtaining an original corpus set; the original corpus set comprises at least one first candidate text;
a matching module: the method is used for screening a second candidate text in the original corpus according to a target event causal relationship template;
a generation module: for each second candidate text, determining a sentence vector of the second candidate text according to the word vector of each word and the word vector of each word in the second candidate text;
a determination module: and the causal relationship determination model is used for training the causal relationship determination model to be trained based on the statement vector of each second candidate text to obtain the trained causal relationship determination model.
10. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method according to any of the preceding claims 1-8 are implemented when the computer program is executed by the processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011379460.1A CN112329478A (en) | 2020-11-30 | 2020-11-30 | Method, device and equipment for constructing causal relationship determination model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011379460.1A CN112329478A (en) | 2020-11-30 | 2020-11-30 | Method, device and equipment for constructing causal relationship determination model |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112329478A true CN112329478A (en) | 2021-02-05 |
Family
ID=74308353
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011379460.1A Pending CN112329478A (en) | 2020-11-30 | 2020-11-30 | Method, device and equipment for constructing causal relationship determination model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112329478A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113742445A (en) * | 2021-07-16 | 2021-12-03 | 中国科学院自动化研究所 | Text recognition sample obtaining method and device and text recognition method and device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108132931A (en) * | 2018-01-12 | 2018-06-08 | 北京神州泰岳软件股份有限公司 | A kind of matched method and device of text semantic |
CN111709244A (en) * | 2019-11-20 | 2020-09-25 | 中共南通市委政法委员会 | Deep learning method for identifying causal relationship of contradictory dispute events |
CN111767408A (en) * | 2020-05-27 | 2020-10-13 | 青岛大学 | Causal graph construction method based on integration of multiple neural networks |
CN111914067A (en) * | 2020-08-19 | 2020-11-10 | 苏州思必驰信息科技有限公司 | Chinese text matching method and system |
-
2020
- 2020-11-30 CN CN202011379460.1A patent/CN112329478A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108132931A (en) * | 2018-01-12 | 2018-06-08 | 北京神州泰岳软件股份有限公司 | A kind of matched method and device of text semantic |
CN111709244A (en) * | 2019-11-20 | 2020-09-25 | 中共南通市委政法委员会 | Deep learning method for identifying causal relationship of contradictory dispute events |
CN111767408A (en) * | 2020-05-27 | 2020-10-13 | 青岛大学 | Causal graph construction method based on integration of multiple neural networks |
CN111914067A (en) * | 2020-08-19 | 2020-11-10 | 苏州思必驰信息科技有限公司 | Chinese text matching method and system |
Non-Patent Citations (1)
Title |
---|
李伟康等: "深度学习中汉语字向量和词向量结合方式探究", 《中文信息学报》, vol. 31, no. 6, 30 November 2017 (2017-11-30), pages 140 - 146 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113742445A (en) * | 2021-07-16 | 2021-12-03 | 中国科学院自动化研究所 | Text recognition sample obtaining method and device and text recognition method and device |
CN113742445B (en) * | 2021-07-16 | 2022-09-27 | 中国科学院自动化研究所 | Text recognition sample obtaining method and device and text recognition method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Ahuja et al. | The impact of features extraction on the sentiment analysis | |
Hill et al. | Learning distributed representations of sentences from unlabelled data | |
CN108363790B (en) | Method, device, equipment and storage medium for evaluating comments | |
Yu et al. | Learning composition models for phrase embeddings | |
US20150095017A1 (en) | System and method for learning word embeddings using neural language models | |
CN110414004B (en) | Method and system for extracting core information | |
CN111428490B (en) | Reference resolution weak supervised learning method using language model | |
CN110134777B (en) | Question duplication eliminating method and device, electronic equipment and computer readable storage medium | |
CN114036300A (en) | Language model training method and device, electronic equipment and storage medium | |
CN112860896A (en) | Corpus generalization method and man-machine conversation emotion analysis method for industrial field | |
Salleh et al. | A Malay named entity recognition using conditional random fields | |
CN110457707B (en) | Method and device for extracting real word keywords, electronic equipment and readable storage medium | |
Aida et al. | A comprehensive analysis of PMI-based models for measuring semantic differences | |
CN110837730B (en) | Method and device for determining unknown entity vocabulary | |
CN117033633A (en) | Text classification method, system, medium and equipment | |
Kim et al. | Enhancing Korean named entity recognition with linguistic tokenization strategies | |
CN114139537A (en) | Word vector generation method and device | |
Hussain et al. | A technique for perceiving abusive bangla comments | |
CN113515587A (en) | Object information extraction method and device, computer equipment and storage medium | |
CN112329478A (en) | Method, device and equipment for constructing causal relationship determination model | |
CN111680146A (en) | Method and device for determining new words, electronic equipment and readable storage medium | |
CN108763258B (en) | Document theme parameter extraction method, product recommendation method, device and storage medium | |
Doughman et al. | Time-aware word embeddings for three Lebanese news archives | |
CN114676699A (en) | Entity emotion analysis method and device, computer equipment and storage medium | |
Chowdhury et al. | Detection of compatibility, proximity and expectancy of Bengali sentences using long short term memory |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |