Teaching evaluation-oriented capsule network sentiment analysis method

By combining capsule networks with the cross-attention mechanism, the problems of aspect category distinction and sentiment polarity diversity in teaching evaluation are solved, the detailed analysis and interpretability of multi-faceted emotions are achieved, and the intelligence and scientific level of teaching evaluation are improved.

CN120744683AInactive Publication Date: 2025-10-03NANJING UNIV OF POSTS & TELECOMM

Patent Information

Application Number
CN202511188751.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2025-10-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies have difficulty in effectively distinguishing and modeling different aspect categories in teaching evaluation. The sentiment polarity is diverse and the model is insufficiently interpretable, which makes fine-grained sentiment analysis difficult.

Method used

The capsule network is combined with the pre-trained model RoBERTa and the cross-attention mechanism, the aspect categories are extracted through KeyBERT+ clustering, and the dynamic routing mechanism is used for multi-task joint classification to achieve multi-faceted sentiment analysis of teaching evaluation texts.

Benefits of technology

It realizes the detailed analysis of multi-faceted emotions of teaching evaluation texts, can automatically identify multiple aspect categories and accurately judge the emotional polarity, has good interpretability and high analysis accuracy, and supports education management and teacher evaluation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120744683A_ABST
    Figure CN120744683A_ABST
Patent Text Reader

Abstract

The invention discloses a capsule network sentiment analysis method for teaching evaluation. Firstly, teaching evaluation texts are collected, aspect items are extracted through data preprocessing, an aspect category-emotion two-tuple is generated through manual annotation, and a teaching evaluation data set is constructed. Secondly, splicing each evaluation text and all aspect categories, and inputting the spliced evaluation text and all aspect categories into a pre-training language model for encoding to obtain high-dimensional context vector representation; thirdly, text features highly related to a specific aspect are extracted through a cross attention mechanism, and modeling and classification of category sentiment polarity of all aspects are achieved through a capsule network and a dynamic routing mechanism; and finally, judging the existence of aspect categories and the sentiment polarity of the aspect categories through a multi-task classifier, and outputting a plurality of aspect-sentiment two-tuples contained in the sentences. The sentiment analysis accuracy and interpretability in a multi-aspect and multi-sentiment polarity coexistence scene in a teaching evaluation text are effectively improved, and the method is suitable for intelligent analysis of large-scale education evaluation data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing and educational informatization technology, and specifically to a capsule network sentiment analysis method for teaching evaluation. Background Art

[0002] Smart education represents an advanced stage in educational informatization and is a crucial tool for driving innovative development. As the scope of research on smart education applications continues to expand, smart teaching evaluation has become a pressing challenge in academic research. Smart teaching evaluation is a comprehensive process. This process involves the generation of vast amounts of text data, and extracting and analyzing this data more quickly and accurately has become a significant challenge.

[0003] Traditional teaching evaluation usually takes the form of questionnaires, which makes it difficult to obtain effective feedback on teaching evaluation and is inefficient in processing large amounts of text data.

[0004] In recent years, deep learning-based sentiment analysis methods have made significant progress. In particular, pre-trained models (such as BERT and RoBERTa) have performed well in text semantic understanding, can effectively capture contextual information in text, and are applicable to a variety of natural language processing tasks. However, existing methods still face the following challenges when processing teaching evaluation texts: (1) The aspect categories are fine-grained and numerous, making it difficult for traditional models to effectively distinguish and model different aspects; (2) Sentiment polarity is diverse, and the same text may contain multiple aspects and their corresponding sentiment polarity, making it difficult for the model to achieve fine-grained sentiment analysis; (3) The model is not interpretable enough, making it difficult to clearly reflect the correspondence between each aspect and sentiment polarity. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of existing methods and propose a capsule network sentiment analysis method for teaching evaluation, making it more suitable for sentiment analysis tasks in the field of teaching evaluation.

[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0007] A capsule network sentiment analysis method for teaching evaluation, the method includes:

[0008] S100, crawling the website to obtain students' teaching evaluation texts on teachers, and performing aspect classification extraction using the KeyBERT+ clustering method to obtain an aspect category set and a teaching evaluation dataset;

[0009] S200, each aspect category in the aspect category set is represented by " " and use the RoBERTa model to segment all the evaluation texts in the teaching evaluation dataset. Each word is mapped to the RoBERTa vocabulary to obtain the corresponding vector representation of the word. All word vectors in the sentence constitute the vector representation of the sentence, and all word vectors in the aspect category constitute the vector representation of the aspect category.

[0010] S300, obtain the category features encoded and output by the RoBERTa model and sentence features , perform linear transformation on both to obtain Query, Key, and Value; calculate the dot product of Query and Key, scale them and obtain the attention distribution through Softmax, then use the attention distribution to weighted sum the Value to obtain the category-related text features ;

[0011] S400, The input is a linear layer, mapped to a main capsule vector, and its length is normalized by the Squash activation function. A learnable category-guided capsule is initialized for each aspect category, and the category-guided capsule is expanded to the batch dimension to facilitate subsequent dynamic routing with the main capsule vector.

[0012] S500, through the fully connected layer and the Softmax function, realizes multi-task joint classification, improving the model's ability to perform fine-grained sentiment analysis. This layer further processes the feature vector output by each category capsule to determine the existence of the category and the sentiment polarity. The category capsule output vector is used to detect the existence of the category in the input text; if the category exists, its sentiment polarity is further classified and the sentiment label is output as positive, negative, or neutral.

[0013] S600, the loss function, is used to jointly optimize the category existence detection and sentiment polarity classification tasks. Using the cross-entropy loss function, the category existence loss and sentiment polarity loss are calculated separately, and the weighted sum of the two is used as the total loss function. The model is trained and optimized using the teaching evaluation dataset.

[0014] S700: Train and infer the model based on data input, forward propagation, loss calculation, parameter update, and inference output.

[0015] Preferably, S100 includes:

[0016] S101. Use the KeyBERT algorithm to extract keywords. Extract up to three keywords from each teaching evaluation text, ranging from a single word to a combination of two words, and encode each keyword into a vector. Observe the keyword extraction results, cluster the extracted keywords using the KMeans algorithm, and divide the keywords into nine categories.

[0017] Among them, setting n_clusters=9 divides the keywords into 9 categories, namely Teacher Personality, Teacher Support, Teacher Expertise, Teacher Performance, Lecture Inspiration, Lecture Feedback, Lecture Expression, Lecture Content, and Lecture Evaluation;

[0018] S102. Define aspect category set , sentiment polarity set ,The teaching evaluation text is manually labeled with aspect categories and sentiment ,double tuples, and a teaching evaluation dataset is obtained, which includes 2000 training set, 500 validation set, and 320 test set items, respectively;

[0019] in, Represents a collection of aspect categories 9 categories in For positive emotions, For neutral emotions, For negative emotions.

[0020] Preferably, S200 includes:

[0021] S201. Obtain a sentence in the teaching evaluation dataset , then the sentence contains 9 aspects Corresponding to 9 emotional polarities ;

[0022] in Represents words in a sentence, sentence The length is n;

[0023] S202, sentence S is Composed into sequences and converted into word vectors, expressed as: ;

[0024] in Indicates the aspect category currently being processed, ;

[0025] S203. Encode the input text through the RoBERTa model to obtain the hidden layer representation: ;

[0026] in, is the hidden layer representation of the CLS tag, is the latent representation of the aspect category;

[0027] is the hidden layer representation of the text sentence, The first The hidden layer representation of the labels, is the embedding dimension of RoBERTa output.

[0028] Preferably, S300 includes:

[0029] S301, category features and sentence features Perform linear transformations respectively to obtain the Query vector: 、Key vector: , and the Value vector: ;

[0030] in, , , are respectively learnable weight matrices;

[0031] S302. Calculate the dot product similarity between the query vector and each key vector, and scale them to obtain the attention score: ;

[0032] in, The dimension of the Key vector, used for scaling to prevent the gradient from being too large;

[0033] S303. Perform Softmax normalization on all attention scores to obtain the attention distribution: ;

[0034] S304. Use attention distribution to weight the sum of the Value vector to obtain category-related text features For use by subsequent capsule network layers: .

[0035] Preferably, S400 includes:

[0036] S401, the category-related text features output by the cross attention layer Input linear layer, mapped to the main capsule vector: ;

[0037] in, represents the main capsule vector, represents the weight matrix, represents the bias term;

[0038] S402, main capsule vector Apply the Squash activation function to normalize its length to between 0 and 1 to enhance the expressive power of the vector: ;

[0039] in, Represents the main capsule output after Squash, Represents a vector The L2 norm of

[0040] S403, for each aspect category Initialize a learnable category-guided capsule ; in, , represents the dimension of the capsule vector, , N is the number of aspect categories;

[0041] S404, guide the category capsule Expand the batch dimension to form a shape of The tensor allows the main capsule vector corresponding to each evaluation text to be dynamically routed with the category guidance capsules of all categories: ;

[0042] S405, using dynamic routing algorithm, the main capsule vector With each category guide capsule Perform multiple rounds of information transmission and aggregation to obtain the final category capsule output : ;

[0043] in, is the routing weight, obtained by Softmax normalization, representing the main capsule With category capsule The coupling strength, ;

[0044] in is the routing coefficient, which is used to measure the coupling strength between the main capsule and the category capsule and is dynamically updated with the dynamic routing process.

[0045] Preferably, S500 includes:

[0046] S501, for each category capsule output vector , input to the category classifier, and output the probability distribution of the category existence through the fully connected layer and Softmax function: ;

[0047] in, represents the weight matrix of the category classifier, Represents the bias term of the category classifier; output It is a binary classification, which means the sentence output category has two results: existence (YES) or non-existence (NO);

[0048] S502, if the category exists, then the category capsule output vector [CLS] vector with RoBERTa Splicing, input to the sentiment classifier, through the fully connected layer and Softmax function output the probability distribution of sentiment polarity: ;

[0049] in, is the weight matrix of the sentiment classifier, is the bias term of the sentiment classifier, is the hidden layer representation of the CLS tag; the output There are three categories, namely, the emotional polarity is positive / neutral / negative.

[0050] Preferably, S600 includes:

[0051] S601, set the real existing label and , the corresponding model output prediction is and , is one-hot encoding, is the Softmax output probability vector;

[0052] Then we get the aspect category existence loss: ;

[0053] Emotional Polarity Loss: ;

[0054] in, represents the set of aspect categories contained in a sentence;

[0055] S602: The total loss function is obtained by weighted summing the aspect category existence loss and the sentiment polarity loss:

[0056] ;

[0057] in, represents the regularization coefficient, is the L2 norm of all learnable parameters to prevent overfitting.

[0058] Preferably, the training and reasoning of the model in S700 includes:

[0059] S701, Model training process:

[0060] Input "[CLS] sentence [SEP] category [SEP]", after encoding by RoBERTa, we get ;

[0061] Obtaining category-related text features through cross-attention layers ;

[0062] After the main capsule layer, the category guided capsule layer, and dynamic routing, the category capsule output is obtained ;

[0063] Input category classifier, output category existence probability;

[0064] If the category exists, and Splicing, input sentiment classifier, output sentiment polarity probability;

[0065] Calculate total loss , back propagation, update parameters;

[0066] S702, Model Reasoning Process:

[0067] For each category, enter “[CLS] sentence [SEP] category [SEP]”;

[0068] Determine whether the category exists in turn, and if so, output the sentiment polarity, otherwise mark it as none.

[0069] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned capsule network sentiment analysis method for teaching evaluation.

[0070] A computer device includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the program, the steps of the above-mentioned capsule network sentiment analysis method for teaching evaluation are implemented.

[0071] Compared with the prior art, the present invention has the following beneficial effects:

[0072] This paper combines a pretrained language model, a cross-attention mechanism, and a capsule network to achieve a sophisticated, multifaceted sentiment analysis of teaching evaluation texts. The model automatically identifies multiple aspect categories within evaluation texts and accurately determines the sentiment polarity of each aspect. With high analytical accuracy and good interpretability, it can provide powerful data support for educational management and teacher evaluation.

[0073] The deep integration of capsule networks and cross-attention mechanisms can effectively model the complex correlation between text and various categories. Through the dynamic routing mechanism, the model's ability to capture fine-grained emotional features is improved, and the model's adaptability to scenarios where multiple aspects and multiple emotional polarities coexist is significantly enhanced.

[0074] Using a multi-task joint learning framework, the model can simultaneously detect the presence of aspect categories and classify sentiment polarity, improving its overall performance and generalization capabilities. Through end-to-end training, it can fully utilize both structured and unstructured information in teaching evaluation data to achieve efficient feature extraction and sentiment discrimination.

[0075] The model structure of the present invention is flexible and can adapt to teaching evaluation datasets of different sizes and types. It supports the expansion of multiple categories and multiple sentiment polarities and has good scalability and engineering feasibility. The model has a fast inference speed and can meet the real-time analysis needs in large-scale education evaluation scenarios. The present invention can automatically extract aspect categories and sentiment polarity tuples from teaching evaluation texts and output structured evaluation results, which facilitates subsequent data statistics, visualization, and decision support, greatly improving the intelligent and scientific level of education evaluation. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0077] Figure 1 This is a flowchart of the capsule network sentiment analysis method for teaching evaluation of the present invention.

[0078] Figure 2 It is a sentiment analysis model diagram of the present invention.

[0079] Figure 3 Schematic diagram of the cross-attention mechanism of the present invention.

[0080] Figure 4 This is a diagram of the capsule network dynamic routing process of the present invention. DETAILED DESCRIPTION

[0081] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0082] See also Figure 1-Figure 4 , the present invention provides a technical solution:

[0083] Example 1: A capsule network sentiment analysis method for teaching evaluation, the method comprising:

[0084] S100, Dataset Acquisition: Use website crawlers to obtain students’ teaching evaluation texts on teachers, and perform aspect classification extraction using the KeyBERT+ clustering method to obtain aspect category sets and teaching evaluation datasets;

[0085] Preferably, S100 includes:

[0086] S101. Use the KeyBERT algorithm to extract keywords. Extract up to three keywords from each teaching evaluation text, ranging from a single word to a combination of two words, and encode each keyword into a vector. Observe the keyword extraction results, cluster the extracted keywords using the KMeans algorithm, and divide the keywords into nine categories.

[0087] Among them, setting n_clusters=9 divides the keywords into 9 categories, namely Teacher Personality, Teacher Support, Teacher Expertise, Teacher Performance, Lecture Inspiration, Lecture Feedback, Lecture Expression, Lecture Content, and Lecture Evaluation;

[0088] S102. Define aspect category set , sentiment polarity set ,The teaching evaluation text is manually labeled with aspect categories and sentiment ,double tuples, and a teaching evaluation dataset is obtained, which includes 2000 training set, 500 validation set, and 320 test set items, respectively;

[0089] in, Represents a collection of aspect categories 9 categories in For positive emotions, For neutral emotions, For negative emotions.

[0090] S200, text vectorization representation layer: each aspect category in the aspect category set is represented by " " and use the RoBERTa model to segment all the evaluation texts in the teaching evaluation dataset. Each word is mapped to the RoBERTa vocabulary to obtain the corresponding vector representation of the word. All word vectors in the sentence constitute the vector representation of the sentence, and all word vectors in the aspect category constitute the vector representation of the aspect category.

[0091] Preferably, S200 includes:

[0092] S201. Obtain a sentence in the teaching evaluation dataset , then the sentence contains 9 aspects Corresponding to 9 emotional polarities ;

[0093] in Represents words in a sentence, sentence The length is n;

[0094] S202, sentence S is Composed into sequences and converted into word vectors, expressed as: ;

[0095] in Indicates the aspect category currently being processed, ;

[0096] S203. Encode the input text through the RoBERTa model to obtain the hidden layer representation: ;

[0097] in, is the hidden layer representation of the CLS tag, is the latent representation of the aspect category;

[0098] is the hidden layer representation of the text sentence, The text The hidden layer representation of the labels, is the embedding dimension of RoBERTa output.

[0099] S300, Cross Attention Layer: Obtaining Category Features Encoded by the RoBERTa Model and sentence features , perform linear transformation on both to obtain Query, Key, and Value; calculate the dot product of Query and Key, scale them and obtain the attention distribution through Softmax, then use the attention distribution to weighted sum the Value to obtain the category-related text features ;

[0100] Preferably, S300 includes:

[0101] S301, category features and sentence features Perform linear transformations respectively to obtain the Query vector: 、Key vector: , and the Value vector: ;

[0102] in, , , are respectively learnable weight matrices;

[0103] S302. Calculate the dot product similarity between the query vector and each key vector, and scale them to obtain the attention score: ;

[0104] in, The dimension of the Key vector, used for scaling to prevent the gradient from being too large;

[0105] S303. Perform Softmax normalization on all attention scores to obtain the attention distribution: ;

[0106] S304. Use attention distribution to weight the sum of the Value vector to obtain category-related text features For use by subsequent capsule network layers: .

[0107] S400, capsule network layer: The input is a linear layer, mapped to a main capsule vector, and its length is normalized by the Squash activation function. A learnable category-guided capsule is initialized for each aspect category, and the category-guided capsule is expanded to the batch dimension to facilitate subsequent dynamic routing with the main capsule vector.

[0108] Preferably, S400 includes:

[0109] S401, the category-related text features output by the cross attention layer Input linear layer, mapped to the main capsule vector: ;

[0110] in, represents the main capsule vector, represents the weight matrix, represents the bias term;

[0111] S402, main capsule vector Apply the Squash activation function to normalize its length to between 0 and 1 to enhance the expressive power of the vector: ;

[0112] in, Represents the main capsule output after Squash, Represents a vector The L2 norm of

[0113] S403, for each aspect category Initialize a learnable category-guided capsule ; in, , represents the dimension of the capsule vector, , N is the number of aspect categories;

[0114] S404, guide the category capsule Expand the batch dimension to form a shape of The tensor allows the main capsule vector corresponding to each evaluation text to be dynamically routed with the category guidance capsules of all categories: ;

[0115] S405, using dynamic routing algorithm, the main capsule vector With each category guide capsule Perform multiple rounds of information transmission and aggregation to obtain the final category capsule output : ;

[0116] in, is the routing weight, obtained by Softmax normalization, representing the main capsule With category capsules The coupling strength, ;

[0117] in is the routing coefficient, which is used to measure the coupling strength between the main capsule and the category capsule and is dynamically updated with the dynamic routing process.

[0118] S500, Classification Layer: This layer implements multi-task joint classification through a fully connected layer and a Softmax function, improving the model's ability to perform fine-grained sentiment analysis. This layer further processes the feature vectors output by each category capsule to determine the existence of the category and the emotional polarity. The category capsule output vector is used to detect the existence of the category in the input text. If the category exists, its emotional polarity is further classified, and a positive, negative, or neutral emotional label is output.

[0119] Preferably, S500 includes:

[0120] S501, output vector for each category capsule , input to the category classifier, and output the probability distribution of the category existence through the fully connected layer and Softmax function: ;

[0121] in, represents the weight matrix of the category classifier, Represents the bias term of the category classifier; output It is a binary classification, which means the sentence output category has two results: existence (YES) or non-existence (NO);

[0122] S502, if the category exists, then the category capsule output vector [CLS] vector with RoBERTa Splicing, input to the sentiment classifier, through the fully connected layer and Softmax function output the probability distribution of sentiment polarity: ;

[0123] in, is the weight matrix of the sentiment classifier, is the bias term of the sentiment classifier, is the hidden layer representation of the CLS tag; the output There are three categories, namely, the emotional polarity is positive / neutral / negative.

[0124] S600, Loss Function Calculation: The loss function is used to jointly optimize the category existence detection and sentiment polarity classification tasks. Using the cross-entropy loss function, the category existence loss and sentiment polarity loss are calculated separately, and their weighted sum is used as the total loss function. The model is trained and optimized using the teaching evaluation dataset.

[0125] Preferably, S600 includes:

[0126] S601, set the real existing label and , the corresponding model output prediction is and , is one-hot encoding, is the Softmax output probability vector;

[0127] Then we get the aspect category existence loss: ;

[0128] Emotional Polarity Loss: ;

[0129] in, represents the set of aspect categories contained in a sentence;

[0130] S602: The total loss function is obtained by weighted summing the aspect category existence loss and the sentiment polarity loss: ;

[0131] in, represents the regularization coefficient, is the L2 norm of all learnable parameters to prevent overfitting.

[0132] S700, training and inference process: train and infer the model based on data input, forward propagation, loss calculation, parameter update and inference output.

[0133] Preferably, the training and reasoning of the model in S700 includes:

[0134] S701, Model training process:

[0135] Input "[CLS] sentence [SEP] category [SEP]", after encoding by RoBERTa, we get ;

[0136] Obtaining category-related text features through cross-attention layers ;

[0137] After the main capsule layer, the category guided capsule layer, and dynamic routing, the category capsule output is obtained ;

[0138] Input category classifier, output category existence probability;

[0139] If the category exists, and Splicing, input sentiment classifier, output sentiment polarity probability;

[0140] Calculate total loss , back propagation, update parameters;

[0141] S702, Model Reasoning Process:

[0142] For each category, enter “[CLS] sentence [SEP] category [SEP]”;

[0143] Determine whether the category exists in turn, and if so, output the sentiment polarity, otherwise mark it as none.

[0144] Example 2: Attached Figure 2 This is a diagram of a capsule network sentiment analysis model for teaching evaluation, including input concatenation, RoBERTa encoding, cross attention, capsule network, multi-task classification and output. This method is suitable for teaching evaluation scenarios. The input is the student's evaluation text of the teacher, and the output is the various aspects involved in the evaluation text and its corresponding sentiment polarity. Figure 2The model is divided into two parts, the left and the right. The left part depicts the encoding and interaction between text and aspects. First, the evaluation text is concatenated with each aspect category and then fed into the RoBERTa model to obtain the contextual semantic representation of each token. Subsequently, a cross-attention mechanism is used to achieve deep interaction between aspect categories and text features, extracting text feature representations that are highly relevant to the current aspect. The right part depicts multi-task classification and output. The model first uses a category classifier to determine whether each aspect exists in the text (yes / no). If so, a sentiment classifier is used to output the sentiment polarity of that aspect (positive, neutral, negative). Ultimately, the model outputs all aspects present in the evaluation text and their corresponding sentiment polarities, enabling fine-grained sentiment analysis of teaching evaluations.

[0145] In the specific implementation, Figure 3 This is a schematic diagram of the cross attention mechanism, which describes in detail the Q / K / V calculation, attention score generation and weighted output process of the cross attention mechanism. The cross attention mechanism is used to strengthen the correlation features between aspect categories and text. The specific process is as follows: and text features Perform linear transformations on each of them to obtain the Query (Q), Key (K), and Value (V) vectors. Calculate the similarity score between the Query and Key through dot product and scaling operations, and perform Softmax normalization on the score to obtain the attention weight (Attention Scores) of each text token for the current aspect category. Use the attention weight to weight the Value vector and obtain the text feature output (Output) that is highly relevant to the current aspect category, i.e. , which is used for subsequent capsule network processing. This mechanism can effectively capture key information related to specific aspect categories in the evaluation text and improve the accuracy of aspect-level sentiment analysis.

[0146] In the specific implementation, Figure 4This is a diagram of the dynamic routing process of a capsule network, including key steps such as the primary capsule, category guide capsules, weighted summation, and Squash activation function normalization. The dynamic routing process of a capsule network aggregates information between the primary and category guide capsules. The specific steps are as follows: The feature vectors output by the cross-attention process are input into the primary capsule layer (Primary Capsule) to generate multiple primary capsule vectors. A category guide capsule (Category Guide Capsule) is initialized for each aspect category and expanded to the batch dimension. Through multiple rounds of dynamic routing, the primary capsule vector and the category guide capsule are weighted summed and normalized using the Squash function to generate the final capsule output (CategoryCapsule) for each aspect category. The final category capsule output is used for subsequent aspect presence determination and sentiment polarity classification. The dynamic routing mechanism enables feature decoupling and information aggregation between different aspect categories, improving the model's ability to represent multiple aspects and emotions.

[0147] Example 3: The computer-readable storage medium of this embodiment stores a computer program, which, when executed by a processor, implements the steps of the capsule network sentiment analysis method for teaching evaluation in Example 1.

[0148] The computer-readable storage medium of this embodiment may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal; the computer-readable storage medium of this embodiment may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, etc. equipped on the terminal; further, the computer-readable storage medium may also include both an internal storage unit of the terminal and an external storage device.

[0149] The computer-readable storage medium of this embodiment is used to store computer programs and other programs and data required by the terminal. The computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.

[0150] Example 4: The computer device of this embodiment includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of a capsule network sentiment analysis method for teaching evaluation in Example 1 are implemented.

[0151] In this embodiment, the processor can be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The memory can include read-only memory and random access memory, and provide instructions and data to the processor. A part of the memory can also include non-volatile random access memory. For example, the memory can also store information about the device type.

[0152] Those skilled in the art will appreciate that the disclosed embodiments may be provided as methods, systems, or computer program products. Therefore, the present solution may take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware embodiments. Furthermore, the present solution may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage) containing computer-usable program code.

[0153] The present solution is described with reference to the flowcharts and / or block diagrams of the methods and computer program products according to the embodiments of the present solution. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as the combination of the processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions; these computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or methods Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0154] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or methods Figure 1 The function specified in one or more boxes.

[0155] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or methods Figure 1A step that specifies a function in one or more boxes.

[0156] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0157] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art will be able to modify the technical solutions described in the aforementioned embodiments or substitute equivalents for some of the technical features. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.

Claims

1. A capsule network sentiment analysis method for teaching evaluation, characterized by: The method comprises: S100, obtaining students' teaching evaluation texts of teachers, and performing aspect classification extraction using the KeyBERT+ clustering method to obtain aspect category sets and teaching evaluation datasets; S200, each aspect category in the aspect category set is represented by " " and use the RoBERTa model to segment all the evaluation texts in the teaching evaluation dataset. Each word is mapped to the RoBERTa vocabulary to obtain the corresponding vector representation of the word. All word vectors in the sentence constitute the vector representation of the sentence, and all word vectors in the aspect category constitute the vector representation of the aspect category. S300, obtain the category features encoded and output by the RoBERTa model and sentence features , perform linear transformation on both to obtain Query, Key, and Value; calculate the dot product of Query and Key, scale them and obtain the attention distribution through Softmax, then use the attention distribution to weighted sum the Value to obtain the category-related text features ; S400, Input linear layer, map to main capsule vector, and normalize its length through Squash activation function; initialize a learnable category-guided capsule for each aspect category, and expand the category-guided capsule to batch dimension; S500: Use the category capsule output vector to perform category existence detection to determine whether the category exists in the input text; if the category exists, further classify its sentiment polarity and output a positive, negative or neutral sentiment label; S600, using the cross entropy loss function to calculate the category existence loss and sentiment polarity loss respectively, and taking the weighted sum of the two as the total loss function; S700: Train and infer the model based on data input, forward propagation, loss calculation, parameter update, and inference output.

2. The capsule network sentiment analysis method for teaching evaluation according to claim 1, characterized in that: The S100 includes: S101. Use the KeyBERT algorithm to extract keywords from each teaching evaluation text and encode each keyword into a vector; observe the keyword extraction results, use the KMeans algorithm to cluster the extracted keywords, and divide the keywords into 9 categories; S102. Define aspect category set , sentiment polarity set , then the teaching evaluation text is manually labeled with aspect categories and sentiment tuples to obtain the teaching evaluation dataset, which includes a training set, a validation set, and a test set; in, Represents a collection of aspect categories 9 categories in For positive emotions, For neutral emotions, For negative emotions.

3. The capsule network sentiment analysis method for teaching evaluation according to claim 1, characterized in that: The S200 includes: S201. Obtain a sentence in the teaching evaluation dataset , then the sentence contains 9 aspects Corresponding to 9 emotional polarities ; in Represents words in a sentence, sentence The length is n; S202, sentence S is Composed into sequences and converted into word vectors, expressed as: ; in Indicates the aspect category currently being processed, ; S203. Encode the input text through the RoBERTa model to obtain the hidden layer representation: ; in, is the hidden layer representation of the CLS tag, is the latent representation of the aspect category; is the hidden layer representation of the text sentence, The first The hidden layer representation of the labels, is the embedding dimension of RoBERTa output.

4. The capsule network sentiment analysis method for teaching evaluation according to claim 1, characterized in that: The S300 includes: S301, category features and sentence features Perform linear transformations respectively to obtain the Query vector: 、Key vector: , and the Value vector: ; in, , , are respectively learnable weight matrices; S302. Calculate the dot product similarity between the query vector and each key vector, and scale them to obtain the attention score: ; in, The dimension of the Key vector, used for scaling to prevent the gradient from being too large; S303. Perform Softmax normalization on all attention scores to obtain the attention distribution: ; S304. Use attention distribution to weight the sum of the Value vector to obtain category-related text features For use by subsequent capsule network layers: .

5. The capsule network sentiment analysis method for teaching evaluation according to claim 1, characterized in that: The S400 includes: S401, the category-related text features output by the cross attention layer Input linear layer, mapped to the main capsule vector: ; in, represents the main capsule vector, represents the weight matrix, represents the bias term; S402, main capsule vector Apply the Squash activation function to normalize its length to between 0 and 1 to enhance the expressive power of the vector: ; in, Represents the main capsule output after Squash, Represents a vector The L2 norm of S403, for each aspect category Initialize a learnable category-guided capsule ; in, , represents the dimension of the capsule vector, , N is the number of aspect categories; S404, guide the category capsule Expand the batch dimension to form a shape of The tensor allows the main capsule vector corresponding to each evaluation text to be dynamically routed with the category guidance capsules of all categories: ; S405, using dynamic routing algorithm, the main capsule vector With each category guide capsule Perform multiple rounds of information transmission and aggregation to obtain the final category capsule output : ; in, is the routing weight, obtained by Softmax normalization, representing the main capsule With category capsule The coupling strength, ; in is the routing coefficient, which is used to measure the coupling strength between the main capsule and the category capsule and is dynamically updated with the dynamic routing process.

6. The capsule network sentiment analysis method for teaching evaluation according to claim 1, characterized in that: The S500 includes: S501, for each category capsule output vector , input to the category classifier, and output the probability distribution of the category existence through the fully connected layer and Softmax function: ; in, represents the weight matrix of the category classifier, Represents the bias term of the category classifier; output It is a binary classification; S502, if the category exists, then the category capsule output vector [CLS] vector with RoBERTa Splicing, input to the sentiment classifier, through the fully connected layer and Softmax function output the probability distribution of sentiment polarity: ; in, is the weight matrix of the sentiment classifier, is the bias term of the sentiment classifier, is the hidden layer representation of the CLS tag; the output There are three categories, namely, the emotional polarity is positive / neutral / negative.

7. The capsule network sentiment analysis method for teaching evaluation according to claim 1, characterized in that: The S600 includes: S601, set the real existing label and , the corresponding model output prediction is and , is one-hot encoding, is the Softmax output probability vector; Then we get the aspect category existence loss: ; Emotional Polarity Loss: ; in, represents the set of aspect categories contained in a sentence; S602: The total loss function is obtained by weighted summing the aspect category existence loss and the sentiment polarity loss: ; in, represents the regularization coefficient, is the L2 norm of all learnable parameters to prevent overfitting.

8. The capsule network sentiment analysis method for teaching evaluation according to claim 1, characterized in that: The training and reasoning of the model in S700 includes: S701, Model training process: Input "[CLS] sentence [SEP] category [SEP]", after encoding by RoBERTa, we get ; Obtaining category-related text features through cross-attention layers ; After the main capsule layer, the category guided capsule layer, and dynamic routing, the category capsule output is obtained ; Input category classifier, output category existence probability; If the category exists, and Splicing, input sentiment classifier, output sentiment polarity probability; Calculate total loss , back propagation, update parameters; S702, Model Reasoning Process: For each category, enter "[CLS] sentence [SEP] category [SEP]"; Determine whether the category exists in turn, and if so, output the sentiment polarity, otherwise mark it as none.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the capsule network sentiment analysis method for teaching evaluation according to any one of claims 1 to 8 are implemented.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the steps of the capsule network sentiment analysis method for teaching evaluation according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Sentence-level sentiment analysis method based on text capsule neural network

    CN115098631A

  • Aspect emotion tetrad prediction method and system

    CN116562305A

  • Chinese dialogue aspect level sentiment analysis method and system

    CN117151120A

  • Attention mechanism and capsule network-based aspect-level sentiment classification method

    CN117251775A

  • Capsule network-based multi-target fine-grained vertical field analysis method

    CN117952083A

Cited By

  • Method for dynamically sensing and quantifying user intention based on multi-modal information

    CN121919817A

  • Method for dynamic perception and quantification of user intent based on multi-modal information

    CN121919817B