Patent ID: 11972218
Assignee: JINAN UNIVERSITY
Field: Computer technology (Electrical engineering)
Classification: CPC G  Y | IPC G

Claim 0:
1. A specific target-oriented social media tweet sentiment analysis method, comprising:
preprocessing social media tweet data to obtain a target text and a specific target;
passing the target text through an embedding layer to obtain target text word vectors, and passing the specific target through the embedding layer to obtain a specific target word vector;
passing the target text word vectors through a self-attention structure to obtain a self-attention result;
combining the self-attention result with the specific target word vector and passing through a cross-attention structure to obtain cross-attention results;
concatenating the cross-attention results to obtain an attention representation matrix; and
passing the attention representation matrix sequentially through a pooling layer, a fully connected layer and a softmax layer to obtain a sentiment tendency result of the specific target;
wherein the passing the target text word vectors through a self-attention structure to obtain a self-attention result comprises:
passing the target text word vectors through a local self-attention structure to obtain a local self-attention result;
passing the target text word vectors through a self-attention structure containing position information to obtain a position self-attention result; and
combining the local self-attention result and the position self-attention result to obtain the self-attention result;
wherein the passing the target text word vectors through a local self-attention structure to obtain a local self-attention result comprises:
acquiring interaction information between each word and a neighboring word thereof by the local self-attention structure, wherein an expression formula of the local self-attention structure is as follows:, Attention
   local
  
  =
  
   
    softmax
    (
    
     
      
       (
       
        
         W
         q
        
        ·
        x
       
       )
      
      ⁢
      
       K
       A
       T
      
     
     
      d
     
    
    )
   
   ⁢
   
    V
    A
   
  
 

where, KA=(Wk·xi)i ∈A, VA=(Wv·xi)i∈A;
wherein sizes of a key matrix and a value matrix of local self-attention matrices are restricted by a matrix A to obtain a local attention representation of one word; and an expression of the matrix A is as follows:

A={j−k, . . . ,j−1,j,j+a, . . . ,j+k,t}

where, j represents a position of current word x, k represents a size of “local”, t represents a position of the specific target; repeating this operation for each word in the social media tweet data, j in the matrix A is varied accordingly, and a single-head local self-attention result is obtained by concatenating all results;
using a multi-head local attention mechanism by: repeating the local self-attention structure at least three times, and choosing different the parameter matrices Wq, Wk, and Wv to obtain multiple different local attention representations; and
concatenating all the local attention representations, and performing parameter matrix projection to obtain the local self-attention result.