Canteen evaluation sentiment analysis method, system and equipment and storage medium

Through a canteen evaluation emotion analysis method combining pre-trained language model, a two-way gated recurrent unit network and a two-layer attention mechanism, the problem of insufficient flexibility and accuracy in the existing technology is solved, and efficient and accurate emotions are achieved. Analysis reduces dependence on labeled data and emotional dictionary.

CN119476210APending Publication Date: 2025-02-18CHINA TELECOM DIGITAL INTELLIGENCE TECH CO LTD HEBEI BRANCH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411583653.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The existing emotion analysis methods for canteen evaluation are insufficient in terms of flexibility and accuracy, especially the need for a large amount of labeled data for model training and tuning, and the results are affected by the degree of perfection of the emotional dictionary.

Method used

A canteen evaluation sentiment analysis method is adopted, by obtaining the text data of canteen dining feedback, emotional polarity annotation and vectorization processing is performed, and feature extraction is performed using pre-trained language model and bidirectional gated recurrent unit network, combined with double-layer attention The mechanism calculates the weights of sentences and characters, and ultimately uses a classifier to classify emotions.

Benefits of technology

It realizes flexible and accurate canteen evaluation sentiment analysis without relying on a large amount of labeled data, reducing the requirements for emotional dictionary integrity, and improving the accuracy and adaptability of the analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119476210A_ABST
    Figure CN119476210A_ABST
Patent Text Reader

Abstract

The invention provides a canteen evaluation sentiment analysis method, system and device and a storage medium, and relates to the field of text data analysis. The method comprises the following steps: acquiring first text data containing dining feedback information of a canteen; performing emotional polarity labeling on the first text data to obtain second text data; performing vectorization processing on the second text data by utilizing a pre-training language model to obtain text vector data; performing feature extraction on the text vector data by using a bidirectional gating loop unit network, and calculating the weight of each sentence and character for sentiment classification in combination with a double-layer attention mechanism to obtain text feature data; and performing sentiment classification on the text feature data by utilizing the classifier, and generating a sentiment analysis report according to a sentiment classification result. According to the scheme, canteen evaluation sentiment analysis can be flexibly and accurately carried out without the help of a large number of labeled data sets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of text data analysis, and more specifically, to a canteen evaluation sentiment analysis method, system, device and storage medium. Background Art

[0002] As canteen service quality is increasingly valued, user feedback has become an indispensable key indicator for evaluating its performance. However, a major challenge facing canteen managers is how to efficiently and accurately extract users' emotional tendencies from huge and unstructured text feedback.

[0003] At present, sentiment analysis of canteen reviews mainly relies on two methods: sentiment dictionary-based methods and machine learning-based technologies. The former does not require manual annotation of samples and is convenient to implement, but its results are limited by the degree of perfection of the sentiment dictionary. Most existing Chinese sentiment dictionaries have problems such as insufficient sentiment vocabulary, lack of professional vocabulary, and insufficient consideration of context, which affects the flexibility of analysis.

[0004] In contrast, sentiment analysis methods based on machine learning show greater flexibility and can optimize analysis results by adjusting parameters to better adapt to actual conditions. However, the limitation of this method is that it requires a large amount of high-quality annotated data sets for model training and tuning, and its learning effect is directly affected by data quality.

[0005] Therefore, there is an urgent need for a sentiment analysis method that can combine the advantages of both, ensuring that the flexibility and accuracy of machine learning can be utilized while effectively reducing the dependence on large amounts of labeled data, thereby achieving efficient and accurate sentiment analysis of canteen reviews. Summary of the invention

[0006] The purpose of this application is to provide a canteen evaluation sentiment analysis method, system, device and storage medium, which can flexibly and accurately perform canteen evaluation sentiment analysis without the need for a large number of labeled data sets.

[0007] This application is implemented as follows:

[0008] In a first aspect, the present application provides a canteen evaluation sentiment analysis method, comprising the following steps: obtaining first text data containing canteen dining feedback information; performing sentiment polarity annotation on the first text data to obtain second text data; performing vectorization processing on the second text data using a pre-trained language model to obtain text vector data; performing feature extraction on the text vector data using a bidirectional gated recurrent unit network, and calculating the weight of each sentence and character for sentiment classification in combination with a double-layer attention mechanism to obtain text feature data; performing sentiment classification on the text feature data using a classifier, and generating a sentiment analysis report based on the sentiment classification results.

[0009] In some implementations, before the sentiment polarity is labeled on the first text data, the method also includes: performing data cleaning on the first text data, and adjusting the data after the data cleaning to a standard format; wherein the data cleaning includes non-text data cleaning, removing useless symbols, removing meaningless text, removing field string letters or data, and removing repeated text.

[0010] In some implementations, the method of using a pre-trained language model to vectorize the second text data to obtain text vector data includes: using a RoBERTa model to vectorize the second text data to combine the sentence vector and the character vector to obtain a final vector representation, thereby obtaining corresponding text vector data based on the final vector representation.

[0011] In some implementations, the dual-layer attention mechanism includes a sentence-level attention mechanism and a character-level attention mechanism to respectively calculate the weight values ​​of sentences and characters for sentiment classification.

[0012] In some implementations, the method uses a bidirectional gated recurrent unit network to perform feature extraction on text vector data, and combines a two-layer attention mechanism to calculate the weight of each sentence and character for sentiment classification to obtain text feature data, including: inputting the text vector data into a bidirectional gated recurrent unit network for multi-segment feature extraction, capturing the characteristic information of the sentence, and applying an attention mechanism to the sentence to calculate the weight value of the sentence for sentiment classification to obtain a corresponding sentence vector; inputting the sentence vector into a bidirectional gated recurrent unit network for feature privilege, capturing the characteristic information of the character, and applying an attention mechanism to the character to calculate the weight of each character in the sentence and its representation to obtain a corresponding character vector; and obtaining the corresponding text feature data based on the sentence vector and the character vector.

[0013] In some implementations, the calculation formula in the step of inputting the text vector data into the bidirectional gated recurrent unit network to extract multiple segments of features, capture the characteristic information of the sentence, and apply the attention mechanism to the sentence includes:

[0014] H ij =tanh(W x G ij +b x )

[0015]

[0016] Among them, H ij Represents a single-layer perceptron for G ij The implicit representation of W x represents the weight matrix, b x represents the bias, Ux Refers to the context vector, which can be obtained by initialization and is a parameter of the model, α ij It means H ij with U x The weight of the similarity, G ij is the output vector of the previous BiGRU neural network layer, D i refers to the corresponding sentence vector, the superscript T represents the matrix transpose, and the subscripts i, j, and x are the corresponding index variables.

[0017] In some implementations, the calculation formula in the step of inputting the sentence vector into the bidirectional gated recurrent unit network for feature privilege, capturing the feature information of the characters, and applying the attention mechanism to the characters includes:

[0018]

[0019] Among them, M i is the current hidden state of the bidirectional gated recurrent unit network, is the forward hidden state of the bidirectional gated recurrent unit network, is the reverse hidden state of the bidirectional gated recurrent unit network, To encode the corresponding word vector into the forward GRU hidden layer representation, To encode the corresponding word vector into the reverse GRU hidden layer representation, D i refers to the corresponding sentence vector, and the subscript i is the corresponding index variable.

[0020] In a second aspect, the present application provides a canteen evaluation sentiment analysis system, which includes:

[0021] A data acquisition module is used to acquire first text data containing cafeteria dining feedback information; a sentiment polarity labeling module is used to label the first text data with sentiment polarity to obtain second text data; a vectorization processing module is used to use a pre-trained language model to vectorize the second text data to obtain text vector data; a feature extraction module is used to use a bidirectional gated recurrent unit network to extract features from the text vector data, and combine a double-layer attention mechanism to calculate the weight of each sentence and character for sentiment classification to obtain text feature data; a sentiment classification module is used to use a classifier to perform sentiment classification on the text feature data, and generate a sentiment analysis report based on the sentiment classification results.

[0022] In a third aspect, the present application provides an electronic device, comprising a memory for storing one or more programs; a processor; when the one or more programs are executed by the processor, a method as described in any one of the first aspects is implemented.

[0023] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method as described in any one of the above-mentioned first aspects.

[0024] Compared with the prior art, the present invention has at least the following advantages or beneficial effects:

[0025] This application proposes a method for sentiment analysis of cafeteria reviews. By introducing a pre-trained language model and using the semantic knowledge learned from a large amount of text data, the text is converted into a vector representation rich in semantic information. This process does not need to rely on a specific sentiment dictionary, thereby reducing the requirements for dictionary completeness. At the same time, the bidirectional gated recurrent unit network is used to extract features from text vector data, which can capture both forward and backward information in the text, avoiding the problem of gradient vanishing or exploding that is prone to occur when processing long texts. Moreover, by combining a two-layer attention mechanism, this application can further weight key sentences and characters in the text, making feature extraction more accurate, which is beneficial to subsequent sentiment classification tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 This is a flow chart of an embodiment of a canteen evaluation sentiment analysis method of the present application;

[0028] Figure 2 This is a structural diagram of an embodiment of a cafeteria evaluation sentiment analysis system of the present application;

[0029] Figure 3 A structural block diagram of an electronic device provided in an embodiment of the present application.

[0030] Icon: 101, data acquisition module; 102, sentiment polarity labeling module; 103, vectorization processing module; 104, feature extraction module; 105, sentiment classification module; 201, processor; 202, memory; 203, communication interface. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0032] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0033] Example 1

[0034] In today's society, as people's requirements for quality of life continue to improve, canteen service quality has become a focus of attention for major institutions, schools and enterprises. User feedback is a window that directly reflects the canteen service level, and its importance is self-evident. However, faced with massive, unstructured text feedback data, how to efficiently and accurately extract users' emotional tendencies has become a major problem facing canteen managers.

[0035] In the prior art, there are mainly two types of sentiment analysis methods based on sentiment dictionaries and based on machine learning to deal with this problem. However, although the former is convenient, it is limited by the perfection of the dictionary, and the latter is flexible but requires a large amount of labeled data. The inventors found through analysis that both methods are difficult to meet the needs of canteen managers for efficient and accurate sentiment analysis. In order to overcome these problems, the embodiment of the present application proposes a canteen evaluation sentiment analysis method, which does not require the help of a large number of labeled data sets, and can flexibly and accurately perform canteen evaluation sentiment analysis.

[0036] See also Figure 1 , the canteen evaluation sentiment analysis method comprises the following steps:

[0037] Step S101: Acquire first text data including canteen dining feedback information;

[0038] In step S101, feedback texts after dining in the cafeteria can be collected through various channels (such as online surveys, user reviews, social media, etc.). These text data are original unstructured information, which contain users' various views and emotional expressions on the cafeteria service. These widely collected user feedbacks can provide a rich data source for subsequent sentiment analysis, ensuring the comprehensiveness and representativeness of the analysis results.

[0039] Step S102: labeling the first text data with sentiment polarity to obtain second text data;

[0040] In step S102, sentiment polarity labeling refers to labeling the sentiment polarity of each sentence, phrase or word in the first text data to facilitate the subsequent sentiment analysis task. At the same time, the accuracy and effectiveness of sentiment classification depend on the quality and accuracy of the labeled data. Through sentiment polarity labeling, the first text data can be divided into three categories: positive, neutral and negative sentiment, and then a set of sentiment classification standards can be established to facilitate sentiment analysis and related research on the text. For example, "1" can be used to represent positive sentiment, "-1" can be used to represent negative sentiment, and "0" can be used to represent neutrality.

[0041] Step S103: vectorizing the second text data using the pre-trained language model to obtain text vector data;

[0042] Among them, the pre-trained language model (such as BERT, GPT, etc.) has a strong text representation capability and can convert text data into a numerical representation (i.e., a text vector) in a high-dimensional vector space. Step S103 uses the context-awareness of the pre-trained model to capture the semantic information and grammatical structure in the text, which can provide rich feature representation for subsequent feature extraction and sentiment classification.

[0043] Step S104: extracting features from the text vector data using a bidirectional gated recurrent unit network, and calculating the weight of each sentence and character for sentiment classification in combination with a double-layer attention mechanism to obtain text feature data;

[0044] In step S104, the bidirectional gated recurrent unit network (BiGRU network) can simultaneously capture the forward and backward information in the text and extract a more comprehensive feature representation. Combined with a two-layer attention mechanism (usually including sentence-level attention and character-level attention), the importance of different sentences and characters in sentiment classification can be weighted to highlight key information and suppress irrelevant information. That is, through feature extraction and attention weighting, this step can further refine feature information that plays a decisive role in sentiment classification and improve the accuracy and pertinence of sentiment classification. At the same time, the use of a two-layer attention mechanism enables the model to better handle long texts and complex emotional expressions.

[0045] It should be noted that the bidirectional gated recurrent unit network is a recurrent neural network that consists of two independent GRU units, one that processes data forward in time series and the other that processes data in reverse time series. Through this bidirectional structure, the BiGRU network can capture both forward and backward information of sequence data, thereby better understanding and predicting patterns in the sequence.

[0046] It should also be noted that the attention mechanism is a method used to strengthen the neural network's attention to key information in the input sequence. It adjusts the network's attention to different inputs by calculating the importance of each input. Specifically, the Attention mechanism calculates a weight vector based on the current state and each element in the input sequence, and then performs a weighted average of this vector and the input sequence to obtain a weighted representation.

[0047] Step S105: Use a classifier to perform sentiment classification on the text feature data, and generate a sentiment analysis report based on the sentiment classification results.

[0048] In step S105, after obtaining the text feature data, sentiment classification is performed by using a trained classifier (such as logistic regression, support vector machine, deep learning classifier, etc.). The classifier determines the sentiment polarity (positive, neutral or negative) of the text based on the key information in the feature data, and generates a corresponding sentiment analysis report. The report content may include overall sentiment tendency, key sentiment points, suggested improvement directions, etc. Among them, the sentiment classification results directly reflect the user's satisfaction and emotional attitude towards the canteen service, and provide valuable feedback information for canteen managers. The sentiment analysis report further converts the classification results into easy-to-understand and easy-to-apply suggestions and guidance, which helps canteen managers to improve service quality and enhance user satisfaction in a targeted manner.

[0049] In summary, the above embodiments construct a sentiment analysis framework that can flexibly and accurately perform sentiment analysis of canteen reviews without the need for a large number of annotated data sets by introducing a pre-trained language model, a bidirectional gated recurrent unit network, and a double-layer attention mechanism. Among them, the existing method based on sentiment dictionaries is limited by the degree of perfection of the dictionary, and the present application introduces a pre-trained language model and uses its semantic knowledge learned on a large amount of text data to convert the text into a vector representation rich in semantic information. This process does not need to rely on a specific sentiment dictionary, thereby reducing the requirements for dictionary integrity. At the same time, the bidirectional gated recurrent unit network is used to extract features from text vector data, which can capture the forward and backward information in the text at the same time, avoiding the problem of gradient disappearance or explosion that is prone to occur when processing long texts. In addition, by combining the double-layer attention mechanism, the present application can further weight the key sentences and characters in the text, making the feature extraction more accurate, which is conducive to subsequent sentiment classification tasks.

[0050] Based on the foregoing solution, in some implementation manners of the present application, before performing sentiment polarity annotation on the first text data, it further includes: performing data cleaning processing on the first text data, and adjusting the data after the data cleaning processing into a standard format; wherein, the data cleaning processing includes non-text data cleaning, removing useless symbols, removing meaningless text, removing long strings of letters or data, and removing duplicate text.

[0051] It should be noted that, based on the non-linear and informal characteristics of the first text data containing cafeteria dining feedback information, in order to ensure the accuracy of the subsequent sentiment analysis results, it is necessary to perform preprocessing operations on the evaluation text. For example, programming techniques are used to assist in text data cleaning, such as programming with software like pyCharm to remove useless information, non-standard formats, duplicate data, error data, etc., so as to make the data more standardized and accurate. The main steps of the data cleaning processing include: non-text data cleaning, removing useless symbols, meaningless text, removing long strings of letters or numbers, and removing duplicate text.

[0052] Exemplarily, the jieba word segmentation tool can be used for word segmentation. First, the jieba library is imported, and the CSV file containing the data of cafeteria dining feedback information is loaded. Then, by calling the lcut() method in the library and using the exact mode by default, a list is returned, in which there are no redundant words, which is more suitable for text analysis.

[0053] After the above-mentioned comment word segmentation processing, the word list of each sentence contains a large number of stop words that do not participate in the expression of the text meaning and have no actual meaning (as shown in the following table), such as "is", "of", "then", "moreover", etc. Obviously, these words that appear frequently in the text but have no effect on the text sentiment expression can be cleared. Removing the stop words in the text will help improve the quality of the text features and thus increase the generalization ability of the model.

[0054]

[0055]

[0056] Based on the foregoing solution, in some implementation manners of the present application, the using the pre-trained language model to perform vectorization processing on the second text data to obtain text vector data includes: using the RoBERTa model to perform vectorization processing on the second text data, so as to combine the clause vectors and character vectors and sum them to obtain the final vector representation, and thus obtain the corresponding text vector data according to the final vector representation.

[0057] It should be noted that when using the RoBERTa model for vectorization processing, the sentence vector (i.e., the vector representation of each sentence or phrase) and the character vector (i.e., the vector representation of each character or word in the text) of the text can be obtained separately. By summing or fusing these two vectors in other forms, a comprehensive vector representation that takes into account both the overall information of the sentence and the detailed information of the characters can be obtained. This combination helps to capture the emotional information in the text more comprehensively. After the above processing, the comprehensive vector representation obtained is the final text vector data. This vector not only contains the semantic information and contextual relationship of the text, but also reflects the characteristics of the text in terms of emotional polarity.

[0058] That is, in the above implementation, the accuracy of sentiment classification can be further improved by vectorizing the RoBERTa model and combining the comprehensive representation of sentence vectors and character vectors. At the same time, since the RoBERTa model can capture the deep semantic information and contextual relationships in the text, it supports the analysis of complex sentiment expressions. This is especially important for processing ambiguous, contradictory or multi-level sentiment expressions that may appear in cafeteria reviews.

[0059] Based on the aforementioned scheme, in some implementations of the present application, the dual-layer attention mechanism includes a sentence-level attention mechanism and a character-level attention mechanism to respectively calculate the weight values ​​of sentences and characters for sentiment classification.

[0060] It should be noted that the combination of sentence-level attention mechanism and character-level attention mechanism enables the simultaneous consideration of sentiment information of text at different levels. First, the key sentences are screened out through the sentence-level attention mechanism; then, within the key sentences, the key words or phrases are further identified through the character-level attention mechanism. This analysis method from coarse to fine, from overall to local, helps to capture the sentiment information in the text more comprehensively and improve the accuracy and depth of sentiment classification.

[0061] Specifically, the sentence-level attention mechanism is used to calculate the weight value of each sentence in the text for the overall sentiment classification. In the cafeteria review text, different sentences may contain different sentiment tendencies and importance. The sentence-level attention mechanism can identify those sentences that play a key role in sentiment classification and give them higher weights. In this way, in the subsequent sentiment classification process, the information of these key sentences will be taken into account more, thereby improving the accuracy of classification.

[0062] The character-level attention mechanism goes further into the sentence and calculates the weight of each character or word in the text for the sentence sentiment classification. In the cafeteria review, certain specific words or phrases may directly express the user's emotional tendencies, such as "delicious" and "unpalatable". The character-level attention mechanism can identify these key words or phrases and give them higher weights. In this way, even in the same sentence, the emotional contribution of different words or phrases can be accurately evaluated.

[0063] Based on the aforementioned scheme, in some implementations of the present application, the bidirectional gated recurrent unit network is used to perform feature extraction on text vector data, and a double-layer attention mechanism is combined to calculate the weight of each sentence and character for sentiment classification to obtain text feature data, including: inputting the text vector data into the bidirectional gated recurrent unit network for multi-segment feature extraction, capturing the characteristic information of the sentence, and applying an attention mechanism to the sentence to calculate the weight value of the sentence for sentiment classification to obtain the corresponding sentence vector; inputting the sentence vector into the bidirectional gated recurrent unit network for feature privilege, capturing the characteristic information of the character, and applying an attention mechanism to the character to calculate the weight of each character in the sentence and its representation to obtain the corresponding character vector; according to the sentence vector and the character vector, the corresponding text feature data is obtained.

[0064] In the above implementation, a bidirectional gated recurrent unit network (BiGRU) and a two-layer attention mechanism (sentence level and character level) are combined to deeply extract the sentiment features in the text and calculate the weights of different levels (sentences and characters) for sentiment classification. The specific processing steps include:

[0065] First, the second text data is converted into vector data (such as word embedding vector), and then input into the first BiGRU network. The BiGRU network can capture the forward and backward information of the text sequence at the same time, so as to more comprehensively extract the characteristic information of the sentence. The output of this step is a hidden state sequence containing sentence-level feature information.

[0066] Then, a sentence-level attention mechanism is applied to the hidden state sequence output by the BiGRU. This mechanism identifies sentences or sentence fragments that play a key role in sentiment classification by calculating the weight value of each sentence (or more precisely, the hidden state at each time step) for the overall sentiment classification. The weight value is usually calculated based on the relevance of the hidden state to the sentiment classification task, such as through dot product, cosine similarity, or more complex attention functions. The weighted hidden state is aggregated (such as through weighted sum) into a sentence vector, which represents the sentiment characteristics of the entire sentence.

[0067] Then the sentence vector obtained in the previous step is used as input and sent to another BiGRU network for feature extraction. This time, the goal of the BiGRU network is to capture the feature information of the characters or words inside the sentence. Since the sentence vector already contains the overall sentiment characteristics of the sentence, the BiGRU network in this step can focus more on the detailed features inside the sentence.

[0068] Among them, based on the character-level feature extraction, the character-level attention mechanism is applied. This mechanism calculates the weight value of each character (or word) in the sentence for the sentence sentiment classification. Similar to the sentence-level attention mechanism, the weight value is also calculated based on the correlation between the character feature vector and the sentiment classification task. The weighted character feature vector is aggregated into a character vector, which represents the contribution of each character in the sentence to the sentence sentiment classification.

[0069] Finally, the final text feature data is generated based on the sentence vector and character vector (or their combination). These feature data not only contain the overall sentiment features of the text (through the sentence vector), but also the detailed features within the text (through the character vector), as well as the interaction and weight distribution between features at different levels. These feature data will be used as input for the subsequent sentiment classification model to determine the sentiment tendency of the text.

[0070] In the above implementation, through the above processing, the advantages of the BiGRU network in extracting features from sequence data and the ability of the two-layer attention mechanism in capturing feature weights at different levels can be fully utilized, thereby improving the accuracy and depth of text sentiment classification.

[0071] Based on the above scheme, in some implementations of the present application, the calculation formula in the step of inputting the text vector data into the bidirectional gated recurrent unit network for multi-segment feature extraction, capturing the characteristic information of the sentence, and applying the attention mechanism to the sentence includes:

[0072] H ij =tanh(W x G ij +b x )

[0073]

[0074] Among them, H ij Represents a single-layer perceptron for G ij The implicit representation of W x represents the weight matrix, b x represents the bias, U x Refers to the context vector, which can be obtained by initialization and is a parameter of the model, α ij It means H ij with U xThe weight of the similarity, G ij is the output vector of the previous BiGRU neural network layer, D i It refers to the corresponding sentence vector, the superscript T indicates the matrix transpose, and the subscripts i, j, and x are the corresponding index variables. It should be noted that the index variables i, j, and x do not have specific meanings. They are used to refer to a certain layer and only represent a random number that does not exceed the maximum number of layers.

[0075] Based on the foregoing scheme, in some implementations of the present application, the calculation formula in the step of inputting the sentence vector into the bidirectional gated recurrent unit network for feature privilege, capturing the feature information of the characters, and applying the attention mechanism to the characters includes:

[0076]

[0077] Among them, M i is the current hidden state of the bidirectional gated recurrent unit network, is the forward hidden state of the bidirectional gated recurrent unit network, is the reverse hidden state of the bidirectional gated recurrent unit network, To encode the corresponding word vector into the forward GRU hidden layer representation, To encode the corresponding word vector into the reverse GRU hidden layer representation, D i refers to the corresponding sentence vector, and the subscript i is the corresponding index variable.

[0078] Example 2

[0079] See also Figure 2 , the embodiment of the present application provides a canteen evaluation sentiment analysis system, which includes:

[0080] The data acquisition module 101 is used to acquire first text data containing cafeteria dining feedback information; the sentiment polarity labeling module 102 is used to label the first text data with sentiment polarity to obtain second text data; the vectorization processing module 103 is used to vectorize the second text data using a pre-trained language model to obtain text vector data; the feature extraction module 104 is used to extract features from the text vector data using a bidirectional gated recurrent unit network, and calculate the weight of each sentence and character for sentiment classification in combination with a double-layer attention mechanism to obtain text feature data; the sentiment classification module 105 is used to use a classifier to perform sentiment classification on the text feature data, and generate a sentiment analysis report based on the sentiment classification results.

[0081] For the specific implementation process of the above system, please refer to the canteen evaluation sentiment analysis method provided in Example 1, which will not be repeated here.

[0082] Example 3

[0083] See also Figure 3 , the embodiment of the present application provides an electronic device, which includes at least one processor 201 and at least one memory 202; wherein the processor 201 and the memory 202 are directly connected to each other, or communicate with each other through a communication interface 203, or are electrically connected through one or more communication buses or signal lines to achieve data transmission or interaction; the memory 202 stores program instructions that can be executed by the processor 201, and the processor 201 calls the program instructions to execute a cafeteria evaluation sentiment analysis method. For example, the following is realized:

[0084] Acquire first text data containing cafeteria dining feedback information; perform sentiment polarity labeling on the first text data to obtain second text data; use a pre-trained language model to vectorize the second text data to obtain text vector data; use a bidirectional gated recurrent unit network to extract features from the text vector data, and combine the double-layer attention mechanism to calculate the weight of each sentence and character for sentiment classification to obtain text feature data; use a classifier to perform sentiment classification on the text feature data, and generate a sentiment analysis report based on the sentiment classification results.

[0085] Among them, the memory 202 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc.

[0086] The processor 201 may be an integrated circuit chip with signal processing capability. The processor 201 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0087] Understandably, Figure 3 The structure shown is for illustration only. The electronic device may also include Figure 3 More or fewer components as shown, or with Figure 3 Different configurations are shown. Figure 3 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0088] Example 4

[0089] The present application provides a computer-readable storage medium having a computer program stored thereon, which implements a cafeteria evaluation sentiment analysis method when executed by the processor 201. For example, it implements:

[0090] Acquire first text data containing cafeteria dining feedback information; perform sentiment polarity labeling on the first text data to obtain second text data; use a pre-trained language model to vectorize the second text data to obtain text vector data; use a bidirectional gated recurrent unit network to extract features from the text vector data, and combine the double-layer attention mechanism to calculate the weight of each sentence and character for sentiment classification to obtain text feature data; use a classifier to perform sentiment classification on the text feature data, and generate a sentiment analysis report based on the sentiment classification results.

[0091] If the above functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0092] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above, and that the present application can be implemented in other specific forms without departing from the spirit or essential features of the present application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims be included in the present application. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.

Claims

1. A canteen evaluation sentiment analysis method, characterized in that: The following steps are involved: Acquire first text data including cafeteria dining feedback information; Performing sentiment polarity labeling on the first text data to obtain second text data; Performing vectorization processing on the second text data using the pre-trained language model to obtain text vector data; The bidirectional gated recurrent unit network is used to extract features from text vector data, and the weight of each sentence and character for sentiment classification is calculated in combination with a double-layer attention mechanism to obtain text feature data. Use the classifier to perform sentiment classification on text feature data and generate a sentiment analysis report based on the sentiment classification results.

2. The method according to claim 1, characterized in that Before the sentiment polarity labeling of the first text data is performed, the method further includes: The first text data is cleaned and the cleaned data is adjusted to a standard format; wherein the data cleaning process includes non-text data cleaning, removing useless symbols, removing meaningless text, removing field string letters or data, and removing repeated text.

3. The method according to claim 1, characterized in that The method of using a pre-trained language model to vectorize the second text data to obtain text vector data includes: using a RoBERTa model to vectorize the second text data to combine the sentence vector and the character vector to obtain a final vector representation, thereby obtaining corresponding text vector data based on the final vector representation.

4. The method according to claim 1, characterized in that: The dual-layer attention mechanism includes a sentence-level attention mechanism and a character-level attention mechanism to respectively calculate the weight values ​​of sentences and characters for sentiment classification.

5. The method according to claim 1, characterized in that The bidirectional gated recurrent unit network is used to extract features from text vector data, and the weight of each sentence and character for sentiment classification is calculated in combination with a double-layer attention mechanism to obtain text feature data, including: The text vector data is input into the bidirectional gated recurrent unit network for multi-segment feature extraction to capture the characteristic information of the sentence, and an attention mechanism is applied to the sentence to calculate the weight value of the sentence for sentiment classification and obtain the corresponding sentence vector; The sentence vector is input into the bidirectional gated recurrent unit network for feature privilege, capturing the feature information of the characters, and applying an attention mechanism to the characters to calculate the weight and representation of each character in the sentence to obtain the corresponding character vector; According to the sentence vector and character vector, the corresponding text feature data is obtained.

6. The method according to claim 5, characterized in that The calculation formula in the step of inputting the text vector data into the bidirectional gated recurrent unit network to extract multiple segments of features, capture the characteristic information of the sentence, and apply the attention mechanism to the sentence is include: H ij =tanh(W x G ij +b x ) Among them, H ij Represents a single-layer perceptron for G ij The implicit representation of W x represents the weight matrix, b x represents the bias, U x Refers to the context vector, which can be obtained by initialization and is a parameter of the model, α ij It means H ij with U x The weight of the similarity, G ij is the output vector of the previous BiGRU neural network layer, D i refers to the corresponding sentence vector, the superscript T represents the matrix transpose, and the subscripts i, j, and x are the corresponding index variables.

7. The method according to claim 5, characterized in that The calculation formula in the step of inputting the sentence vector into the bidirectional gated recurrent unit network for feature privilege, capturing the feature information of the characters, and applying the attention mechanism to the characters includes: Among them, M i is the current hidden state of the bidirectional gated recurrent unit network, is the forward hidden state of the bidirectional gated recurrent unit network, is the reverse hidden state of the bidirectional gated recurrent unit network, To encode the corresponding word vector into the forward GRU hidden layer representation, To encode the corresponding word vector into the reverse GRU hidden layer representation, D i refers to the corresponding sentence vector, and the subscript i is the corresponding index variable.

8. A canteen evaluation sentiment analysis system, characterized in that: include: A data acquisition module, used to acquire first text data including canteen dining feedback information; A sentiment polarity labeling module, used to label the first text data with sentiment polarity to obtain second text data; A vectorization processing module, used to perform vectorization processing on the second text data using a pre-trained language model to obtain text vector data; The feature extraction module is used to extract features from text vector data using a bidirectional gated recurrent unit network, and calculate the weight of each sentence and character for sentiment classification in combination with a double-layer attention mechanism to obtain text feature data; The sentiment classification module is used to use a classifier to perform sentiment classification on text feature data and generate a sentiment analysis report based on the sentiment classification results.

9. An electronic device, characterized in that: include: A memory for storing one or more programs; processor; When the one or more programs are executed by the processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.