Text analysis method and device, computer equipment and storage medium
Through text analysis method, multiple task-specific reasoning modules are used to extract and classify students' open scientific interpretation problems, solving the problem of inefficiency of traditional analysis, real-time understanding of students' scientific thinking and precise teaching intervention.
Patent Information
- Application Number
- CN202510896358.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-07-01
AI Technical Summary
In the prior art, students' open scientific explanation problem analysis relies on manual analysis, resulting in high labor costs and time consumption, and it is difficult to objectively reflect the development of students' scientific thinking.
The text analysis method is adopted, and multiple task-specific inference modules are used to extract and classify semantic features of the analytical corpus, including dynamic sparse attention layer, gated interaction layer, mixed position-aware attention layer, adaptive feature recombination layer and linear layer, and text analysis is performed to obtain the analysis category inference matrix for multiple tasks.
Real-time understanding of students' scientific thinking and precise teaching intervention are achieved, the efficiency of analysis of open scientific explanation problems is improved, and the time and cost of manual intervention is reduced.
Smart Images

Figure CN120409496A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a text analysis method, apparatus, computer equipment, and storage medium. Background Art
[0002] The current educational trend increasingly emphasizes the status of scientific thinking in STEM (Science, Technology, Engineering, Mathematics) education. The essential characteristics of scientific thinking (such as systematic reasoning, model building, and evidence weighing) are often fully demonstrated and enhanced in open-ended scientific explanation questions. At present, in order to train students to develop scientific thinking, teachers will use open-ended scientific explanation questions to require students to analyze real situations based on subject concepts and answer them in text.
[0003] However, in actual teaching, the process of analyzing the texts of students' answers relies on manual analysis of multi-dimensional indicators such as concept accuracy, evidence adaptability, and logical coherence, which incurs high labor costs and time consumption. In addition, the analysis process relies on the teacher's subjective opinions, making it difficult to objectively and accurately analyze the texts of students' answers and difficult to reflect the current development of students' scientific thinking. Summary of the Invention
[0004] Based on this, the purpose of the present invention is to provide a text analysis method, device, computer equipment and storage medium to extract semantic features of the corpus to be analyzed, use multiple task-specific reasoning modules to perform analysis category reasoning of corresponding tasks on the obtained semantic feature matrix, and obtain analysis category reasoning matrices corresponding to multiple tasks for text analysis, so as to solve the problem of low efficiency of traditional open scientific explanation problem analysis, help teachers understand students' cognitive trajectories in real time, and provide accurate basis for teaching intervention.
[0005] In a first aspect, an embodiment of the present application provides a text analysis method, comprising the following steps: Obtaining a corpus to be analyzed and a text evaluation model, wherein the corpus to be analyzed includes a target question text and an answer text corresponding to the target question text; the text evaluation model includes a feature extraction module, multiple task-specific reasoning modules, and a category prediction module, wherein the task-specific reasoning module includes a dynamic sparse attention layer, a gated interaction layer, a hybrid position-aware attention layer, an adaptive feature recombination layer, and a linear layer; Inputting the corpus to be analyzed into the feature extraction module to extract semantic features and obtain a semantic feature matrix of the corpus to be analyzed; The semantic feature matrix of the to-be-analyzed corpus is respectively input into a plurality of the task-specific inference modules. Through the dynamic sparse attention layer, dynamic sparse attention feature extraction is performed on the semantic feature matrix of the to-be-analyzed corpus to obtain a plurality of dynamic sparse attention matrices; through the gated interaction layer, gated feature extraction and feature interaction are performed on the plurality of dynamic sparse attention matrices to obtain a plurality of gated interaction matrices; through the hybrid position-aware attention layer, hybrid position-aware attention feature extraction is performed on the plurality of gated interaction matrices to obtain a plurality of hybrid position-aware attention matrices; through the adaptive feature recombination layer, feature recombination is performed on the plurality of hybrid position-aware attention matrices to obtain a plurality of adaptive feature recombination matrices; through the linear layer, linear classification calculation is performed on the plurality of adaptive feature recombination matrices to obtain a plurality of analysis category inference matrices; The plurality of analysis category inference matrices are input into the category prediction module for analysis category prediction probability calculation to obtain a plurality of analysis category prediction probability data; according to the plurality of analysis category prediction probability data, a text analysis result is obtained.
[0006] In a second aspect, an embodiment of the present application provides a text analysis device, including: A data acquisition module, configured to acquire a to-be-analyzed corpus and a text evaluation model, where the to-be-analyzed corpus includes a target question text and a corresponding answer text of the target question text; the text evaluation model includes a feature extraction module, a plurality of task-specific inference modules, and a category prediction module, and the task-specific inference module includes a dynamic sparse attention layer, a gated interaction layer, a hybrid position-aware attention layer, an adaptive feature recombination layer, and a linear layer; A feature processing module, configured to input the to-be-analyzed corpus into the feature extraction module for semantic feature extraction to obtain a semantic feature matrix of the to-be-analyzed corpus; An analysis category reasoning module is used to input the semantic feature matrix of the corpus to be analyzed into a plurality of the task-specific reasoning modules respectively. Through the dynamic sparse attention layer, dynamic sparse attention feature extraction is performed on the semantic feature matrix of the corpus to be analyzed to obtain a plurality of dynamic sparse attention matrices; through the gated interaction layer, gated feature extraction and feature interaction are performed on the plurality of dynamic sparse attention matrices to obtain a plurality of gated interaction matrices; through the hybrid position-aware attention layer, hybrid position-aware attention feature extraction is performed on the plurality of gated interaction matrices to obtain a plurality of hybrid position-aware attention matrices; through the adaptive feature recombination layer, feature recombination is performed on the plurality of hybrid position-aware attention matrices to obtain a plurality of adaptive feature recombination matrices; through the linear layer, linear classification calculation is performed on the plurality of adaptive feature recombination matrices to obtain a plurality of analysis category reasoning matrices; through the linear layer, linear classification calculation is performed on the plurality of adaptive feature recombination matrices to obtain a plurality of analysis category reasoning matrices. A text analysis module is used to input the plurality of analysis category reasoning matrices into the category prediction module to calculate the analysis category prediction probabilities, obtaining a plurality of analysis category prediction probability data; based on the plurality of analysis category prediction probability data, a text analysis result is obtained.
[0007] In a third aspect, an embodiment of the present application provides a computer device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor; when the computer program is executed by the processor, the steps of the text analysis method as described in the first aspect are implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a storage medium storing a computer program, and when the computer program is executed by a processor, the steps of the text analysis method as described in the first aspect are implemented.
[0009] In an embodiment of the present application, a text analysis method, device, computer device, and storage medium are provided. Semantic feature extraction is performed on the corpus to be analyzed, and a plurality of task-specific reasoning modules are used to perform analysis category reasoning for corresponding tasks on the obtained semantic feature matrices respectively, obtaining analysis category reasoning matrices corresponding to the plurality of tasks for text analysis, solving the problem of low analysis efficiency in traditional open scientific explanation problem analysis, being able to help teachers understand students' cognitive trajectories in real time, and providing a basis for precise teaching intervention.
[0010] For better understanding and implementation, the present invention will be described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1Schematic flowchart of the text analysis method provided in the first embodiment of the present application; Figure 2 Schematic flowchart of S2 in the text analysis method provided in the first embodiment of the present application; Figure 3 Schematic flowchart of S3 in the text analysis method provided in the first embodiment of the present application; Figure 4 Schematic flowchart of S3 in the text analysis method provided in the second embodiment of the present application; Figure 5 Schematic flowchart of S3 in the text analysis method provided in the third embodiment of the present application; Figure 6 Schematic flowchart of S3 in the text analysis method provided in the fourth embodiment of the present application; Figure 7 Schematic flowchart of S3 in the text analysis method provided in the fifth embodiment of the present application; Figure 8 Schematic flowchart of S4 in the text analysis method provided in the first embodiment of the present application; Figure 9 Schematic flowchart of S5 in the text analysis method provided in the sixth embodiment of the present application; Figure 10 Schematic flowchart of S6 in the text analysis method provided in the seventh embodiment of the present application; Figure 11 Schematic structural diagram of the text analysis system provided in the eighth embodiment of the present application; Figure 12 Schematic structural diagram of the computer device provided in the ninth embodiment of the present application. Detailed implementation manners
[0012] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of the devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0013] The terms used in the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. The singular forms of "a", "the" and "said" used in the present application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0014] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".
[0015] The data sending end can be a computer device or a mobile terminal device, used to establish a network connection with the data receiving end, capable of encoding the data information sent to the data receiving end, and parsing the data information sent from the data receiving end.
[0016] The data receiving end can be a computer device or a mobile terminal device, used to establish a network connection with the data sending end, capable of encoding the data information sent to the data sending end, and parsing the data information sent from the data sending end.
[0017] Please refer to Figure 1 , Figure 1 , which is a schematic flowchart of the text analysis method provided by the first embodiment of this application. The method includes the following steps: S1: Obtain the corpus to be analyzed and the text evaluation model.
[0018] The execution subject of the text analysis method is the analysis device of the text analysis method (hereinafter referred to as the analysis device). In an optional embodiment, the analysis device can be a computer device, which can be a server, or a server cluster formed by combining multiple computer devices.
[0019] In this embodiment, the analysis device obtains the corpus to be analyzed and the text evaluation model. Among them, the corpus to be analyzed includes the target question text and the corresponding answer text of the target question text; the text evaluation model includes a feature extraction module, several task-specific inference modules, and a category prediction module. The task-specific inference module includes a dynamic sparse attention layer, a gated interaction layer, a hybrid position-aware attention layer, an adaptive feature recombination layer, and a linear layer.
[0020] S2: Input the corpus to be analyzed into the feature extraction module for semantic feature extraction to obtain the semantic feature matrix of the corpus to be analyzed.
[0021] In this embodiment, the analysis device inputs the corpus to be analyzed into the feature extraction module for semantic feature extraction to obtain the semantic feature matrix of the corpus to be analyzed.
[0022] The feature extraction module includes several layers of encoders, and each encoder includes a multi-head self-attention unit and a post-processing unit; please refer to Figure 2 , Figure 2 which is a schematic flowchart of step S2 in the text analysis method provided by the first embodiment of this application, including steps S21 to S23, specifically as follows: S21: Segment the to-be-analyzed corpus and perform word vector mapping to obtain a word vector sequence; add the word vector sequence to a preset sine-cosine position encoding matrix to obtain a word embedding matrix.
[0023] In this embodiment, the analysis device segments the to-be-analyzed corpus and performs word vector mapping to obtain a word vector sequence. Specifically, the analysis device uses a BERT tokenizer to generate a corresponding sub-word sequence of the to-be-analyzed corpus, where the sub-word sequence includes several sub-words. The analysis device maps each sub-word in the sub-word sequence to a 768-dimensional word vector to obtain a word vector sequence.
[0024] The analysis device adds the word vector sequence to a preset sine-cosine position encoding matrix to obtain a word embedding matrix, where the sine-cosine position encoding matrix includes sine-cosine encoding vectors of several positions in several dimensions, and the sine-cosine encoding vector is:
[0025] In the formula, k is the dimension index, i is the position index, is the sine-cosine encoding vector of the k th position in the i th dimension, is the sine-cosine encoding vector of the k th position in the (2 i +1)th dimension.
[0026] In an optional embodiment, the analysis device performs normalization processing on the word vector sequence, and adds the normalized word vector sequence to a preset sine-cosine position encoding matrix to obtain a word embedding matrix.
[0027] S22: Use the word embedding matrix as the input matrix of the first-layer encoder, and perform split-head projection decomposition on the input matrix through the multi-head self-attention unit to obtain a first split-head projection matrix; perform multi-head self-attention feature extraction on the first split-head projection matrix according to a preset first multi-head self-attention feature extraction algorithm to obtain a first multi-head self-attention matrix.
[0028] In this embodiment, the analysis device uses the word embedding matrix as the input matrix of the first-layer encoder. Through the multi-head self-attention unit, the input matrix is decomposed by head-wise projection to obtain the first head-wise projection matrix, where the first head-wise projection matrix includes a first head-wise query matrix, a first head-wise key matrix, and a first head-wise value matrix, as follows:
[0029] In the formula, is the first head-wise query matrix of the h th head, is the first head-wise key matrix of the h th head, is the first head-wise value matrix of the h th head, X is the word embedding matrix, , , are the first, second, and third head-wise learnable weight parameters of the h th head respectively.
[0030] The analysis device performs multi-head self-attention feature extraction according to the first head-wise projection matrix and a preset first multi-head self-attention feature extraction algorithm to obtain a first multi-head self-attention matrix, where the first multi-head self-attention feature extraction algorithm is:
[0031] In the formula, is the first attention feature output of the h th head, is the dimension parameter, T is the transpose symbol, is the normalization exponential function, is the first multi-head self-attention matrix, is the concatenation function, is the first multi-head self-attention weight parameter.
[0032] S23: Through the post-processing unit, the first multi-head self-attention matrix is sequentially subjected to fully connected processing and activation processing to obtain a first intermediate feature matrix. The first multi-head self-attention matrix and the first intermediate feature matrix are subjected to residual connection and layer normalization processing to obtain a post-processing matrix, which is used as the output matrix of the first-layer encoder; the output matrix of the first-layer encoder is used as the input matrix of the next encoding layer, and the above steps are repeated until the output matrix of the last layer encoder is obtained, which is used as the semantic feature matrix.
[0033] In this embodiment, the analysis device performs a fully connected process and an activation process on the first multi-head self-attention matrix in sequence through the post-processing unit to obtain a first intermediate feature matrix, where the first intermediate feature matrix is:
[0034] In the formula, is the first intermediate feature matrix, is the activation function, is the first weight parameter, is the second weight parameter, is the first bias parameter, is the second bias parameter.
[0035] The analysis device performs residual connection and layer normalization processing on the first multi-head self-attention matrix and the first intermediate feature matrix to obtain a post-processing matrix, which is used as the output matrix of the first-layer encoder, where the post-processing matrix is:
[0036] In the formula, is the post-processing matrix, is the layer normalization function.
[0037] The analysis device uses the output matrix of the first-layer encoder as the input matrix of the next encoding layer and repeats the execution until the output matrix of the last encoding layer is obtained as the semantic feature matrix.
[0038] S3: Input the semantic feature matrix of the corpus to be analyzed into several of the task-specific inference modules respectively. Through the dynamic sparse attention layer, perform dynamic sparse attention feature extraction on the semantic feature matrix of the corpus to be analyzed to obtain several dynamic sparse attention matrices; through the gated interaction layer, perform gated feature extraction and feature interaction on the several dynamic sparse attention matrices to obtain several gated interaction matrices; through the hybrid position-aware attention layer, perform hybrid position-aware attention feature extraction on the several gated interaction matrices to obtain several hybrid position-aware attention matrices; through the adaptive feature recombination layer, perform feature recombination on the several hybrid position-aware attention matrices to obtain several adaptive feature recombination matrices; through the linear layer, perform linear classification calculation on the several adaptive feature recombination matrices to obtain several analysis category inference matrices; through the linear layer, perform linear classification calculation on the several adaptive feature recombination matrices to obtain several analysis category inference matrices.
[0039] In this embodiment, the analysis device inputs the semantic feature matrix of the corpus to be analyzed into a plurality of the task-specific inference modules respectively. Through the dynamic sparse attention layer, dynamic sparse attention feature extraction is performed on the semantic feature matrix of the corpus to be analyzed to obtain a plurality of dynamic sparse attention matrices; through the gated interaction layer, gated feature extraction and feature interaction are performed on the plurality of dynamic sparse attention matrices to obtain a plurality of gated interaction matrices; through the hybrid position-aware attention layer, hybrid position-aware attention feature extraction is performed on the plurality of gated interaction matrices to obtain a plurality of hybrid position-aware attention matrices; through the adaptive feature recombination layer, feature recombination is performed on the plurality of hybrid position-aware attention matrices to obtain a plurality of adaptive feature recombination matrices; through the linear layer, linear classification calculation is performed on the plurality of adaptive feature recombination matrices to obtain a plurality of analysis category inference matrices; through the linear layer, linear classification calculation is performed on the plurality of adaptive feature recombination matrices to obtain a plurality of analysis category inference matrices.
[0040] To better learn the different features of claims, reasoning, and evidence, the analysis device copies the shared representational semantic feature matrix to the corresponding task-specific inference modules of claims, reasoning, and evidence through hardware-level parallelized channels. Each task-specific inference module is allocated an independent GPU video memory page-locked buffer to avoid data transfer overhead. The input of each task-specific sub-network is an independent semantic feature matrix.
[0041] Please refer to Figure 3 , Figure 3 which is a schematic flowchart of S3 in the text analysis method provided in the first embodiment of the present application, including steps S301 to S302, specifically as follows: S301: Perform convolution processing on the semantic feature matrix to obtain a convolution matrix; construct a sparse mask matrix for the convolution matrix to obtain a sparse mask matrix.
[0042] In this embodiment, the analysis device uses a lightweight CNN convolution layer. The kernel size of the lightweight CNN convolution layer is 3×3, and the output channels are 8. Convolution processing is performed on the semantic feature matrix to obtain a convolution matrix; a sparse mask matrix is constructed for the convolution matrix to obtain a sparse mask matrix to retain the high-attention region. Among them, the sparse mask matrix includes a plurality of sparse mask vectors, and the sparse mask vector is:
[0043] where is the sparse mask vector at the i, j position index in the sparse mask matrix, is the sigmoid activation function, is the convolution function, is the semantic feature matrix.
[0044] S302: Perform global projection decomposition on the semantic feature matrix to obtain a global projection matrix; according to a preset dynamic sparse attention feature extraction algorithm, perform dynamic sparse attention feature extraction on the sparse mask matrix and the global projection matrix to obtain a dynamic sparse attention matrix.
[0045] In this embodiment, the analysis device performs global projection decomposition on the semantic feature matrix to obtain a global projection matrix, where the global projection matrix includes a global query matrix, a global key matrix, and a global value matrix, as follows:
[0046] In the formula, is the global query matrix, is the global key matrix, is the global value matrix, H is the semantic feature matrix, , , are the first, second, and third global learnable weight parameters, respectively.
[0047] The analysis device performs dynamic sparse attention feature extraction according to the sparse mask matrix, the global projection matrix, and a preset dynamic sparse attention feature extraction algorithm to obtain a dynamic sparse attention matrix, where the dynamic sparse attention feature extraction algorithm is:
[0048] In the formula, is the dynamic sparse attention matrix, M is the sparse mask matrix, is the global query matrix, is the global key matrix, is the global value matrix, is the preset number of channels.
[0049] Please refer to Figure 4 , Figure 4 which is the flowchart of S3 in the text analysis method provided in the second embodiment of this application, including steps S303 to S304, specifically as follows: S303: Perform activation processing according to the dynamic sparse attention matrix, a preset gating parameter matrix, and a preset activation function to construct a gating weight matrix.
[0050] In this embodiment, the analysis device performs activation processing according to the dynamic sparse attention matrix, a preset gating parameter matrix, and a preset activation function to construct a gating weight matrix, where the gating weight matrix is:
[0051] In the formula, is the gating weight matrix, G is the gating parameter matrix.
[0052] S304: Element-wise multiply the dynamic sparse attention matrix with the gating weight matrix to obtain a gating feature matrix; perform a residual connection between the dynamic sparse attention matrix and the gating feature matrix to obtain a residual connection matrix; perform layer normalization processing on the residual connection matrix to obtain a layer-normalized residual connection matrix as the gating interaction matrix.
[0053] In this embodiment, the analysis device element-wise multiplies the dynamic sparse attention matrix with the gating weight matrix to obtain a gating feature matrix; performs a residual connection between the dynamic sparse attention matrix and the gating feature matrix to obtain a residual connection matrix.
[0054] The analysis device performs layer normalization processing on the residual connection matrix to obtain a layer-normalized residual connection matrix as the gating interaction matrix, where the gating interaction matrix is:
[0055] In the formula, is the gating interaction matrix, is the residual connection matrix.
[0056] Please refer to Figure 5 , Figure 5 which is a schematic flowchart of S3 in the text analysis method provided in the first and third embodiments of this application, including steps S305 to S306, specifically as follows: S305: Perform head projection decomposition on the gating interaction matrix to obtain a second head projection matrix, where the second head projection matrix includes a second head query matrix, a second head key matrix, and a second head value matrix; superimpose the second head query matrix and the second head key matrix with a preset dual-mode position encoding matrix respectively to obtain a third head query matrix and a third head key matrix, and obtain a third head query matrix and a third head key matrix.
[0057] In this embodiment, the analysis device performs head projection decomposition on the gating interaction matrix to obtain a second head projection matrix, where the second head projection matrix includes a second head query matrix, a second head key matrix, and a second head value matrix, as described below:
[0058] Wherein, is the second sub - head query matrix of the h th head, is the second sub - head key matrix of the h th head, is the second sub - head value matrix of the h th head, , , are respectively the fourth, fifth, and sixth sub - head learnable weight parameters of the h th head.
[0059] The analysis device superimposes the second sub - head query matrix and the second sub - head key matrix with a preset dual - mode position encoding matrix respectively to obtain a third sub - head query matrix and a third sub - head key matrix. The dual - mode position encoding matrix includes dual - mode encoding vectors of several positions in several dimensions, and the dual - mode encoding vector is:
[0060] Wherein, is the dual - mode encoding vector of the k th position in the 2 i th dimension, is the dual - mode encoding vector of the k th position in the (2 i + 1)th dimension.
[0061] The third sub - head query matrix and the third sub - head key matrix are as follows:
[0062] Wherein, is the third sub - head query matrix of the h th head, is the third sub - head key matrix of the h th head, is the learnable fusion coefficient of the h th head, is the dual - mode position encoding matrix.
[0063] S306: Obtain a second multi - head self - attention matrix according to the third sub - head query matrix, the third sub - head key matrix, the second sub - head value matrix, and a preset second multi - head self - attention feature extraction algorithm, and use it as the hybrid position - aware attention matrix.
[0064] In this embodiment, the analysis device obtains a second multi-head self-attention matrix as the hybrid position-aware attention matrix according to the third split query matrix, the third split key matrix, the second split value matrix, and a preset second multi-head self-attention feature extraction algorithm. Among them, the second multi-head self-attention feature extraction algorithm is as follows:
[0065] In the formula, is the output of the second attention feature of the h th head, is the second multi-head self-attention matrix, is the second multi-head self-attention weight parameter.
[0066] Please refer to Figure 6 , Figure 6 which is a schematic flowchart of S3 in the text analysis method provided in the fourth embodiment of the present application, including steps S307 to S308, specifically as follows: S307: Perform dimension partitioning on the hybrid position-aware attention matrix to obtain several groups of dimension partitioning matrices, perform intra-group information interaction on several groups of dimension partitioning matrices respectively to obtain several groups of information interaction matrices; obtain an intra-group self-attention matrix according to several groups of information interaction matrices and a preset intra-group self-attention algorithm.
[0067] In this embodiment, the analysis device performs dimension partitioning on the hybrid position-aware attention matrix to obtain several groups of dimension partitioning matrices, and performs intra-group information interaction on several groups of dimension partitioning matrices respectively to obtain several groups of information interaction matrices.
[0068] The analysis device obtains an intra-group self-attention matrix according to several groups of information interaction matrices and a preset intra-group self-attention algorithm. Among them, the intra-group self-attention algorithm is as follows:
[0069] In the formula, is the output of the intra-group self-attention feature of the th group, is the number of groups, is the information interaction matrix of the th group, is the intra-group self-attention matrix, is the data shaping function.
[0070] S308: Perform a linear transformation on the intra-group self-attention matrix to obtain an importance weight matrix, perform channel-wise multiplication of the hybrid position-aware attention matrix and the importance weight matrix to obtain a second intermediate feature matrix; perform an outer product and dimensionality reduction processing on the second intermediate feature matrix to obtain several adaptive feature recombination matrices.
[0071] In this embodiment, the analysis device performs a linear transformation on the intra-group self-attention matrix to obtain an importance weight matrix, multiplies the hybrid position-aware attention matrix and the importance weight matrix channel by channel to obtain a second intermediate feature matrix, and performs an outer product and dimensionality reduction processing on the second intermediate feature matrix to obtain a number of adaptive feature recombination matrices.
[0072] Please refer to Figure 7 , Figure 7 which is a schematic flowchart of S3 in the text analysis method provided in the fifth embodiment of this application, including steps S309 to S311, specifically as follows: S309: Perform global linear projection and grouped convolution processing on the adaptive feature recombination matrix to obtain a global linear projection matrix and a grouped convolution matrix, and perform feature fusion on the global linear projection matrix and the grouped convolution matrix to obtain a feature fusion matrix.
[0073] In this embodiment, the analysis device performs global linear projection and grouped convolution processing on the adaptive feature recombination matrix to obtain a global linear projection matrix and a grouped convolution matrix, and performs feature fusion on the global linear projection matrix and the grouped convolution matrix to obtain a feature fusion matrix.
[0074] S310: Calculate the normalized similarity according to the feature fusion matrix, a preset set of prototype vectors for several analysis categories, and a preset normalized similarity calculation algorithm to obtain the normalized similarities for several analysis categories.
[0075] In this embodiment, the analysis device calculates the normalized similarity according to the feature fusion matrix, a preset set of prototype vectors for several analysis categories, and a preset normalized similarity calculation algorithm to obtain the normalized similarities for several analysis categories, where the analysis category is used to indicate the cognitive level reflected by the response text, and the normalized similarity calculation algorithm is:
[0076] wherein, is the normalized similarity of the c th analysis category, is the temperature coefficient, is the feature fusion matrix, is the set of prototype vectors of the c th analysis category, C is the number of analysis categories.
[0077] S311: Perform linear classification calculation according to the normalized similarities for several analysis categories, the feature fusion matrix, and a preset linear classification algorithm to obtain a linear classification matrix.
[0078] In this embodiment, the analysis device performs a linear classification calculation according to the normalized similarity of the corresponding analysis categories of the task-specific inference module, the feature fusion matrix, and a preset linear classification algorithm, to obtain a linear classification matrix, where the linear classification matrix includes linear classification vectors of several analysis categories, and the linear classification algorithm is:
[0079] In the formula, is the linear classification matrix corresponding to the t th task-specific inference module, is the linear classification weight parameter, is the linear classification bias parameter.
[0080] S4: Input the inference matrices of several analysis categories into the category prediction module to calculate the prediction probabilities of the analysis categories, to obtain several analysis category prediction probability data; according to the several analysis category prediction probability data, obtain the text analysis result.
[0081] In this embodiment, the analysis device inputs the inference matrices of several analysis categories into the category prediction module to calculate the prediction probabilities of the analysis categories, to obtain several analysis category prediction probability data; according to the several analysis category prediction probability data, obtain the text analysis result.
[0082] Please refer to Figure 8 , Figure 8 which is a schematic flowchart of S4 in the text analysis method provided in the first embodiment of this application, including steps S41 to S42, specifically as follows: S41: Extract the linear classification vectors of several analysis categories at several positions in the inference matrix of the analysis category, and calculate the prediction probabilities of the analysis categories according to a preset analysis category prediction probability algorithm, to obtain analysis category prediction probability data.
[0083] In this embodiment, extract the linear classification vectors of several analysis categories at several positions in the inference matrix of the analysis category, and calculate the prediction probabilities of the analysis categories according to a preset analysis category prediction probability algorithm, to obtain analysis category prediction probability data, where the analysis category prediction probability data includes prediction probability vectors of several analysis categories at several positions, and the analysis category prediction probability algorithm is:
[0084] In the formula, is the t th data of the prediction probabilities of the analysis categories corresponding to the n th position of the cThe prediction probability vectors of each analysis category is the t th linear classification vector of the n th position of the analysis category inference matrix corresponding to the c th task-specific inference module for each analysis category.
[0085] S42: Average the prediction probability vectors of several positions of the same analysis category in the analysis category prediction probability data to obtain the average prediction probability vectors of several analysis categories; confirm the analysis category corresponding to the largest average prediction probability vector to obtain the analysis categories corresponding to several task-specific inference modules; obtain the text analysis result according to the analysis categories corresponding to several task-specific inference modules and a preset evaluation correspondence table.
[0086] In this embodiment, the analysis device averages the prediction probability vectors of several positions of the same analysis category in the analysis category prediction probability data to obtain the average prediction probability vectors of several analysis categories; confirms the analysis category corresponding to the largest average prediction probability vector to obtain the analysis categories corresponding to several task-specific inference modules.
[0087] The analysis device obtains the text analysis result according to the analysis categories corresponding to several task-specific inference modules and a preset evaluation correspondence table.
[0088] Semantic feature extraction is performed on the corpus to be analyzed. Using multiple task-specific inference modules, the obtained semantic feature matrix is respectively subjected to analysis category inference for corresponding tasks to obtain multiple analysis category inference matrices corresponding to the tasks, which are used for text analysis, solving the problem of low analysis efficiency in traditional open scientific explanation problems, being able to help teachers understand students' cognitive trajectories in real time, and providing a basis for precise teaching intervention.
[0089] In an alternative embodiment, it further includes step S9: training the text evaluation model. Please refer to Figure 9 , Figure 9 which is the flowchart of S5 in the text analysis method provided in the sixth embodiment of the present application, including steps S51~S53, specifically as follows: S51: Obtain several training corpora, input the several training corpora into the text evaluation model, and obtain several analysis category prediction probability data of the several training corpora.
[0090] In this embodiment, the analysis device obtains several training corpora, where the training corpora include training question texts and several corresponding answer texts of the training question texts.
[0091] The analysis device inputs a plurality of the training corpora into the text evaluation model to obtain a plurality of analysis category prediction probability data of the plurality of the training corpora.
[0092] S52: Obtain the true probability data of the analysis categories of the plurality of the training corpora corresponding to the plurality of the task-specific inference modules; calculate the cross-entropy loss for the plurality of the analysis category prediction probability data and the plurality of the true probability data of the analysis categories to obtain the cross-entropy loss values of the plurality of the training corpora corresponding to the plurality of the task-specific inference modules; accumulate the plurality of cross-entropy loss values corresponding to the same task-specific inference module to obtain the total cross-entropy loss values corresponding to the plurality of the task-specific inference modules. In this embodiment, the analysis device obtains the true probability data of the analysis categories of the plurality of the training corpora corresponding to the plurality of the task-specific inference modules, calculates the cross-entropy loss based on the plurality of the analysis category prediction probability data and the true probability data of the analysis categories of the plurality of the training corpora corresponding to the plurality of the task-specific inference modules to obtain the cross-entropy loss values of the plurality of the training corpora corresponding to the plurality of the task-specific inference modules, and accumulates the plurality of cross-entropy loss values corresponding to the same task-specific inference module to obtain the total cross-entropy loss values corresponding to the plurality of the task-specific inference modules, where the cross-entropy loss function is:
[0093] In the formula, is the cross-entropy loss value, is the true probability vector of the t th analysis category at the n th position in the true probability data of the analysis categories corresponding to the c th task-specific inference module of the training corpus, is the predicted probability vector of the t th analysis category at the n th position in the analysis category prediction probability data corresponding to the c th task-specific inference module of the training corpus.
[0094] The analysis device accumulates the plurality of cross-entropy loss values corresponding to the same task-specific inference module to obtain the total cross-entropy loss values corresponding to the plurality of the task-specific inference modules.
[0095] S53: Calculate the multi-task joint loss value according to the cross-entropy loss value corresponding to the same task-specific inference module, obtain the joint loss values corresponding to several task-specific inference modules, accumulate several total cross-entropy loss values and several joint loss values to obtain the total loss value; train the text evaluation model according to the total loss value.
[0096] In this embodiment, the analysis device calculates the multi-task joint loss value according to the cross-entropy loss value corresponding to the same task-specific inference module, and obtains the joint loss values corresponding to several task-specific inference modules, where the multi-task joint loss value is:
[0097] In the formula, is the multi-task joint loss value, Z is the number of cross-entropy loss values of the training corpus, is the t logarithmic variance parameter corresponding to the [i]-th task-specific inference module.
[0098] The analysis device accumulates several total cross-entropy loss values and several joint loss values to obtain the total loss value; trains the text evaluation model according to the total loss value.
[0099] The analysis device accumulates the total cross-entropy loss values and joint loss values corresponding to several task-specific inference modules to obtain the total loss value, and trains the text evaluation model according to the total loss value by using backpropagation to repeatedly calculate the gradient. The relative confidence between tasks is deduced by variational inference, so that the gradient norm of high-uncertainty tasks has an adaptive decay during parameter update, while strengthening the dominance of low-uncertainty tasks in the shared representation space. This mechanism realizes the dynamic balance of multi-task optimization of the text evaluation model by implicitly coupling the geometric features of the loss surface.
[0100] In an optional embodiment, it further includes step S6: training the text evaluation model. Please refer to Figure 10 , Figure 10 which is the flowchart of S6 in the text analysis method provided in the seventh embodiment of this application, including steps S61~S63, specifically as follows: S61: Construct prompt templates corresponding to several training question texts, input the prompt templates corresponding to several training question texts into a preset large language model for text generation, and obtain mixed texts corresponding to several training question texts.
[0101] In this embodiment, the analysis device constructs prompt templates corresponding to a number of training question texts, where the prompt templates include the training question texts and prompt texts.
[0102] The analysis device inputs the prompt templates corresponding to a number of training question texts into a preset large language model for text generation, and obtains mixed texts corresponding to the number of training question texts, where the large language model can adopt a large language model based on DeepSeek-671B or GPT-4o.
[0103] S62: Perform dynamic masked language modeling on the mixed texts corresponding to a number of training question texts to obtain dynamic masked texts corresponding to the number of training question texts and context information of a number of words in the dynamic masked texts.
[0104] In this embodiment, the analysis device performs dynamic masked language modeling on the mixed texts corresponding to a number of training question texts to randomly cover 15%-30% of the key scientific terms in the mixed texts, and obtains dynamic masked texts corresponding to the number of training question texts and context information of a number of words in the dynamic masked texts.
[0105] S63: Calculate a loss value according to the context information of a number of words in the dynamic masked texts corresponding to a number of training question texts and a preset loss function to obtain a sub-loss value, and train the feature extraction module in the text evaluation model according to the sub-loss value.
[0106] In this embodiment, the analysis device calculates an error loss value according to the context information of a number of words in the dynamic masked texts corresponding to a number of training question texts and a preset error loss function to obtain an error loss value, and trains the feature extraction module in the text evaluation model according to the error loss value, where the error loss function is:
[0107] In the formula, is the error loss value, J is the number of dynamic masked texts, is the q dynamic masked text corresponding to the th training question text, q is the qth word in the dynamic masked text,
[0108] Please refer to Figure 11 , Figure 11A structural schematic diagram of a text analysis device provided by the eighth embodiment of the present application. The text analysis device can implement all or part of the text analysis device through software, hardware, or a combination of both. The text analysis device 11 includes: A data acquisition module 111, configured to acquire a corpus to be analyzed and a text evaluation model. Among them, the corpus to be analyzed includes a target question text and a corresponding answer text of the target question text; the text evaluation model includes a feature extraction module, a plurality of task-specific inference modules, and a category prediction module. The task-specific inference module includes a dynamic sparse attention layer, a gated interaction layer, a hybrid position-aware attention layer, an adaptive feature recombination layer, and a linear layer; A feature processing module 112, configured to input the corpus to be analyzed into the feature extraction module for semantic feature extraction to obtain a semantic feature matrix of the corpus to be analyzed; An analysis category inference module 113, configured to input the semantic feature matrix of the corpus to be analyzed into a plurality of the task-specific inference modules respectively. Through the dynamic sparse attention layer, perform dynamic sparse attention feature extraction on the semantic feature matrix of the corpus to be analyzed to obtain a plurality of dynamic sparse attention matrices; through the gated interaction layer, perform gated feature extraction and feature interaction on the plurality of dynamic sparse attention matrices to obtain a plurality of gated interaction matrices; through the hybrid position-aware attention layer, perform hybrid position-aware attention feature extraction on the plurality of gated interaction matrices to obtain a plurality of hybrid position-aware attention matrices; through the adaptive feature recombination layer, perform feature recombination on the plurality of hybrid position-aware attention matrices to obtain a plurality of adaptive feature recombination matrices; through the linear layer, perform linear classification calculation on the plurality of adaptive feature recombination matrices to obtain a plurality of analysis category inference matrices; through the linear layer, perform linear classification calculation on the plurality of adaptive feature recombination matrices to obtain a plurality of analysis category inference matrices; A text analysis module 114, configured to input the plurality of analysis category inference matrices into the category prediction module for analysis category prediction probability calculation to obtain a plurality of analysis category prediction probability data; and obtain a text analysis result according to the plurality of analysis category prediction probability data.
[0109] In the embodiment of the present application, through a data acquisition module, a corpus to be analyzed and a text evaluation model are acquired. Among them, the corpus to be analyzed includes a target question text and a corresponding answer text of the target question text; the text evaluation model includes a feature extraction module, a plurality of task-specific inference modules, and a category prediction module. The task-specific inference module includes a dynamic sparse attention layer, a gated interaction layer, a hybrid position-aware attention layer, an adaptive feature recombination layer, and a linear layer. Through a feature processing module, the corpus to be analyzed is input into the feature extraction module for semantic feature extraction to obtain a semantic feature matrix of the corpus to be analyzed. Through an analysis category inference module, the semantic feature matrix of the corpus to be analyzed is respectively input into a plurality of the task-specific inference modules. Through the dynamic sparse attention layer, dynamic sparse attention feature extraction is performed on the semantic feature matrix of the corpus to be analyzed to obtain a plurality of dynamic sparse attention matrices. Through the gated interaction layer, gated feature extraction and feature interaction are performed on the plurality of dynamic sparse attention matrices to obtain a plurality of gated interaction matrices. Through the hybrid position-aware attention layer, hybrid position-aware attention feature extraction is performed on the plurality of gated interaction matrices to obtain a plurality of hybrid position-aware attention matrices. Through the adaptive feature recombination layer, feature recombination is performed on the plurality of hybrid position-aware attention matrices to obtain a plurality of adaptive feature recombination matrices. Through the linear layer, linear classification calculation is performed on the plurality of adaptive feature recombination matrices to obtain a plurality of analysis category inference matrices. Through a text analysis module, the plurality of analysis category inference matrices are input into the category prediction module for analysis category prediction probability calculation to obtain a plurality of analysis category prediction probability data. According to the plurality of analysis category prediction probability data, a text analysis result is obtained. Semantic feature extraction is performed on the corpus to be analyzed, and a plurality of task-specific inference modules are used to perform analysis category inference on the obtained semantic feature matrix for corresponding tasks respectively, obtaining analysis category inference matrices corresponding to the plurality of tasks for text analysis, solving the problem of low analysis efficiency of traditional open scientific explanation problems, being able to help teachers understand students' cognitive trajectories in real time, and providing a basis for accurate teaching intervention.
[0110] Please refer to Figure 12 , Figure 12 FIG. is a schematic structural diagram of a computer device provided in the ninth embodiment of the present application. The computer device 12 includes: a processor 121, a memory 122, and a computer program 123 stored on the memory 122 and executable on the processor 121. The computer device can store multiple instructions, and the instructions are suitable for being loaded and executed by the processor 121 to perform the method steps shown in the above first to seventh embodiments. The specific execution process can refer to the specific descriptions of the first to seventh embodiments and will not be elaborated here.
[0111] Among them, the processor 121 may include one or more processing cores. The processor 121 is connected to various parts within the server using various interfaces and lines. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 122, and by invoking the data in the memory 122, it performs various functions of the text analysis device 11 and processes data. Optionally, the processor 121 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 121 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the content to be displayed on the touch display screen; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 121 and may be implemented separately by a single chip.
[0112] Among them, the memory 122 may include a random access memory (RAM), or may also include a read-only memory (ROM). Optionally, the memory 122 includes a non-transitory computer-readable storage medium. The memory 122 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 122 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for at least one function (such as touch instructions, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store the data involved in the above-mentioned various method embodiments. Optionally, the memory 122 may also be at least one storage device located far from the aforementioned processor 121.
[0113] The embodiment of the present application also provides a storage medium. The storage medium may store multiple instructions. The instructions are suitable for being loaded and executed by a processor to perform the method steps of the first to seventh embodiments shown above. The specific execution process may refer to the specific descriptions of the first to seventh embodiments shown above and will not be elaborated here.
[0114] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the above-mentioned division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated here.
[0115] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0116] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in the form of hardware or software depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0117] In the embodiments provided by the present invention, it should be understood that the disclosed device / terminal device and method can be implemented in other ways. For example, the device / terminal device embodiments described above are only illustrative. For example, the division of the module or unit is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.
[0118] The unit described as a separated component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0119] In addition, in each embodiment of the present invention, each functional unit can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0120] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above-described embodiment methods of the present invention can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-described various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc.
[0121] The present invention is not limited to the above-described embodiments. If various modifications or deformations of the present invention do not depart from the spirit and scope of the present invention, and if these modifications and deformations are within the scope of the claims of the present invention and equivalent technical scope, then the present invention also intends to include these modifications and deformations.
Claims
1. A text analysis method, characterized in that, Including the following steps: Obtain the corpus to be analyzed and the text evaluation model. Among them, the corpus to be analyzed includes the target question text and the corresponding answer text of the target question text; the text evaluation model includes a feature extraction module, a number of task-specific inference modules, and a category prediction module. The task-specific inference module includes a dynamic sparse attention layer, a gated interaction layer, a hybrid position-aware attention layer, an adaptive feature recombination layer, and a linear layer; Input the corpus to be analyzed into the feature extraction module for semantic feature extraction to obtain the semantic feature matrix of the corpus to be analyzed; Input the semantic feature matrix of the corpus to be analyzed into a number of the task-specific inference modules respectively. Through the dynamic sparse attention layer, perform dynamic sparse attention feature extraction on the semantic feature matrix of the corpus to be analyzed to obtain a number of dynamic sparse attention matrices; through the gated interaction layer, perform gated feature extraction and feature interaction on a number of the dynamic sparse attention matrices to obtain a number of gated interaction matrices; through the hybrid position-aware attention layer, perform hybrid position-aware attention feature extraction on a number of the gated interaction matrices to obtain a number of hybrid position-aware attention matrices; through the adaptive feature recombination layer, perform feature recombination on a number of the hybrid position-aware attention matrices to obtain a number of adaptive feature recombination matrices; through the linear layer, perform linear classification calculation on a number of the adaptive feature recombination matrices to obtain a number of analysis category inference matrices; Input a number of the analysis category inference matrices into the category prediction module for analysis category prediction probability calculation to obtain a number of analysis category prediction probability data; according to a number of analysis category prediction probability data, obtain the text analysis result.
2. The text analysis method according to claim 1, wherein: The feature extraction module includes a number of layers of encoders, and the encoder includes a multi-head self-attention unit and a post-processing unit; The step of inputting the corpus to be analyzed into the feature extraction module for semantic feature extraction to obtain the semantic feature matrix of the corpus to be analyzed includes the steps: Perform word segmentation and word vector mapping on the corpus to be analyzed to obtain a word vector sequence; add the word vector sequence to a preset sine-cosine position encoding matrix to obtain a word embedding matrix; Use the word embedding matrix as the input matrix of the first-layer encoder. Through the multi-head self-attention unit, perform split-head projection decomposition on the input matrix to obtain a first split-head projection matrix; according to a preset first multi-head self-attention feature extraction algorithm, perform multi-head self-attention feature extraction on the first split-head projection matrix to obtain a first multi-head self-attention matrix; Through the post-processing unit, perform fully connected processing and activation processing on the first multi-head self-attention matrix in sequence to obtain a first intermediate feature matrix; The first multi-head self-attention matrix and the first intermediate feature matrix are subjected to residual connection and layer normalization processing to obtain a post-processing matrix as the output matrix of the first-layer encoder; the output matrix of the first-layer encoder is used as the input matrix of the next-layer encoding layer, and the process is repeated until the output matrix of the last-layer encoder is obtained as the semantic feature matrix.
3. The text analysis method according to claim 1, characterized in that, The method comprises the steps of performing dynamic sparse attention feature extraction on the semantic feature matrix of the corpus to be analyzed through the dynamic sparse attention layer to obtain a plurality of dynamic sparse attention matrices. Performing convolution processing on the semantic feature matrix to obtain a convolution matrix; performing sparse mask matrix construction on the convolution matrix to obtain a sparse mask matrix; Performing global projection decomposition on the semantic feature matrix to obtain a global projection matrix; According to the preset dynamic sparse attention feature extraction algorithm, dynamic sparse attention feature extraction is performed on the sparse mask matrix and the global projection matrix to obtain a dynamic sparse attention matrix.
4. The text analysis method according to claim 1, characterized in that The gated interaction layer is used to perform gated feature extraction and feature interaction on a plurality of dynamic sparse attention matrices to obtain a plurality of gated interaction matrices, including the steps of: According to a preset gating parameter matrix and a preset activation function, the dynamic sparse attention matrix is activated to construct a gating weight matrix; Multiplying the dynamic sparse attention matrix by the gated weight matrix element-by-element to obtain a gated feature matrix; Performing a residual connection on the dynamic sparse attention matrix and the gated feature matrix to obtain a residual connection matrix; Performing layer normalization processing on the residual connection matrix to obtain the residual connection matrix after layer normalization processing as the gated interaction matrix.
5. The text analysis method according to claim 4, characterized in that The hybrid position-aware attention layer is used to extract hybrid position-aware attention features from a plurality of gated interaction matrices to obtain a plurality of hybrid position-aware attention matrices, including the steps of: Performing head-projection decomposition on the gated interaction matrix to obtain a second head-projection matrix, where the second head-projection matrix includes a second head-query matrix, a second head-key matrix, and a second head-value matrix; Superimposing the second sub-query matrix and the second sub-key matrix with the preset dual-mode position coding matrix respectively to obtain a third sub-query matrix and a third sub-key matrix; According to the third head query matrix, the third head key matrix, the second head value matrix and the preset second multi-head self-attention feature extraction algorithm, a second multi-head self-attention matrix is obtained as the hybrid position-aware attention matrix.
6. The text analysis method according to claim 5, characterized in that, The adaptive feature recombination layer is used to perform feature recombination on a plurality of the hybrid position-aware attention matrices to obtain a plurality of adaptive feature recombination matrices, comprising the steps of: Performing dimension division on the hybrid position-aware attention matrix to obtain a plurality of groups of dimension division matrices; performing intra-group information interaction on each of the plurality of groups of dimension division matrices to obtain a plurality of groups of information interaction matrices; and obtaining an intra-group self-attention matrix based on the plurality of groups of information interaction matrices and a preset intra-group self-attention algorithm; Perform a linear transformation on the intra-group self-attention matrix to obtain an importance weight matrix, and perform a channel-wise multiplication of the hybrid position-aware attention matrix and the importance weight matrix to obtain a second intermediate feature matrix; Perform an outer product and dimensionality reduction processing on the second intermediate feature matrix to obtain a number of adaptive feature recombination matrices.
7. The text analysis method according to claim 6, wherein The step of inputting a number of the adaptive feature recombination matrices into the linear layer for linear classification calculation to obtain a number of linear classification matrices includes: Perform global linear projection and grouped convolution processing on the adaptive feature recombination matrix to obtain a global linear projection matrix and a grouped convolution matrix; perform feature fusion on the global linear projection matrix and the grouped convolution matrix to obtain a feature fusion matrix; Perform normalized similarity calculation according to the feature fusion matrix, a preset set of prototype vectors of a number of analysis categories, and a preset normalized similarity calculation algorithm to obtain normalized similarities of a number of analysis categories; Perform linear classification calculation according to the normalized similarities of a number of analysis categories, the feature fusion matrix, and a preset linear classification algorithm to obtain a linear classification matrix.
8. The text analysis method according to claim 7, characterized in that, The step of inputting a number of the analysis category inference matrices into the category prediction module for analysis category prediction probability calculation to obtain a number of analysis category prediction probability data; obtaining a text analysis result according to a number of analysis category prediction probability data includes: Extract linear classification vectors of a number of analysis categories at a number of positions in the analysis category inference matrix, and perform analysis category prediction probability calculation according to a preset analysis category prediction probability algorithm to obtain analysis category prediction probability data, where the analysis category prediction probability data includes prediction probability vectors of a number of analysis categories at a number of positions; Perform an averaging process on the prediction probability vectors at the same analysis category at a number of positions in the analysis category prediction probability data to obtain average prediction probability vectors of a number of analysis categories; confirm the analysis category corresponding to the largest average prediction probability vector to obtain a number of analysis categories corresponding to the task-specific inference modules; obtain a text analysis result according to a number of analysis categories corresponding to the task-specific inference modules and a preset evaluation correspondence table.
9. The text analysis method according to claim 1, characterized in that, It further includes the step: training the text evaluation model; The step of training the text evaluation model includes: Obtain a number of training corpora, input the number of training corpora into the text evaluation model to obtain a number of analysis category prediction probability data of a number of training corpora corresponding to the task-specific inference modules, where the training corpora include training question texts and a number of answer texts corresponding to the training question texts; Obtain the true probability data of the analysis categories corresponding to several of the task-specific inference modules; calculate the cross-entropy loss for several of the analysis category prediction probability data and several of the true probability data of the analysis categories, and obtain the cross-entropy loss values of several of the training corpora corresponding to several of the task-specific inference modules; accumulate several cross-entropy loss values corresponding to the same task-specific inference module to obtain the total cross-entropy loss values corresponding to several of the task-specific inference modules; Calculate the multi-task joint loss value according to the cross-entropy loss value corresponding to the same task-specific inference module to obtain the joint loss values corresponding to several of the task-specific inference modules, and accumulate several of the total cross-entropy loss values and several of the joint loss values to obtain the total loss value; train the text evaluation model according to the total loss value.
10. A text analysis device, characterized in that, Comprising: A data acquisition module for acquiring the corpus to be analyzed and a text evaluation model, wherein the corpus to be analyzed includes a target question text and an answer text corresponding to the target question text; the text evaluation model includes a feature extraction module, several task-specific inference modules, and a category prediction module, and the task-specific inference module includes a dynamic sparse attention layer, a gated interaction layer, a mixed position-aware attention layer, an adaptive feature recombination layer, and a linear layer; A feature processing module for inputting the corpus to be analyzed into the feature extraction module for semantic feature extraction to obtain a semantic feature matrix of the corpus to be analyzed; An analysis category inference module for inputting the semantic feature matrix of the corpus to be analyzed into several of the task-specific inference modules respectively, and through the dynamic sparse attention layer, performing dynamic sparse attention feature extraction on the semantic feature matrix of the corpus to be analyzed to obtain several dynamic sparse attention matrices; through the gated interaction layer, performing gated feature extraction and feature interaction on several of the dynamic sparse attention matrices to obtain several gated interaction matrices; through the mixed position-aware attention layer, performing mixed position-aware attention feature extraction on several of the gated interaction matrices to obtain several mixed position-aware attention matrices; through the adaptive feature recombination layer, performing feature recombination on several of the mixed position-aware attention matrices to obtain several adaptive feature recombination matrices; through the linear layer, performing linear classification calculation on several of the adaptive feature recombination matrices to obtain several analysis category inference matrices; A text analysis module for inputting several of the analysis category inference matrices into the category prediction module for analysis category prediction probability calculation to obtain several analysis category prediction probability data; obtaining a text analysis result according to several analysis category prediction probability data.
Citation Information
Patent Citations
Emotion recognition method and device for question and answer text and electronic equipment
CN116303947A
Energy management method and system based on big data
CN118195361A
Method for correcting dialogue intention information of old people based on deep neural network
CN119577522A
Multi-modal sentiment analysis method and system based on attention and graph enhanced text
CN119622559A
Transform accelerator-oriented multi-stage dynamic sparse optimization method
CN120146105A