CN111126056B - Method and device for identifying trigger words - Google Patents

Method and device for identifying trigger words Download PDF

Info

Publication number
CN111126056B
CN111126056B CN201911242217.2A CN201911242217A CN111126056B CN 111126056 B CN111126056 B CN 111126056B CN 201911242217 A CN201911242217 A CN 201911242217A CN 111126056 B CN111126056 B CN 111126056B
Authority
CN
China
Prior art keywords
target text
matrix
features
mapping
feature
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.)
Active
Application number
CN201911242217.2A
Other languages
Chinese (zh)
Other versions
CN111126056A (en
Inventor
徐猛
付骁弈
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Mininglamp Software System Co ltd
Original Assignee
Beijing Mininglamp Software System Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Mininglamp Software System Co ltd filed Critical Beijing Mininglamp Software System Co ltd
Priority to CN201911242217.2A priority Critical patent/CN111126056B/en
Publication of CN111126056A publication Critical patent/CN111126056A/en
Application granted granted Critical
Publication of CN111126056B publication Critical patent/CN111126056B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

A method of identifying a trigger word, comprising: performing word segmentation on a target text, determining the association relation between every two word segments in each word segment of the target text, and obtaining a relation matrix according to the determined association relation; performing coding mapping on each word of a target text, obtaining a vector of the target text, and inputting the vector into a cyclic neural network to obtain a coding feature matrix of the target text; carrying out semantic mapping according to the obtained coding feature matrix to obtain semantic features of the target text; and identifying trigger words in the target text by adopting a graph neural network according to the obtained relation matrix and the characteristics of the target text in a plurality of semantic spaces. The method and the device can extract the characteristics of a plurality of semantic spaces, and semantic extraction of texts is more sufficient.

Description

Method and device for identifying trigger words
Technical Field
The present invention relates to the field of computers, and in particular, to a method and apparatus for recognizing trigger words.
Background
A large amount of news data is generated daily on the internet describing many events that have occurred. But due to the wide variety of events, the type of event cannot be quickly and accurately resolved. The method can distinguish and master the public events or the events in the specific industry, is beneficial to grasping the development trend of the events and the development direction of the whole industry in real time, can assist high-level decision making, reduces risk, and has important practical application value and research significance. Also, the type of event is often obtained from keywords such as "gun shot", "attack", etc., which are called trigger words. It is therefore extremely important that these trigger words be recognized quickly and accurately.
The method based on the attention mechanism neural network and the machine learning adopted in the prior art can extract the characteristics, but the relation between the trigger words and other words in the sentences cannot be fully utilized, so that the characteristic extraction is single.
In addition, the rule-based methods employed in the prior art often require a field expert to write a certain amount of rules, requiring a certain amount of manpower and financial resources. Meanwhile, rules in different fields are quite different, and universality is difficult to achieve.
Disclosure of Invention
The application provides a method and a device for recognizing trigger words, which can achieve the purpose of extracting characteristics of a plurality of semantic spaces.
The application provides a method for identifying trigger words, which comprises the steps of segmenting a target text, determining the association relation between every two segmented words in each segmented word of the target text, and obtaining a relation matrix according to the determined association relation; performing coding mapping on each word of a target text, obtaining a vector of the target text, and inputting the vector into a cyclic neural network to obtain a coding feature matrix of the target text; carrying out semantic mapping according to the obtained coding feature matrix to obtain semantic features of the target text; and identifying the trigger words in the target text according to the obtained relation matrix and the semantic features of the target text.
In an exemplary embodiment, the determining the association relationship between the words of the target text includes: performing part-of-speech tagging and dependency syntactic analysis on each word segment to obtain a dependency relationship tree of all the word segments of the target text; and determining the association relation between every two segmentation words in each segmentation word of the target text according to the obtained dependency relation tree.
In an exemplary embodiment, the foregoing code mapping each word of the target text to obtain a vector of the target text includes: and carrying out coding mapping on each word of the target text, obtaining a word vector, a part-of-speech vector and a position vector of each word, and combining the word vector, the part-of-speech vector and the position vector to obtain a vector of the target text.
In an exemplary embodiment, the obtaining the word vector, the part-of-speech vector, and the position vector of each word includes: acquiring a word segmentation ID of each word segmentation of the target text, and obtaining a word vector of the target text according to the word segmentation ID and an initialization vector of each word segmentation of the target text; acquiring part-of-speech ID of each word of the target text, and acquiring part-of-speech vectors of the target text according to the part-of-speech ID and preset part-of-speech vectors; and acquiring the position ID of each word segment of the target text, and acquiring the part-of-speech vector of the target text according to the position ID and a preset position vector.
In an exemplary embodiment, the obtaining the vector of the target text and inputting the vector into the recurrent neural network to obtain the encoding feature matrix of the target text includes: and obtaining the vector of the target text, inputting the vector into a bidirectional LSTM network, and combining the obtained output results in two directions to obtain the coding feature matrix of the target text.
In an exemplary embodiment, the performing semantic mapping according to the obtained coding feature matrix to obtain semantic features of the target text includes: performing matrix conversion of a specified number on the obtained coding feature matrix to obtain a corresponding specified number of conversion matrixes, and mapping the conversion matrixes to a plurality of semantic spaces respectively to obtain a plurality of mapping features corresponding to the conversion matrixes; performing matrix operation on appointed mapping features in the obtained plurality of mapping features to obtain multi-head attention weight features; and obtaining a plurality of semantic space features of the target text according to the obtained multi-head attention weight feature and one appointed mapping feature of the plurality of mapping features, and performing dimension conversion on the obtained plurality of semantic spaces to obtain the semantic features of the target text.
In an exemplary embodiment, the above specified number of matrices includes a first matrix, a second matrix, and a third matrix having the same dimensions; the method for converting the obtained coding feature matrix into the corresponding conversion matrix with the specified number of matrixes, mapping the conversion matrix into a plurality of semantic spaces respectively, and obtaining a plurality of mapping features corresponding to the conversion matrix comprises the following steps: multiplying the obtained coding feature matrix with a first matrix, a second matrix and a third matrix with the same dimension respectively to obtain a first conversion feature, a second conversion feature and a third conversion feature which respectively correspond to the first matrix, the second matrix and the third matrix; mapping the obtained first conversion feature, second conversion feature and third conversion feature to a plurality of semantic spaces respectively to obtain corresponding first mapping feature, second mapping feature and third mapping feature; performing matrix operation on specified mapping features in the obtained plurality of mapping features to obtain multi-head attention weight features, wherein the method comprises the following steps: multiplying the obtained first mapping feature by the transposed second mapping feature to obtain a multi-head attention weight feature; the obtaining the plurality of semantic space features of the target text according to the obtained multi-head attention weight feature and one appointed mapping feature of the plurality of mapping features comprises: multiplying the obtained multi-head attention weight feature with a third mapping feature to obtain a plurality of semantic space features of the target text.
In an exemplary embodiment, the identifying the trigger word in the target text according to the obtained relation matrix and the semantic feature of the target text includes: inputting the obtained relation matrix and semantic features into a trained graphic neural network for calculation to obtain a relation feature vector; performing linear transformation on the obtained relation feature vector to obtain changed features, and performing softmax calculation on the obtained changed features to obtain the probability of each word belonging to each type of event; and determining trigger words in all the segmented words in the target text according to the acquired probability that each segmented word belongs to each class of event.
In an exemplary embodiment, before the word segmentation of the target text, the method further includes: and removing the appointed characteristics in the target text.
The application also provides a device for identifying the trigger words, which comprises a relation determining module, a relation matrix and a relation determining module, wherein the relation determining module is used for segmenting the target text, determining the association relation between every two segmented words in each segmented word of the target text, and obtaining the relation matrix according to the determined association relation; the coding module is used for carrying out coding mapping on each word of the target text, obtaining the vector of the target text, inputting the vector into the cyclic neural network and obtaining the coding feature matrix of the target text; the semantic analysis module is used for carrying out semantic mapping according to the obtained coding feature matrix to obtain semantic features of the target text; and the identification module is used for identifying the trigger words in the target text according to the obtained relation matrix and the semantic features of the target text.
Compared with the related art, the method and the device have the advantages that the target text is segmented, the association relation between every two segmented words in the segmented words of the target text is determined, and the relation matrix is obtained according to the determined association relation; performing coding mapping on each word of a target text, obtaining a vector of the target text, and inputting the vector into a cyclic neural network to obtain a coding feature matrix of the target text; carrying out semantic mapping according to the obtained coding feature matrix to obtain semantic features of the target text; according to the obtained relation matrix and the semantic features of the target text, the trigger words in the target text are identified, so that the feature of a plurality of semantic spaces can be extracted, and the semantic extraction of the target text is more sufficient.
In one exemplary embodiment, the present embodiments use a multi-head self-attention mechanism to extract features of multiple semantic spaces, more fully extracting the semantics of sentences, than a general attention mechanism or self-attention mechanism.
In an exemplary embodiment, the graph neural network (GCN) may make full use of the dependency relationship between each word and other words in the sentence, and more conform to the current application scenario, relative to the currently mainstream neural networks such as the recurrent neural network, the convolutional neural network, and the like. Such as the trigger word "injure" must be associated with some subject, such as a person, place, time, etc. Whereas a conventional neural network cannot capture this relationship.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the application. Other advantages of the present application may be realized and attained by the structure particularly pointed out in the written description and drawings.
Drawings
The accompanying drawings are included to provide an understanding of the technical aspects of the present application, and are incorporated in and constitute a part of this specification, illustrate the technical aspects of the present application and together with the examples of the present application, and not constitute a limitation of the technical aspects of the present application.
FIG. 1 is a flowchart of a method for recognizing trigger words according to an embodiment of the present application;
fig. 2 is a schematic diagram of a device module for recognizing trigger words according to an embodiment of the present application.
Detailed Description
The present application describes a number of embodiments, but the description is illustrative and not limiting and it will be apparent to those of ordinary skill in the art that many more embodiments and implementations are possible within the scope of the embodiments described herein. Although many possible combinations of features are shown in the drawings and discussed in the detailed description, many other combinations of the disclosed features are possible. Any feature or element of any embodiment may be used in combination with or in place of any other feature or element of any other embodiment unless specifically limited.
The present application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features and elements of the present disclosure may also be combined with any conventional features or elements to form a unique inventive arrangement as defined in the claims. Any feature or element of any embodiment may also be combined with features or elements from other inventive arrangements to form another unique inventive arrangement as defined in the claims. Thus, it should be understood that any of the features shown and/or discussed in this application may be implemented alone or in any suitable combination. Accordingly, the embodiments are not to be restricted except in light of the attached claims and their equivalents. Further, various modifications and changes may be made within the scope of the appended claims.
Furthermore, in describing representative embodiments, the specification may have presented the method and/or process as a particular sequence of steps. However, to the extent that the method or process does not rely on the particular order of steps set forth herein, the method or process should not be limited to the particular sequence of steps described. Other sequences of steps are possible as will be appreciated by those of ordinary skill in the art. Accordingly, the particular order of the steps set forth in the specification should not be construed as limitations on the claims. Furthermore, the claims directed to the method and/or process should not be limited to the performance of their steps in the order written, and one skilled in the art can readily appreciate that the sequences may be varied and still remain within the spirit and scope of the embodiments of the present application.
As shown in fig. 1, a method for identifying trigger words according to an embodiment of the present application includes the following steps:
s1, segmenting a target text, determining the association relation between every two segmented words in each segmented word of the target text, and obtaining a relation matrix according to the determined association relation;
s2, carrying out coding mapping on each word of a target text, obtaining a vector of the target text, and inputting the vector into a cyclic neural network to obtain a coding feature matrix of the target text;
s3, carrying out semantic mapping according to the obtained coding feature matrix to obtain semantic features of the target text;
s4, identifying trigger words in the target text according to the obtained relation matrix and the semantic features of the target text.
In one exemplary embodiment, the target text may be a sentence, paragraph, article, or the like.
In an exemplary embodiment, before the word segmentation of the target text in step S1, step S5 is further included: and removing the appointed characteristics in the target text.
Illustratively, removing the specified feature in the target text refers to: and cleaning the data to remove some unnecessary symbols such as emoticons, website links, redundant punctuations and the like in the target text.
In an exemplary embodiment, the determining the association relationship between the words of the target text in step S1 includes the following steps:
s11, performing part-of-speech tagging and dependency syntactic analysis on each word segment to obtain a dependency relationship tree of all the word segments of the target text;
s22, determining the association relation between every two segmentation words in each segmentation word of the target text according to the obtained dependency relation tree.
Taking a target text as an example, a part-of-speech tagging and dependency syntactic analysis is carried out by using a standfordNTP tool after data are cleaned, so that part-of-speech and dependency trees of each word are obtained. And judging whether an association relationship exists between the two words according to the dependency tree, so that a relationship matrix R [ S, S ] can be obtained, wherein S is the sentence length. For each value in R, the value is 1 if there is a relationship between the two words, and 0 otherwise.
In addition, the mark carries out error adjustment in the training process, and then the sequence marking is carried out: for example, for a sentence "the small mine was arrested by the public security bureau", in which it is apparent that "arrest" is the trigger word for an event, and when the sequence is noted, "arrest" is marked as T, and the other words are marked as "O", the whole sentence is marked as "O O O O O O T T O", where T is a set containing defined event types, and if there are n events, T is n.
In an exemplary embodiment, the encoding mapping for each word of the target text in step S2, to obtain a target text vector includes:
and carrying out coding mapping on each word of the target text, obtaining a word vector, a part-of-speech vector and a position vector of each word, and combining the word vector, the part-of-speech vector and the position vector to obtain a vector of the target text.
In an exemplary embodiment, the obtaining the word vector, the part-of-speech vector, and the position vector of each word in step S2 includes:
s20, acquiring a word segmentation ID of each word segmentation of the target text, and obtaining a word vector of the target text according to the word segmentation ID and an initialization vector of each word segmentation of the target text;
s21, acquiring part-of-speech ID of each word of the target text, and acquiring part-of-speech vectors of the target text according to the part-of-speech ID and preset part-of-speech vectors;
s22, acquiring the position ID of each word segment of the target text, and obtaining the part-of-speech vector of the target text according to the position ID and a preset position vector.
For example, taking the target text as a sentence, a computer is not directly processing Chinese characters, so a sentence needs to be converted into a series of representations to numbers. Assuming that there are 20000 different Chinese characters (including other common symbols) in the corpus, each Chinese character is randomly initialized to a 300-dimensional vector, then a vector D with dimension [20000,300] can be obtained, wherein for index IDs from 0 to 19999, each ID corresponds to a different Chinese character. Then for each word in a sentence (length S) the corresponding id can be found in D to obtain the corresponding vector and thus a vector of dimension S,300 can be obtained.
In order to obtain part-of-speech information of different words in a sentence, a part-of-speech vector M (similar to vector D) is used, and the dimension of M is set to be [60, 50], where 60 is the total number of parts-of-speech in the corpus and 50 is the feature number of the corresponding part-of-speech. Then for each word in a sentence (length S) the corresponding id can be found in M, thus obtaining the corresponding vector, and thus a vector of dimension S,50 can be obtained.
As above, in order to acquire position information of different characters in a sentence, a position vector P (similar to vector D) is employed, and the dimension of P is set to [200,50], where s=200 is the maximum length of a sample sentence, and 50 is the feature number of the corresponding position. Assuming that the actual length of the sentence send is 61, then the position ID of send is 1,2,3,4, 61, the remaining S-61 are 0. For each location ID, a corresponding vector can be found in the vector P. A vector of dimension S,50 is thus obtained for each sentence.
Finally, the above three vectors obtained for each sentence are combined (e.g., transversely concatenated), so that a vector of dimension S,400 (300+50+50=400) can be obtained.
In an exemplary embodiment, the obtaining the vector of the target text in step S2 and inputting the vector into the recurrent neural network to obtain the encoding feature matrix of the target text includes:
and obtaining the vector of the target text, inputting the vector into a bidirectional LSTM network, and combining the obtained output results in two directions to obtain the coding feature matrix of the target text.
In an exemplary embodiment, the semantic mapping according to the obtained coding feature matrix in step S3, to obtain the semantic feature of the target text, includes the following steps:
s31, performing matrix conversion of a specified number on the obtained coding feature matrix to obtain a corresponding specified number of conversion matrixes, and mapping the conversion matrixes to a plurality of semantic spaces respectively to obtain a plurality of mapping features corresponding to the conversion matrixes;
s32, performing matrix operation on specified mapping features in the obtained plurality of mapping features to obtain multi-head attention weight features;
s33, obtaining a plurality of semantic space features of the target text according to the obtained multi-head attention weight feature and one appointed mapping feature in the plurality of mapping features, and performing dimension conversion on the obtained plurality of semantic space features to obtain the semantic features of the target text.
Illustratively, dimensional transformation of the resulting plurality of semantic spatial features refers to: and combining and splicing the plurality of semantic space features into a comprehensive semantic feature.
In an exemplary embodiment, the specified number of matrices in step S3 includes a first matrix, a second matrix, and a third matrix having the same dimensions;
in an exemplary embodiment, the performing matrix conversion of the specified number of the obtained coding feature matrices in step S31 to obtain a corresponding specified number of conversion matrices, and mapping the conversion matrices to a plurality of semantic spaces to obtain a plurality of mapping features corresponding to the conversion matrices, including:
multiplying the obtained coding feature matrix with a first matrix, a second matrix and a third matrix with the same dimension respectively to obtain a first conversion feature, a second conversion feature and a third conversion feature which respectively correspond to the first matrix, the second matrix and the third matrix;
mapping the obtained first conversion feature, second conversion feature and third conversion feature to a plurality of semantic spaces respectively to obtain corresponding first mapping feature, second mapping feature and third mapping feature;
in an exemplary embodiment, the performing matrix operation on the specified mapping feature in the obtained plurality of mapping features in step S32, to obtain the multi-head attention weighting feature includes:
multiplying the obtained first mapping feature by the transposed second mapping feature to obtain a multi-head attention weight feature;
in an exemplary embodiment, the obtaining the plurality of semantic spatial features of the target text according to the obtained multi-headed attention weight feature and one of the plurality of mapping features specifying the mapping feature in step S33 includes:
multiplying the obtained multi-headed attention weight feature by a third mapping feature to obtain the plurality of semantic space features.
For example, the feature extraction is performed on the merged vector of the sentence obtained by the above method using a bidirectional LSTM network, and then the output results of the two directions obtained by the bidirectional long-short-term memory network are merged (for example, transversely spliced), so as to obtain a preliminary feature result of the sentence, namely, a coding feature matrix T1, and the dimensions are [ S, E ] (e=100 is set).
And then, respectively performing three conversions on the coding feature matrix T1: i.e. multiplied by three different matrices: a first matrix T21, a second matrix T22, and a third matrix T23. The dimensions of the three matrices are the same, assuming [ E, E2], resulting in three feature matrices, a first transformation feature T31, a second transformation feature T32, and a third transformation feature T33, all having dimensions [ S, E2] (e2=400= 4*E).
The first transformation feature T31, the second transformation feature T32, and the third transformation feature T33 are then dimension transformed, respectively: namely, mapping the original [ S, E2] - > [4, S, E ] to 4 semantic spaces to obtain corresponding first mapping features, second mapping features and third mapping features (still recorded as T31, T32 and T33, but dimensional transformation and unchanged values), and then performing matrix operation to obtain a multi-head attention weight feature T41=T31 (T32) T, (wherein the dimension of T41 is [4, S ]); then, the multi-head attention weighted feature T41 is multiplied by the third mapping feature T33 to obtain a plurality of semantic spatial features t5=t41×t33 (T5 dimension is [4, s, e ]).
Finally, the semantic features T5 are subjected to dimension conversion, namely [4, S, E ] - > [ S,4*E ] - > [ S, E2], so that the semantic features T6 of the sentence can be obtained.
In an exemplary embodiment, the identifying the trigger word in the target text according to the obtained relation matrix and the semantic feature of the target text in step S4 includes:
s41, inputting the obtained relation matrix and semantic features into a trained graphic neural network for calculation to obtain a relation feature vector;
s42, performing linear transformation on the obtained relation feature vector to obtain changed features, and performing softmax calculation on the obtained changed features to obtain the probability of each word belonging to each type of event;
s43, determining trigger words in all the segmented words in the target text according to the acquired probability that each segmented word belongs to each class of event.
For example, the relationship matrix R and the semantic feature T6 obtained above are calculated by using a (multi-layer) graph neural network, and finally a relationship feature vector T7 with a dimension of S, E3 is obtained. Compared with other neural networks, the graph neural network can fully utilize the relation among words, even in the multi-layer graph neural network, the relation matrix R always participates in calculation, so that the relation features among trigger words and related subjects can be fully extracted.
The process has two steps, the first step is to linearly transform the obtained relation feature vector T7, namely, connect a fully connected network (which is equivalent to multiplying by a matrix with a dimension of [ E3, N ], where N is the type number of the event), so as to obtain a changed feature T8 with a dimension of [ S, N ], and then perform softmax calculation, namely, t9=softmax (T8), where each row of elements in T9 represents the probability that the word belongs to each type of event.
In the test stage, it can be determined whether each word is a trigger word according to T9. In the training stage, error calculation is carried out by adopting a cross entropy method through a T7 and a pre-made sequence labeling result, gradient back propagation is carried out, and the whole training process is completed.
As shown in fig. 2, an apparatus for recognizing trigger words according to an embodiment of the present application includes the following modules:
the relation determining module 10 is used for segmenting the target text, determining the association relation between every two segmented words in each segmented word of the target text, and obtaining a relation matrix according to the determined association relation;
the encoding module 20 is configured to perform encoding mapping on each word of a target text, obtain a vector of the target text, and input the vector into a recurrent neural network to obtain an encoding feature matrix of the target text;
the semantic analysis module 30 is configured to obtain semantic features of the target text by performing semantic mapping according to the obtained encoding feature matrix;
and the recognition module 40 is used for recognizing the trigger words in the target text according to the obtained relation matrix and the semantic features of the target text.
In an exemplary embodiment, the relationship determining module 10 is configured to determine an association relationship between the words of the target text, which refers to:
the relation determining module 10 is used for performing part-of-speech tagging and dependency syntax analysis on each word segment to obtain a dependency relation tree of all the word segments of the target text;
and the relation determining module 10 is used for determining the association relation between every two of the segmented words of the target text according to the obtained dependency relation tree.
In an exemplary embodiment, the encoding module 20 is configured to perform encoding mapping on each word of the target text, and obtain a target text vector, which refers to:
the encoding module 20 is configured to encode and map each word segment of the target text, obtain a word vector, a part-of-speech vector, and a position vector of each word segment, and combine the word vector, the part-of-speech vector, and the position vector to obtain a vector of the target text.
In an exemplary embodiment, the encoding module 20 is configured to obtain a word vector, a part-of-speech vector, and a position vector of each word, including:
the encoding module 20 is configured to obtain a word segmentation ID of each word segmentation of the target text, and obtain a word vector of the target text according to the word segmentation ID and an initialization vector of each word segmentation of the target text;
the encoding module 20 is configured to obtain a part-of-speech ID of each word of the target text, and obtain a part-of-speech vector of the target text according to the part-of-speech ID and a preset part-of-speech vector;
the encoding module 20 is configured to obtain a location ID of each word segment of the target text, and obtain a part-of-speech vector of the target text according to the location ID and a preset location vector.
In an exemplary embodiment, the encoding module 20 is configured to obtain the vector of the target text and input the vector into the recurrent neural network, so as to obtain the encoding feature matrix of the target text, which means that:
the encoding module 20 is configured to obtain the vector of the target text, input the vector into a bidirectional LSTM network, and combine the output results in the two directions to obtain the encoding feature matrix of the target text.
In an exemplary embodiment, the semantic analysis module 30 is configured to perform semantic mapping according to the obtained encoding feature matrix, so as to obtain semantic features of the target text, which refers to:
the semantic analysis module 30 is configured to perform matrix conversion on the obtained coding feature matrix by a specified number to obtain a corresponding conversion matrix by a specified number, and map the conversion matrix to a plurality of semantic spaces respectively to obtain a plurality of mapping features corresponding to the conversion matrix;
the semantic analysis module 30 is configured to perform matrix operation on a specified mapping feature in the obtained plurality of mapping features to obtain a multi-head attention weight feature;
the semantic analysis module 30 is configured to assign a plurality of semantic space features obtained by the mapping feature according to the obtained multi-head attention weight feature and one of the plurality of mapping features, and perform dimensional transformation on the obtained plurality of semantic space features to obtain semantic features of the target text.
In one exemplary embodiment, the semantic analysis module 30 is configured to specify a number of matrices including a first matrix, a second matrix, and a third matrix that are the same in dimension;
in an exemplary embodiment, the semantic analysis module 30 is configured to perform a specified number of matrix transformations on the obtained coding feature matrix to obtain a corresponding specified number of transformation matrices, and map the corresponding specified number of transformation matrices to a plurality of semantic spaces, so as to obtain a plurality of mapping features corresponding to the transformation matrices, which means:
the semantic analysis module 30 is configured to multiply the obtained coding feature matrix with a first matrix, a second matrix, and a third matrix with the same dimension, to obtain a first conversion feature, a second conversion feature, and a third conversion feature corresponding to the first matrix, the second matrix, and the third matrix, respectively;
the semantic analysis module 30 is configured to map the obtained first conversion feature, second conversion feature, and third conversion feature to a plurality of semantic spaces, respectively, to obtain a corresponding first mapping feature, second mapping feature, and third mapping feature;
in an exemplary embodiment, the semantic analysis module 30 is configured to perform matrix operation on a specified mapping feature of the obtained plurality of mapping features to obtain a multi-head attention weight feature, which refers to:
a semantic analysis module 30, configured to multiply the obtained first mapping feature with the transposed second mapping feature to obtain a multi-head attention weight feature;
in an exemplary embodiment, the semantic analysis module 30 is configured to designate a plurality of semantic spatial features obtained from the obtained multi-headed attention weighting feature and one of the plurality of mapping features, and refers to:
the semantic analysis module 30 is configured to multiply the obtained multi-headed attention weight feature with a third mapping feature to obtain the plurality of semantic space features.
In an exemplary embodiment, the identifying module 40 is configured to identify, according to the obtained relationship matrix and the semantic feature of the target text, a trigger word in the target text, which refers to:
the recognition module 40 is used for inputting the obtained relation matrix and semantic features into the trained graphic neural network to calculate so as to obtain a relation feature vector;
the recognition module 40 is configured to perform linear transformation on the obtained relationship feature vector to obtain a changed feature, and then perform softmax calculation on the obtained changed feature to obtain a probability that each word belongs to each class of event;
and the recognition module 40 is configured to determine trigger words in all the segmented words in the target text according to the acquired probability that each segmented word belongs to each class of event.
In an exemplary embodiment, the apparatus further includes a cleaning module 50 for removing specified features in the target text before the target text is segmented by the relationship determination module 10.
Those of ordinary skill in the art will appreciate that all or some of the steps, systems, functional modules/units in the apparatus, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between the functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed cooperatively by several physical components. Some or all of the components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as known to those skilled in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. Furthermore, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media.

Claims (8)

1. A method of identifying a trigger word, the method comprising:
performing word segmentation on a target text, determining the association relation between every two word segments in each word segment of the target text, and obtaining a relation matrix according to the determined association relation;
performing coding mapping on each word of a target text, obtaining a vector of the target text, and inputting the vector into a cyclic neural network to obtain a coding feature matrix of the target text;
carrying out semantic mapping according to the obtained coding feature matrix to obtain semantic features of the target text;
identifying trigger words in the target text according to the obtained relation matrix and the semantic features of the target text;
the semantic mapping is carried out according to the obtained coding feature matrix to obtain the semantic features of the target text, which comprises the following steps:
performing matrix conversion of a specified number on the obtained coding feature matrix to obtain a corresponding specified number of conversion matrixes, and mapping the conversion matrixes to a plurality of semantic spaces respectively to obtain a plurality of mapping features corresponding to the conversion matrixes;
performing matrix operation on appointed mapping features in the obtained plurality of mapping features to obtain multi-head attention weight features;
obtaining a plurality of semantic space features of the target text according to the obtained multi-head attention weight feature and one appointed mapping feature of the plurality of mapping features, and performing dimension conversion on the obtained plurality of semantic spaces to obtain the semantic features of the target text;
the identifying the trigger word in the target text according to the obtained relation matrix and the semantic features of the target text comprises the following steps:
inputting the obtained relation matrix and semantic features into a trained graphic neural network for calculation to obtain a relation feature vector;
performing linear transformation on the obtained relation feature vector to obtain changed features, and performing softmax calculation on the obtained changed features to obtain the probability of each word belonging to each type of event;
and determining trigger words in all the segmented words in the target text according to the acquired probability that each segmented word belongs to each class of event.
2. The method of claim 1, wherein the determining the association between the tokens of the target text comprises:
performing part-of-speech tagging and dependency syntactic analysis on each word segment to obtain a dependency relationship tree of all the word segments of the target text;
and determining the association relation between every two segmentation words in each segmentation word of the target text according to the obtained dependency relation tree.
3. The method of claim 1, wherein the encoding mapping each word of the target text to obtain the vector of the target text comprises:
and carrying out coding mapping on each word of the target text, obtaining a word vector, a part-of-speech vector and a position vector of each word, and combining the word vector, the part-of-speech vector and the position vector to obtain a vector of the target text.
4. The method of claim 2, wherein the obtaining the word vector, the part-of-speech vector, and the position vector for each word segment comprises:
acquiring a word segmentation ID of each word segmentation of the target text, and obtaining a word vector of the target text according to the word segmentation ID and an initialization vector of each word segmentation of the target text;
acquiring part-of-speech ID of each word of the target text, and acquiring part-of-speech vectors of the target text according to the part-of-speech ID and preset part-of-speech vectors;
and acquiring the position ID of each word segment of the target text, and acquiring the part-of-speech vector of the target text according to the position ID and a preset position vector.
5. The method of claim 1, wherein the obtaining the vector of the target text and inputting the vector into the recurrent neural network results in the encoded feature matrix of the target text, comprising:
and obtaining the vector of the target text, inputting the vector into a bidirectional LSTM network, and combining the obtained output results in two directions to obtain the coding feature matrix of the target text.
6. The method of claim 1, wherein the specified number of matrices comprises a first matrix, a second matrix, a third matrix, which are the same in dimension;
the method for converting the obtained coding feature matrix into the corresponding conversion matrix with the specified number of matrixes, mapping the conversion matrix into a plurality of semantic spaces respectively, and obtaining a plurality of mapping features corresponding to the conversion matrix comprises the following steps:
multiplying the obtained coding feature matrix with a first matrix, a second matrix and a third matrix with the same dimension respectively to obtain a first conversion feature, a second conversion feature and a third conversion feature which respectively correspond to the first matrix, the second matrix and the third matrix;
mapping the obtained first conversion feature, second conversion feature and third conversion feature to a plurality of semantic spaces respectively to obtain corresponding first mapping feature, second mapping feature and third mapping feature;
performing matrix operation on specified mapping features in the obtained plurality of mapping features to obtain multi-head attention weight features, wherein the method comprises the following steps:
multiplying the obtained first mapping feature by the transposed second mapping feature to obtain a multi-head attention weight feature;
the obtaining the plurality of semantic space features of the target text according to the obtained multi-head attention weight feature and one appointed mapping feature of the plurality of mapping features comprises:
multiplying the obtained multi-head attention weight feature with a third mapping feature to obtain a plurality of semantic space features of the target text.
7. The method of claim 1, wherein prior to the word segmentation of the target text, further comprises: and removing the appointed characteristics in the target text.
8. An apparatus for identifying a trigger word, the apparatus comprising:
the relation determining module is used for segmenting the target text, determining the association relation between every two segmented words in each segmented word of the target text, and obtaining a relation matrix according to the determined association relation;
the coding module is used for carrying out coding mapping on each word of the target text, obtaining the vector of the target text, inputting the vector into the cyclic neural network and obtaining the coding feature matrix of the target text;
the semantic analysis module is used for carrying out semantic mapping according to the obtained coding feature matrix to obtain semantic features of the target text;
the recognition module is used for recognizing trigger words in the target text according to the obtained relation matrix and the semantic features of the target text;
the semantic analysis module is used for carrying out semantic mapping according to the obtained coding feature matrix to obtain semantic features of the target text, and the semantic features are as follows:
the semantic analysis module is used for carrying out matrix conversion on the obtained coding feature matrix in a specified number to obtain a corresponding conversion matrix in a specified number, and mapping the conversion matrix into a plurality of semantic spaces respectively to obtain a plurality of mapping features corresponding to the conversion matrix;
the semantic analysis module is used for carrying out matrix operation on specified mapping features in the obtained plurality of mapping features to obtain multi-head attention weight features;
the semantic analysis module is used for appointing a plurality of semantic space features obtained by the mapping features according to the obtained multi-head attention weight features and one of the plurality of mapping features, and carrying out dimension conversion on the plurality of obtained semantic space features to obtain semantic features of the target text;
the recognition module is used for recognizing the trigger words in the target text according to the obtained relation matrix and the semantic features of the target text, and is:
the recognition module is used for inputting the obtained relation matrix and semantic features into the trained graphic neural network to calculate so as to obtain a relation feature vector;
the recognition module is used for carrying out linear transformation on the obtained relation feature vector to obtain changed features, and carrying out softmax calculation on the obtained changed features to obtain the probability of each word belonging to each type of event;
and the identification module is used for determining trigger words in all the segmented words in the target text according to the acquired probability that each segmented word belongs to each class of event.
CN201911242217.2A 2019-12-06 2019-12-06 Method and device for identifying trigger words Active CN111126056B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911242217.2A CN111126056B (en) 2019-12-06 2019-12-06 Method and device for identifying trigger words

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911242217.2A CN111126056B (en) 2019-12-06 2019-12-06 Method and device for identifying trigger words

Publications (2)

Publication Number Publication Date
CN111126056A CN111126056A (en) 2020-05-08
CN111126056B true CN111126056B (en) 2023-05-09

Family

ID=70496229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911242217.2A Active CN111126056B (en) 2019-12-06 2019-12-06 Method and device for identifying trigger words

Country Status (1)

Country Link
CN (1) CN111126056B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111984822A (en) * 2020-09-03 2020-11-24 平安科技(深圳)有限公司 Image generation method and device, electronic equipment and computer readable storage medium
CN113836928B (en) * 2021-09-28 2024-02-27 平安科技(深圳)有限公司 Text entity generation method, device, equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110263323A (en) * 2019-05-08 2019-09-20 清华大学 Keyword abstraction method and system based on the long Memory Neural Networks in short-term of fence type
CN110532558A (en) * 2019-08-29 2019-12-03 杭州涂鸦信息技术有限公司 A kind of more intension recognizing methods and system based on the parsing of sentence structure deep layer

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2636098C1 (en) * 2016-10-26 2017-11-20 Общество с ограниченной ответственностью "Аби Продакшн" Use of depth semantic analysis of texts on natural language for creation of training samples in methods of machine training

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110263323A (en) * 2019-05-08 2019-09-20 清华大学 Keyword abstraction method and system based on the long Memory Neural Networks in short-term of fence type
CN110532558A (en) * 2019-08-29 2019-12-03 杭州涂鸦信息技术有限公司 A kind of more intension recognizing methods and system based on the parsing of sentence structure deep layer

Also Published As

Publication number Publication date
CN111126056A (en) 2020-05-08

Similar Documents

Publication Publication Date Title
CN110704633B (en) Named entity recognition method, named entity recognition device, named entity recognition computer equipment and named entity recognition storage medium
CN112633419B (en) Small sample learning method and device, electronic equipment and storage medium
CA2738480C (en) Detection of confidential information
CN112926327B (en) Entity identification method, device, equipment and storage medium
CN110765785B (en) Chinese-English translation method based on neural network and related equipment thereof
CN111866004B (en) Security assessment method, apparatus, computer system, and medium
CN110581864B (en) Method and device for detecting SQL injection attack
CN111581345A (en) Document level event extraction method and device
CN111222336B (en) Method and device for identifying unknown entity
CN111599340A (en) Polyphone pronunciation prediction method and device and computer readable storage medium
CN111126056B (en) Method and device for identifying trigger words
CN112800239A (en) Intention recognition model training method, intention recognition method and device
CN114528835A (en) Semi-supervised specialized term extraction method, medium and equipment based on interval discrimination
CN115099233A (en) Semantic analysis model construction method and device, electronic equipment and storage medium
CN111581346A (en) Event extraction method and device
CN114201756A (en) Vulnerability detection method and related device for intelligent contract code segment
CN111859933B (en) Training method, recognition method, device and equipment for maleic language recognition model
CN113743101A (en) Text error correction method and device, electronic equipment and computer storage medium
CN111723182B (en) Key information extraction method and device for vulnerability text
WO2023108981A1 (en) Method and apparatus for training text generation model, and storage medium and computer device
CN110705258A (en) Text entity identification method and device
CN115470861A (en) Data processing method and device and electronic equipment
CN111401069A (en) Intention recognition method and intention recognition device for conversation text and terminal
CN112416754B (en) Model evaluation method, terminal, system and storage medium
CN111401009B (en) Digital expression character recognition conversion method, device, server and storage medium

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
GR01 Patent grant
GR01 Patent grant