CN114048288A - Fine-grained emotion analysis method and system, computer equipment and storage medium - Google Patents

Fine-grained emotion analysis method and system, computer equipment and storage medium Download PDF

Info

Publication number
CN114048288A
CN114048288A CN202111325245.8A CN202111325245A CN114048288A CN 114048288 A CN114048288 A CN 114048288A CN 202111325245 A CN202111325245 A CN 202111325245A CN 114048288 A CN114048288 A CN 114048288A
Authority
CN
China
Prior art keywords
vector
emotion
fine
feature
feature extraction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111325245.8A
Other languages
Chinese (zh)
Inventor
刘伟硕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Mininglamp Software System Co ltd
Original Assignee
Beijing Mininglamp Software System Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Mininglamp Software System Co ltd filed Critical Beijing Mininglamp Software System Co ltd
Priority to CN202111325245.8A priority Critical patent/CN114048288A/en
Publication of CN114048288A publication Critical patent/CN114048288A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language 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/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3346Query execution using probabilistic model
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2411Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Probability & Statistics with Applications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

The application relates to a fine-grained emotion analysis method, a fine-grained emotion analysis system, computer equipment and a storage medium, wherein the fine-grained emotion analysis method comprises the following steps: a vector acquisition step, namely inputting input text data into a shared network structure layer, acquiring a word vector, a word vector and a position vector according to the text data in the shared network structure layer, accordingly obtaining vector representation of the text data, and acquiring feature extraction vectors and emotion vectors according to the vector representation; an emotion probability vector acquisition step, namely inputting the feature extraction vector and the emotion vector into a non-shared network structure layer and outputting the emotion probability vector of the corresponding aspect; and acquiring the emotion label, namely acquiring the final emotion label according to the emotion probability vector. Semantic information acquired by a Bert model based on a self-attention mechanism and text features of sentence levels are obtained by performing feature extraction on the whole text sequence, and the recognition capability of the network structure on the facial emotion direction is enhanced.

Description

Fine-grained emotion analysis method and system, computer equipment and storage medium
Technical Field
The present application relates to the field of text sentiment analysis techniques in natural language processing, and in particular, to a fine-grained sentiment analysis method, system, computer device, and storage medium.
Background
At present, text comments (including social comments, news comments, commodity evaluations and the like) on the internet have academic value and commercial value, and the comments or the comments can be subjected to sentiment analysis to identify the sentiment attitude of a corresponding user to a certain event or commodity and the like, for example, a social platform and a news portal can utilize information after sentiment analysis to carry out targeted marketing and pushing on the user; the E-commerce platform can analyze attributes of various aspects of the commodity by utilizing an emotion analysis technology to obtain the evaluation of the consumers, so that the browsing time of other consumers is saved, and the evaluation of the commodity can be subjected to refined label display instead of simple good evaluation and poor evaluation.
Currently, emotion analysis can be divided into two types, namely coarse-grained type and fine-grained type according to the granularity of task attention objects, wherein the coarse-grained task attention objects are at a document level and a sentence level, and the fine-grained task attention objects are at an Aspect (Aspect) level, wherein the Aspect can be a word or a plurality of words.
However, the current fine-grained emotion analysis has the following problems that the emotion classification method based on the dictionary mainly calculates the distance between emotion words and attribute words and considers the influence of negative words and turning words, and the method is based on rules and is not enough for deep semantic mining of texts; the emotion classification method based on supervised learning mainly utilizes a text vectorization representation and deep learning network, aims at word information characteristics of a text, and aims at the insufficient utilization of the overall characteristics of the text, and all the problems can cause the emotion classification accuracy to be reduced.
At present, an effective solution is not provided aiming at low emotion classification accuracy in the related technology.
Disclosure of Invention
The embodiment of the application provides a fine-grained emotion analysis method, a fine-grained emotion analysis system, computer equipment and a storage medium, and the problem of low emotion classification accuracy in the related technology is at least solved by using sentence-level features and semantic information in aspect-level emotion analysis.
In a first aspect, an embodiment of the present application provides a fine-grained emotion analysis method, which is characterized by including the following steps:
a vector acquisition step, namely inputting input text data into a shared network structure layer, acquiring a word vector, a word vector and a position vector according to the text data in the shared network structure layer, accordingly obtaining vector representation of the text data, and acquiring feature extraction vectors and emotion vectors according to the vector representation;
an emotion probability vector acquisition step, namely inputting the feature extraction vector and the emotion vector into a non-shared network structure layer and outputting the emotion probability vector of the corresponding aspect;
and acquiring the emotion label, namely acquiring the final emotion label according to the emotion probability vector.
In some embodiments, the shared network structure layer at least includes a Bert layer and a TextCNN model, and the vector obtaining step specifically includes:
a vector representation obtaining step, namely establishing a word vector matrix, a word vector matrix and a position vector matrix corresponding to the dictionary, obtaining corresponding word vectors, word vectors and position vectors according to the text data, and obtaining vector representation of the text data according to the word vectors, the word vectors and the position vectors;
a feature extraction vector obtaining step, namely inputting vector representation into a pre-trained Bert model to obtain a feature extraction vector;
and acquiring the emotion vector, namely inputting the vector representation into the TextCNN model to obtain the emotion vector corresponding to the text data.
In some of these embodiments, the initialization of the parameters of the word vector matrix, and the position vector matrix in the step of obtaining the vector representation is random;
the vector representation is obtained by stitching the word vector, the word vector and the position vector.
In some embodiments, the manner of obtaining the feature extraction vector includes:
and training according to the pre-training task of the Bert model by using the existing data corpus to obtain the Bert model, and obtaining the Bert model according to the Bert model or directly obtaining the feature extraction vector of the Bert model by directly adopting an open-source Bert model service.
In some embodiments, the non-shared network fabric layer comprises a plurality of feature extractors, and the emotion probability vector obtaining step further comprises:
the method comprises the steps of designing a feature extractor, determining the number of aspects of fine-grained emotion analysis according to the number of tasks, and setting feature extractors with the same number as the number of aspects, wherein the feature extractors are identical in structure, parameters among the feature extractors are independent, and each feature extractor comprises an attention mechanism model and a multilayer perceptron;
a feature extraction step, wherein the attention mechanism model carries out feature extraction on the feature extraction vector and the emotion vector to obtain a feature vector;
and a step of obtaining the specific dimension emotion probability vector, which is to adjust the feature vector into the specific dimension emotion probability vector required by the task by using a multilayer perceptron.
In some embodiments, the emotion tag obtaining step further comprises:
and performing argmax function operation on the emotion probability vector to obtain the position number of the selected emotion probability, and accordingly combining a preset mapping relation to obtain a corresponding emotion label.
In a second aspect, an embodiment of the present application provides a fine-grained emotion analysis system, which is characterized by including:
the vector acquisition module is used for inputting input text data into a shared network structure layer, acquiring a word vector, a word vector and a position vector according to the text data in the shared network structure layer, accordingly obtaining vector representation of the text data, and acquiring feature extraction vectors and emotion vectors according to the vector representation; the emotion probability vector acquisition module is used for inputting the feature extraction vector and the emotion vector into a non-shared network structure layer and outputting the emotion probability vector of the corresponding aspect;
and the emotion tag acquisition module is used for acquiring a final emotion tag according to the emotion probability vector.
In some embodiments, the non-shared network fabric layer comprises a plurality of feature extractors, and the emotion probability vector acquisition module further comprises:
the characteristic extractor design unit is used for determining the number of aspects of fine-grained emotion analysis according to the number of tasks, setting the number of characteristic extractors which is the same as the number of the aspects, wherein the structure of the characteristic extractors is the same, parameters among the characteristic extractors are independent, and the characteristic extractors comprise attention mechanism models and multilayer perceptrons;
the feature extraction unit is used for extracting features of the feature extraction vector and the emotion vector by the attention mechanism model and obtaining a feature vector;
and the specific dimension emotion probability vector acquisition unit adjusts the feature vector into an emotion probability vector of a specific dimension required by the task by using the multilayer perceptron.
In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the fine-grained sentiment analysis method according to the first aspect is implemented.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the fine-grained sentiment analysis method according to the first aspect is implemented.
Compared with the related technology, the fine-grained emotion analysis method, the fine-grained emotion analysis system, the computer equipment and the storage medium provided by the embodiment of the application can be applied to the technical field of deep learning and can also be applied to the technical field of natural language processing, and the embodiment of the application has the following advantages and beneficial effects:
1. according to the invention, the self semantic features of the text are extracted through the pre-training model, and the sentence-level features of the text are extracted through the TextCNN model, so that a foundation is laid for extracting effective features in the aspect of fine-grained emotion.
2. Semantic information acquired by a Bert model based on a self-attention mechanism and text features of sentence levels are obtained by performing feature extraction on the whole text sequence, and the recognition capability of the network structure on the facial emotion direction is enhanced.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a flow diagram of a fine-grained sentiment analysis method according to an embodiment of the present application;
FIG. 2 is a flow diagram of a fine grain sentiment analysis method according to a preferred embodiment of the present application;
FIG. 3 is a preferred flow diagram of a fine-grained sentiment analysis method according to an embodiment of the present application;
FIG. 4 is a block diagram of a fine-grained sentiment analysis system according to an embodiment of the present application;
FIG. 5 is a block diagram of a network architecture according to an embodiment of the present application;
fig. 6 is a hardware structure diagram of a computer device according to an embodiment of the present application.
Wherein:
a vector acquisition module 1; an emotion probability vector acquisition module 2;
an emotion label acquisition module 3; a feature extractor design unit 21;
a feature extraction unit 22; a specific dimension emotion probability vector acquisition unit 23;
a vector representation acquisition unit 11; a feature extraction vector acquisition unit 12;
an emotion vector acquisition unit 13;
a processor 81; a memory 82; a communication interface 83; a bus 80.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
Aspect-based sentiment classification (ABSC) belongs to one of fine-grained sentiment analysis tasks and aims to find sentiment tendency related to entity Aspect (Aspect). The method improves the emotion classification accuracy of the model by using the sentence-level features and semantic information in aspect-level emotion analysis.
Based on this, the present embodiment provides a fine-grained emotion analysis method. Fig. 1 is a flowchart of a fine-grained sentiment analysis method according to an embodiment of the present application, and as shown in fig. 1, the flowchart includes the following steps:
a vector acquisition step S1, inputting the input text data into a shared network structure layer, acquiring a word vector, a word vector and a position vector according to the text data in the shared network structure layer, accordingly obtaining a vector representation of the text data, and acquiring a feature extraction vector and an emotion vector according to the vector representation;
an emotion probability vector obtaining step S2, wherein the feature extraction vector and the emotion vector are input into a non-shared network structure layer, and the emotion probability vector of the corresponding aspect is output;
and an emotion label acquisition step S3, acquiring a final emotion label according to the emotion probability vector.
Through the steps, by setting the shared network structure layer and the non-shared network structure layer, in the shared network structure layer, the word vector and the position vector are respectively obtained through input text data, vector representation of the whole text data is obtained, and then the feature extraction vector and the emotion vector are obtained, wherein the defect that the result is inaccurate due to the fact that the sequence of the words or the words is insensitive in the subsequent attention mechanism can be effectively overcome by increasing the obtaining of the position vector; in the non-shared network structure layer, the emotion probability vectors of multiple aspects can be obtained, and the final emotion label is obtained according to the preset rule, so that the identification capability of the whole network structure on the emotion directions of the aspects is improved.
In some embodiments, the shared network structure layer at least includes a Bert layer and a TextCNN model, and the vector obtaining step S1 specifically includes:
a vector representation obtaining step S11, establishing a word vector matrix, a word vector matrix and a position vector matrix corresponding to the dictionary, obtaining corresponding word vectors, word vectors and position vectors according to the text data, and obtaining the vector representation of the text data according to the word vectors, the word vectors and the position vectors;
exemplary, the process of establishing the word vector matrix, such as: the word "I" corresponds to 1, and the 1 st vector is taken out from the word vector matrix as the word vector of "I".
A feature extraction vector obtaining step S12, inputting the vector representation into a pre-trained Bert model to obtain a feature extraction vector;
and an emotion vector acquisition step S13, wherein the vector representation is input into the TextCNN model to obtain an emotion vector corresponding to the text data.
Through the steps, semantic information acquired by a Bert model based on a self-attention mechanism is utilized, and the text features of sentence levels are obtained by performing feature extraction on the whole text sequence, so that a foundation is laid for extracting effective features aiming at the aspect of fine-grained emotion, and the recognition capability of a network structure to the aspect of emotion directions is enhanced.
In some of these embodiments, the initialization of the parameters of the word vector matrix, and the position vector matrix in the step of obtaining the vector representation is random;
the vector representation is obtained by stitching the word vector, the word vector and the position vector.
In some embodiments, the manner of obtaining the feature extraction vector includes:
and training according to the pre-training task of the Bert model by using the existing data corpus to obtain the Bert model, and obtaining the Bert model according to the Bert model or directly obtaining the feature extraction vector of the Bert model by directly adopting an open-source Bert model service.
In some embodiments, the unshared network architecture layer includes a plurality of feature extractors, and the emotion probability vector obtaining step S2 further includes:
a feature extractor designing step S21, determining the number of aspects of fine-grained emotion analysis according to the number of tasks, and setting feature extractors with the same number as the number of aspects, wherein the feature extractors have the same structure, parameters among the feature extractors are independent, and each feature extractor comprises an attention mechanism model and a multilayer perceptron;
a feature extraction step S22, wherein the attention mechanism model performs feature extraction on the feature extraction vector and the emotion vector to obtain a feature vector;
and a specific dimension emotion probability vector acquisition step S23, wherein the feature vector is adjusted to be the specific dimension emotion probability vector required by the task by using a multilayer perceptron.
In some embodiments, the emotion tag obtaining step S3 further includes:
and performing argmax function operation on the emotion probability vector to obtain the position number of the selected emotion probability, and accordingly combining a preset mapping relation to obtain a corresponding emotion label.
The embodiments of the present application are described and illustrated below by means of preferred embodiments.
FIG. 2 is a flow chart of a fine-grained sentiment analysis method according to a preferred embodiment of the present application.
S201:
For an input text sequence, its word vector representation, word vector representation and word position vector representation are obtained, respectively. Establishing a word vector matrix corresponding to the dictionary, and taking out a corresponding word vector in the word vector matrix when processing the text sequence; the word vector and the position vector are obtained in a similar manner.
S202:
The three vector representations obtained in S201 are concatenated to obtain the vector representation of the input sequence.
S203:
And inputting the vector representation of the text sequence into a pre-trained Bert model to obtain a feature extraction vector T.
It should be noted that, in the training process of the Bert, the existing data corpus can be used, and the Bert model is obtained by training according to the pre-training task of the Bert model; or directly obtaining the word vector representation of the Bert model by adopting the open-source Bert model service (such as Bert-as-service).
S204:
The vector representation of the text sequence is input into the TextCNN model, resulting in an emotion vector S for the entire sequence.
It should be noted that the textCNN model is used as a representation of the whole emotion tendency of the text sequence in the forward propagation process, and the textCNN model is trained together with the whole model to optimize parameters and is not trained independently.
S205:
And establishing a feature extractor which is designed aiming at the aspect of fine-grained emotion analysis and has unshared parameters, wherein the feature extractor consists of an attention mechanism and a multilayer perceptron.
The attention mechanism performs characteristic extraction on a characteristic vector consisting of a characteristic extraction vector T and an emotion vector S, and then adjusts the vector output by the attention mechanism into an emotion probability vector with a specific dimension required by a composite task by using a multilayer perceptron.
S206:
Setting an aspect number i aiming at fine-grained emotion analysis, and respectively designing i feature extractors with the same structure but unshared parameters.
It should be noted that the number of aspects i depends on the specific task, and for example, the task requires emotion analysis divided into three aspects of price, quality, and experience, so the number of aspects i is equal to 3.
S207:
The feature extraction vector T and the emotion vector S are input to all feature extractors.
S208:
And obtaining the emotion probability vector of the corresponding aspect according to the output of each feature extractor.
S209:
And obtaining a final emotion label according to the emotion probability vectors of all aspects.
The method comprises the following specific steps: and after argmax operation is carried out on the emotion probability vector, obtaining a corresponding emotion label according to the obtained position number and the mapping relation.
Illustratively, when the emotion vector [0.1,0.1,0.8], argmax operation results in a position number of 2.
It should be noted that the mapping relationship may be determined manually or obtained through an external model.
Fig. 3 is a preferred flowchart of a fine-grained emotion analysis method according to an embodiment of the present application, and as shown in fig. 3, the fine-grained emotion analysis method includes the following steps:
s301, the E-commerce comments are arranged into text data to obtain corresponding word vectors, word vectors and position vectors, and the feature vectors of the E-commerce comments are obtained through splicing;
s302, training a Bert model according to relevant data of the E-commerce comment corresponding to the product field, inputting the feature vector obtained in S301 into the Bert model to obtain a feature extraction vector, and inputting the feature vector obtained in S301 into a TextCNN model to obtain an emotion vector;
s303, inputting the feature extraction vector and the emotion vector obtained in the S302 into an attention mechanism model and a multilayer perceptron to obtain a corresponding emotion probability vector;
and S304, obtaining a final emotion probability according to the emotion probability vector and an argmax function, and obtaining a final emotion label through a preset mapping relation.
Through the steps, the emotion analysis of the fine granularity of the comment text is realized, the text semantics are deeply mined, and reasonable user portrait and in-depth analysis of products are established.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.
The embodiment also provides a fine-grained emotion analysis system, and the apparatus is used for implementing the above embodiments and preferred embodiments, and the details of which have been already described are omitted. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 4 is a block diagram of a fine-grained sentiment analysis system according to an embodiment of the present application, and as shown in fig. 4, the system includes:
the vector acquisition module 1 is used for inputting input text data into a shared network structure layer, acquiring a word vector, a word vector and a position vector according to the text data in the shared network structure layer, accordingly obtaining vector representation of the text data, and acquiring feature extraction vectors and emotion vectors according to the vector representation;
the emotion probability vector acquisition module 2 is used for inputting the feature extraction vector and the emotion vector into a non-shared network structure layer and outputting the emotion probability vector in the corresponding aspect;
and the emotion tag acquisition module 3 is used for acquiring a final emotion tag according to the emotion probability vector.
In some embodiments, the unshared network architecture layer includes a plurality of feature extractors, and the emotion probability vector obtaining module 2 further includes:
the feature extractor design unit 21 is used for determining the number of aspects of fine-grained emotion analysis according to the number of tasks, setting feature extractors with the same number as the number of aspects, wherein the feature extractors are identical in structure, parameters among the feature extractors are independent, and each feature extractor comprises an attention mechanism model and a multilayer perceptron;
the feature extraction unit 22 is used for extracting features of the feature extraction vector and the emotion vector by the attention mechanism model and obtaining a feature vector;
the specific dimension emotion probability vector acquisition unit 23 adjusts the feature vector to an emotion probability vector of a specific dimension required by the task using the multi-layer perceptron.
In some embodiments, the shared network structure layer at least includes a Bert layer and a TextCNN model, and the vector obtaining module 1 specifically includes:
the vector representation obtaining unit 11 is used for establishing a word vector matrix, a word vector matrix and a position vector matrix corresponding to the dictionary, obtaining corresponding word vectors, word vectors and position vectors according to the text data, and obtaining vector representation of the text data according to the word vectors, the word vectors and the position vectors;
the feature extraction vector acquisition unit 12 is used for inputting the vector representation into a pre-trained Bert model to acquire a feature extraction vector;
the emotion vector acquisition unit 13 inputs the vector representation to the TextCNN model, and obtains an emotion vector corresponding to the text data.
In some embodiments, the initialization of the parameters of the word vector matrix, the word vector matrix and the position vector matrix in the vector representation obtaining unit is random;
the vector representation is obtained by stitching the word vector, the word vector and the position vector.
In some embodiments, the obtaining of the feature extraction vector includes using an existing data corpus, training according to a pre-training task of the Bert model to obtain the Bert model, and obtaining according to the Bert model, or directly obtaining the feature extraction vector of the Bert model by directly adopting an open-source Bert model service.
In some embodiments, the emotion tag acquisition module 3 performs argmax function operation on the emotion probability vector to obtain a position number of the selected emotion probability, and accordingly obtains a corresponding emotion tag by combining a preset mapping relationship.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
The fine-grained emotion analysis system corresponds to a network structure, and a structural block diagram of the network structure is shown in fig. 5 and comprises the following steps;
share Layers including Bert models and TextCNN models, and Aspect Layers including feature extractors including Attention & MLP, with no inter-parameter communication between feature extractors.
Obtaining a feature vector according to the text sequence, inputting the feature vector into a sharing layer, obtaining a plurality of feature extraction vectors Ti (i is 1, 2., n) through a Bert model, obtaining an emotion vector S through a TextCNN model, sequentially inputting all the feature extraction vectors and the emotion vector into each feature extractor, and obtaining emotion probabilities corresponding to each direction through the feature extractors in each direction.
In addition, the fine-grained emotion analysis method described in conjunction with fig. 1 in the embodiment of the present application may be implemented by a computer device. Fig. 6 is a hardware structure diagram of a computer device according to an embodiment of the present application.
The computer device may comprise a processor 81 and a memory 82 in which computer program instructions are stored.
Specifically, the processor 81 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
Memory 82 may include, among other things, mass storage for data or instructions. By way of example, and not limitation, memory 82 may include a Hard Disk Drive (Hard Disk Drive, abbreviated to HDD), a floppy Disk Drive, a Solid State Drive (SSD), flash memory, an optical Disk, a magneto-optical Disk, tape, or a Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 82 may include removable or non-removable (or fixed) media, where appropriate. The memory 82 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 82 is a Non-Volatile (Non-Volatile) memory. In particular embodiments, Memory 82 includes Read-Only Memory (ROM) and Random Access Memory (RAM). The ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), Electrically rewritable ROM (EAROM), or FLASH Memory (FLASH), or a combination of two or more of these, where appropriate. The RAM may be a Static Random-Access Memory (SRAM) or a Dynamic Random-Access Memory (DRAM), where the DRAM may be a Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), an Extended data output Dynamic Random-Access Memory (EDODRAM), a Synchronous Dynamic Random-Access Memory (SDRAM), and the like.
The memory 82 may be used to store or cache various data files for processing and/or communication use, as well as possible computer program instructions executed by the processor 81.
The processor 81 reads and executes the computer program instructions stored in the memory 82 to implement any of the fine-grained emotion analysis methods in the above embodiments.
In some of these embodiments, the computer device may also include a communication interface 83 and a bus 80. As shown in fig. 6, the processor 81, the memory 82, and the communication interface 83 are connected via the bus 80 to complete communication therebetween.
The communication interface 83 is used for implementing communication between modules, devices, units and/or equipment in the embodiment of the present application. The communication port 83 may also be implemented with other components such as: the data communication is carried out among external equipment, image/data acquisition equipment, a database, external storage, an image/data processing workstation and the like.
Bus 80 includes hardware, software, or both to couple the components of the computer device to each other. Bus 80 includes, but is not limited to, at least one of the following: data Bus (Data Bus), Address Bus (Address Bus), Control Bus (Control Bus), Expansion Bus (Expansion Bus), and Local Bus (Local Bus). By way of example, and not limitation, Bus 80 may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (Front Side Bus), an FSB (FSB), a Hyper Transport (HT) Interconnect, an ISA (ISA) Bus, an Infini Band Interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a microchannel Architecture (MCA) Bus, a PCI (Peripheral Component Interconnect) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a Video Electronics Bus (audio Electronics Association), abbreviated VLB) bus or other suitable bus or a combination of two or more of these. Bus 80 may include one or more buses, where appropriate. Although specific buses are described and shown in the embodiments of the application, any suitable buses or interconnects are contemplated by the application.
The computer device can execute the vector obtaining step, the emotion probability vector obtaining step and the emotion tag obtaining step in the embodiment of the present application based on the text data, thereby implementing the fine-grained emotion analysis method described in conjunction with fig. 1.
In addition, in combination with the fine-grained emotion analysis method in the foregoing embodiments, the present application embodiment may provide a computer-readable storage medium to implement. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the fine-grained sentiment analysis methods of the above embodiments.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A fine-grained emotion analysis method is characterized by comprising the following steps:
a vector acquisition step, namely inputting input text data into a shared network structure layer, acquiring a word vector, a word vector and a position vector according to the text data in the shared network structure layer, acquiring vector representation of the text data according to the word vector and the position vector, and acquiring a feature extraction vector and an emotion vector according to the vector representation;
an emotion probability vector obtaining step, namely inputting the feature extraction vector and the emotion vector into a non-shared network structure layer, and outputting the emotion probability vector of the corresponding aspect;
and acquiring an emotion label, namely acquiring a final emotion label according to the emotion probability vector.
2. The fine-grained emotion analysis method of claim 1, wherein the shared network structure layer at least includes a Bert layer and a TextCNN model, and the vector acquisition step specifically includes:
a vector representation obtaining step, namely establishing a word vector matrix, a word vector matrix and a position vector matrix corresponding to the dictionary, obtaining corresponding word vectors, word vectors and position vectors according to the text data, and obtaining vector representation of the text data according to the word vectors, the word vectors and the position vectors;
a feature extraction vector obtaining step, namely inputting the vector representation into the Bert model trained in advance to obtain a feature extraction vector;
and obtaining an emotion vector, namely inputting the vector representation to the TextCNN model to obtain the emotion vector corresponding to the text data.
3. The fine grain emotion analysis method of claim 2, wherein initialization of parameters of the word vector matrix, and the position vector matrix in the vector representation acquisition step is random;
and splicing the word vector, the word vector and the position vector to obtain the vector representation.
4. The fine-grained emotion analysis method according to claim 2 or 3, wherein the feature extraction vector is obtained in a manner including:
and training according to a pre-training task of the Bert model by using the existing data corpus to obtain the Bert model, and obtaining according to the Bert model or directly obtaining the feature extraction vector of the Bert model by directly adopting an open-source Bert model service.
5. The fine grain emotion analysis method of claim 1, wherein the unshared network fabric layer comprises a plurality of feature extractors, and the emotion probability vector obtaining step further comprises:
the method comprises the steps of designing a feature extractor, determining the number of aspects of fine-grained emotion analysis according to the number of tasks, and setting the feature extractors with the same number as the number of the aspects, wherein the feature extractors have the same structure, parameters of the feature extractors are independent, and the feature extractor comprises an attention mechanism model and a multilayer perceptron;
a feature extraction step, wherein the attention mechanism model performs feature extraction on the feature extraction vector and the emotion vector to obtain a feature vector;
and a specific dimension emotion probability vector obtaining step, namely adjusting the feature vector to the emotion probability vector of the specific dimension required by the task by utilizing the multilayer perceptron.
6. The fine-grained emotion analysis method of claim 1, wherein the emotion tag acquisition step further comprises:
and performing argmax function operation on the emotion probability vector to obtain a position number of the selected emotion probability, and obtaining the corresponding emotion label by combining a preset mapping relation.
7. A fine-grained sentiment analysis system, comprising:
the system comprises a vector acquisition module, a character extraction module and a sentiment extraction module, wherein the vector acquisition module is used for inputting input text data to a shared network structure layer, acquiring a character vector, a word vector and a position vector according to the text data in the shared network structure layer, acquiring vector representation of the text data according to the character vector, the word vector and the position vector, and acquiring a feature extraction vector and a sentiment vector according to the vector representation; the emotion probability vector acquisition module is used for inputting the feature extraction vector and the emotion vector into a non-shared network structure layer and outputting the emotion probability vector of the corresponding aspect;
and the emotion label acquisition module is used for acquiring a final emotion label according to the emotion probability vector.
8. The fine grain emotion analysis system of claim 7, wherein the unshared network fabric layer comprises a plurality of feature extractors, and the emotion probability vector acquisition module further comprises:
the characteristic extractor design unit is used for determining the number of aspects of fine-grained emotion analysis according to the number of tasks, setting the characteristic extractors with the same number as the number of the aspects, wherein the characteristic extractors have the same structure, the parameters of the characteristic extractors are independent, and each characteristic extractor comprises an attention mechanism model and a multilayer perceptron;
the attention mechanism model is used for extracting the features of the feature extraction vector and the emotion vector to obtain a feature vector;
and the specific dimension emotion probability vector acquisition unit adjusts the feature vector into the emotion probability vector of a specific dimension required by the task by utilizing the multilayer perceptron.
9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the fine grain sentiment analysis method of any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the fine-grained sentiment analysis method according to any one of claims 1 to 6.
CN202111325245.8A 2021-11-10 2021-11-10 Fine-grained emotion analysis method and system, computer equipment and storage medium Pending CN114048288A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111325245.8A CN114048288A (en) 2021-11-10 2021-11-10 Fine-grained emotion analysis method and system, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111325245.8A CN114048288A (en) 2021-11-10 2021-11-10 Fine-grained emotion analysis method and system, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114048288A true CN114048288A (en) 2022-02-15

Family

ID=80207914

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111325245.8A Pending CN114048288A (en) 2021-11-10 2021-11-10 Fine-grained emotion analysis method and system, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114048288A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115329775A (en) * 2022-10-14 2022-11-11 成都晓多科技有限公司 Method and system for joint recognition of aspect category and emotion polarity in statement
CN117540725A (en) * 2024-01-05 2024-02-09 摩尔线程智能科技(北京)有限责任公司 Aspect-level emotion analysis method and device, electronic equipment and storage medium

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110334210A (en) * 2019-05-30 2019-10-15 哈尔滨理工大学 A kind of Chinese sentiment analysis method merged based on BERT with LSTM, CNN
US20200073937A1 (en) * 2018-08-30 2020-03-05 International Business Machines Corporation Multi-aspect sentiment analysis by collaborative attention allocation
CN111339255A (en) * 2020-02-26 2020-06-26 腾讯科技(深圳)有限公司 Target emotion analysis method, model training method, medium, and device
CN111460807A (en) * 2020-03-13 2020-07-28 平安科技(深圳)有限公司 Sequence labeling method and device, computer equipment and storage medium
CN111475615A (en) * 2020-03-12 2020-07-31 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) Fine-grained emotion prediction method, device and system for emotion enhancement and storage medium
CN111680154A (en) * 2020-04-13 2020-09-18 华东师范大学 Comment text attribute level emotion analysis method based on deep learning
CN111881260A (en) * 2020-07-31 2020-11-03 安徽农业大学 Neural network emotion analysis method and device based on aspect attention and convolutional memory
CN111881291A (en) * 2020-06-19 2020-11-03 山东师范大学 Text emotion classification method and system
CN112559683A (en) * 2020-12-11 2021-03-26 苏州元启创人工智能科技有限公司 Multi-mode data and multi-interaction memory network-based aspect-level emotion analysis method
WO2021072852A1 (en) * 2019-10-16 2021-04-22 平安科技(深圳)有限公司 Sequence labeling method and system, and computer device
CN112860888A (en) * 2021-01-26 2021-05-28 中山大学 Attention mechanism-based bimodal emotion analysis method
CN113033215A (en) * 2021-05-18 2021-06-25 华南师范大学 Emotion detection method, device, equipment and storage medium
WO2021135446A1 (en) * 2020-06-19 2021-07-08 平安科技(深圳)有限公司 Text classification method and apparatus, computer device and storage medium
CN113536773A (en) * 2021-07-20 2021-10-22 北京明略软件系统有限公司 Commodity comment sentiment analysis method and system, electronic equipment and storage medium
CN113535897A (en) * 2021-06-30 2021-10-22 杭州电子科技大学 Fine-grained emotion analysis method based on syntactic relation and opinion word distribution

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200073937A1 (en) * 2018-08-30 2020-03-05 International Business Machines Corporation Multi-aspect sentiment analysis by collaborative attention allocation
CN110334210A (en) * 2019-05-30 2019-10-15 哈尔滨理工大学 A kind of Chinese sentiment analysis method merged based on BERT with LSTM, CNN
WO2021072852A1 (en) * 2019-10-16 2021-04-22 平安科技(深圳)有限公司 Sequence labeling method and system, and computer device
CN111339255A (en) * 2020-02-26 2020-06-26 腾讯科技(深圳)有限公司 Target emotion analysis method, model training method, medium, and device
CN111475615A (en) * 2020-03-12 2020-07-31 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) Fine-grained emotion prediction method, device and system for emotion enhancement and storage medium
CN111460807A (en) * 2020-03-13 2020-07-28 平安科技(深圳)有限公司 Sequence labeling method and device, computer equipment and storage medium
WO2021179570A1 (en) * 2020-03-13 2021-09-16 平安科技(深圳)有限公司 Sequence labeling method and apparatus, and computer device and storage medium
CN111680154A (en) * 2020-04-13 2020-09-18 华东师范大学 Comment text attribute level emotion analysis method based on deep learning
WO2021135446A1 (en) * 2020-06-19 2021-07-08 平安科技(深圳)有限公司 Text classification method and apparatus, computer device and storage medium
CN111881291A (en) * 2020-06-19 2020-11-03 山东师范大学 Text emotion classification method and system
CN111881260A (en) * 2020-07-31 2020-11-03 安徽农业大学 Neural network emotion analysis method and device based on aspect attention and convolutional memory
CN112559683A (en) * 2020-12-11 2021-03-26 苏州元启创人工智能科技有限公司 Multi-mode data and multi-interaction memory network-based aspect-level emotion analysis method
CN112860888A (en) * 2021-01-26 2021-05-28 中山大学 Attention mechanism-based bimodal emotion analysis method
CN113033215A (en) * 2021-05-18 2021-06-25 华南师范大学 Emotion detection method, device, equipment and storage medium
CN113535897A (en) * 2021-06-30 2021-10-22 杭州电子科技大学 Fine-grained emotion analysis method based on syntactic relation and opinion word distribution
CN113536773A (en) * 2021-07-20 2021-10-22 北京明略软件系统有限公司 Commodity comment sentiment analysis method and system, electronic equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
刘思琴;冯胥睿瑞;: "基于BERT的文本情感分析", 信息安全研究, no. 03, 5 March 2020 (2020-03-05) *
宋婷;陈战伟;: "基于方面情感的层次化双注意力网络", 信息技术与网络安全, no. 06, 10 June 2020 (2020-06-10) *
赵晓铮: "基于Attention机制的短文本情感分类方法研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 March 2020 (2020-03-15) *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115329775A (en) * 2022-10-14 2022-11-11 成都晓多科技有限公司 Method and system for joint recognition of aspect category and emotion polarity in statement
CN115329775B (en) * 2022-10-14 2023-03-24 成都晓多科技有限公司 Method and system for joint recognition of aspect category and emotion polarity in statement
CN117540725A (en) * 2024-01-05 2024-02-09 摩尔线程智能科技(北京)有限责任公司 Aspect-level emotion analysis method and device, electronic equipment and storage medium
CN117540725B (en) * 2024-01-05 2024-03-22 摩尔线程智能科技(北京)有限责任公司 Aspect-level emotion analysis method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US9766868B2 (en) Dynamic source code generation
US9619209B1 (en) Dynamic source code generation
CN108932320B (en) Article searching method and device and electronic equipment
EP3872652B1 (en) Method and apparatus for processing video, electronic device, medium and product
WO2020147409A1 (en) Text classification method and apparatus, computer device, and storage medium
CN110187780B (en) Long text prediction method, long text prediction device, long text prediction equipment and storage medium
CN114048288A (en) Fine-grained emotion analysis method and system, computer equipment and storage medium
CN113722438B (en) Sentence vector generation method and device based on sentence vector model and computer equipment
CN115982376B (en) Method and device for training model based on text, multimode data and knowledge
US11516159B2 (en) Systems and methods for providing a comment-centered news reader
US10699078B2 (en) Comment-centered news reader
CN114722292A (en) Book searching method, device, equipment and storage medium
CN108874786B (en) Machine translation method and device
CN116561320A (en) Method, device, equipment and medium for classifying automobile comments
US20230052110A1 (en) System and method for text moderation via pretrained transformers
CN108021609B (en) Text emotion classification method and device, computer equipment and storage medium
CN113792232B (en) Page feature calculation method, page feature calculation device, electronic equipment, page feature calculation medium and page feature calculation program product
CN114564581A (en) Text classification display method, device, equipment and medium based on deep learning
CN113536773A (en) Commodity comment sentiment analysis method and system, electronic equipment and storage medium
CN112035622A (en) Integrated platform and method for natural language processing
CN109145312A (en) A kind of machine translation method based on L2 cache, device, medium and electronic equipment
KR20210039907A (en) Method for calculating for weight score using appearance rate of word
CN112651413B (en) Integrated learning classification method, device, equipment and storage medium for hypo-custom graph
CN107329953A (en) The processing method and electronic equipment of natural language corpus data
CN113762381B (en) Emotion classification method, system, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination