CN114462425B - Social media text processing method, device and equipment and storage medium - Google Patents

Social media text processing method, device and equipment and storage medium Download PDF

Info

Publication number
CN114462425B
CN114462425B CN202210380446.6A CN202210380446A CN114462425B CN 114462425 B CN114462425 B CN 114462425B CN 202210380446 A CN202210380446 A CN 202210380446A CN 114462425 B CN114462425 B CN 114462425B
Authority
CN
China
Prior art keywords
vector
social media
determining
word
media text
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
CN202210380446.6A
Other languages
Chinese (zh)
Other versions
CN114462425A (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 Zhongke Wenge Technology Co ltd
Original Assignee
Beijing Zhongke Wenge Technology 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 Zhongke Wenge Technology Co ltd filed Critical Beijing Zhongke Wenge Technology Co ltd
Priority to CN202210380446.6A priority Critical patent/CN114462425B/en
Publication of CN114462425A publication Critical patent/CN114462425A/en
Application granted granted Critical
Publication of CN114462425B publication Critical patent/CN114462425B/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
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

The disclosure relates to a social media text processing method, a social media text processing device, social media text processing equipment and a storage medium. The method comprises the steps of performing word segmentation processing on a social media text to obtain a plurality of terms; for any term, determining a word vector of the term based on the semantics of the term in different application scene contexts, wherein the word vector comprises the semantics of the term in different application scene contexts, so that the text context feature extraction capability and the implicit emotion inference capability can be improved by using the word vector; further, determining a global semantic vector of the social media text based on respective word vectors of the plurality of terms; determining local semantic vectors of the social media texts based on the word vectors of the terms and the weights of the terms in the social media texts; and determining the emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector, thereby improving the prediction accuracy of the emotion type of the social media text.

Description

Social media text processing method, device and equipment and storage medium
Technical Field
The present disclosure relates to the field of natural language processing, and in particular, to a social media text processing method, apparatus, device, and storage medium.
Background
With the rise of different social networks and social applications, people share various information in the social networks and the social applications through social media, such as experience and life, expression of viewpoints and insights, understanding of customs and culture around the world, establishment and maintenance of social relationships, marketing and popularization of various brands of products, and the spread information relates to the aspects of modern people's life.
Emotional analysis based on social media texts has wide and important application value in various fields, such as social management, business decision, information prediction and the like. At present, deep learning makes breakthrough progress in the field of emotion analysis, and is mainly developed through word embedding vectorization, a memory storage mechanism, an attention mechanism and a pre-training language model related research direction.
However, the social media text data has the characteristics of short length, infinite new words, much noise and the like, so that the problem of data sparsity is caused, and the capability of a neural network for acquiring text context is greatly weakened; and social media text data may lack words for explicitly expressing emotion (i.e., explicit emotion words), and have interference caused by linguistic phenomena with different scene polarities (e.g., in some scenes, the same word expresses positive emotion, and in other scenes, the same word expresses negative emotion), so that the yield of the neural network model is often less than expected when calculating high-order dependency features (including text context features), and the capability of the neural network model for solving the problem of difficulty in implicit emotion inference through the context features is limited.
Disclosure of Invention
To solve the technical problem or at least partially solve the technical problem, the present disclosure provides a social media text processing method, an apparatus, an electronic device and a computer-readable storage medium.
In a first aspect, an embodiment of the present disclosure provides a method for processing social media text, where the method includes:
performing word segmentation processing on the social media text to obtain a plurality of terms;
for any term, determining a word vector of the term based on semantics of the term in different application scene contexts;
determining a global semantic vector for the social media text based on the respective word vectors of the plurality of terms;
determining a local semantic vector of the social media text based on a word vector of each of the plurality of terms and a weight of each of the plurality of terms in the social media text;
and determining the emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector.
Optionally, the determining a word vector of the term based on the semantics of the term in different application context includes:
determining a basic vector and a weight of each semantic meaning based on the semantic meaning of the lexical item in different application scene contexts;
and determining a word vector of the term based on the basic vector of each semantic and the weight of each semantic.
Optionally, the weight of each semantic is a complex-valued weight, and the word vector is a quantum complex word vector;
the determining the word vector of the term based on the base vector of each semantic and the weight of each semantic comprises:
and weighting the basic vector of each semantic and the complex value weight of each semantic to obtain the quantum complex word vector of the lexical item.
Optionally, the determining a global semantic vector of the social media text based on the word vector of each of the plurality of terms includes:
determining a plurality of compound semantics based on respective word vectors of the plurality of terms;
obtaining a probability of each of the pre-trained composite semantics;
determining a global semantic vector for the social media text based on the plurality of compound semantics and the probability of each of the compound semantics.
Optionally, the determining a global semantic vector of the social media text based on the word vector of each of the plurality of terms includes:
determining a basis vector based on respective word vectors of M terms, the dimension of the basis vector being M N Dimension, N is the dimension of the word vector; each dimension of the base vector corresponds to a composite semantic;
obtaining a pre-trained tensor, the dimension of the tensor being M N Dimension, N is the dimension of the word vector; the dimensions of each tensor represent the probability of a compound semantic;
determining a global semantic vector for the social media text based on the basis vectors and the tensors.
Optionally, before the determining a global semantic vector of the social media text based on the basis vector and the tensor, the method further includes:
and carrying out dimensionality reduction on the basis vectors and the tensor.
Optionally, the weight of each term in the social media text is a normalization result of the term or the inverse text frequency index of each term in the social media text.
Optionally, the determining a local semantic vector of the social media text based on the word vector of each of the plurality of terms and the weight of each of the plurality of terms in the social media text includes:
determining a conjugate transpose matrix of a word vector for each of the plurality of terms;
determining a local semantic vector of the social media text based on a conjugate transpose matrix of respective word vectors of the plurality of terms, the respective word vectors of the plurality of terms, and respective weights of the plurality of terms at the social media text.
Optionally, after determining the local semantic vector of the social media text, the method further includes:
spatially aligning the local semantic vector with the global semantic vector.
Optionally, the determining, based on the global semantic vector and the local semantic vector, an emotion type corresponding to the social media text includes:
performing projection processing on the local semantic vector to the global semantic vector to obtain a projection result;
and determining the emotion type corresponding to the social media text based on the projection result.
In a second aspect, the embodiment of the present disclosure provides an apparatus for processing social media text, where the apparatus includes:
the word segmentation unit is used for carrying out word segmentation processing on the social media text to obtain a plurality of terms;
the word vector determining unit is used for determining a word vector of any term based on the semanteme of the term in different application scene contexts;
a global semantic determining unit, configured to determine a global semantic vector of the social media text based on a word vector of each of the plurality of terms;
a local semantic determining unit, configured to determine a local semantic vector of the social media text based on a word vector of each of the plurality of terms and a weight of each of the plurality of terms in the social media text;
and the type determining unit is used for determining the emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
a memory;
a processor; and
a computer program;
wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method of the first aspect.
In a fourth aspect, the present disclosure provides a computer-readable storage medium, on which a computer program is stored, the computer program being executed by a processor to implement the method of the first aspect.
In a fifth aspect, the disclosed embodiments also provide a computer program product comprising a computer program or instructions, which when executed by a processor, implement the method of the first aspect.
The method and the device have the advantages that the social media text is subjected to word segmentation processing to obtain a plurality of terms; for any term, determining a word vector of the term based on the semantics of the term in different application scene contexts, wherein the word vector comprises the semantics of the term in different application scene contexts, so that the text context feature extraction capability and the implicit emotion inference capability can be improved by using the word vector; further, determining a global semantic vector of the social media text based on respective word vectors of the plurality of terms; determining local semantic vectors of the social media texts based on the word vectors of the terms and the weights of the terms in the social media texts; and determining the emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector, thereby improving the prediction accuracy of the emotion type of the social media text.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the embodiments or technical solutions in the prior art description will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
Fig. 1 is a flowchart of a social media text processing method provided in an embodiment of the present disclosure;
fig. 2 is a schematic diagram of an application scenario provided by the embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a social media text processing apparatus according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a computer device provided in an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
At present, a deep learning emotion analysis model based on word vectors adopts a word vector representation mode of texts to represent the texts into continuous and dense data, and then the continuous and dense data is input into a neural network for classification calculation, and representative methods include FastText, TextCNN and the like. However, the conventional text word vector feature representation method often ignores the context information or word sequence in the text, and is difficult to effectively represent the importance degree of each word in the sentence.
At present, a deep learning emotion analysis model based on a memory storage mechanism optimizes a neural network structure to capture context information to the maximum extent, so that the model can keep a larger range of word sequences when a text is represented by learning, and a representative method is RCNN and the like.
At present, a deep learning emotion analysis model based on an attention mechanism extracts words with important meanings by introducing the attention mechanism to express sentences, and combines the representations of the information words to form sentence vectors, and similarly, clue sentences for correctly emotion classifying documents can be obtained by measuring the importance of the sentences by using the attention mechanism again to obtain the document vectors, and accordingly text emotion classification is performed, and a representative method is HAN and the like. However, the emotion information acquired by such a model floats on the surface, and deep emotion information cannot be sufficiently extracted.
At present, a deep learning emotion analysis model based on a pre-language model uses a dynamic word vector based on a pre-training language model (such as BERT), breaks through the problem that a static word vector cannot solve the ambiguity of a word, and can accurately understand the semantics of a sentence.
Therefore, the breakthrough progress of deep learning in the emotion analysis field is mainly realized by continuously optimizing and providing a new neural network to improve the capability of a model for learning the context dependency relationship of the text. However, the social media text data has the characteristics of short length, infinite new words, much noise and the like, so that the problem of data sparsity is caused, and the capability of a neural network for acquiring the context is greatly weakened; and social media text data may lack words for explicitly expressing emotion (i.e., explicit emotion words), and have interference caused by linguistic phenomena with different scene polarities (e.g., in some scenes, the same word expresses positive emotion, and in other scenes, the same word expresses negative emotion), so that the yield of the neural network model is often less than expected when calculating high-order dependency features (including text context features), and the capability of the neural network model for solving the problem of difficulty in implicit emotion inference through the context features is limited.
To solve this problem, embodiments of the present disclosure provide a social media text processing method, which is described below with reference to specific embodiments.
Fig. 1 is a flowchart of a social media text processing method provided in an embodiment of the present disclosure. The method can be executed by a social media text processing device, the social media text processing device can be implemented in a software and/or hardware manner, and the social media text processing device can be configured in an electronic device, such as a server or a terminal, where the terminal specifically includes a mobile phone, a computer, a tablet computer, or the like. In addition, the method may be applied to the application scenario shown in fig. 2, which includes the server 21 and the terminal 22. It can be understood that the social media text processing method provided by the embodiment of the disclosure can also be applied to other scenes.
The social media text processing method shown in fig. 1 is described below with reference to the application scenario shown in fig. 2, and for example, the terminal in fig. 2 may execute the method. The method comprises the following specific steps:
s101, performing word segmentation processing on the social media text to obtain a plurality of terms.
The social media text is a representation of written language on a production and exchange user relationship content platform. In the embodiment of the disclosure, the social media text may be a sentence, a paragraph or a chapter posted by the user in different social websites, different social applications.
The word segmentation processing is to process the sentence segments and chapters written in natural language, take the words as the unit as output, and then carry out dictionary mapping on the output words to obtain the lexical items. For example, "stay rainy, stay me not" can be classified as "stay rainy/stay, stay/me/not".
S102, aiming at any term, determining a word vector of the term based on the semanteme of the term in different application scene contexts.
Taking the term "apple" as an example, the semantics of "apple" are different in different application scenarios, for example, in the application scenario of the vegetable market, the potential semantics of "apple" is fruit; in the application scenario of the communication technology field, the potential semantic meaning of "apple" is company.
Therefore, the semantics of the term "apple" in different application scene contexts can be learned in advance through a large number of social text corpora containing the term "apple", so as to obtain a word vector of the term "apple", wherein each element in the word vector represents one semantic of the term "apple", and each element in the word vector is relatively independent.
S103, determining a global semantic vector of the social media text based on the word vectors of the plurality of terms.
In this embodiment, since the word vector includes semantics of the term in different application context, a global semantic vector of the social media text may be determined by using the word vector. Global semantics may be understood as a set of semantics of social media text in different application scenarios. The global semantic vector contains the semantics of the social media text in different application scene contexts, and the text context feature extraction capability and the implicit emotion inference capability can be improved.
S104, determining a local semantic vector of the social media text based on the word vector of each term and the weight of each term in the social media text.
In this embodiment, the local semantic vector of the social media text may be understood as a semantic of the social media text in the current application scenario, and the current application scenario may be understood as a scenario in which the user publishes the social media text.
S105, determining the emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector.
In this embodiment, the emotion types of the social media text may be divided in advance, and the emotion types are, for example: sadness, fear, frightening, joy, anger, alertness, hate, etc.
In this embodiment, a large number of social media corpora may be collected in advance, a global semantic vector, a local semantic vector, and an emotion type corresponding to different social media corpora are extracted, the global semantic vector and the local semantic vector are input to a neural network model as training samples of the neural network model, the emotion type is used as labeling information, the neural network model is trained, and by continuously adjusting parameters of the neural network model, the output of the neural network model converges or equals to the emotion type used as labeling information, and training is completed.
And inputting the global semantic vector obtained in the step S103 and the local semantic vector obtained in the step S104 into the trained neural network model by using the trained neural network model, and outputting the emotion type by using the neural network model.
In summary, in the embodiment of the present disclosure, a plurality of terms are obtained by performing word segmentation processing on a social media text; for any term, determining a word vector of the term based on the semantics of the term in different application scene contexts, wherein the word vector comprises the semantics of the term in different application scene contexts, so that the text context feature extraction capability and the implicit emotion inference capability can be improved by using the word vector; further, determining a global semantic vector of the social media text based on respective word vectors of the plurality of terms; determining local semantic vectors of the social media texts based on the word vectors of the terms and the weights of the terms in the social media texts; and determining the emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector, thereby improving the prediction accuracy of the emotion type of the social media text.
On the basis of the above embodiments, the determining a word vector of the term based on the semantics of the term in different application scenario contexts includes:
determining a basic vector and a weight of each semantic meaning based on the semantic meaning of the lexical item in different application scene contexts; and determining a word vector of the term based on the basic vector of each semantic and the weight of each semantic.
For example, assume that the term has n independent semantics, i.e., the semantics of the term in the context of the n application scenarios are all different. Modelling terms as defined in an n-dimensional Hilbert space H n The n independent semantics of the term can form n base vectors
Figure 220124DEST_PATH_IMAGE001
Wherein, in the step (A),
Figure 360118DEST_PATH_IMAGE002
for the base vector constructed based on the ith independent semantic, i takes on any value from 1 to n.
The weight of each semantic is the importance or tendency of a certain semantic in the whole semantic.
In some embodiments, the weight of each semantic is a complex-valued weight, and the word vector is a quantum complex word vector. The determining the word vector of the term based on the basis of the basis vector and the weight of each semantic comprises: and weighting the basic vector of each semantic and the complex value weight of each semantic to obtain the quantum complex word vector of the lexical item.
The specific process is as follows:
Figure 861506DEST_PATH_IMAGE003
wherein, t i A quantum complex word vector for the ith term in the social media text,
Figure 137767DEST_PATH_IMAGE004
complex-valued weights for the jth semantic of the ith term,
Figure 636881DEST_PATH_IMAGE005
for the base vector constructed based on the jth semantic,
Figure 60910DEST_PATH_IMAGE006
is that
Figure 303672DEST_PATH_IMAGE004
Is represented by the complex number of (a),
Figure 700018DEST_PATH_IMAGE007
is non-negative real and satisfies
Figure 104455DEST_PATH_IMAGE008
Figure 219041DEST_PATH_IMAGE009
Is a real number
Figure 796653DEST_PATH_IMAGE010
Corresponding complex phase is full
Figure 313085DEST_PATH_IMAGE011
The complex-valued weights can also be redefined according to the euler formula as:
Figure 888423DEST_PATH_IMAGE012
in this example
Figure 481517DEST_PATH_IMAGE013
And
Figure 862819DEST_PATH_IMAGE014
are trainable parameters.
A quantum complex word vector of terms, comprising two partial quantum states: amplitude and complex phase, where the amplitude may represent co-occurrence information of a low-level word, and the co-occurrence information is information that is represented based on statistics, and may include, for example and without limitation, word frequency. The phase may represent the emergent meaning or polarity of a word when combined with other words. For example, "pride" expresses positive emotion in a scenario where she is at good university, her mother really is she pride, "and negative emotion in a scenario where he prides little to achieve performance. Therefore, the inference capability of the implicit emotion can be improved by constructing the quantum complex word vector of the lexical item.
On the basis of the foregoing embodiment, the determining a global semantic vector of the social media text based on the word vector of each of the plurality of terms includes:
determining a plurality of compound semantics based on respective word vectors of the plurality of terms; obtaining a probability of each of the pre-trained composite semantics; determining a global semantic vector for the social media text based on the plurality of compound semantics and the probability of each of the compound semantics.
For example, a base vector is determined based on the word vectors of each of the M terms, the base vector having a dimension of M N Dimension, N is the dimension of the word vector; each dimension of the base vector corresponds to a composite semantic; obtaining a pre-trained tensor, the dimension of the tensor being M N Dimension, N is the dimension of the word vector; the dimensionality of each tensor represents the probability of a compound semantic; determining a global semantic vector for the social media text based on the basis vectors and the tensors.
Considering the dimensions of the basis vectors and tensors as M N A dimension belonging to a high dimension, the method further comprising, prior to said determining a global semantic vector of the social media text based on the basis vectors and the tensor, in order to reduce computational effort: and carrying out dimensionality reduction on the basis vectors and the tensor.
For example, a social media text sentence may be output as M terms after word segmentation, where M is a positive integer, and then the M terms may construct M complex word vectors, which may be represented as a sequence
Figure 233758DEST_PATH_IMAGE015
The global semantic vector of the social media text is M words with N dimensions in spaceSuperposition of quantum complex word vectors of terms, the representation of the quantum multi-volume wave function is:
Figure 979997DEST_PATH_IMAGE016
wherein the content of the first and second substances,
Figure 803597DEST_PATH_IMAGE017
representing one dimension in the basis vector, the dimension of the basis vector being M N Dimension, each dimension of the basis vector corresponds to a compound semantic.
Figure 988590DEST_PATH_IMAGE018
Is one dimension of M N Tensor, each dimension of the tensor
Figure 214035DEST_PATH_IMAGE019
Which represents the probability of compound semantics. Tensor
Figure 396755DEST_PATH_IMAGE020
Pre-training needs to be performed in a large social media corpus data set to learn as much semantics of text contexts and polarity information of terms as possible.
Due to tensor
Figure 707650DEST_PATH_IMAGE021
Dimension of M N The high-dimensional tensor is a high-dimensional tensor, and extremely large computing resources are consumed for subsequent loading and use. In this application, the dimension reduction processing on the tensor specifically includes: mapping it into a low-dimensional feature subspace by tensor decomposition, the final tensor
Figure 634018DEST_PATH_IMAGE022
Can be expressed as:
Figure 510707DEST_PATH_IMAGE023
wherein the tensor decomposition function
Figure 129907DEST_PATH_IMAGE024
May be CP decomposition, Tucker decomposition, etc. The dimension reduction processing for the basis vectors is similar to that of the tensors, and is not described again.
Figure 928099DEST_PATH_IMAGE025
After reducing dimension, it is recorded as
Figure 395508DEST_PATH_IMAGE026
Figure 329966DEST_PATH_IMAGE027
A global semantic vector for social media text.
According to the method and the device, the composite relation of all terms is constructed by using the quantum multi-volume wave function as the global semantic representation, the problem that the feature extraction capability of the text context is weakened due to sparse social media text data can be solved, the computing resources can be saved, and the tensor is greatly reduced
Figure 10000239251772
The loading time of (c).
On the basis of the above embodiment, the weight of each term in the social media text is a normalization result of each term in the word frequency or the inverse text frequency index of the social media text.
For example, if λ i The method represents the weight (namely the importance) of the ith term in the social media text in the whole text, the weight is the importance of one term in the whole text, and the weight can be the word frequency and can also be an inverse text frequency index, and the normalization condition needs to be met. Thus, λ i The normalization condition needs to be satisfied:
Figure 202293DEST_PATH_IMAGE029
on the basis of the foregoing embodiment, the determining a local semantic vector of the social media text based on the word vector of each of the plurality of terms and the weight of each of the plurality of terms in the social media text includes:
determining a conjugate transpose matrix of a word vector for each of the plurality of terms;
determining a local semantic vector of the social media text based on a conjugate transpose matrix of respective word vectors of the plurality of terms, the respective word vectors of the plurality of terms, and respective weights of the plurality of terms at the social media text.
In some embodiments, the local semantic vector of the social media text is a feature of a social media text word represented by a quantum overlay state. The concrete expression is as follows:
Figure 470464DEST_PATH_IMAGE030
wherein the content of the first and second substances,
Figure 259428DEST_PATH_IMAGE031
local semantic vector, λ, representing social media text i Representing the weight (i.e., importance) of the ith term in the social media text in its entire text.
Wherein the content of the first and second substances,
Figure 220431DEST_PATH_IMAGE032
the density matrix of the ith term in the social media text.
Figure 524373DEST_PATH_IMAGE033
Is t i Conjugate transpose matrix of (1), t i The vector is a quantum complex word vector of the ith term in the social media text.
In some embodiments, after the determining the local semantic vector of the social media text, the method further comprises: spatially aligning the local semantic vector with the global semantic vector. In this embodiment, considering that the space of the local semantic vector is different from that of the global semantic vector, and the space of the global semantic vector is larger than that of the local semantic vector, in order to facilitate subsequent calculation, the local semantic vector and the global semantic vector need to be spatially aligned.
In some embodiments, in order to spatially align the local semantic vector with the global semantic vector, the present embodiment uses a pre-trained first complex neural network to spatially align the local semantic vector, wherein the first complex neural network may be a pre-trained first complex neural network
Figure 596234DEST_PATH_IMAGE034
The method can also be replaced by a complex domain expansion network of neural networks such as CNN, LSTM and Transformer and the like and variants thereof.
The specific process is as follows:
Figure 505284DEST_PATH_IMAGE035
wherein the content of the first and second substances,
Figure 371609DEST_PATH_IMAGE036
is a local semantic vector of social media text,
Figure 631689DEST_PATH_IMAGE037
the local semantic vector after the spatial alignment is obtained.
On the basis of the foregoing embodiment, the determining, based on the global semantic vector and the local semantic vector, an emotion type corresponding to the social media text includes:
performing projection processing on the local semantic vector to the global semantic vector to obtain a projection result; and determining the emotion type corresponding to the social media text based on the projection result.
In some embodiments, the probability that the emotion type of the social media text is the ith emotion type is predicted through a pre-trained second complex neural network, wherein the second complex neural network can be
Figure 38400DEST_PATH_IMAGE038
The method can also be replaced by a complex domain expansion network of neural networks such as CNN, LSTM and Transformer and the like and variants thereof.
The specific process is as follows:
Figure 70466DEST_PATH_IMAGE039
wherein the content of the first and second substances,
Figure 842112DEST_PATH_IMAGE040
probability that the emotion type of the social media text is the ith emotion type,
Figure 589489DEST_PATH_IMAGE041
is a local semantic vector after the spatial alignment,
Figure 799890DEST_PATH_IMAGE042
a global semantic vector for social media text.
Figure 683532DEST_PATH_IMAGE043
Is the type i emotion, an
Figure 157239DEST_PATH_IMAGE044
An emotion type of the social media text predicted for the second complex neural network.
It is noted that, for simplicity of description, the foregoing method embodiments are described as a series of acts or combination of acts, but those skilled in the art will appreciate that the disclosed embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently with other steps in accordance with the disclosed embodiments. In addition, those skilled in the art can appreciate that the embodiments described in the specification all belong to alternative embodiments.
Fig. 3 is a schematic structural diagram of a social media text processing apparatus according to an embodiment of the present disclosure. The social media text processing device comprises: a word segmentation unit 31, a word vector determination unit 32, a global semantic determination unit 33, a local semantic determination unit 34, and a type determination unit 35.
The word segmentation unit 31 is configured to perform word segmentation processing on the social media text to obtain a plurality of terms;
a word vector determination unit 32, configured to determine, for any term, a word vector of the term based on semantics of the term in different application scenario contexts;
a global semantic determining unit 33, configured to determine a global semantic vector of the social media text based on a word vector of each of the plurality of terms;
a local semantic determining unit 34, configured to determine a local semantic vector of the social media text based on a word vector of each of the plurality of terms and a weight of each of the plurality of terms in the social media text;
a type determining unit 35, configured to determine, based on the global semantic vector and the local semantic vector, an emotion type corresponding to the social media text.
In some embodiments, the word vector determination unit 32 includes:
a first subunit 321, configured to determine, based on semantics of the term in different application scenario contexts, a base vector and a weight of each semantic, where elements in the base vector correspond to the semantics of the term in different application scenario contexts one to one;
a second subunit 322, configured to determine a word vector of the term based on the base vector and the weights of the semantics.
In some embodiments, the weight of each semantic is a complex-valued weight, and the word vector is a quantum complex word vector; the second subunit is configured to: and carrying out weighting processing on the basic vector and the complex value weight of each semantic to obtain the quantum complex word vector of the term.
In some embodiments, a global semantics determining unit to: determining a plurality of compound semantics based on respective word vectors of the plurality of terms; obtaining a probability of each of the pre-trained composite semantics; determining a global semantic vector for the social media text based on the plurality of compound semantics and the probability of each of the compound semantics.
In some embodiments, a global semantics determining unit to: determining a basis vector based on respective word vectors of M terms, the dimension of the basis vector being M N Dimension, N is the dimension of the word vector; each dimension of the base vector corresponds to a composite semantic; obtaining a pre-trained tensor, the dimension of the tensor being M N Dimension, N is the dimension of the word vector; the dimensions of each tensor represent the probability of a compound semantic; determining a global semantic vector for the social media text based on the basis vectors and the tensors.
In some embodiments, the global semantic determination unit is further configured to, prior to said determining the global semantic vector of the social media text based on the basis vector and the tensor: and carrying out dimensionality reduction on the basis vectors and the tensor.
In some embodiments, the weight of each of the plurality of terms in the social media text is a result of a normalization of each of the plurality of terms in a term frequency or an inverse text frequency index of the social media text.
In some embodiments, the local semantic determination unit is to: determining a conjugate transpose matrix of a word vector for each of the plurality of terms; determining a local semantic vector of the social media text based on a conjugate transpose matrix of respective word vectors of the plurality of terms, the respective word vectors of the plurality of terms, and respective weights of the plurality of terms at the social media text.
In some embodiments, the local semantic determining unit, after said determining the local semantic vector of the social media text, is further configured to: spatially aligning the local semantic vector with the global semantic vector.
In some embodiments, the type determining unit is configured to: performing projection processing on the local semantic vector to the global semantic vector to obtain a projection result; and determining the emotion type corresponding to the social media text based on the projection result.
In some embodiments, the division of each unit in the social media text processing device is only one logical function division, and there may be another division manner when the actual implementation is performed, for example, at least two units in the social media text processing device may be implemented as one unit; units in the social media text processing apparatus may also be divided into a plurality of sub-units. It will be understood that the various units or sub-units may be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application.
It should be noted that, for the effects and details of the social media text processing apparatus disclosed in the above embodiments, reference may be made to each embodiment of the social media text processing method, and details are not repeated in order to avoid repetition.
Embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, where the non-transitory computer-readable storage medium stores a program or an instruction, where the program or the instruction causes a computer to execute steps of various embodiments of a social media text processing method, and details are not repeated here to avoid repeated description.
Fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. Referring now in particular to fig. 4, there is shown a schematic block diagram of a computer device 400 suitable for use in implementing embodiments of the present disclosure. The computer device shown in fig. 4 is only an example and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
As shown in fig. 4, computer device 400 may include a processing means (e.g., central processor, graphics processor, etc.) 401 that may perform various appropriate actions and processes to implement social media text processing according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage 408 into a Random Access Memory (RAM) 403 to implement embodiments as described in this disclosure. In the RAM 403, various programs and data necessary for the operation of the computer apparatus 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the computer device 400 to communicate with other devices, either wirelessly or by wire, to exchange data.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart, thereby implementing the voice control method as described above. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 401.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Calculating appropriate media transmissions, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the computer device; or may exist separately and not be incorporated into the computer device.
The computer readable medium carries one or more programs which, when executed by the computing device, cause the computing device to:
performing word segmentation processing on the social media text to obtain a plurality of terms;
for any term, determining a word vector of the term based on semantics of the term in different application scene contexts;
determining a global semantic vector for the social media text based on a word vector for each of the plurality of terms;
determining a local semantic vector of the social media text based on a word vector of each of the plurality of terms and a weight of each of the plurality of terms in the social media text;
and determining the emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector.
Optionally, when the one or more programs are executed by the computer device, the computer device may also perform other steps described in the above embodiments.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. 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 some 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.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (11)

1. A method for processing social media text, the method comprising:
performing word segmentation processing on the social media text to obtain a plurality of terms;
for any term, determining a word vector of the term based on semantics of the term in different application scene contexts; each element in the word vector represents a semantic meaning, and each element in the word vector is relatively independent;
determining a global semantic vector for the social media text based on the respective word vectors of the plurality of terms;
determining a local semantic vector of the social media text based on a word vector of each of the plurality of terms and a weight of each of the plurality of terms in the social media text;
determining an emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector;
wherein determining a word vector for the term based on semantics of the term in different application context includes:
determining a basic vector and a weight of each semantic meaning based on the semantic meaning of the lexical item in different application scene contexts;
the weight of each semantic is a complex value weight, and the word vector is a quantum complex word vector;
weighting the basic vector of each semantic and the complex value weight of each semantic to obtain a quantum complex word vector of the lexical item;
the quantum complex word vector of the lexical item comprises two parts of quantum states of amplitude and complex phase, wherein the amplitude represents co-occurrence information of low-level words, and the phase represents the emergent meaning or polarity embodied when one word is combined with other words.
2. The method of claim 1, wherein determining a global semantic vector for the social media text based on the word vectors for each of the plurality of terms comprises:
determining a plurality of compound semantics based on respective word vectors of the plurality of terms;
obtaining a probability of each of the pre-trained composite semantics;
determining a global semantic vector for the social media text based on the plurality of compound semantics and the probability of each of the compound semantics.
3. The method of claim 2, wherein determining a global semantic vector for the social media text based on the word vectors for each of the plurality of terms comprises:
determining a basis vector based on respective word vectors of M terms, the dimension of the basis vector being M N Dimension, N is the dimension of the word vector; each dimension of the base vector corresponds to a composite semantic;
obtaining a pre-trained tensor, the dimension of the tensor being M N Dimension, N is the dimension of the word vector; the dimensions of each tensor represent the probability of a compound semantic;
determining a global semantic vector for the social media text based on the basis vectors and the tensors.
4. The method of claim 3, wherein prior to the determining a global semantic vector for the social media text based on the basis vectors and the tensor, the method further comprises:
and carrying out dimensionality reduction on the basis vectors and the tensor.
5. The method of claim 1, wherein the weight of each of the terms in the social media text is a result of normalizing each of the terms in a term frequency or an inverse text frequency index of the social media text.
6. The method of claim 1, wherein determining the local semantic vector of the social media text based on the word vector of each of the plurality of terms and the weight of each of the plurality of terms in the social media text comprises:
determining a conjugate transpose matrix of a word vector for each of the plurality of terms;
determining a local semantic vector of the social media text based on a conjugate transpose matrix of respective word vectors of the plurality of terms, the respective word vectors of the plurality of terms, and respective weights of the plurality of terms at the social media text.
7. The method of claim 6, wherein after the determining the local semantic vector of the social media text, the method further comprises:
spatially aligning the local semantic vector with the global semantic vector.
8. The method of claim 1, wherein determining the emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector comprises:
performing projection processing on the local semantic vector to the global semantic vector to obtain a projection result;
and determining the emotion type corresponding to the social media text based on the projection result.
9. An apparatus for processing social media text, the apparatus comprising:
the word segmentation unit is used for carrying out word segmentation processing on the social media text to obtain a plurality of terms;
the word vector determining unit is used for determining a word vector of any term based on the semanteme of the term in different application scene contexts; each element in the word vector represents a semantic meaning, and each element in the word vector is relatively independent;
a global semantic determining unit, configured to determine a global semantic vector of the social media text based on a word vector of each of the plurality of terms;
a local semantic determining unit, configured to determine a local semantic vector of the social media text based on a word vector of each of the plurality of terms and a weight of each of the plurality of terms in the social media text;
the type determining unit is used for determining the emotion type corresponding to the social media text based on the global semantic vector and the local semantic vector;
a word vector determination unit comprising:
the first subunit is used for determining a basic vector and a weight of each semantic based on the semantics of the term in different application scene contexts;
the weight of each semantic is a complex value weight, and the word vector is a quantum complex word vector;
the second subunit is used for carrying out weighting processing on the basic vector and the complex value weight of each semantic to obtain a quantum complex word vector of the term;
the quantum complex word vector of the term comprises two quantum states of amplitude and complex phase;
the amplitude represents the co-occurrence information of low-level words, and the phase represents the emergent meaning or polarity embodied when one word is combined with other words.
10. A computer device, comprising:
a memory;
a processor; and
a computer program;
wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method of any one of claims 1-8.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-8.
CN202210380446.6A 2022-04-12 2022-04-12 Social media text processing method, device and equipment and storage medium Active CN114462425B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210380446.6A CN114462425B (en) 2022-04-12 2022-04-12 Social media text processing method, device and equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210380446.6A CN114462425B (en) 2022-04-12 2022-04-12 Social media text processing method, device and equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114462425A CN114462425A (en) 2022-05-10
CN114462425B true CN114462425B (en) 2022-08-02

Family

ID=81418490

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210380446.6A Active CN114462425B (en) 2022-04-12 2022-04-12 Social media text processing method, device and equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114462425B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115221846A (en) * 2022-06-08 2022-10-21 华为技术有限公司 Data processing method and related equipment
CN117235630B (en) * 2023-11-15 2024-03-05 吉林大学 Intelligent disease area visual management system and method thereof

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180240157A1 (en) * 2017-02-17 2018-08-23 Wipro Limited System and a method for generating personalized multimedia content for plurality of users
CN107436942A (en) * 2017-07-28 2017-12-05 广州市香港科大霍英东研究院 Word embedding grammar, system, terminal device and storage medium based on social media
CN109101490B (en) * 2018-07-24 2021-04-27 山西大学 Factual implicit emotion recognition method and system based on fusion feature representation
CN109325124B (en) * 2018-09-30 2020-10-16 武汉斗鱼网络科技有限公司 Emotion classification method, device, server and storage medium
CN111353303B (en) * 2020-05-25 2020-08-25 腾讯科技(深圳)有限公司 Word vector construction method and device, electronic equipment and storage medium
CN113742481A (en) * 2021-07-14 2021-12-03 安徽师范大学 Social media big data-based travel stream emotion space-time change feature research method

Also Published As

Publication number Publication date
CN114462425A (en) 2022-05-10

Similar Documents

Publication Publication Date Title
CN111444340B (en) Text classification method, device, equipment and storage medium
US20220269707A1 (en) Method and system for analyzing entities
CN107491534B (en) Information processing method and device
CN112131366B (en) Method, device and storage medium for training text classification model and text classification
CN111274815B (en) Method and device for mining entity focus point in text
US9807473B2 (en) Jointly modeling embedding and translation to bridge video and language
CN111428010B (en) Man-machine intelligent question-answering method and device
CN114462425B (en) Social media text processing method, device and equipment and storage medium
CN113987147A (en) Sample processing method and device
Kejriwal et al. On detecting urgency in short crisis messages using minimal supervision and transfer learning
WO2023159767A1 (en) Target word detection method and apparatus, electronic device and storage medium
CN113505206B (en) Information processing method and device based on natural language reasoning and electronic equipment
CN110705255A (en) Method and device for detecting association relation between sentences
Aziguli et al. A robust text classifier based on denoising deep neural network in the analysis of big data
CN110457325B (en) Method and apparatus for outputting information
CN117290477A (en) Generating type building knowledge question-answering method based on secondary retrieval enhancement
CN113591490B (en) Information processing method and device and electronic equipment
CN112307738B (en) Method and device for processing text
US20230315990A1 (en) Text detection method and apparatus, electronic device, and storage medium
CN112926341A (en) Text data processing method and device
CN112101015B (en) Method and device for identifying multi-label object
Liu et al. Named entity recognition using a semi-supervised model based on bert and bootstrapping
CN113901789A (en) Gate-controlled hole convolution and graph convolution based aspect-level emotion analysis method and system
Moholkar et al. Deep ensemble approach for question answer system
CN117649117B (en) Treatment scheme determining method and device and computer equipment

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