A text classification method, system, electronic device and medium
By mining the association, semantic, and structural features of text segments in social networks and constructing a value graph structure, the problem of existing methods being unable to integrate social network value features is solved, thus improving the accuracy of text classification.
Patent Information
- Application Number
- CN202511114563.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-11
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-08-11
AI Technical Summary
Existing text classification methods struggle to effectively capture the value features and reader evaluation contributions of text segments within social networks, resulting in limited classification accuracy. Furthermore, existing models have difficulty integrating the correlation between semantic features and social network value features.
By extracting the association features, semantic features, and structural features of text segments in social networks, a value graph structure is constructed. Combining long short-term memory networks, multilayer perceptrons, and self-attention mechanisms, the embedding vectors of text segments, category descriptions, and reader evaluation texts are integrated to form a multi-dimensional classification basis.
It improves the accuracy of text classification, can more comprehensively reflect the potential relationship between text segments and classification categories, capture the value distribution characteristics of text segments in social networks, and enhance the model's ability to model complex semantic relationships.
Smart Images

Figure CN120596667B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of text classification, and particularly relate to a text classification method, system, electronic device and medium. BACKGROUND
[0002] Text classification is a core task in the field of natural language processing, aiming to assign documents to predefined categories according to their content. Due to the diversity of text structure and complexity of content, traditional machine learning methods have been unable to meet the classification needs. In contrast, deep learning methods can automatically obtain higher-level and more abstract semantic representations through multi-layer semantic operations, with strong generalization ability, thus making them have more extensive applications in the fields of spam identification, sentiment analysis, public opinion analysis, topic classification and news classification, etc.
[0003] With the development of deep learning, text classification methods can be divided into three categories: methods based on traditional neural networks, methods based on graph neural networks and methods based on pre-trained models. Methods based on traditional neural networks include convolutional neural networks, recurrent neural networks and recurrent neural networks, which can automatically learn text representations without relying on domain experts to manually design features, which makes the model have better generalization ability. However, these methods have obvious shortcomings when processing social network texts: Convolutional Neural Network (CNN) cannot effectively capture global semantic information in long text sequences; Recurrent Neural Network (RNN) and recurrent neural network are prone to gradient vanishing or gradient explosion problems, making it difficult to model long dependencies; more importantly, existing methods generally ignore the unique value features of social network texts, and cannot effectively capture important value information generated by text segmentation in social networks, resulting in limited classification accuracy. In addition, existing models are difficult to effectively fuse the association between the semantic features of the text and the social network value features, and perform poorly when processing text classification tasks with complex social attributes. SUMMARY
[0004] The following is a summary of the subject matter of the detailed description. This summary is not intended to limit the scope of the claims.
[0005] The main purpose of the embodiments of the present disclosure is to propose a text classification method, system, electronic device and medium, which ultimately improves the accuracy of text classification.
[0006] The first aspect of the embodiments of the present application proposes a text classification method, which comprises:
[0007] In response to the classification instruction of the target text, a plurality of text segments of the target text are determined, and associated features, semantic features and structural features of the text segments are extracted;
[0008] According to the associated features, the structural features and the semantic features, the categories corresponding to the text segments are determined;
[0009] According to the categories corresponding to the plurality of text segments, the category of the target text is determined;
[0010] Among them, the associated features of the text segments include:
[0011] A plurality of reader evaluation texts of each of the text segments in the social network are determined, and according to the categories of the plurality of categories of the target text and the category descriptions thereof, the reader evaluation texts belonging to each of the classification categories among the plurality of reader evaluation texts are determined;
[0012] According to the text segments, the category descriptions corresponding to each of the classification categories, and the reader evaluation texts of each of the classification categories, the associated features between the text segments and the classification categories are determined;
[0013] Among them, the semantic features of the text segments include:
[0014] According to a semantic feature extraction model, the semantic features are extracted from the text segments;
[0015] Among them, the structural features of the text segments include:
[0016] The important value features of the text segments generated in the social network are determined;
[0017] According to the important value features of the text segments, a value graph structure is constructed, wherein the nodes in the value graph structure are the unique corresponding text segments, and the edges are the similarities between the important value features of two nodes;
[0018] The structural features are extracted from the value graph structure.
[0019] In some embodiments, the associated features between the text segments and the classification categories are determined according to the text segments, the category descriptions corresponding to each of the classification categories, and the reader evaluation texts of each of the classification categories, including:
[0020] A first embedding vector of the text segment is extracted based on a vector embedding model, and a second embedding vector of the category description is extracted based on the vector embedding model;
[0021] Extracting the sum of the embedding vectors of the reader evaluation texts of each classification category based on the vector embedding model to obtain a third embedding vector;
[0022] Concatenating the second embedding vector and the third embedding vector to obtain a fourth embedding vector;
[0023] Obtaining a fifth embedding vector according to a dot product of the fourth embedding vector and the first embedding vector;
[0024] Normalizing the fifth embedding vector and performing a dot product with the fourth embedding vector to obtain a sixth embedding vector;
[0025] Inputting the sixth embedding vector into a long short-term memory network to obtain an association vector output by the long short-term memory network;
[0026] The association features between the text segment and the classification category are extracted from the association vector based on a multi-layer perceptron.
[0027] In some implementations, determining the important value features generated by the text segment in the social network includes:
[0028] extracting value features generated by the text segment in the social network;
[0029] Calculate the importance of the value feature based on LightGBM to obtain the importance value corresponding to the value feature;
[0030] Selecting the value feature whose importance value is higher than the first threshold as a candidate value feature;
[0031] Calculating the variance inflation factor and maximum information coefficient of any two candidate value features;
[0032] Obtaining the correlation between any two candidate value features based on a weighted sum of the variance inflation factors and maximum information coefficients of any two candidate value features;
[0033] Selecting a plurality of groups of candidate value features whose correlation is higher than a second threshold; wherein a group of candidate value features includes two candidate value features;
[0034] According to the relevance from low to high, the candidate value features in the plurality of groups are traversed, and in a case that an importance value of a first candidate value feature in a group of the candidate value features is greater than an importance value of a second candidate value feature, the first candidate value feature is taken as an important value feature; in a case that the importance value of the second candidate value feature in the group of the candidate value features is greater than the importance value of the first candidate value feature, the second candidate value feature is taken as the important value feature.
[0035] In some embodiments, the extracting the structural features from the value graph structure comprises:
[0036] Based on the value graph structure, a feature matrix and an adjacency matrix of the target text are calculated;
[0037] The feature matrix and the adjacency matrix are input into a self-attention mechanism to obtain output first structural features;
[0038] Based on the first structural features input into a gated recurrent network, output second structural features are obtained;
[0039] The second structural features are output to a soft attention mechanism to obtain output structural features.
[0040] In some embodiments, the semantic feature extraction model is a CNN-BiLSTM network, and the extracting corresponding semantic features from the text segments according to the semantic feature extraction model comprises:
[0041] The embedding vector corresponding to the text segment is extracted;
[0042] The embedding vector is input into the CNN-BiLSTM to obtain output first semantic features;
[0043] The embedding vector is input into a multi-scale window attention mechanism to obtain output second semantic features;
[0044] The first semantic features and the second semantic features are executed to perform gated feature fusion to obtain semantic features.
[0045] In some embodiments, the determining the category corresponding to the text segment according to the association features, the structural features and the semantic features comprises:
[0046] Based on the structural features, the association features and the semantic features, a fusion feature is obtained by splicing;
[0047] Based on a full connection layer and the fusion feature, the category corresponding to the text segment is determined.
[0048] In some embodiments, the determining the category of the target text according to the categories corresponding to the plurality of text segments comprises:
[0049] obtaining a voting result according to the confidence weighted voting of the text segments;
[0050] determining the category of the target text according to the voting result.
[0051] A second aspect of the embodiments of the present application proposes a text classification system, and the method comprises:
[0052] a feature acquisition module configured to determine a plurality of text segments of a target text in response to a classification instruction of the target text, and extract associated features, semantic features and structural features of each text segment;
[0053] a segment category calculation module configured to determine categories corresponding to the text segments according to the associated features, the structural features and the semantic features;
[0054] a text category calculation module configured to determine the category of the target text according to the categories corresponding to the plurality of text segments;
[0055] wherein the extraction of the associated features of each text segment comprises:
[0056] determining a plurality of reader evaluation texts of each of the text segments in a social network, and determining the reader evaluation texts belonging to each of the classification categories from the plurality of reader evaluation texts according to the categories of the plurality of classification categories of the target text and the category descriptions of the classification categories;
[0057] determining the associated features between the text segments and the classification categories according to the text segments, the category descriptions corresponding to each of the classification categories, and the reader evaluation texts corresponding to each of the classification categories;
[0058] wherein the extraction of the semantic features of each text segment comprises:
[0059] extracting the corresponding semantic features from the text segments according to a semantic feature extraction model;
[0060] wherein the extraction of the structural features of each text segment comprises:
[0061] determining important value features of the text segments generated in the social network;
[0062] constructing a value graph structure according to the important value features of the text segments, wherein the nodes in the value graph structure are the unique corresponding text segments, and the edges are the similarities between the important value features of two nodes;
[0063] extracting structural features from the value graph structure.
[0064] A third aspect of embodiments of the present application provides an electronic device, comprising at least one controller and a memory connected to the controller for communication; the memory stores instructions capable of being executed by the at least one controller, and the instructions are executed by the at least one controller to cause the at least one controller to perform the text classification method as described above.
[0065] A fourth aspect of embodiments of the present application provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed to implement the text classification method as described above.
[0066] The text classification method provided by the embodiments has the following advantages:
[0067] To solve the above problems, the present application mines the value contribution of the text segment in the social network, the contribution of the reader evaluation in the social network to the classification of the text segment, and forms a multi-dimensional classification basis by combining the semantic features of the text segment itself with the two aspects of features, so as to realize the classification of each text segment and finally realize the classification of the entire text. In the first aspect, the method can more comprehensively reflect the potential correlation between the text segment and the classification category by simultaneously combining the embedding vectors of the text segment, the category description and the reader evaluation text. In the second aspect, the method mines important value features that can reflect the actual influence of the segment content in the propagation process in the social network, and constructs a graph structure with the node being the only text segment and the edge weight reflecting the similarity degree of the value features of the two segments, and then extracts graph embedding representations from the graph structure. These graph embedding representations can reflect the value distribution characteristics of the text segment in the social network. In the third aspect, the method extracts corresponding semantic features from the text segment according to a semantic feature extraction model, and finally performs vector splicing on the structural features, the correlation features and the semantic features obtained respectively by the three aspects to form a multi-dimensional classification basis, so as to realize the classification of each text segment and finally realize the classification of the entire text, thereby improving the accuracy of text classification.
[0068] Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will become apparent to those skilled in the art upon examination of the following and / or can be learned by practice of the application. BRIEF DESCRIPTION OF DRAWINGS
[0069] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0070] Figure 1 is a schematic diagram of a text classification method provided in an embodiment of the present application;
[0071] Figure 2 1 is a flow chart of determining association features between text segments and classification categories provided by an embodiment of the present application;
[0072] Figure 3 This is a flow chart of extracting corresponding semantic features from text segments provided by an embodiment of the present application;
[0073] Figure 4 is a schematic diagram of a text classification system provided in an embodiment of the present application;
[0074] Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0075] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0076] In the description of this application, if there is a description of first, second, etc., it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0077] In the description of this application, it should be understood that descriptions involving orientation, such as the orientation or positional relationship indicated by up, down, etc., are based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on this application.
[0078] like Figure 1 In one embodiment of the present application, a text classification method is provided, which includes the following steps S100 to S300:
[0079] Step S100, in response to the classification instruction of the target text, determine a plurality of text segments of the target text, and extract the associated features, semantic features and structural features of each text segment.
[0080] Step S200, according to the associated features, structural features and semantic features, determine the category corresponding to the text segment.
[0081] Step S300, according to the categories corresponding to the plurality of text segments, determine the category of the target text.
[0082] In order to solve the above problems, there are features in the social network that can reflect the classification categories of the text segments, and these features can assist the classification of the text segments. Therefore, the present application mines in the social network: the value contribution of the text segment in the social network, the contribution of the reader evaluation (or reader comment) in the social network to the text classification, and uses the two contributions combined with the semantic features of the text segment to form a multi-dimensional classification basis to realize the classification of each text segment, and finally realize the classification of the entire text. The following will be introduced respectively:
[0083] Among them, the associated features of each text segment are extracted, including the following steps S110 to S120:
[0084] Step S110, determine a plurality of reader evaluation texts of each text segment in the social network, and according to the categories of the plurality of classifications of the target text and the category descriptions thereof, determine the reader evaluation texts belonging to each classification category in the plurality of reader evaluation texts.
[0085] As in most e-book reading software at present, there will be reader evaluation of each text segment, from which the reader evaluation text can be extracted.
[0086] The classification category is a category set in advance, which can be based on the category description of each classification category, and then compared with the reader evaluation text in terms of similarity to determine the closeness between each reader evaluation text and each category. The closer the case is, the reader evaluation text can be attributed to the corresponding category, and it is considered that the reader's reader evaluation text can reflect the similarity between the text segment and the category.
[0087] Step S120, according to the text segment, the category description corresponding to each classification category, and the reader evaluation text corresponding to each classification category, determine the associated features between the text segment and the classification category.
[0088] The associated features are features that can reflect the relevance between the text segment and the classification category. By obtaining the evaluation text of the reader on the text segment in the social network, the correlation between the text segment and each category is calculated in combination with the classification category description. For example Figure 2In some embodiments, the steps in step S120 specifically include the following:
[0089] Step S1210, extracting a first embedding vector of the text segment based on the vector embedding model, and extracting a second embedding vector of the category description based on the vector embedding model.
[0090] For example: there are N text segments, and the first text segment There are M classification categories, and for the jth category, there are corresponding L reader evaluation texts.
[0091] There are M classification categories, and for the jth category, there are corresponding L reader evaluation texts, that is to .
[0092] In step S1210, the BERT model is selected as the vector embedding model. The first embedding vector of the text segment :
[0093] ;
[0094] The second embedding vector of the category description corresponding to the category :
[0095] ;
[0096] Step S1220, extracting the sum of embedding vectors of reader evaluation texts corresponding to each classification category based on the vector embedding model to obtain a third embedding vector.
[0097] In step S1220, the sum of embedding vectors of reader evaluation texts corresponding to each classification category is extracted based on the vector embedding model. It is assumed that the sum of embedding vectors for the jth category is :
[0098] ;
[0099] Step S1230, concatenating the second embedding vector and the third embedding vector to obtain a fourth embedding vector.
[0100] In step S1230, the second embedding vector and the third embedding vector are concatenated to obtain a fourth embedding vector , which includes:
[0101] ;
[0102] Step S1240, obtaining a fifth embedding vector according to the dot product of the fourth embedding vector and the first embedding vector.
[0103] In step S1240, the fifth embedding vector is obtained according to the dot product of the fourth embedding vector and the first embedding vector . Comprises:
[0104] ;
[0105] Step S1250, after normalizing the fifth embedding vector, the dot product of the fourth embedding vector is obtained.
[0106] In step S1250, after normalizing the fifth embedding vector , the dot product of the fourth embedding vector is obtained. Comprises:
[0107] ;
[0108] Wherein, is a mapping function of the normalization operation.
[0109] Step S1260, inputting the sixth embedding vector into the long short-term memory network to obtain the association vector output by the long short-term memory network.
[0110] In step S1260, the sixth embedding vector is input into the long short-term memory network to obtain the association vector output by the long short-term memory network . Comprises:
[0111] ;
[0112] Wherein, lstm is a mapping function corresponding to the long short-term memory network.
[0113] Step S1270, extracting an association feature from the association vector based on a multi-layer perception.
[0114] In step S1270, an association feature is extracted from the association vector based on a multi-layer perception.
[0115] ;
[0116] Wherein, is a mapping function corresponding to the multi-layer perception.
[0117] Compared with the prior art, the method can more comprehensively reflect the association between the text segments and the classification categories by simultaneously fusing the embedding vectors of the category description and the reader evaluation. In addition, the modeling capability of the model for complex semantic relationships is enhanced by processing the correlation degree sequence through the long short-term memory network, thereby improving the classification accuracy in the social network text classification task.
[0118] The step S130 of extracting the semantic features of each text segment comprises the following steps S1310-S1340:
[0119] The step S130 of extracting the semantic features of each text segment comprises the following steps S1310-S1340:
[0120] The semantic features refer to the context meaning of the text content itself, for example, the bidirectional long short-term memory network can be used to extract the word sequence dependency relationship to capture the topic distribution and sentiment tendency of the segment.
[0121] As Figure 3 Further, the step S130 of extracting the semantic features of each text segment from the text segment according to the semantic feature extraction model comprises the following steps S1310-S1340:
[0122] The step S1310 of extracting the embedding vector corresponding to the text segment. The embedding vector refers to a feature representation converted from the text segment into a numerical form by a vectorization method, for example, a word vector is generated using a Word2Vec or BERT pre-training model and then an average pooling operation is performed to realize the conversion of discrete text symbols o into continuous numerical space representation for subsequent neural network processing.
[0123] The step S1320 of inputting the embedding vector into the CNN-BiLSTM to obtain the output first semantic feature. The CNN-BiLSTM refers to a hybrid model combining a convolutional neural network and a bidirectional long short-term memory network, which can be implemented by extracting local semantic features through a convolutional layer and capturing context dependency through a bidirectional LSTM, and is used to capture local key information and long-distance time sequence features of the text.
[0124] The step S1330 of inputting the embedding vector into the multi-scale window attention mechanism to obtain the output second semantic feature. The multi-scale window attention mechanism is used to capture the global correlation features of the text under different semantic granularities.
[0125] The step S1340 of performing gated feature fusion on the first semantic feature and the second semantic feature to obtain the semantic feature. The gated feature fusion refers to dynamically adjusting the fusion ratio of different features through a learnable gating mechanism, which can be implemented by generating a gating weight using a sigmoid function and then performing weighted summation on the features, and is used to adaptively integrate complementary semantic information extracted by different models.
[0126] Compared with the prior art, the method cooperates CNN-BiLSTM and a multi-scale window attention mechanism, retains the sensitivity of the convolutional network to local semantics, and enhances the capturing ability of global semantic association through the multi-scale attention mechanism. Compared with a single model architecture, the double-path design can improve the integrity of feature expression.
[0127] The extracting of the structural features of each text segment includes the following steps S140 to S160:
[0128] In step S140, the important value features of the text segment generated in the social network are determined.
[0129] In step S150, a value graph structure is constructed according to the important value features of the text segment, wherein the nodes in the value graph structure correspond to the unique text segments, and the edges correspond to the similarity between the important value features of the two nodes.
[0130] In step S160, the structural features are extracted from the value graph structure.
[0131] The important value features refer to the user interaction data generated by the text segment in the social network, which can be quantified by indicators such as the number of likes, the depth of forwarding, and the sentiment tendency of comments, to reflect the actual influence of the segment content in the propagation process. The value graph structure refers to a topological network representing the value distribution relationship of the text, in which the nodes represent unique text segments, and the edge weights represent the similarity between the value features of the two segments. For example, the cosine similarity algorithm can be used to calculate the edge weight. The structural features refer to the graph embedding representation extracted from the value graph structure, which can capture the association pattern between nodes using a graph attention network, and reflect the value distribution characteristics of the text segment in the social network.
[0132] Further, the determination of the important value features of the text segment generated in the social network in step S140 includes the following steps S1410 to S1470:
[0133] In step S1410, the value features of the text segment generated in the social network are extracted.
[0134] In step S1420, the importance of the value features is calculated based on LightGBM to obtain the importance values corresponding to the value features. LightGBM refers to a machine learning algorithm based on a gradient boosting framework, which uses a tree model to calculate the gain and evaluate the importance of features, to quantify the contribution of different value features to the classification results.
[0135] In step S1430, the value features with importance values higher than a first threshold value are selected as candidate value features.
[0136] Step S1440, calculate the variance inflation factor and the maximum information coefficient of any two candidate value features. The variance inflation factor refers to an index for measuring the multicollinearity between features, for example, calculating the variance inflation coefficient between features by using a linear regression model, which is used to detect the redundancy between candidate value features.
[0137] The maximum information coefficient refers to a non-parametric statistical quantity for measuring the correlation between variables, which can be implemented by using grid discretization and mutual information calculation, and is used to capture the linear or nonlinear correlation between candidate value features.
[0138] Step S1450, based on the weighted sum of the variance inflation factor and the maximum information coefficient of any two candidate value features, the correlation of any two candidate value features is obtained. The weighted sum refers to the linear combination of indexes of different dimensions after normalization, for example, the variance inflation factor and the maximum information coefficient are weighted calculated by using the preset weight coefficient, which is used to comprehensively evaluate the correlation strength between features.
[0139] Step S1460, select a plurality of groups of candidate value features with a correlation higher than a second threshold; wherein a group of candidate value features includes two candidate value features.
[0140] Step S1470, in the order from low to high correlation, traverse the plurality of groups of candidate value features, and in the case that the importance value of the first candidate value feature in a group of candidate value features is greater than the importance value of the second candidate value feature, the first candidate value feature is taken as an important value feature; in the case that the importance value of the second candidate value feature in a group of candidate value features is greater than the importance value of the first candidate value feature, the second candidate value feature is taken as an important value feature.
[0141] Compared with the prior art, the method can simultaneously capture the linear and nonlinear correlation between features by fusing the variance inflation factor and the maximum information coefficient, and realize more accurate feature screening by combining the importance sorting mechanism, effectively solving the problem of low efficiency of the classification model caused by high dimension and strong redundancy of the social network text features. Through the multi-stage feature screening mechanism, the key discriminative features are retained while the feature space dimension is reduced, thereby improving the calculation efficiency of subsequent graph structure construction. At the same time, the feature selection strategy based on comprehensive correlation evaluation can avoid single index bias and ensure that the important value features selected have stronger classification discrimination ability, thereby finally improving the accuracy of text classification.
[0142] Further, step S160 extracts structural features from the value graph structure, including the following steps S1610 to S1640:
[0143] Step S1610, based on the value graph structure, calculate the feature matrix and the adjacency matrix of the target text.
[0144] wherein the feature matrix refers to a matrix composed of feature vectors of nodes in the value graph structure, for example, formed by concatenating word vectors or sentence vectors of text segmentation, used to represent the distribution state of different text segments in the feature space.
[0145] The adjacency matrix refers to a matrix describing the connection relationship between nodes in the value graph structure, for example, calculating edge weights using cosine similarity or Euclidean distance, used to quantify the association strength between different text segments.
[0146] Step S1620, input the feature matrix and the adjacency matrix into the self-attention mechanism to obtain the output first structure feature. The self-attention mechanism refers to capturing global dependency by calculating attention weights between different positions in the feature matrix, for example, implemented by using a multi-head attention module, which can dynamically adjust the interaction strength between node features.
[0147] Step S1630, input the first structure feature into the GRU to obtain the output second structure feature. The GRU refers to the Gated Recurrent Unit, which can specifically use a hidden state update gate and a reset gate structure to capture the time sequence dependency in the sequential structure feature.
[0148] Step S1640, output the second structure feature to the soft attention mechanism to obtain the output structure feature. The soft attention mechanism refers to weighting and aggregating the input features through learnable parameters, which can be specifically implemented by using a fully connected layer combined with normalization operation, and can automatically focus on key structure features.
[0149] Specifically, after calculating the feature matrix and the adjacency matrix, the self-attention mechanism first performs global interaction on the node features, calculates the association weight between different nodes through multi-head attention, and generates the first structure feature containing global structure information. Then, the GRU models the first structure feature in sequence, captures the local dependency between adjacent nodes by using its gating mechanism, and outputs the second structure feature with time sequence association. Finally, the soft attention mechanism dynamically weights the second structure feature, automatically selects the feature dimensions with high contribution to the classification task through learnable parameters, and forms the final structure feature vector. This process realizes the extraction of structure features from global to local and from static to dynamic through multi-stage attention mechanism.
[0150] Compared with the prior art, the method innovatively associates the multiple reader evaluation texts existing in the social network, the important value features of socialization, and the semantic features of the text content in multiple dimensions, which can improve the accuracy of target text classification.
[0151] Further, the determining, in the step S200, of the category corresponding to the text segment according to the association feature, the value feature, and the semantic feature comprises the following steps S210 to S220:
[0152] The step S210 comprises the following steps:
[0153] The step S220 comprises the following steps:
[0154] In the determining of the category corresponding to the text segment, the structural feature, the association feature, and the semantic feature are first spliced to form a fusion feature vector. The fusion feature simultaneously contains the social value attribute, the category association, and the semantic information of the text. Subsequently, the fusion feature is input into a full connection layer, processed through linear transformation and a nonlinear activation function, and finally outputs the probability distribution of the text segment belonging to each classification category.
[0155] Compared with the prior art, the method realizes the synergistic effect of the structural feature, the association feature, and the semantic feature through multi-dimensional feature splicing and full connection layer fusion, enhances the understanding ability of the model to the comprehensive attributes of the text by fusing the structural feature, the association feature, and the semantic feature, and solves the classification deviation problem caused by the single feature of the traditional method. Meanwhile, the nonlinear mapping mechanism of the full connection layer further optimizes the classification boundary, so that the model can more accurately distinguish similar categories.
[0156] The determining, in the step S300, of the category of the target text according to the categories corresponding to the plurality of text segments comprises the following steps S310 to S320:
[0157] The step S310 comprises the following steps:
[0158] The step S310 comprises the following steps:
[0159] Through the above technical solutions, the method can improve the classification accuracy in the long text multi-paragraph scenario.
[0160] The text classification method provided in the application has at least the following beneficial effects:
[0161] To solve the above problems, the application mines the value contribution of the text segment in the social network, the contribution of the reader evaluation in the social network to the classification of the text segment, and forms a multi-dimensional classification basis by combining the two contributions with the semantic features of the text segment itself to realize the classification of each text segment and finally realize the classification of the entire text. In the first aspect, the method can more comprehensively reflect the potential association between the text segment and the classification category by simultaneously fusing the embedding vectors of the text segment, the category description, and the reader evaluation text. In the second aspect, the method mines important value features that can reflect the actual influence of the segment content in the propagation process in the social network, constructs a graph structure with the node being the only text segment and the edge weight reflecting the similarity of the value features of the two segments, and then extracts graph embedding representations from the graph structure. These graph embedding representations can reflect the value distribution characteristics of the text segment in the social network. In the third aspect, the method extracts the corresponding semantic features from the text segment according to a semantic feature extraction model, and finally performs vector splicing on the structural features, the association features, and the semantic features obtained by the three aspects to form a multi-dimensional classification basis to realize the classification of each text segment and finally realize the classification of the entire text, thereby improving the accuracy of text classification.
[0162] As Figure 4 One embodiment of the application provides a text classification system, which comprises:
[0163] The feature acquisition module 1000 is configured to determine a plurality of text segments of the target text in response to a classification instruction of the target text, and extract association features, semantic features, and structural features of each text segment.
[0164] The segment category calculation module 2000 is configured to determine the category corresponding to the text segment according to the association features, the structural features, and the semantic features.
[0165] The text category calculation module 3000 is configured to determine the category of the target text according to the categories corresponding to the plurality of text segments.
[0166] The association features of each text segment include:
[0167] Determine a plurality of reader evaluation texts of each text segment in the social network, and determine the reader evaluation texts belonging to each classification category among the plurality of reader evaluation texts according to the categories of the plurality of classifications of the target text and the category descriptions thereof.
[0168] Determine the association features between the text segment and the classification category according to the text segment, the category description corresponding to each classification category, and the reader evaluation text corresponding to each classification category.
[0169] The semantic features of each text segment include:
[0170] According to the semantic feature extraction model, corresponding semantic features are extracted from the text segments;
[0171] The structure features of each text segment are extracted, including:
[0172] The important value features of the text segments in the social network are determined;
[0173] The value graph structure is constructed according to the important value features of the text segments, wherein the nodes in the value graph structure correspond to the unique text segments, and the edges correspond to the similarity between the important value features of the two nodes;
[0174] The structure features are extracted from the value graph structure.
[0175] It should be noted that the text classification method embodiment and the above-mentioned text classification system embodiment are based on the same inventive concept, and therefore the related content of the above-mentioned text classification method embodiment is also applicable to the text classification system embodiment, which will not be described here.
[0176] Referring to Figure 5 The electronic device provided by the embodiment of the present application comprises:
[0177] at least one memory;
[0178] at least one processor;
[0179] at least one program;
[0180] The program is stored in the memory, and the processor executes the at least one program to implement the above-mentioned text classification method of the present disclosure.
[0181] The electronic device can be any intelligent terminal, including a mobile phone, a tablet computer, a personal digital assistant (PDA), a vehicle-mounted computer, etc.
[0182] The electronic device of the embodiment of the present application will be described in detail below.
[0183] The processor 1600 can be implemented in the form of a general central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to execute related programs to implement the technical solutions provided by the embodiment of the present application.
[0184] The memory 1700 can be implemented in the form of a Read Only Memory (ROM), a static storage device, a dynamic storage device, or a Random Access Memory (RAM), etc. The memory 1700 can store an operating system and other application programs, and the program codes of the technical solutions provided by the embodiments of the present specification are stored in the memory 1700 and called and executed by the processor 1600 to implement the text classification method of the present application.
[0185] The input / output interface 1800 is configured to realize information input and output.
[0186] The communication interface 1900 is configured to realize the communication interaction between the device and other devices, and can realize communication through a wired manner (for example, a USB, a network cable, etc.) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.).
[0187] The bus 2000 is configured to transmit information between various components (for example, the processor 1600, the memory 1700, the input / output interface 1800, and the communication interface 1900) of the device.
[0188] The processor 1600, the memory 1700, the input / output interface 1800, and the communication interface 1900 are connected to each other through the bus 2000 to realize communication connection between them in the device.
[0189] The embodiments of the present application also provide a storage medium, which is a computer readable storage medium, and stores computer executable instructions for causing a computer to execute the above-mentioned text classification method.
[0190] The memory is a non-transitory computer readable storage medium, which can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory can include a high-speed random access memory, and can also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory remotely arranged relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0191] The embodiments described in the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0192] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than the figures, or combine certain steps, or different steps.
[0193] The device embodiments described above are merely illustrative, and units described as separate components can or can not be physically separated, i.e., can be located in one place or distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments.
[0194] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the functions of the modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.
[0195] The terms "first", "second", "third", "fourth" and the like (if any) in the specification of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0196] It should be understood that in the present application, "at least one" means one or more, and "multiple" means two or more. "And / or" is used to describe the relationship between the associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that there are three cases: only A, only B, and A and B at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or similar expressions means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can mean a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0197] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented by other manners. For example, the apparatus embodiments described above are merely illustrative, for example, the division of units is merely a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, apparatuses or units, and can be electrical, mechanical or other forms.
[0198] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place or can be distributed to a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0199] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0200] If the integrated unit is realized 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, the technical solutions of the present application essentially or the part of the prior art that contributes to the technical solutions or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program storage media.
[0201] The above is a specific description of the preferred embodiments of the present application, but the embodiments of the present application are not limited to the above described embodiments. Those skilled in the art can make various equivalent modifications or replacements without departing from the spirit of the embodiments of the present application, and these equivalent modifications or replacements are all included in the scope defined by the claims of the embodiments of the present application.
Claims
1. A text classification method, characterized in that: The method comprises: In response to a classification instruction of a target text, determining a plurality of text segments of the target text, and extracting association features, semantic features, and structural features of the text segments; Determining a category corresponding to the text segment based on the association feature, the structural feature, and the semantic feature; Determining the category of the target text according to the categories corresponding to the multiple text segments; Among them, the associated features of the text segment are extracted, including: Determining a plurality of reader evaluation texts for each of the text segments in the social network, and determining, based on the multiple classification categories and category descriptions of the target text, the reader evaluation texts belonging to each of the classification categories among the plurality of reader evaluation texts; determining, based on the text segment, the category description corresponding to each of the classification categories, and the reader evaluation text of each of the classification categories, an association feature between the text segment and the classification category; The semantic features of text segments are extracted, including: Extracting semantic features from the text segments according to a semantic feature extraction model; Among them, the structural features of the text segment are extracted, including: determining important value features generated by the text segment in the social network; Constructing a value graph structure based on the important value features of the text segment, wherein a node in the value graph structure is a uniquely corresponding text segment, and an edge is a similarity between the important value features of two nodes; Structural features are extracted from the value graph structure.
2. The text classification method according to claim 1, characterized in that Determining the association features between the text segments and the classification categories based on the text segments, the category description corresponding to each of the classification categories, and the reader evaluation text of each of the classification categories includes: extracting a first embedding vector for the text segment based on a vector embedding model, and extracting a second embedding vector for the category description based on the vector embedding model; Extracting the sum of the embedding vectors of the reader evaluation texts of each classification category based on the vector embedding model to obtain a third embedding vector; Concatenating the second embedding vector and the third embedding vector to obtain a fourth embedding vector; Obtaining a fifth embedding vector according to a dot product of the fourth embedding vector and the first embedding vector; Normalizing the fifth embedding vector and performing a dot product with the fourth embedding vector to obtain a sixth embedding vector; Inputting the sixth embedding vector into a long short-term memory network to obtain an association vector output by the long short-term memory network; The association features between the text segment and the classification category are extracted from the association vector based on a multi-layer perceptron.
3. The text classification method according to claim 1, characterized in that Determining the important value features generated by the text segment in the social network includes: extracting value features generated by the text segment in the social network; Calculate the importance of the value feature based on LightGBM to obtain the importance value corresponding to the value feature; Selecting the value feature whose importance value is higher than the first threshold as a candidate value feature; Calculating the variance inflation factor and maximum information coefficient of any two candidate value features; Obtaining the correlation between any two candidate value features based on a weighted sum of the variance inflation factors and maximum information coefficients of any two candidate value features; Selecting a plurality of groups of candidate value features whose correlation is higher than a second threshold; wherein a group of candidate value features includes two candidate value features; The plurality of groups of candidate value features are traversed in order of the relevance from low to high, and when the importance value of the first candidate value feature in a group of candidate value features is greater than the importance value of the second candidate value feature, the first candidate value feature is taken as the important value feature; when the importance value of the second candidate value feature in a group of candidate value features is greater than the importance value of the first candidate value feature, the second candidate value feature is taken as the important value feature.
4. The text classification method according to claim 3, characterized in that The extracting structural features from the value graph structure includes: Based on the value graph structure, calculating the feature matrix and adjacency matrix of the target text; Inputting the feature matrix and the adjacency matrix into a self-attention mechanism to obtain a first structural feature of the output; Inputting the first structural feature into a gated recurrent network to obtain an output second structural feature; The second structural feature is output to the soft attention mechanism to obtain the output structural feature.
5. The text classification method according to claim 1, characterized in that The semantic feature extraction model is a CNN-BiLSTM network, and the corresponding semantic features are extracted from the text segment according to the semantic feature extraction model, including: Extracting embedding vectors corresponding to the text segments; Inputting the embedding vector into the CNN-BiLSTM to obtain a first semantic feature of the output; Inputting the embedding vector into a multi-scale window attention mechanism to obtain a second semantic feature of the output; Perform gated feature fusion on the first semantic feature and the second semantic feature to obtain a semantic feature.
6. The text classification method according to claim 5, characterized in that The determining, based on the association feature, the structural feature, and the semantic feature, of a category corresponding to the text segment includes: Obtaining a fusion feature based on the splicing of the structural feature, the association feature, and the semantic feature; Based on the fully connected layer and the fused features, the category corresponding to the text segment is determined.
7. The text classification method according to claim 6, characterized in that Determining the category of the target text according to the categories corresponding to the multiple text segments includes: Perform weighted voting based on the confidence of the text segments to obtain a voting result; The category of the target text is determined according to the voting result.
8. A text classification system, characterized in that The system comprises: A feature acquisition module, configured to determine a plurality of text segments of the target text in response to a classification instruction of the target text, and extract associated features, semantic features, and structural features of each text segment; A segmentation category calculation module, configured to determine a category corresponding to the text segment based on the association feature, the structural feature, and the semantic feature; a text category calculation module, configured to determine the category of the target text according to the categories corresponding to the multiple text segments; The associated features of each text segment are extracted, including: Determining a plurality of reader evaluation texts for each of the text segments in the social network, and determining, based on the multiple classification categories and category descriptions of the target text, the reader evaluation texts belonging to each of the classification categories among the plurality of reader evaluation texts; determining, based on the text segment, the category description corresponding to each of the classification categories, and the reader evaluation text corresponding to each of the classification categories, an association feature between the text segment and the classification category; The semantic features of each text segment are extracted, including: Extracting corresponding semantic features from the text segments according to a semantic feature extraction model; The structural features of each text segment are extracted, including: determining important value features generated by the text segment in the social network; Constructing a value graph structure based on the important value features of the text segment, wherein a node in the value graph structure is a uniquely corresponding text segment, and an edge is a similarity between the important value features of two nodes; Structural features are extracted from the value graph structure.
9. An electronic device, characterized in that: It includes at least one controller and a memory for communicating with the controller; the memory stores instructions that can be executed by the at least one controller, and the instructions are executed by at least one of the controllers to enable at least one of the controllers to perform the text classification method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the text classification method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Product function feature importance analysis method based on online user comments
CN109165996A
Social media rumor detection method and device based on graph structure adversarial learning
CN111858928A