CN114707518A - Semantic fragment-oriented target emotion analysis method, device, equipment and medium - Google Patents

Semantic fragment-oriented target emotion analysis method, device, equipment and medium Download PDF

Info

Publication number
CN114707518A
CN114707518A CN202210637534.XA CN202210637534A CN114707518A CN 114707518 A CN114707518 A CN 114707518A CN 202210637534 A CN202210637534 A CN 202210637534A CN 114707518 A CN114707518 A CN 114707518A
Authority
CN
China
Prior art keywords
representation
target
context
hidden state
sentence
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.)
Granted
Application number
CN202210637534.XA
Other languages
Chinese (zh)
Other versions
CN114707518B (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.)
Sichuan University
Original Assignee
Sichuan University
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 Sichuan University filed Critical Sichuan University
Priority to CN202210637534.XA priority Critical patent/CN114707518B/en
Publication of CN114707518A publication Critical patent/CN114707518A/en
Application granted granted Critical
Publication of CN114707518B publication Critical patent/CN114707518B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/049Temporal neural networks, e.g. delay elements, oscillating neurons or pulsed inputs

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)
  • Machine Translation (AREA)

Abstract

The invention discloses a semantic segment-oriented target emotion analysis method, a semantic segment-oriented target emotion analysis device, semantic segment-oriented target emotion analysis equipment and a semantic segment-oriented target emotion analysis medium, which are applied to the field of target emotion analysis, wherein in the method, a text sample is input to an embedding layer to obtain a sentence word vector, a context word vector and a target word vector; coding the sentence word vector, the context word vector and the target word vector by utilizing an attention coding layer to obtain corresponding hidden state representation; inputting the hidden state representation of the context and the target word into a multi-attention layer to obtain the semantic feature representation of the target context; inputting the sentence hidden state representation into a structured self-attention layer to obtain sentence segmentation semantic feature representation; and inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer to obtain a target word emotion prediction result. Therefore, the method enables the model to focus attention on each semantic segment, further inhibits noise on words and improves the accuracy of a target emotion analysis task.

Description

Semantic fragment-oriented target emotion analysis method, device, equipment and medium
Technical Field
The invention relates to the field of target emotion analysis, in particular to a semantic segment-oriented target emotion analysis method, device, equipment and medium.
Background
The Target Sentiment Analysis (TSA) task refers to determining the Sentiment polarity of a specific target in a sentence.
In the prior art, attention mechanism is adopted to capture the relation, namely weight, between a specific target in a sentence and other words/phrases in the sentence. However, since the attention mechanism only focuses on the relationship between words, it is easy to mismatch a specific target with irrelevant words. In The sentence "The bed is good and so comfortable bucket authority of The same thing as The real emotion analysis", The attention mechanism may erroneously assign The same weight to The front and back "good", "comfortable" and "answer" of The target "authority", thereby causing The accuracy of The target emotion analysis task to be affected.
Disclosure of Invention
In view of this, the present invention provides a semantic segment-oriented target emotion analysis method, apparatus, device, and medium, so as to improve the current situation that the accuracy of a target emotion analysis task is affected because a special target is likely to be mistakenly matched with irrelevant other words because attention mechanism only focuses on the relationship between words in the target emotion analysis task.
In a first aspect, an embodiment of the present invention provides a target emotion analysis method for semantic segments, including:
inputting an obtained text sample to an embedded layer of a preset target emotion analysis model to obtain sentence word vectors, upper and lower word vectors and target word vectors of the text sample;
based on an attention coding layer of the target emotion analysis model, obtaining sentence hidden state representation, context hidden state representation and target word hidden state representation according to the sentence word vector, the context word vector and the target word vector;
inputting the context hidden state representation and the target word hidden state representation to a multi-head attention layer of the target emotion analysis model to obtain context semantic features corresponding to target words and obtain target context semantic feature representation;
inputting the sentence hidden state representation into a structured self-attention layer of the target emotion analysis model to acquire semantic features of a plurality of semantic segments corresponding to the sentence hidden state to obtain sentence segment semantic feature representation;
and inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample, wherein the prediction layer is used for pooling the target context semantic feature representation and then performing target word emotion prediction according to a splicing result of the sentence segmentation semantic feature representation and the pooled target context semantic feature representation.
Optionally, in an implementation manner provided in the embodiment of the present invention, the attention coding layer includes a first multi-headed attention coding module, a second multi-headed attention coding module, and a third multi-headed attention coding module, where the first multi-headed attention coding module and the second multi-headed attention coding module both include a first multi-headed attention unit and a convolution unit that are sequentially connected, and the third multi-headed attention coding module includes a second multi-headed attention unit and a convolution unit that are sequentially connected;
the obtaining, by the attention coding layer based on the target emotion analysis model, a sentence hidden state representation, a context hidden state representation, and a target word hidden state representation according to the sentence word vector, the context word vector, and the target word vector includes:
mapping the sentence word vector and the context word vector to corresponding query representation, key representation and value representation respectively based on a first multi-head attention unit of the first multi-head attention coding module and the second multi-head attention coding module;
based on a second multi-head attention unit of the third multi-head attention coding module, mapping the target word vector to a key representation and a value representation corresponding to the target word vector, and mapping the context word vector to a query representation corresponding to the target word vector;
obtaining sentence semantic feature representation, context semantic feature representation and target semantic feature representation according to query representation, key representation and value representation respectively corresponding to the sentence word vector, the context word vector and the target word vector;
and respectively inputting the sentence semantic feature representation, the context semantic feature representation and the target semantic feature representation into convolution units of the first multi-head attention coding module, the second multi-head attention coding module and the third multi-head attention coding module to perform point-by-point convolution transformation to obtain sentence hidden state representation, context hidden state representation and target word hidden state representation.
Optionally, in an implementation manner provided by the embodiment of the present invention, the inputting the context hidden state representation and the target word hidden state representation into a multi-head attention layer of the target emotion analysis model to obtain a context semantic feature corresponding to a target word, so as to obtain a target context semantic feature representation, including:
mapping the target word hidden state representation into a key representation and a value representation corresponding to the target word hidden state by using a multi-head attention layer of the target emotion analysis model, and mapping the context hidden state representation into a query representation corresponding to the target word hidden state representation;
and obtaining the semantic feature representation of the target context by using the query representation, the key representation and the value representation corresponding to the target word hidden state representation.
Optionally, in an implementation manner provided by the embodiment of the present invention, the prediction layer includes an average pooling layer and a full-link layer;
the step of inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample comprises:
inputting the target context semantic feature representation into the average pooling layer to obtain a pooled target context semantic feature representation;
connecting the sentence segmentation semantic feature representation with the target context semantic feature representation after the pooling treatment to obtain a text representation corresponding to the text sample;
inputting the text representation to the full connection layer to obtain classification output corresponding to the text representation;
and based on a preset classifier, outputting and calculating the target word emotion prediction result of the text sample according to the classification corresponding to the text sample.
Optionally, in an implementation manner provided by the embodiment of the present invention, the embedding layer includes a pre-trained bidirectional coding characterization model based on a converter.
In a second aspect, an embodiment of the present invention provides a semantic segment-oriented target emotion analysis apparatus, including:
the embedding module is used for inputting the obtained text sample to an embedding layer of a preset target emotion analysis model to obtain sentence word vectors, upper and lower text word vectors and target word vectors of the text sample;
a hidden state coding module, configured to obtain, based on an attention coding layer of the target emotion analysis model, a sentence hidden state representation, a context hidden state representation, and a target word hidden state representation according to the sentence word vector, the context word vector, and the target word vector;
the first feature acquisition module is used for inputting the context hidden state representation and the target word hidden state representation into a multi-head attention layer of the target emotion analysis model so as to acquire context semantic features corresponding to target words and obtain target context semantic feature representation;
the second characteristic acquisition module is used for inputting the sentence hidden state representation into a structured self-attention layer of the target emotion analysis model so as to acquire semantic characteristics of a plurality of semantic segments corresponding to the sentence hidden state and obtain sentence segmented semantic characteristic representation;
and the prediction module is used for inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample, wherein the prediction layer is used for pooling the target context semantic feature representation and then performing target word emotion prediction according to a splicing result of the sentence segmentation semantic feature representation and the pooled target context semantic feature representation.
Optionally, in an implementation manner provided by the embodiment of the present invention, the attention coding layer includes a first multi-head attention coding module, a second multi-head attention coding module, and a third multi-head attention coding module, where the first multi-head attention coding module and the second multi-head attention coding module both include a first multi-head attention unit and a convolution unit that are sequentially connected, and the third multi-head attention coding module includes a second multi-head attention unit and a convolution unit that are sequentially connected;
the hidden state encoding module comprises:
a first mapping sub-module, configured to map the sentence word vector and the context word vector to corresponding query representation, key representation, and value representation, respectively, based on the first multi-headed attention unit of the first multi-headed attention coding module and the second multi-headed attention coding module;
a second mapping sub-module, configured to map the target word vector to a key representation sum value representation corresponding to the target word vector based on a second multi-head attention unit of the third multi-head attention coding module, and map the context word vector to a query representation corresponding to the target word vector;
a semantic feature representation obtaining sub-module, configured to obtain a sentence semantic feature representation, a context semantic feature representation, and a target semantic feature representation according to query representations, key representations, and value representations respectively corresponding to the sentence word vector, the context word vector, and the target word vector;
a hidden state representation obtaining sub-module, configured to input the sentence semantic feature representation, the context semantic feature representation, and the target semantic feature representation to convolution units of the first multi-head attention coding module, the second multi-head attention coding module, and the third multi-head attention coding module respectively to perform point-by-point convolution transformation, so as to obtain a sentence hidden state representation, a context hidden state representation, and a target word hidden state representation.
Optionally, in an implementation manner provided by the embodiment of the present invention, the first feature obtaining module includes:
a target word mapping submodule, configured to map, by using a multi-head attention layer of the target emotion analysis model, the target word hidden state representation into a key representation and value representation corresponding to the target word hidden state, and map the context hidden state representation into a query representation corresponding to the target word hidden state representation;
and the target context semantic feature acquisition submodule is used for expressing the corresponding query expression, key expression and value expression by utilizing the hidden state of the target word to obtain the target context semantic feature expression.
In a third aspect, an embodiment of the present invention provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the computer program, when running on the processor, executes the semantic segment-oriented target emotion analysis method as disclosed in any one of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when running on a processor, executes the semantic segment-oriented target emotion analysis method as disclosed in any one of the first aspects.
In the semantic segment-oriented target emotion analysis method provided by the embodiment of the invention, after an obtained text sample is obtained, computer equipment inputs the text sample to an embedded layer of a preset target emotion analysis model so as to convert target words, context and words contained in sentences in the text sample into vectors and obtain sentence word vectors, context word vectors and target word vectors; secondly, coding the sentence word vector, the context word vector and the target word vector by utilizing an attention coding layer of the target emotion analysis model so as to convert the sentence word vector, the context word vector and the target word vector into corresponding hidden state representations; then, aiming at the hidden state representation of the context and the hidden state of the target word, the hidden state representation of the context and the hidden state of the target word are input into a multi-head attention layer of a target emotion analysis model to capture the context semantic features corresponding to the target word, so that the representation information of the target word comprises the context semantic information, and then the target context semantic feature representation is obtained, and aiming at the hidden state representation of the sentence, the hidden state representation of the sentence is input into a structured self-attention layer of the target emotion analysis model to obtain the semantic features of a plurality of semantic segments corresponding to the hidden state of the sentence, and then the segmented semantic feature representation of the sentence is obtained, so that in the subsequent steps, the target emotion analysis model puts more attention on the semantic segments rather than the words, and the noise brought by the words is suppressed; and finally, inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample.
Based on the arrangement of the structured self-attention layer, when the attention of the target emotion analysis model is put to words due to the attention coding layer, the embodiment of the invention also focuses on each semantic segment due to the semantic feature representation of sentence segmentation output by the structured self-attention layer, thereby inhibiting the noise on the words and improving the accuracy of the target emotion analysis task. Moreover, the embodiment of the invention also enables the representation information corresponding to the target word to be richer based on the target word representation fused with the context semantic features, namely the target context semantic feature representation, thereby improving the interpretability of the target word.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings required to be used in the embodiments will be briefly described below, and 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 of the present invention. Like components are numbered similarly in the various figures.
FIG. 1 is a schematic flow chart of a first semantic segment-oriented target emotion analysis method provided by an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a flowchart of a second semantic segment oriented target emotion analysis method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a flowchart of a third semantic segment oriented target emotion analysis method according to an embodiment of the present invention;
fig. 4 shows a schematic structural diagram of a target emotion analysis device facing semantic segments according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present invention, are only intended to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present invention belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments of the present invention.
Referring to fig. 1, a schematic flow diagram of a first semantic segment-oriented target emotion analysis method provided in the embodiment of the present invention is shown, and the semantic segment-oriented target emotion analysis method provided in the embodiment of the present invention includes:
s110, inputting the obtained text sample to an embedded layer of a preset target emotion analysis model to obtain sentence word vectors, upper and lower context word vectors and target word vectors of the text sample.
It should be understood that the text sample in the embodiment of the present invention refers to a sentence including a plurality of words, the target word is a word or a phrase in the sentence, and the context is all words located before and after the target word in the text sample. Exemplarily, let the text sample comprisenOf a wordSThe target word is includingmOf a wordTThe context of the target word isCThen, thenS={w 1,w 2,…,w t-1,w t ,…,w t+m+1,w n },T={w t ,…,w t+m },C={w 1 ,w 2 ,…,w t-1 ,w t+m+1 ,w n },nAndmare all positive integers, and n>m。
Furthermore, the task of the embodiment of the present invention is to use text samplesSAnd contextCJudging the target wordTEmotional polarity ofpWherein, in the step (A),pe { -1,0,1}, -1 denotes negative, 0 denotes neutral, 1 tableShowing positive.
Further, it can be understood that, after the computer device in the embodiment of the present invention obtains the text sample, the context and the target word in the text sample are identified, and based on the identified context and the identified target word, the corresponding division and conversion of each word into a word vector are performed, so as to obtain a sentence word vector, a context word vector, and a target word vector.
Exemplarily, let the word vector beeThe sentence word vector ise s Target word vectore t And context word vectorse c Then, then
Figure P_220602170818421_421921001
Figure P_220602170818468_468811002
Figure P_220602170818484_484445003
Wherein, in the process,k=n-m+1。
it will also be appreciated that the manner in which the computer device in embodiments of the present invention identifies the context and target word in the text sample may be set according to the actual implementation. For example, in a feasible manner, the embodiment of the present invention inputs the text sample to the pre-trained context recognition model and the pre-trained target word model, so as to obtain the context word vector and the target word vector.
In yet another possible approach, the embedding layer in the embodiment of the present invention includes a pre-trained bidirectional coding characterization model based on a converter, i.e., a bert (bidirectional Encoder reconstruction from transforms) model. And then the embodiment of the invention completes the identification of the context and the target word based on the BERT model, and outputs the sentence word vector, the upper and lower context word vectors and the target word vector after the identification is completed.
In addition, it should be understood that, when the embodiments of the present invention complete the output of the sentence word vectors, the context word vectors, and the target word vectors based on the BERT model, the BERT model is also pre-trained for fine tuning, so as to ensure that the fine-tuned BERT model can provide correct output based on the input text samples.
Specifically, in a feasible manner provided by the embodiment of the present invention, the pre-training process includes: and marking sentences, contexts and target words in the plurality of text samples by using the CLS mark and the SEP mark, and inputting all marked text samples into the BERT model so as to pre-train the BERT model.
And S120, obtaining sentence hidden state representation, context hidden state representation and target word hidden state representation according to the sentence word vector, the context word vector and the target word vector based on the attention coding layer of the target emotion analysis model.
That is, the embodiment of the present invention is based on the predetermined attention coding layer to vector the words in the sentencee s Context word vectore c And target word vectore t And converting into corresponding hidden state representation, and performing semantic capture and characterization by using the hidden state representation in the subsequent steps.
It will be appreciated that the specific structure of the attention-coding layer may be set according to the actual circumstances. In one possible approach, as provided by embodiments of the present invention, the attention-coding layer comprises a structure of a multi-headed attention-and feed-forward fully-connected network similar to the transform's encoder.
It will also be appreciated that the coding layer that obtains the hidden state representation may be a structure without attention mechanism, and in one possible approach, the sentence hidden state representation, the context hidden state representation, and the target word hidden state representation may also be accomplished through a Recurrent Neural Network (RNN).
In another possible way provided by the embodiment of the present invention, the embodiment of the present invention completes hidden state representation output through Multi-Head Attention (MHA) and Point-wise Convolution Transformation (PCT), and specifically referring to fig. 2, a flowchart of a second semantic segment-oriented target emotion analysis method provided by the embodiment of the present invention is shown, that is, the Attention coding layer includes a first Multi-Head Attention coding module, a second Multi-Head Attention coding module, and a third Multi-Head Attention coding module, where the first Multi-Head Attention coding module and the second Multi-Head Attention coding module both include a first Multi-Head Attention unit and a Convolution unit that are connected in sequence, and the third Multi-Head Attention coding module includes a second Multi-Head Attention unit and a Convolution unit that are connected in sequence;
further, the S120 includes:
s121, respectively mapping the sentence word vector and the context word vector to corresponding query representation, key representation and value representation based on the first multi-head attention unit of the first multi-head attention coding module and the second multi-head attention coding module;
s122, based on the second multi-headed attention unit of the third multi-headed attention coding module, mapping the target word vector to a key representation sum value representation corresponding to the target word vector, and mapping the context word vector to a query representation corresponding to the target word vector;
s123, obtaining sentence semantic feature representation, context semantic feature representation and target semantic feature representation according to query representation, key representation and value representation respectively corresponding to the sentence word vector, the context word vector and the target word vector;
and S124, inputting the sentence semantic feature representation, the context semantic feature representation and the target semantic feature representation into convolution units of the first multi-head attention coding module, the second multi-head attention coding module and the third multi-head attention coding module respectively to perform point-by-point convolution transformation, so as to obtain sentence hidden state representation, context hidden state representation and target word hidden state representation.
It can be understood that although the recurrent neural network is usually used for calculating the hidden state representation at the present stage and can achieve better effect in most cases, the recurrent neural network does not support parallelized calculation, and thus takes more time to complete the parameter calculation. Moreover, the training of the recurrent neural network is a truncated back propagation that increases with time, thus affecting the model's ability to capture dependencies on a long time scale.
Therefore, the embodiment of the invention realizes parallel operation based on multi-head attention, and captures the context information and the global information of the input vector. And based on point-by-point convolution transformation, the context information is correspondingly converted, and corresponding hidden state representation is output.
Specifically, the embodiment of the invention uses Intra-MHA (Intra-multi-head attention), namely self-attention to complete the semantic feature representation calculation of sentences and contexts, and uses Inter-MHA to complete the fusion semantic feature of the contexts and the target words, namely the target semantic feature representation calculation.
It should be understood that, when computer equipment utilizes a multi-head attention mechanism to capture semantic features, firstly, mapping the obtained input information into a Query space, a Key space and a Value space correspondingly to obtain Query representation, Key representation and Value representation; then, corresponding operation is carried out by utilizing the query expression and the key expression to obtain a weight with a value corresponding to the value; and then, obtaining corresponding output according to the value and the weighting operation of the corresponding weight.
Further, Intra-MHA is used to handle the attention of the sequence itself. That is, the same input information received by the Intra-MHA will be mapped into Query space, Key space, and Value space simultaneously to get Query representation, Key representation, and Value representation.
Therefore, the sentence semantic feature representation and the context semantic feature representation in the embodiment of the present invention may be calculated by referring to the following formula, that is:
Figure P_220602170818515_515685001
in the formula (I), the compound is shown in the specification,
Figure P_220602170818548_548413001
representing sentence word vectorse s To middleiThe semantic feature representation of the sentence corresponding to the word vector,
Figure P_220602170818564_564511002
representing context word vectorse c To middleiThe semantic feature representation of the sentence corresponding to the word vector,MHA() The attention of a plurality of heads is shown,MHA() The first, second and third parameters in (1) represent the mappings of Query space, Key space and Value space, i.e. Query representation, Key representation and Value representation, respectively. Thus, in the calculation process of the sentence semantic feature representation and the context semantic feature representation, the query representation, the key representation and the value representation are all the mappings of the sentence word vector and the context word vector.
Different from the computation of sentence semantic feature representation and context semantic feature representation, the embodiment of the invention enriches the expression of the target word, and takes the mapping of the context word vector in the Query space as the Query representation of the target word vector based on Inter-MHA, namely:
Figure P_220602170818595_595777001
in the formula (I), the compound is shown in the specification,
Figure P_220602170818627_627000001
representing sentence word vectorse t To middleiAnd representing the semantic features of the target context corresponding to the word vectors.
After the calculation of all the target context semantic feature representations, sentence semantic feature representations and context semantic feature representations is completed, the embodiment of the invention performs point-by-point convolution transformation on each feature representation based on the convolution layer to obtain corresponding hidden state representations.
To better illustrate the point-by-point convolution transformation process of the convolutional layer provided by the embodiment of the present invention, the following formula is provided for illustration, that is:
Figure P_220602170818658_658266001
in the formula (I), the compound is shown in the specification,PCT(h) Representation to feature representationhA point-by-point convolution transformation is performed,σrepresents a Relu (Rectified linear unit) activation function; symbol denotes convolution;
Figure P_220602170818705_705133001
and
Figure P_220602170818736_736381002
represents the convolution kernel weights of the convolutional layers,
Figure P_220602170818753_753440003
and
Figure P_220602170818785_785199004
representing the bias term of the convolutional layer.
S130, inputting the context hidden state representation and the target word hidden state representation into a multi-head attention layer of the target emotion analysis model to obtain context semantic features corresponding to target words and obtain target context semantic feature representation.
That is, in order to obtain the representation with more interactive information in the embodiment of the present invention, when obtaining the hidden state representation of the context and the hidden state representation of the target word, the computer device uses a multi-head attention mechanism to fuse the hidden state representation of the context and the hidden state representation of the target word, so that the semantic features of the target word include the context semantic features, and further obtain the semantic feature representation of the target context.
It can be understood that the feature fusion process based on multi-head attention can be set according to actual situations, for example, in a feasible manner provided by the embodiment of the present invention, specifically referring to fig. 3, a flowchart of a third target emotion analysis method for semantic segments provided by the embodiment of the present invention is shown, that is, in such feasible manner, the step S130 includes:
s131, mapping the target word hidden state representation into a key representation and value representation corresponding to the target word hidden state by using a multi-head attention layer of the target emotion analysis model, and mapping the context hidden state representation into a query representation corresponding to the target word hidden state representation;
s132, obtaining the semantic feature representation of the target context by using the query representation, the key representation and the value representation corresponding to the target word hidden state representation.
That is, in the embodiment of the present invention, the mapping of the target word hidden state in the Key space and the Value space is used as the Key representation sum Value, and the mapping of the context hidden state in the Query space is used as the Query representation; then, calculating the weight according to the query expression and the key expression, and performing weighting operation according to the value expression and the calculated weight to obtain a corresponding weighted value; and finally, splicing the weighted values of each head (head) of the multi-head attention layer to obtain the target context semantic feature representation.
S140, inputting the sentence hidden state representation into a structured self-attention layer of the target emotion analysis model to obtain semantic features of a plurality of semantic segments corresponding to the sentence hidden state, and obtaining sentence segment semantic feature representation.
That is, in the embodiment of the present invention, in order to improve the phenomenon that noise occurs due to the fact that attention weights of words in the context of a target word are the same, Structured Self-attention (SS) is set in a target emotion analysis model.
It should be understood that when information is input to the attention layer to obtain the attention weight distribution, the attention weight distribution indicates the attention of each part of the input information. However, the input information is actually divided into layers, such as documents (documents) which can be divided into layers with different granularities, such as chapter, paragraph, sentence and word.
Therefore, the embodiment of the invention performs hierarchical division on the sentence expression based on the structured self-attention, namely, the sentence expression is divided into a plurality of semantic segments, namely, the sentence hidden state expression is divided into a plurality of semantic segments, and the semantic features of the semantic segments are used for judging the target emotion polarity.
Therefore, the target emotion analysis model puts more attention on semantic segmentation rather than words, and noise caused by the words in the context of the target words is suppressed.
To better illustrate the computation process of the sentence segmentation semantic feature representation provided by the embodiment of the present invention, the following formula is shown, namely:
Figure P_220602170818800_800844001
in the formula (I), the compound is shown in the specification,
Figure P_220602170818847_847726001
representing sentence word vectorse s To middleiThe hidden state of the sentence corresponding to the word vector is represented,
Figure P_220602170818863_863338002
to represent
Figure P_220602170818894_894647003
The corresponding structured self-attention weight is,
Figure P_220602170818925_925842004
to represent
Figure P_220602170818942_942402005
The corresponding sentence is segmented into semantic characteristics,
Figure P_220602170818974_974185006
and
Figure P_220602170819005_005435007
represent the corresponding training weights of the structured self-attention layer.
S150, inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample, wherein the prediction layer is used for pooling the target context semantic feature representation and then performing target word emotion prediction according to a splicing result of the sentence segmentation semantic feature representation and the pooled target context semantic feature representation.
That is, after pooling the target context semantic feature representation, the embodiment of the present invention splices the pooled target context semantic feature representation and the sentence segmentation semantic feature representation to obtain the final representation of the target in the sentence. It can be understood that the final representation of the target in the embodiment of the present invention includes semantic features of the target word and semantic features of a context of the target word, and thus can represent a relationship between a word vector of the target and a word vector of the context; and the final representation of the target also comprises sentence segmentation semantic feature representation corresponding to each sentence segmentation, so that when the target emotion analysis model carries out emotion prediction, the correct collocation of the word vector of the target and the word vector of the context is determined according to the semantics of each sentence segmentation. Therefore, the target emotion analysis model is predicted more accurately, and the accuracy of the target emotion analysis task is improved.
In addition, it can be further understood that the specific structure of the prediction layer and the specific operation process of the prediction layer for performing prediction according to the final representation of the target can be set according to the actual situation, for example, in a feasible manner provided by the embodiment of the present invention, the prediction layer includes an average pooling layer and a full connection layer;
further, the S150 includes:
inputting the target context semantic feature representation into the average pooling layer to obtain a pooled target context semantic feature representation;
connecting the sentence segmentation semantic feature representation with the target context semantic feature representation after the pooling processing to obtain a text representation corresponding to the text sample;
inputting the text representation to the full connection layer to obtain classification output corresponding to the text representation;
and based on a preset classifier, outputting and calculating the target word emotion prediction result of the text sample according to the classification corresponding to the text sample.
That is, in the embodiment of the present invention, an average pooling (average pooling) layer is used to pool the semantic feature representation of the target context, and the result of the pooling process and the semantic feature representation of sentence segmentation are represented as follows:
Figure P_220602170819021_021064001
in the formula (I), the compound is shown in the specification,s o a representation of the text corresponding to the text sample,s s the representation sentence is segmented into semantic feature representations,
Figure P_220602170819052_052303001
expression of semantic feature of object context after pooling treatment [ 2 ]]A splice is indicated.
Next, the text is representeds o Inputting the data into the full connection layer to perform corresponding operation, and obtaining corresponding classification output, which is shown as the following formula:
Figure P_220602170819083_083613001
in the formula (I), the compound is shown in the specification,xthe output of the classification is represented by,W o andb o respectively representing the training weights and the training offsets corresponding to the fully-connected layer.
And finally, performing emotion probability distribution operation based on a preset classifier, and further obtaining an emotion prediction result of the target word of the text sample, wherein the emotion prediction result is shown as the following formula:
Figure P_220602170819098_098745001
in the formula (I), the compound is shown in the specification,ythe emotion prediction result of the target word is shown,softmaxa pre-set classifier is represented that is,Cthe number of polarities representing emotion.
In the semantic fragment-oriented target emotion analysis method provided by the embodiment of the invention, after an obtained text sample is obtained, a computer device inputs the text sample to an embedded layer of a preset target emotion analysis model so as to convert target words, context and words contained in sentences in the text sample into vectors, and obtain sentence word vectors, context word vectors and target word vectors; secondly, coding the sentence word vector, the context word vector and the target word vector by utilizing an attention coding layer of the target emotion analysis model so as to convert the sentence word vector, the context word vector and the target word vector into corresponding hidden state representations; then, aiming at the hidden state representation of the context and the hidden state of the target word, the hidden state representation of the context and the hidden state of the target word are input into a multi-head attention layer of a target emotion analysis model to capture the context semantic features corresponding to the target word, so that the representation information of the target word comprises the context semantic information, and then the target context semantic feature representation is obtained, and aiming at the hidden state representation of the sentence, the hidden state representation of the sentence is input into a structured self-attention layer of the target emotion analysis model to obtain the semantic features of a plurality of semantic segments corresponding to the hidden state of the sentence, and then the segmented semantic feature representation of the sentence is obtained, so that in the subsequent steps, the target emotion analysis model puts more attention on the semantic segments rather than the words, and the noise brought by the words is suppressed; and finally, inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample.
Based on the arrangement of the structured self-attention layer, when the attention of the target emotion analysis model is put to words due to the attention coding layer, the embodiment of the invention also focuses on each semantic segment due to the semantic feature representation of sentence segmentation output by the structured self-attention layer, thereby inhibiting the noise on the words and improving the accuracy of the target emotion analysis task. Moreover, the embodiment of the invention also enables the representation information corresponding to the target word to be richer based on the target word representation fused with the context semantic features, namely the target context semantic feature representation, thereby improving the interpretability of the target word.
Corresponding to the target emotion analysis method for semantic segments provided in the embodiment of the present invention, an embodiment of the present invention further provides a target emotion analysis device for semantic segments, and referring to fig. 4, a schematic structural diagram of the target emotion analysis device for semantic segments provided in the embodiment of the present invention is shown, where the target emotion analysis device 200 for semantic segments provided in the embodiment of the present invention includes:
the embedding module 210 is configured to input the obtained text sample to an embedding layer of a preset target emotion analysis model, so as to obtain a sentence word vector, a context word vector, and a target word vector of the text sample;
a hidden state encoding module 220, configured to obtain a sentence hidden state representation, a context hidden state representation, and a target word hidden state representation according to the sentence word vector, the context word vector, and the target word vector based on an attention encoding layer of the target emotion analysis model;
a first feature obtaining module 230, configured to input the context hidden state representation and the target word hidden state representation into a multi-head attention layer of the target emotion analysis model, so as to obtain a context semantic feature corresponding to a target word, and obtain a target context semantic feature representation;
a second feature obtaining module 240, configured to input the sentence hidden state representation to a structured self-attention layer of the target emotion analysis model, so as to obtain semantic features of a plurality of semantic segments corresponding to the sentence hidden state, and obtain a sentence segment semantic feature representation;
and the prediction module 250 is configured to input the target context semantic feature representation and the sentence segmentation semantic feature representation to a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample, where the prediction layer is configured to perform target word emotion prediction according to a splicing result of the sentence segmentation semantic feature representation and the target context semantic feature representation after pooling processing after pooling the target context semantic feature representation.
Optionally, in a feasible manner provided by the embodiment of the present invention, the attention coding layer includes a first multi-headed attention coding module, a second multi-headed attention coding module, and a third multi-headed attention coding module, where the first multi-headed attention coding module and the second multi-headed attention coding module both include a first multi-headed attention unit and a convolution unit that are sequentially connected, and the third multi-headed attention coding module includes a second multi-headed attention unit and a convolution unit that are sequentially connected;
the hidden state encoding module comprises:
a first mapping sub-module, configured to map the sentence word vector and the context word vector to corresponding query representation, key representation, and value representation, respectively, based on the first multi-headed attention unit of the first multi-headed attention coding module and the second multi-headed attention coding module;
a second mapping sub-module, configured to map the target word vector to a key representation sum value representation corresponding to the target word vector based on a second multi-head attention unit of the third multi-head attention coding module, and map the context word vector to a query representation corresponding to the target word vector;
a semantic feature representation obtaining sub-module, configured to obtain a sentence semantic feature representation, a context semantic feature representation, and a target semantic feature representation according to query representations, key representations, and value representations respectively corresponding to the sentence word vector, the context word vector, and the target word vector;
a hidden state representation obtaining sub-module, configured to input the sentence semantic feature representation, the context semantic feature representation, and the target semantic feature representation to convolution units of the first multi-head attention coding module, the second multi-head attention coding module, and the third multi-head attention coding module respectively to perform point-by-point convolution transformation, so as to obtain a sentence hidden state representation, a context hidden state representation, and a target word hidden state representation.
Optionally, in a feasible manner provided by the embodiment of the present invention, the first feature acquiring module includes:
a target word mapping submodule, configured to map, by using a multi-head attention layer of the target emotion analysis model, the target word hidden state representation to a key representation and a value representation corresponding to the target word hidden state, and map the context hidden state representation to a query representation corresponding to the target word hidden state representation;
and the target context semantic feature acquisition submodule is used for expressing the corresponding query expression, key expression and value expression by utilizing the hidden state of the target word to obtain the target context semantic feature expression.
Optionally, in a possible manner provided by the embodiment of the present invention, the prediction layer includes an average pooling layer and a full-link layer;
further, the prediction module comprises:
the pooling sub-module is used for inputting the target context semantic feature representation into the average pooling layer to obtain a pooled target context semantic feature representation;
the connection submodule is used for connecting the sentence segmentation semantic feature representation with the target context semantic feature representation after the pooling processing to obtain a text representation corresponding to the text sample;
the output sub-module is used for inputting the text representation to the full connection layer to obtain the classification output corresponding to the text representation;
and the classification submodule is used for outputting and calculating the target word emotion prediction result of the text sample according to the classification corresponding to the text sample based on a preset classifier.
Optionally, in a possible manner provided by the embodiment of the present invention, the embedding layer includes a pre-trained bidirectional coding characterization model based on a converter.
The semantic segment-oriented target emotion analysis device 200 provided in the embodiment of the present application can implement each process of the semantic segment-oriented target emotion analysis method in the method embodiment corresponding to fig. 1, and can achieve the same technical effect, and is not described here again to avoid repetition.
The embodiment of the present invention further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the computer program, when running on the processor, executes the semantic segment oriented target emotion analysis method disclosed in the method embodiment corresponding to fig. 1.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program runs on a processor, the method for analyzing target emotion oriented to semantic segments disclosed in the method embodiment corresponding to fig. 1 is executed.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules 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 invention or a part of the technical solution that contributes to the prior art in essence can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention.

Claims (10)

1. A semantic segment-oriented target emotion analysis method is characterized by comprising the following steps:
inputting an obtained text sample to an embedded layer of a preset target emotion analysis model to obtain sentence word vectors, upper and lower word vectors and target word vectors of the text sample;
based on an attention coding layer of the target emotion analysis model, obtaining sentence hidden state representation, context hidden state representation and target word hidden state representation according to the sentence word vector, the context word vector and the target word vector;
inputting the context hidden state representation and the target word hidden state representation to a multi-head attention layer of the target emotion analysis model to obtain context semantic features corresponding to target words and obtain target context semantic feature representation;
inputting the sentence hidden state representation into a structured self-attention layer of the target emotion analysis model to obtain semantic features of a plurality of semantic segments corresponding to the sentence hidden state to obtain sentence segmented semantic feature representation;
and inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample, wherein the prediction layer is used for pooling the target context semantic feature representation and then performing target word emotion prediction according to a splicing result of the sentence segmentation semantic feature representation and the pooled target context semantic feature representation.
2. The semantic segment-oriented target emotion analysis method of claim 1, wherein the attention coding layer comprises a first multi-head attention coding module, a second multi-head attention coding module and a third multi-head attention coding module, the first multi-head attention coding module and the second multi-head attention coding module both comprise a first multi-head attention unit and a convolution unit which are connected in sequence, and the third multi-head attention coding module comprises a second multi-head attention unit and a convolution unit which are connected in sequence;
the obtaining, by the attention coding layer based on the target emotion analysis model, a sentence hidden state representation, a context hidden state representation, and a target word hidden state representation according to the sentence word vector, the context word vector, and the target word vector includes:
mapping the sentence word vector and the context word vector to corresponding query representation, key representation and value representation respectively based on a first multi-head attention unit of the first multi-head attention coding module and the second multi-head attention coding module;
based on a second multi-head attention unit of the third multi-head attention coding module, mapping the target word vector to be a key representation sum value representation corresponding to the target word vector, and mapping the context word vector to be a query representation corresponding to the target word vector;
obtaining sentence semantic feature representation, context semantic feature representation and target semantic feature representation according to query representation, key representation and value representation respectively corresponding to the sentence word vector, the context word vector and the target word vector;
and respectively inputting the sentence semantic feature representation, the context semantic feature representation and the target semantic feature representation into convolution units of the first multi-head attention coding module, the second multi-head attention coding module and the third multi-head attention coding module to perform point-by-point convolution transformation to obtain sentence hidden state representation, context hidden state representation and target word hidden state representation.
3. The semantic segment-oriented target emotion analysis method of claim 1, wherein the inputting the context hidden state representation and the target word hidden state representation into a multi-head attention layer of the target emotion analysis model to obtain a context semantic feature corresponding to a target word, so as to obtain a target context semantic feature representation, comprises:
mapping the target word hidden state representation into a key representation and a value representation corresponding to the target word hidden state by using a multi-head attention layer of the target emotion analysis model, and mapping the context hidden state representation into a query representation corresponding to the target word hidden state representation;
and obtaining the semantic feature representation of the target context by using the query representation, the key representation and the value representation corresponding to the target word hidden state representation.
4. The semantic segment oriented target emotion analysis method of claim 1, wherein the prediction layer comprises an average pooling layer and a full-link layer;
the step of inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample comprises:
inputting the target context semantic feature representation into the average pooling layer to obtain a pooled target context semantic feature representation;
connecting the sentence segmentation semantic feature representation with the target context semantic feature representation after the pooling processing to obtain a text representation corresponding to the text sample;
inputting the text representation to the full connection layer to obtain classification output corresponding to the text representation;
and based on a preset classifier, outputting and calculating the target word emotion prediction result of the text sample according to the classification corresponding to the text sample.
5. The semantic segment oriented target emotion analysis method of claim 1, wherein the embedding layer comprises a pre-trained converter-based bi-directional coded representation model.
6. A semantic segment-oriented target emotion analysis device is characterized by comprising:
the embedding module is used for inputting the obtained text sample to an embedding layer of a preset target emotion analysis model to obtain sentence word vectors, upper and lower text word vectors and target word vectors of the text sample;
a hidden state coding module, configured to obtain, based on an attention coding layer of the target emotion analysis model, a sentence hidden state representation, a context hidden state representation, and a target word hidden state representation according to the sentence word vector, the context word vector, and the target word vector;
the first feature acquisition module is used for inputting the context hidden state representation and the target word hidden state representation into a multi-head attention layer of the target emotion analysis model so as to acquire context semantic features corresponding to target words and obtain target context semantic feature representation;
the second characteristic acquisition module is used for inputting the sentence hidden state representation into a structured self-attention layer of the target emotion analysis model so as to acquire semantic characteristics of a plurality of semantic segments corresponding to the sentence hidden state and obtain sentence segmented semantic characteristic representation;
and the prediction module is used for inputting the target context semantic feature representation and the sentence segmentation semantic feature representation into a prediction layer of the target emotion analysis model to obtain a target word emotion prediction result of the text sample, wherein the prediction layer is used for pooling the target context semantic feature representation and then performing target word emotion prediction according to a splicing result of the sentence segmentation semantic feature representation and the pooled target context semantic feature representation.
7. The semantic-segment-oriented target emotion analysis device of claim 6, wherein the attention coding layer comprises a first multi-head attention coding module, a second multi-head attention coding module and a third multi-head attention coding module, the first multi-head attention coding module and the second multi-head attention coding module both comprise a first multi-head attention unit and a convolution unit which are connected in sequence, and the third multi-head attention coding module comprises a second multi-head attention unit and a convolution unit which are connected in sequence;
the hidden state encoding module comprises:
a first mapping sub-module, configured to map the sentence word vector and the context word vector to corresponding query representation, key representation, and value representation, respectively, based on the first multi-headed attention unit of the first multi-headed attention coding module and the second multi-headed attention coding module;
a second mapping sub-module, configured to map the target word vector to a key representation sum value representation corresponding to the target word vector based on a second multi-head attention unit of the third multi-head attention coding module, and map the context word vector to a query representation corresponding to the target word vector;
a semantic feature representation obtaining sub-module, configured to obtain a sentence semantic feature representation, a context semantic feature representation, and a target semantic feature representation according to query representations, key representations, and value representations respectively corresponding to the sentence word vector, the context word vector, and the target word vector;
a hidden state representation obtaining sub-module, configured to input the sentence semantic feature representation, the context semantic feature representation, and the target semantic feature representation to convolution units of the first multi-head attention coding module, the second multi-head attention coding module, and the third multi-head attention coding module respectively to perform point-by-point convolution transformation, so as to obtain a sentence hidden state representation, a context hidden state representation, and a target word hidden state representation.
8. The semantic segment oriented target emotion analysis device of claim 6, wherein the first feature acquisition module comprises:
a target word mapping submodule, configured to map, by using a multi-head attention layer of the target emotion analysis model, the target word hidden state representation into a key representation and value representation corresponding to the target word hidden state, and map the context hidden state representation into a query representation corresponding to the target word hidden state representation;
and the target context semantic feature acquisition submodule is used for expressing the corresponding query expression, key expression and value expression by utilizing the hidden state of the target word to obtain the target context semantic feature expression.
9. A computer device comprising a memory and a processor, the memory storing a computer program which, when run on the processor, performs the semantic segment oriented target emotion analysis method of any of claims 1-5.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which when run on a processor performs the semantic segment oriented target emotion analysis method according to any of claims 1-5.
CN202210637534.XA 2022-06-08 2022-06-08 Semantic fragment-oriented target emotion analysis method, device, equipment and medium Active CN114707518B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210637534.XA CN114707518B (en) 2022-06-08 2022-06-08 Semantic fragment-oriented target emotion analysis method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210637534.XA CN114707518B (en) 2022-06-08 2022-06-08 Semantic fragment-oriented target emotion analysis method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN114707518A true CN114707518A (en) 2022-07-05
CN114707518B CN114707518B (en) 2022-08-16

Family

ID=82177948

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210637534.XA Active CN114707518B (en) 2022-06-08 2022-06-08 Semantic fragment-oriented target emotion analysis method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114707518B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115392260A (en) * 2022-10-31 2022-11-25 暨南大学 Social media tweet emotion analysis method facing specific target

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110222349A (en) * 2019-06-13 2019-09-10 成都信息工程大学 A kind of model and method, computer of the expression of depth dynamic context word
CN111259142A (en) * 2020-01-14 2020-06-09 华南师范大学 Specific target emotion classification method based on attention coding and graph convolution network
CN111339255A (en) * 2020-02-26 2020-06-26 腾讯科技(深圳)有限公司 Target emotion analysis method, model training method, medium, and device
CN112131383A (en) * 2020-08-26 2020-12-25 华南师范大学 Specific target emotion polarity classification method
CN112633010A (en) * 2020-12-29 2021-04-09 山东师范大学 Multi-head attention and graph convolution network-based aspect-level emotion analysis method and system
CN113157919A (en) * 2021-04-07 2021-07-23 山东师范大学 Sentence text aspect level emotion classification method and system
CN113641820A (en) * 2021-08-10 2021-11-12 福州大学 Visual angle level text emotion classification method and system based on graph convolution neural network
US20220092267A1 (en) * 2020-09-23 2022-03-24 Jingdong Digits Technology Holding Co., Ltd. Method and system for aspect-level sentiment classification by graph diffusion transformer

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110222349A (en) * 2019-06-13 2019-09-10 成都信息工程大学 A kind of model and method, computer of the expression of depth dynamic context word
CN111259142A (en) * 2020-01-14 2020-06-09 华南师范大学 Specific target emotion classification method based on attention coding and graph convolution network
CN111339255A (en) * 2020-02-26 2020-06-26 腾讯科技(深圳)有限公司 Target emotion analysis method, model training method, medium, and device
CN112131383A (en) * 2020-08-26 2020-12-25 华南师范大学 Specific target emotion polarity classification method
US20220092267A1 (en) * 2020-09-23 2022-03-24 Jingdong Digits Technology Holding Co., Ltd. Method and system for aspect-level sentiment classification by graph diffusion transformer
CN112633010A (en) * 2020-12-29 2021-04-09 山东师范大学 Multi-head attention and graph convolution network-based aspect-level emotion analysis method and system
CN113157919A (en) * 2021-04-07 2021-07-23 山东师范大学 Sentence text aspect level emotion classification method and system
CN113641820A (en) * 2021-08-10 2021-11-12 福州大学 Visual angle level text emotion classification method and system based on graph convolution neural network

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
YOUWEI SONG 等: "Attentional Encoder Network for Target Sentiment Classification", 《HTTPS://ARXIV.ORG/ABS/1902.09314V2》 *
ZHANG J 等: "Target-guided structured attention network for target-dependent sentiment analysis", 《TRANSACTIONS OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS》 *
刘建伟 等: "深度学习中注意力机制研究进展", 《工程科学学报》 *
邓航 等: "面向语义片段结构化自注意力的目标情感分析", 《小型微型计算机系统》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115392260A (en) * 2022-10-31 2022-11-25 暨南大学 Social media tweet emotion analysis method facing specific target

Also Published As

Publication number Publication date
CN114707518B (en) 2022-08-16

Similar Documents

Publication Publication Date Title
CN110196894B (en) Language model training method and language model prediction method
CN108846077B (en) Semantic matching method, device, medium and electronic equipment for question and answer text
CN110795552B (en) Training sample generation method and device, electronic equipment and storage medium
CN112528637B (en) Text processing model training method, device, computer equipment and storage medium
CN112163092B (en) Entity and relation extraction method, system, device and medium
CN111950692B (en) Robust output coding based on hamming distance for improved generalization
CN112446211A (en) Text processing device, method, apparatus, and computer-readable storage medium
CN113380223B (en) Method, device, system and storage medium for disambiguating polyphone
CN114358203A (en) Training method and device for image description sentence generation module and electronic equipment
CN111291552B (en) Method and system for correcting text content
CN113239702A (en) Intention recognition method and device and electronic equipment
CN114707518B (en) Semantic fragment-oriented target emotion analysis method, device, equipment and medium
CN111814479A (en) Enterprise short form generation and model training method and device
CN110992943A (en) Semantic understanding method and system based on word confusion network
CN112949628B (en) Track data enhancement and track identification method based on embedding-mixing
CN112364659B (en) Automatic identification method and device for unsupervised semantic representation
CN116702765A (en) Event extraction method and device and electronic equipment
CN114092931B (en) Scene character recognition method and device, electronic equipment and storage medium
CN112818688B (en) Text processing method, device, equipment and storage medium
CN113420121B (en) Text processing model training method, voice text processing method and device
CN115759254A (en) Question-answering method, system and medium based on knowledge-enhanced generative language model
CN115080748A (en) Weak supervision text classification method and device based on noisy label learning
CN115270792A (en) Medical entity identification method and device
CN115357712A (en) Aspect level emotion analysis method and device, electronic equipment and storage medium
KR20230059524A (en) Method and apparatus for analyzing multimodal data

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