Text classification method, device, equipment, and storage medium

Through the method of combining concept maps and neural networks, the conceptual word sets of short texts are obtained and feature matrix is ​​generated. Combining the weight of conceptual words and text, the problems of lack of context and sparse features in short text classification are solved, and higher classification accuracy is achieved.

CN115687605BActive Publication Date: 2025-09-02CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110825330.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-21
Publication Date
2025-09-02
Estimated Expiration
2041-07-21

AI Technical Summary

Technical Problem

It is difficult for the prior art to accurately classify short texts published on social network platforms, especially the inaccurate classification problems caused by the lack of context information and sparse characteristics of short texts.

Method used

By using the concept map to obtain a set of concept words with a similarity greater than the threshold to the text to be classified, a feature matrix is ​​generated after mapping, and a neural network model is used for classification, taking into account the similarity and importance weights of concept words and text, and fusing the feature matrix for identification.

Benefits of technology

The accuracy of short text classification is improved, the problem of short text lacking context and sparse features is solved, and the accuracy of classification results is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115687605B_ABST
    Figure CN115687605B_ABST
Patent Text Reader

Abstract

The present application discloses a text classification method, apparatus, device, and storage medium. The method includes: determining concept words whose similarity to original words in a text to be classified is greater than a threshold, thereby obtaining a concept word set; performing mapping processing on the concept word set to obtain a first feature matrix; performing mapping processing on the text to be classified to obtain a second feature matrix; and identifying the category of the text to be classified based on the concept word set, the first feature matrix, and the second feature matrix. This improves the accuracy of identifying the category of the text to be classified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to information processing technology, and relate to but are not limited to a text classification method and apparatus, device, and storage medium. Background Art

[0002] With the continuous development of Internet technology, more and more people post text information on social networking platforms such as Weibo. How to accurately classify these texts is a key technology. Summary of the Invention

[0003] In view of this, the text classification method, apparatus, device, and storage medium provided in the embodiments of the present application can improve the recognition accuracy of the text category to be classified. The text classification method, apparatus, device, and storage medium provided in the embodiments of the present application are implemented as follows:

[0004] The text classification method provided in an embodiment of the present application includes: determining concept words whose similarity with original words of a text to be classified is greater than a threshold, thereby obtaining a concept word set; performing mapping processing on the concept word set to obtain a first feature matrix; performing mapping processing on the text to be classified to obtain a second feature matrix; and identifying the category of the text to be classified based on the concept word set, the first feature matrix, and the second feature matrix.

[0005] The text classification device provided in an embodiment of the present application includes: a determination module, which is used to determine concept words whose similarity with the original words of the text to be classified is greater than a threshold, thereby obtaining a concept word set; a processing module, which is used to perform mapping processing on the concept word set to obtain a first feature matrix; the processing module is also used to perform mapping processing on the text to be classified to obtain a second feature matrix; and an identification module, which is used to identify the category of the text to be classified based on the concept word set, the first feature matrix and the second feature matrix.

[0006] An electronic device provided in an embodiment of the present application includes a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the method described in the embodiment of the present application is implemented.

[0007] The computer-readable storage medium provided in the embodiment of the present application stores a computer program thereon, and when the computer program is executed by a processor, the method provided in the embodiment of the present application is implemented.

[0008] In an embodiment of the present application, a concept word set is obtained by determining the concept words whose similarity with the original words of the text to be classified is greater than a threshold; then the concept word set is mapped to obtain a first feature matrix; then the text to be classified is mapped to obtain a second feature matrix; finally, the category of the text to be classified is identified based on the concept word set, the first feature matrix and the second feature matrix. In this way, on the one hand, the introduction of the concept word set corresponding to the text to be classified can solve the problem of difficulty in accurate classification caused by the lack of context and sparse features in the original words; on the other hand, the category of the text to be classified is identified based on the concept word set and the first feature matrix formed after mapping the concept word set, and the second feature matrix formed after mapping the text to be classified. In this way, according to the first feature matrix, the key concept words in the concept word set that have a higher degree of influence on the classification result of the text to be classified can be determined; according to the second feature matrix, the key concept words in the concept word set that have a higher similarity with other concept words can be determined, and then the category of the text to be classified is identified based on these key concept words, and the accuracy of the obtained category is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and, together with the specification, are used to illustrate the technical solutions of the present application.

[0010] Figure 1 A schematic diagram of an implementation flow of a text classification method provided in an embodiment of the present application;

[0011] Figure 2 A schematic diagram of the implementation flow of another text classification method provided in an embodiment of the present application;

[0012] Figure 3 A schematic diagram of an implementation flow of another text classification method provided in an embodiment of the present application;

[0013] Figure 4 A schematic diagram of an implementation flow of another text classification method provided in an embodiment of the present application;

[0014] Figure 5 A schematic diagram of mapping processing of short text data provided in an embodiment of the present application;

[0015] Figure 6 An example schematic diagram of short text data and concept sets provided in an embodiment of the present application;

[0016] Figure 7 A schematic diagram of a knowledge-enhanced network model provided in an embodiment of the present application;

[0017] Figure 8Another example schematic diagram of short text data and concept sets provided in an embodiment of the present application;

[0018] Figure 9 This is a schematic diagram of the structure of a text classification device according to an embodiment of the present application;

[0019] Figure 10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0020] To make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the specific technical solutions of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application but are not intended to limit the scope of the present application.

[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0022] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0023] It should be pointed out that the terms "first\second\third" involved in the embodiments of the present application are used to distinguish similar or different objects, and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0024] An embodiment of the present application provides a text classification method, which is applied to an electronic device. During implementation, the electronic device can be any type of device with information processing capabilities. For example, the electronic device can include a personal computer, a laptop computer, a PDA, or a server. The electronic device can also be a mobile terminal, such as a mobile phone, a car computer, a tablet computer, or a projector. The functions implemented by the method can be implemented by a processor in the electronic device calling program code. Of course, the program code can be stored in a computer storage medium. Therefore, the electronic device includes at least a processor and a storage medium.

[0025] Figure 1 The following is a flowchart of the text classification method provided in the embodiment of the present application. Figure 1 As shown, the method may include the following steps 101 to 103:

[0026] Step 101: determine concept words whose similarity to the original words of the text to be classified is greater than a threshold, thereby obtaining a concept word set.

[0027] In the embodiments of the present application, the text to be classified can be of various lengths. For example, the text to be classified can be a single character or word, such as "good"; a short sentence, such as "yes"; a long sentence, such as "Beijing time, March 30, James received many cheers from fans while playing basketball"; or a paragraph, etc. There is no limit to the length of the text to be classified.

[0028] In some embodiments, the text to be classified is first preprocessed to obtain a plurality of original words. The preprocessing process may include at least one of the following:

[0029] (1) Correct spelling errors in the text to be classified;

[0030] (2) Removing punctuation marks and special symbols from the text to be classified;

[0031] (3) Perform word segmentation on the text to be classified, so that the text to be classified can be divided into N separate words. For example, for the sentence "The movie is so good", the sentence can be divided into five words, such as "The", "movie", "is", "so", and "good", according to the spaces in the sentence.

[0032] (4) Delete the words that do not affect the semantics from the multiple words after the text to be classified is segmented, and obtain M original words (M≤N) of the text to be classified.

[0033] After the preprocessing of the text to be classified is completed, the concept words corresponding to the M original words of the text to be classified are determined. In some embodiments, multiple concept words corresponding to the original words can be obtained through a concept map. The text to be classified is input into the concept map in sequence, and the similarity between each original word and each concept in the concept map is calculated; then, the words with a similarity greater than a threshold are selected as concept words. For example, if the threshold is set to 0.8, the words with a similarity greater than 0.8 to the original words are selected as corresponding concept words; by combining at least one concept word corresponding to each original word, a concept word set can be obtained.

[0034] For example, when the text to be classified {Zhang San is born in some place} is input into the concept graph, a set of concept words {<top chinese entertainer>, <singer>, <place>, <asian city>} can be obtained. Among them, "top chinese entertainer" and "singer" are two concept words corresponding to the original word "Zhang San" in the text to be classified, and "place" and "asian city" are two concept words corresponding to the original word "some place" in the text to be classified. It can be seen that the concept words are all words associated with the original words in the text to be classified.

[0035] Among them, the concept graph is a large knowledge graph system, which contains a large amount of common sense knowledge learned by learning data from hundreds of millions of web pages and accumulated over several years.

[0036] In some embodiments, the concept graph can be the Microsoft Concept Graph. Of course, it can also be other types of knowledge graph systems, and there is no limitation on this.

[0037] Step 102: Perform mapping processing on the set of concept words to obtain a first feature matrix; perform mapping processing on the text to be classified to obtain a second feature matrix.

[0038] In the embodiments of the present application, the concept words are input into the trained word vector library. In the trained word vector library, the first feature vector corresponding to each concept word is found, and the concept word is represented by the first feature vector, so as to obtain a first feature matrix composed of the first feature vectors corresponding to each concept word. Correspondingly, the text to be classified is input into the trained word vector library. In the trained word vector library, the second feature vector corresponding to each text to be classified is found, and the text to be classified is represented by the second feature vector, so as to obtain a second feature matrix composed of the second feature vectors corresponding to each text to be classified.

[0039] In the trained word vector library, first, each concept word is converted into a digital feature, that is, each concept word is represented by a digital feature; then, a numerical condition is set in advance for the length of the digital feature corresponding to each concept word. By padding or truncating, the length of the digital feature corresponding to each concept word satisfies the numerical condition. For example, the numerical condition is set to 150. If the length of the digital feature corresponding to a certain concept word is less than 150, it can be made to meet the condition through zero-padding; if the length of the digital feature corresponding to a certain concept word is greater than 150, the redundant elements in the digital feature are removed. Through the above operations, the concept word can be mapped to the corresponding first feature vector in the trained word vector library. Correspondingly, the same operations are also performed on the text to be classified, which will not be elaborated here.

[0040] Step 103: Identify the category of the text to be classified based on the concept word set, as well as the first feature matrix and the second feature matrix.

[0041] In some embodiments, Step 103 is implemented by performing the following Steps 1031 to 1034:

[0042] Step 1031: Determine the first feature vector of the concept word in the first feature matrix, and determine the second feature vector of the text to be classified in the second feature matrix;

[0043] Step 1032: Determine the first weight of the concept word according to the first feature vector of the concept word and the second feature vector of the text to be classified; wherein, the first weight is used to represent the influence degree of the concept word on the classification result of the text to be classified.

[0044] For example, for the concept word set {<top chinese entertainer (顶级中国艺人)>, <singer (歌手)>, <place (地点)>, <asian city (亚洲城市)>} of the text to be classified {Zhang San is born in some place (张三出生在某地)}, the category to which the text to be classified belongs should be a star rather than a place. Therefore, the concept words "top chinese entertainer" and "singer" have a greater influence on the classification result of the text to be classified, and correspondingly, their corresponding first weights are also greater; while the concept words "place" and "asian city" have a smaller influence on the classification result of the text to be classified, and correspondingly, their corresponding first weights are also smaller.

[0045] In some embodiments, Step 1032 can be implemented by performing Steps 303 to 305 in the following embodiments.

[0046] Step 1033: Determine the second weight of the concept word according to the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set; wherein, the second weight is used to represent the first similarity between the concept word and other concept words in the concept word set.

[0047] In the same concept word set, the semantic meanings of each concept word are not all close. For example, for the concept word set {<top chineseentertainer(Top Chinese entertainer)>, <singer(Singer)>, <place(Place)>, <asian city(Asian city)>} of the text to be classified {Zhang San is born in some place (Zhang San was born somewhere)}, the semantic meanings of the concept words "top Chinese entertainer" and "singer" are relatively close, while the concept words "singer" and "Asian city" belong to two different categories. Correspondingly, the semantic meanings of these two concept words are quite different.

[0048] In the embodiments of the present application, by determining the first similarity between each concept word in the concept word set and all other concept words in the concept word set one by one, the second weight of the concept word can be determined. It can be understood that the concept word with a larger similarity to other concept words has a larger corresponding weight. Such words can better represent the category to which the text to be classified corresponding to the concept word belongs; the concept word with a smaller similarity to other concept words has a smaller corresponding weight. Such words are generally noise words that interfere with the discrimination of the category of the text to be classified. Thus, when identifying the category of the text to be classified, based on the concept words with larger second weights, it is determined which category the text to be classified belongs to, thereby improving the accuracy of identifying the category of the text to be classified.

[0049] In some embodiments, step 1033 can be implemented by performing steps 203 to 204 in the following embodiments.

[0050] Step 1034, based on the concept word set, as well as the first weight and the second weight of each concept word, identify the category of the text to be classified.

[0051] It can be understood that if the text to be classified is a short text, its text length is generally short. Therefore, when identifying the text based on the original word pairs of the text to be classified itself, there may be a problem of lack of context information, and the features are relatively sparse, which may lead to inaccurate classification results.

[0052] In an embodiment of the present application, a first feature matrix is ​​obtained by mapping a concept word set; a second feature matrix is ​​then obtained by mapping a text to be classified; and finally, the category of the text to be classified is identified based on the concept word set, the first feature matrix, and the second feature matrix. In this way, on the one hand, the introduction of the concept word set corresponding to the text to be classified can solve the problem of difficulty in accurate classification caused by the lack of context and sparse features in the original words; on the other hand, the category of the text to be classified is identified based on the concept word set and the first feature matrix formed after mapping the concept word set, and the second feature matrix formed after mapping the text to be classified. In this way, based on the first feature matrix, the key concept words in the concept word set that have a higher degree of influence on the classification result of the text to be classified can be determined; based on the second feature matrix, the key concept words in the concept word set that have a greater similarity with other concept words can be determined, and then the category of the text to be classified is identified based on these key concept words, and the accuracy of the obtained category is higher.

[0053] Figure 2 The following is a flowchart of the text classification method provided in the embodiment of the present application. Figure 2 As shown, the method may include the following steps 201 to 205:

[0054] Step 201, determining concept words whose similarity to the original words of the text to be classified is greater than a threshold, thereby obtaining a concept word set;

[0055] Step 202, determining a first weight of the concept word based on the first feature vector of the concept word and the second feature vector of the text to be classified;

[0056] Step 203: Determine a second similarity between the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set.

[0057] In some embodiments, when determining the second similarity between a concept word and other concept words in the concept set by using the first feature vector of the concept word, the second similarity between the first feature vector of the concept word and the first feature vectors of all other concept words in the concept word set is calculated. That is, after obtaining the second similarity {x1, x2, ...x n-1 After that, by weighting these n-1 similarity values ​​(the total number of concept words is n), the second similarity between the first feature vector of concept word i and the first feature vectors of other concept words in the concept word set is obtained.

[0058] Step 204 : Determine a second weight of the concept word according to the second similarity corresponding to the concept word and the first mapping relationship.

[0059] In some embodiments, the second similarity is the angle between the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set; accordingly, in the first mapping relationship, the angle is negatively correlated with the second weight.

[0060] It is understandable that eigenvectors are directional. By calculating the angle between two first eigenvectors, the second similarity between the two first eigenvectors can be determined. The larger the angle between the two first eigenvectors, the smaller the second similarity between the two concept words; the smaller the angle between the two first eigenvectors, the greater the second similarity between the two concept words.

[0061] For a vector a(x 11 ,x 12 ,...x 1N ) and vector b(x 21 ,x 22 ,...x 2N ), we can calculate the cosine of the angle between these two vectors: To determine the similarity between the two vectors. The larger the cosine value, the smaller the angle between the two vectors, that is, the more similar the two vectors are. For example, the first eigenvector corresponding to top chinese entertainer is a(1,1,2,1,1,1,0,0,0), and the first eigenvector corresponding to singer is b(1,1,1,0,1,1,1,1,1). Then, for the concept words "top chinese entertainer" and "singer", the angle between the first eigenvectors corresponding to these two words is cosθ=0.81. It can be seen that the angle between the two first eigenvectors is very close to 1, indicating that the second similarity of the corresponding two concept words is greater.

[0062] After determining the second similarity corresponding to the concept word based on the angle between the first eigenvector of the concept word and the first eigenvectors of other concept words in the concept word set, the second weight of the concept word can be determined using a preset first mapping relationship. The larger the angle, the smaller the second similarity between the concept word and the other concept words, indicating that the meaning of the concept word differs significantly from the meaning of the other concept words. Therefore, when identifying the category of the text to be classified based on the concept word, the concept word should be assigned a smaller weight. In other words, the angle is negatively correlated with the second weight.

[0063] Of course, there are many ways to determine the second similarity. For example, the second similarity may be the distance between the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set. This is not limited to this.

[0064] Step 205 : Identify the category of the text to be classified based on the concept word set and the first weight and the second weight of each concept word.

[0065] In the embodiment of the present application, the similarity of the concept word to other concept words in the concept set (the second weight) and the degree of influence of the concept word on the classification result of the text to be classified (the first weight) are taken into account. In this way, when identifying the category to which the text to be classified belongs based on the concept word, the two influencing factors can be considered in a balanced manner, thereby making the recognition accuracy higher.

[0066] Figure 3 The following is a flowchart of the text classification method provided in the embodiment of the present application. Figure 3 As shown, the method may include the following steps 301 to 307:

[0067] Step 301, determining concept words whose similarity to the original words of the text to be classified is greater than a threshold, thereby obtaining a concept word set;

[0068] Step 302: Mapping the concept word set to obtain a first feature matrix; mapping the text to be classified to obtain a second feature matrix;

[0069] Step 303: Determine the second eigenvector of the text to be classified in the second eigenmatrix.

[0070] In some embodiments, step 303 may be implemented by executing steps 3031 to 3033 as follows:

[0071] Step 3031: perform feature extraction on the original word to obtain a third feature vector of the original word.

[0072] The same processing method as in step 102 is used. When performing feature extraction processing on the original word, the original word needs to be input into the trained word vector library first. In the trained word vector library, the fifth eigenvector corresponding to each original word is found, and the fifth eigenvector is used to represent the original word.

[0073] Subsequently, the fifth feature vector of the original word is input into the feature enhancement module, which weights the fifth feature vector of the original word with the feature vector corresponding to the original word's context to obtain the third feature vector of the original word. This allows the third feature vector of the original word to contain more feature information, enriching the semantic information of the original word. In addition, when subsequently recognizing text, while classifying and recognizing the text to be classified based on the concept words, it also considers the information contained in the text to be classified itself, integrating multiple factors for recognition, which can improve recognition accuracy.

[0074] Step 3032: Determine a fourth similarity between the third feature vector of the original word and the third feature vector of at least one other original word in the text to be classified.

[0075] In the embodiment of the present application, the method for determining the fourth similarity between the third feature vector of the original word and the third feature vector of at least one other original word in the text to be classified is the same as the method in step 203 and will not be repeated here.

[0076] Step 3033: Determine a second eigenvector based on the fourth similarity corresponding to each original word and the third eigenvector of each original word.

[0077] Understandably, not every original word in the text to be classified has the same or similar meaning as the classification category. For example, for the text to be classified "The movie is so good", the original words obtained after preprocessing are {"The", "movie", "so", "good"}, among which the original word "movie" is close to the category to which the text to be classified belongs, while the original word "The" is far away from the category to which the text to be classified belongs. Therefore, by determining the importance of each original word in the text to be classified, it is possible to identify the category of the text to be classified based on the original words with high importance (i.e., high fourth power), thereby improving recognition accuracy.

[0078] In some embodiments, after determining the fourth similarity corresponding to the original word, the fourth weight corresponding to each original word can be determined through a preset third mapping relationship; weighting the third feature vector of the original word and the corresponding fourth weight is equivalent to determining the importance of each original word in the text to be classified.

[0079] After determining the weighted result of the third eigenvector of the original word and the corresponding fourth weight, a corresponding second feature matrix is ​​constructed based on the weighted result of each original word. Therefore, in the second feature matrix, each dimensional vector corresponds to the weighted result of the third eigenvector of an original word and the corresponding fourth weight. The second feature matrix is ​​input into the maximum pooling layer for dimensionality reduction, and finally the second eigenvector of the text to be classified is obtained.

[0080] In an embodiment of the present application, by calculating the similarity between the original words in the text to be classified and other original words, the weight of each original word is determined accordingly, and the original words with higher importance in the text to be classified can be given higher weights, so that when classifying, it is more inclined to classify according to key words with higher weights, thereby making the classification results more accurate.

[0081] Step 304, determining a third similarity between the first feature vector of the concept word and the second feature vector of the text to be classified;

[0082] Step 305: Determine a first weight of the concept word according to the third similarity and the second mapping relationship.

[0083] In an embodiment of the present application, when classifying and identifying the text to be classified based on the concept words corresponding to the original words of the text to be classified, the influence degree of each concept word on the classification result of the text to be classified is considered, and the influence degree is represented by the first weight.

[0084] Similar to the determination method in step 204, when determining the first weight of each concept word, the calculation is based on the first eigenvector of the concept word and the second eigenvector of the text to be classified. In some embodiments, the third similarity between the first eigenvector and the second eigenvector can be determined by calculating the angle between the first eigenvector of the concept word and the second eigenvector of the text to be classified. The larger the angle between the two eigenvectors, the smaller the third similarity between the concept word and the text to be classified; the smaller the angle between the two eigenvectors, the greater the third similarity between the concept word and the text to be classified.

[0085] Correspondingly, according to the third similarity and the second mapping relationship, the first weight of the concept word is determined, that is, the larger the angle, the smaller the third similarity between the concept word and the text to be classified, indicating that the meaning of the concept word is far different from the category to which the text to be classified belongs. Therefore, when identifying the category of the text to be classified based on the concept word, the concept word should be given a smaller weight, that is, the angle is negatively correlated with the first weight.

[0086] Of course, there are many ways to determine the third similarity. For example, the third similarity can also be the distance between the first feature vector of the concept word and the second feature vector of the text to be classified. This is not limited to this.

[0087] Step 306, determining a second weight of the concept word based on the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set;

[0088] Step 307 : Identify the category of the text to be classified based on the concept word set and the first weight and the second weight of each concept word.

[0089] In an embodiment of the present application, when identifying the category of the text to be classified, it is not based solely on the importance of the concept word relative to the text to be classified (the first weight), but rather takes into account the importance of the concept word relative to the text to be classified (the first weight) and the importance of the concept word relative to the concept set (the second weight), thereby making the recognition accuracy higher.

[0090] Figure 4 The following is a flowchart of the text classification method provided in the embodiment of the present application. Figure 4 As shown, the method may include the following steps 401 to 409:

[0091] Step 401, determining concept words whose similarity to the original words of the text to be classified is greater than a threshold, thereby obtaining a concept word set;

[0092] Step 402: Mapping the concept word set to obtain a first feature matrix; mapping the text to be classified to obtain a second feature matrix;

[0093] Step 403, determining the first eigenvector of the concept word in the first feature matrix, and determining the second eigenvector of the text to be classified in the second feature matrix;

[0094] Step 404, determining a first weight of the concept word based on the first feature vector of the concept word and the second feature vector of the text to be classified;

[0095] Step 405, determining a second weight of the concept word based on the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set;

[0096] Step 406, determining a first product of the first weight and a preset first adjustment coefficient;

[0097] Step 407: Determine a second product of the second weight and the second adjustment coefficient.

[0098] In the embodiment of the present application, a first adjustment coefficient is pre-set. The first adjustment coefficient is the ratio of the first weight to the second weight. According to the first adjustment coefficient, the second adjustment coefficient corresponding to the second weight is determined. For example, if the first adjustment coefficient is γ, the second adjustment coefficient is 1-γ; accordingly, the first weight α of the concept word i The first product with the first adjustment coefficient is γa i , the second weight β of the concept word i The second product with the second adjustment coefficient is (1-γ)β i By setting the first adjustment coefficient, the proportion of the first weight and the second weight corresponding to the concept word can be effectively adjusted, so that when identifying the category of the text to be classified, the first weight and the second weight of the concept word can be adjusted according to the actual situation, making the recognition basis more reasonable.

[0099] In some embodiments, the first adjustment coefficient can be set between 0.5-0.75.

[0100] Step 408: Fusing the first product and the second product to obtain a third weight of the concept word.

[0101] In the embodiment of the present application, the first product and the second product may be added together to obtain the third weight of the concept word. Of course, the result of the addition of the first product and the second product may also be normalized to obtain the third weight of the concept word, so that the third weight is between [0, 1].

[0102] Step 409 : Identify the category of the text to be classified based on the concept word set and the third weight of each concept word.

[0103] In the embodiment of the present application, the third weight of each concept word is obtained by combining the degree of influence of the concept word on the classification result of the text to be classified (i.e., the first weight) and the similarity of the concept word to other concept words (i.e., the second weight). It can be seen that when identifying the category of the text to be classified, the method in the embodiment of the present application balances the importance of the concept word relative to the text to be classified and the importance of the concept word relative to the concept set. Compared with classification based solely on the importance of the concept word relative to the text to be classified, the recognition accuracy is higher.

[0104] In some embodiments, step 409 may be implemented by executing steps 4091 to 4093 as follows:

[0105] Step 4091: Fusing the third weight of the concept word and the corresponding first eigenvector to obtain the fourth eigenvector of the concept word.

[0106] In some embodiments, after obtaining the third weight of a concept word (i.e., a fusion of the first and second weights), the third weight of the concept word is multiplied by the corresponding first eigenvector to obtain the fourth eigenvector of the concept word. It can be seen that the fourth eigenvector of the concept word is a vector that has been given a fusion weight. In this way, the category of the text to be classified is identified based on the fourth eigenvector of the concept word, balancing the importance of the concept word relative to the text to be classified (the first weight) and the importance of the concept word relative to the concept set (the second weight), thereby achieving higher recognition accuracy.

[0107] Step 4092: Fusing the third feature matrix formed by the fourth feature vector of each concept word with the fourth feature matrix formed by the third feature vector of each original word to obtain a fifth feature matrix.

[0108] Step 4093: Input the fifth feature matrix into the classifier to identify the category of the text to be classified.

[0109] In an embodiment of the present application, a fourth feature matrix obtained by fusing the first weight and the second weight of the concept words and a third feature matrix obtained by feature extraction of the original words are fused, and the text to be classified is classified according to the fusion result. In this way, when classifying the text to be classified, both the importance of the concept words relative to the text to be classified and the importance of the concept words relative to the concept set (the third weight obtained by fusing the first weight and the second weight) are taken into account, as well as the importance of the original words of the text to be classified relative to the text to be classified (the fourth weight). This allows the two factors of the concept words and the original words to be comprehensively considered to identify the category of the text to be classified, thereby improving recognition accuracy.

[0110] With the continuous development of internet technology, more and more people are posting text messages on social networking platforms such as Twitter and Weibo. Accurately classifying these short texts is a key technology in the field of natural language processing. Because these short texts are short, lack context, and are often colloquial and noisy, accurately extracting text features and using appropriate classification models to classify them is a key issue.

[0111] In related technologies, text classification methods typically preprocess text using feature engineering, vectorize the text using one-hot encoding or bag-of-words models, and then use machine learning algorithms as classifiers for text classification. These machine learning-based text classification methods often fail to extract high-dimensional features from text data, resulting in suboptimal classification results.

[0112] In recent years, with the advancement of computing power, deep learning has become a mainstream approach for text classification. First, a large corpus of data is used to pre-train word embeddings to obtain a word embedding model. This pre-trained word embedding model can address the dimensionality sparsity and inability to represent semantic information that are common in traditional feature engineering. This pre-trained word embedding model maps the text dataset into a corresponding word embedding matrix. This matrix is ​​then fed into a neural network for training. Through multiple rounds of iteration and parameter adjustment, a suitable neural network model is ultimately trained for text classification.

[0113] When it comes to text classification methods, machine learning and deep learning, both solutions have certain defects.

[0114] The feature engineering and machine learning classification methods in related technologies have the following shortcomings:

[0115] 1. Text feature engineering in related technologies generally uses one-hot or bag-of-words encoding methods. These vectorization methods ignore the order and grammatical specifications of words in the text. If the text is short, the semantic relationships between the text cannot be fully captured, resulting in dimensionality sparsity.

[0116] 2. Using machine learning algorithms as text classifiers often fails to extract high-dimensional features of text, resulting in unsatisfactory classification results.

[0117] For deep learning classification methods, there are also the following disadvantages:

[0118] 1. Using pre-trained word embedding models cannot solve the problem of polysemy. For example, in the short text {The Bulls won the NBA championship}, Bulls is the name of a basketball team. However, the model inputted with word embeddings may not capture this information and may treat it as an animal or a new word, resulting in suboptimal classification results.

[0119] 2. There is an Out of Vocabulary (OOV) problem when using pre-trained word vectors. The model input vocabulary cannot be found in the pre-trained word vector library, or the word vector library is not perfect, which affects the final classification effect.

[0120] 3. It cannot solve the problem of sparse features in short text datasets. Since short texts are too short and lack contextual information, ordinary neural network models cannot obtain effective classification features from sparse text features.

[0121] 4. Unable to capture important words in the text.

[0122] Based on this, the following describes an exemplary application of the embodiment of the present application in a practical application scenario.

[0123] In the embodiment of the present application, a short text classification method based on concept graph and neural network is proposed, which is specifically shown in the following steps 1 to 8:

[0124] Step 1: preprocess the original text data (i.e., the text to be classified);

[0125] Step 2: Use pre-trained word vectors (i.e., trained word vector libraries) to map the pre-processed text data into a text feature matrix.

[0126] Step 3: Use Microsoft Concept Graph to obtain the concept set (i.e., concept word set) of the short text;

[0127] Step 4: Use pre-trained word vectors to map the concept set of the short text into a feature matrix;

[0128] Step 5: Input the text feature matrix and the concept set feature matrix into the neural network model;

[0129] Step 6: The short text encoding module encodes the short text using a gated recurrent unit (Bi-GRU) network, then performs attention calculation, calculates the weights of key words, and weights each word, outputting the encoded short text feature vector h' (i.e., the fourth feature matrix);

[0130] Step 7: The conceptual encoding module first uses the self-attention mechanism to encode the concept features and calculates the attention weight β (i.e., the second weight) of each concept (i.e., concept word) relative to the concept set. Then, the short text feature vector output by the short text encoding module is used with the concept feature vector to perform attention calculation to obtain the concept's attention weight α (i.e., the first weight) relative to the short text. Finally, α and β are combined to obtain the final concept attention weight, and the concept feature vector is weighted to obtain the feature vector r (i.e., the third feature matrix).

[0131] Step 8: After concatenating the short text feature vector h' (ie, the fourth feature matrix) and the concept set feature vector r, the concatenation is input into a softmax classifier to obtain the final text classification result.

[0132] The following are the specific implementation steps of the short text classification method based on concept graph and neural network, as shown in steps 1 to 14:

[0133] Step 1: Preprocess the original short text dataset by using a script to correct spelling errors, clean useless tags, remove punctuation and special symbols, and then use the natural language processing (nltk) toolkit to delete high-frequency words that do not affect the semantics of the original text data and remove stop words.

[0134] Step 2: Use the 300-dimensional word vector library with a total of 1 million words trained using Wikipedia data to map the short text dataset into a text matrix through the pre-trained word vector library.

[0135] Figure 5 A schematic diagram of mapping processing for short text data is given, such as Figure 5 As shown, steps 1 and 2 can be implemented by following the steps 1) to 5): 1) preprocessing the dataset, including correcting spelling errors and removing stop words and punctuation marks; 2) encoding the words; 3) converting the text data into digital features; 4) truncating and padding to make all samples of the same length; 5) mapping each word encoding to a word vector.

[0136] Step 3: Input the short text data into the Microsoft Concept Graph by calling the Application Programming Interface (API) of the Microsoft Concept Graph to obtain the short text concept set. The specific steps are as follows 1) to 8):

[0137] 1) First, input the original text dataset t, then set the number of expanded words Topk, the expansion algorithm to EX, the data information of the knowledge graph MSCG, and the selection mode SelectMode;

[0138] 2) Words = splitData(t); means that for each text in the data set, it is segmented to obtain the initial feature set words;

[0139] 3) Words = ReduceStopWords (Words); indicates that stop words in the feature words are removed;

[0140] 4) Select = GetSelectWordSet (MSCG, SelectMode); indicates obtaining the corresponding word set Select in the Microsoft Concept Graph according to the representation mode;

[0141] 5) Sel_Words = Words∩Select; indicating that the feature word set Sel_Words to be expanded is selected according to Select;

[0142] 6) Word_dic = AccessAPI(Sel_Words, EX, Topk); This indicates that for each feature word in Sel_Words, different conceptual expansion algorithms provided by Microsoft Research are called. The interface returns the top k concept words related to the feature, which are then used to form the expanded dictionary Word_dic.

[0143] 7) d = Getting Extend (Words, Word_dic); represents extending the original feature words according to the extended dictionary Word_dic, thereby obtaining the conceptualized extended semantic representation short text concept set d;

[0144] 8) Return the short text concept set d (i.e., concept word set).

[0145] Figure 6 An example diagram of short text data and concept sets is given, such as Figure 6 As shown in FIG, for the short text “James always gets cheers from fans when he plays basketball”, the corresponding concept set is “sports”, “basketball player” and “singer”.

[0146] Step 4: Map the concept set obtained from the short text through the concept map using the pre-trained word vector library, vectorize the concept set, and obtain the concept set matrix;

[0147] Step 5: Input the short text word vector matrix into the bidirectional gate control (Bi-directional Gated Recurrent Unit, Bi-GRU) network, and obtain the forward hidden state at each moment through the calculation of the gated recurrent unit. and the reverse hidden state The forward hidden state at each moment The backward hidden state at the corresponding moment Perform splicing and connection to obtain the hidden state at that moment

[0148] Step 6: Set the hidden state h of Bi-GRU at each moment j Enter the self-attention layer, and weight the words input at each time step according to the attention calculation, so that important words get higher weights. The attention calculation is defined as: Among them, Q, K, and V are the abbreviations of query, key, and value, respectively. Key represents the data corresponding to the value and is used to calculate the similarity with the query as the basis for Attention selection. Query represents the query when executing Attention once, and Value represents the data that is noticed and selected. Input contains d k Dimension query and key, and d v The value of the dimension.

[0149] Step 7: Calculate the attention weight a through the self-attention layer t (ie the fourth weight), the hidden state h at time t output by Bi-GRU t Weighted average: The final output feature matrix h'∈R n×2u (i.e. the fourth characteristic matrix).

[0150] Step 8: First, the short text feature matrix h'∈R n×2u After the maximum pooling layer, it is converted into a feature vector q∈R 2u (i.e., the second eigenvector);

[0151] Step 9: Introduce the attention mechanism to calculate the relationship weight between the i-th vector in the concept set and its short text feature vector q: α i =soft max(v1 T tanh(W1·concat[c i;q]+b1)), calculate the attention weight α (i.e. the first weight) of the concept and the short text. i is the attention weight between the concept vector in the i-th concept set and its short text, is the weight matrix, is the weight vector, d a is a hyperparameter and b1 is a bias.

[0152] Step 10: Add a self-attention mechanism to the concept set and perform attention calculation within the concept set: β i =soft max(v2 T tanh(W2c i )+b2), to obtain each concept c i The importance weight β (i.e. the second weight) in the entire concept set. i is the attention weight of the concept vector in the i-th concept set, is the weight matrix, is the weight vector, d b is a hyperparameter, b2 is a bias, and the attention mechanism gives important concepts a larger weight and gives unimportant concepts a very small weight (close to zero) to highlight the important concepts in the concept set.

[0153] Step 11, after obtaining α i , β i After attention weight, use the formula: α i =soft max(γα i +(1-γ)β i ) Combine the two attention weights to calculate the final attention weight a (i.e., the third weight) of the concept set, where a i is the final i-th concept vector attention weight, γ∈[0,1] is the adjustment of α i and β i When the γ value (i.e., the preset first adjustment coefficient) approaches 1, the system increases the attention weight between the concept and the short text; when the γ value approaches 0, the system increases the attention weight between the concept and the concept set.

[0154] Step 12: After obtaining the attention weight of each concept vector, perform weighted calculation on each concept vector: c i is the i-th concept vector, a i is the attention weight corresponding to the i-th concept vector, and the final concept vector r (i.e., the third feature matrix) is calculated. i c i Represents the fourth eigenvector corresponding to the i-th concept word.

[0155] Step 13: concatenate the short text feature vector h' extracted by the short text coding and the feature vector r extracted by the concept coding, and input the concatenated feature vector (ie, the fifth feature matrix) into a logistic regression (Softmax) classifier for final classification and recognition.

[0156] Step 14: The system is trained using the back-propagation algorithm and L2 regularization is introduced to avoid overfitting of the neural network model. The network model is optimized by minimizing the cross entropy loss function to complete the classification task. The cross entropy loss function is: Where D is the training set size, C is the number of categories, y is the predicted category, y' is the actual category, λ|θ|| 2 is the regularization term.

[0157] The short text classification system formed based on the above method includes:

[0158] Text preprocessing module, used to clean and preprocess the original text data set;

[0159] The word-to-vector (Word2vec) mapping module is used to map text datasets to generate short text feature matrices containing word meanings.

[0160] The short text conceptualization module is used to obtain the concept set related to the short text and obtain the prior knowledge in the text, which to some extent solves the problem of lack of contextual information in short texts;

[0161] The short text encoding module is used to encode the short text feature matrix and perform attention calculation to obtain the feature vector of the short text;

[0162] The conceptual encoding module is used to encode and calculate attention on the acquired short text concept set to obtain the concept set feature vector.

[0163] like Figure 7 As shown, in the embodiment of the present application, a knowledge enhancement network model that integrates knowledge graph, attention mechanism and Bi-GRU is proposed. The model adopts the network structure of deep self-attention transformer network (Transformer) and integrates concept graph to obtain prior knowledge of short text. The network model mainly consists of the following two parts:

[0164] 1) Short text encoding: Character vectors and word vectors are concatenated as input, short text features are extracted through Bi-GRU, and important text information is weighted using a multi-head self-attention layer to obtain short text features.

[0165] 2) Conceptual Encoding: By calling the Microsoft Concept Graph API, we obtain and vectorize the short text concept set. By performing attention calculations on the feature vectors of the short text, we increase the weights of concepts in the concept set that are closely related to the short text, ultimately deriving the concept set features.

[0166] The short text classification method and system proposed in the embodiments of the present application have both good text classification performance and certain practicality.

[0167] The innovative features of the embodiments of this application are as follows:

[0168] In step 3, the concept set of the short text is obtained by integrating the Microsoft concept graph, and the prior knowledge of the short text is obtained, which can alleviate the feature sparsity problem caused by the lack of context in the short text to a certain extent.

[0169] Step 7 proposes an innovative attention calculation method, which calculates the attention weights of concepts and short texts, and concepts and concept sets, and then combines the two to obtain the final concept weight. The concept attention weight obtained by the above method takes into account both the importance of the concept relative to the concept set and the importance of the concept relative to the short text. Figure 8 As shown in the figure, the short text is clearly related to the business model, while the concept of music style obtained from the concept map is clearly a noise concept, which will affect the classification results. By adding attention calculations to concepts relative to the short text, this system can reduce the attention weight of the concept of music style, reducing the impact of noise concepts, while also increasing the weight of the concept of business, improving the system's classification performance.

[0170] Compared with the short text classification methods in related arts, the method of the embodiment of the present application has the following advantages:

[0171] 1) By integrating concept graphs, we address the problem of short text data being difficult to accurately classify due to lack of context and sparse features;

[0172] 2) A text classification system based on the Transformer structure is proposed, which uses the Bi-GRU network to encode the text and extract the high-dimensional features contained in the text data.

[0173] 3) Introduce the attention mechanism into the system, use the attention mechanism to calculate the correlation between each concept and the concept set and the concept and the short text, perform weighted fusion on the attention weights of the two, and obtain the final weight of each concept, thereby increasing the weights of related concepts and making the system classification effect more discriminative.

[0174] Based on the foregoing embodiments, an embodiment of the present application provides a text classification device, which includes the modules included and the units included in each module, and can be implemented by a processor; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.

[0175] Figure 9 This is a structural diagram of the text classification device according to an embodiment of the present application. Figure 9 As shown, the apparatus 900 includes a determination module 901, a processing module 902, and an identification module 903, wherein:

[0176] The determination module 901 is used to determine the concept words whose similarity with the original words of the text to be classified is greater than a threshold, thereby obtaining a concept word set; the processing module 902 is used to perform mapping processing on the concept word set to obtain a first feature matrix; the processing module 902 is also used to perform mapping processing on the text to be classified to obtain a second feature matrix; the identification module 903 is used to identify the category of the text to be classified based on the concept word set, the first feature matrix and the second feature matrix.

[0177] In some embodiments, the determination module 901 is used to determine the first feature vector of the concept word in the first feature matrix, and to determine the second feature vector of the text to be classified in the second feature matrix; the determination module 901 is also used to determine the first weight of the concept word based on the first feature vector of the concept word and the second feature vector of the text to be classified; wherein, the first weight is used to characterize the degree of influence of the concept word on the classification result of the text to be classified; the determination module 901 is also used to determine the second weight of the concept word based on the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set; wherein, the second weight is used to characterize the first similarity between the concept word and other concept words in the concept word set; the identification module 903 is used to identify the category of the text to be classified based on the concept word set and the first weight and second weight of each concept word.

[0178] In some embodiments, the determination module 901 is used to determine the second similarity between the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set; the determination module 901 is also used to determine the second weight of the concept word based on the second similarity corresponding to the concept word and the first mapping relationship.

[0179] In some embodiments, the determination module 901 is used to determine the second feature vector of the text to be classified; the determination module 901 is also used to determine the third similarity between the first feature vector of the concept word and the second feature vector of the text to be classified; the determination module 901 is also used to determine the first weight of the concept word based on the third similarity and the second mapping relationship.

[0180] In some embodiments, the device 900 also includes a feature extraction module, which is used to perform feature extraction processing on the original word to obtain a third feature vector of the original word; a determination module 901 is used to determine the fourth similarity between the third feature vector of the original word and the third feature vector of at least one other original word in the text to be classified; the determination module 901 is also used to determine the second feature vector based on the fourth similarity corresponding to each original word and the third feature vector of each original word.

[0181] In some embodiments, the device 900 also includes a fusion module, a determination module 901, which is used to determine the first product of the first weight and a preset first adjustment coefficient; the determination module 901 is also used to determine the second product of the second weight and the second adjustment coefficient; the fusion module is used to fuse the first product with the second product to obtain the third weight of the concept word; the identification module 902 is used to identify the category of the text to be classified based on the concept word set and the third weight of each of the concept words.

[0182] In some embodiments, the fusion module is further used to fuse the third weight of the concept word and the corresponding first eigenvector to obtain the fourth eigenvector of the concept word; the fusion module is further used to fuse the third feature matrix composed of the fourth eigenvector of each of the concept words and the fourth feature matrix composed of the third eigenvector of each of the original words to obtain the fifth feature matrix; the recognition module 902 is used to input the fifth feature matrix into the classifier to identify the category of the text to be classified.

[0183] The description of the above device embodiment is similar to the description of the above method embodiment and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of this application, please refer to the description of the method embodiment of this application for understanding.

[0184] It should be noted that in the embodiments of this application Figure 9The division of modules in the text classification device shown is schematic and is only a logical functional division. In actual implementation, there may be other division methods. In addition, the functional units in the various embodiments of the present application can be integrated into a processing unit, or can exist physically separately, or two or more units can be integrated into a single unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units. It can also be implemented in the form of a combination of software and hardware.

[0185] It should be noted that, in the embodiment of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling an electronic device to execute all or part of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.

[0186] An embodiment of the present application provides an electronic device, Figure 10 This is a schematic diagram of the hardware entity of the electronic device according to the embodiment of the present application, such as Figure 10 As shown, the electronic device 1000 includes a memory 1001 and a processor 1002. The memory 1001 stores a computer program that can be run on the processor 1002. When the processor 1002 executes the program, the steps in the method provided in the above embodiment are implemented.

[0187] It should be noted that the memory 1001 is configured to store instructions and applications executable by the processor 1002, and can also cache data to be processed or processed by the processor 1002 and various modules in the electronic device 1000 (for example, image data, audio data, voice communication data and video communication data), which can be implemented through flash memory (FLASH) or random access memory (RAM).

[0188] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method provided in the above embodiment are implemented.

[0189] An embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps of the method provided in the above method embodiment.

[0190] It should be noted that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium, storage medium, and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0191] It should be understood that "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" or "in some embodiments" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description of the various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other. For the sake of brevity, they will not be repeated here.

[0192] The term "and / or" in this article is only a description of the association relationship between associated objects, indicating that there can be three relationships. For example, object A and / or object B can mean: object A exists alone, object A and object B exist at the same time, and object B exists alone.

[0193] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0194] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or modules can be electrical, mechanical or other forms.

[0195] The modules described above as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules; they may be located in one place or distributed across multiple network units; some or all of the modules may be selected according to actual needs to achieve the purpose of this embodiment.

[0196] In addition, all functional modules in the embodiments of the present application can be integrated into one processing unit, or each module can be a separate unit, or two or more modules can be integrated into one unit; the above-mentioned integrated modules can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0197] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, and other media that can store program codes.

[0198] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks or optical disks.

[0199] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0200] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0201] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0202] The above is merely an embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A text classification method, characterized in that: The method comprises: Determine the concept words whose similarity with the original words of the text to be classified is greater than a threshold, thereby obtaining a concept word set; Performing mapping processing on the concept word set to obtain a first feature matrix; Performing mapping processing on the text to be classified to obtain a second feature matrix; According to the concept word set, the first feature matrix and the second feature matrix, the category of the text to be classified is identified; wherein, The step of identifying the category of the text to be classified according to the concept word set, the first feature matrix, and the second feature matrix includes: Determining a first eigenvector of the concept word in the first eigenmatrix, and determining a second eigenvector of the text to be classified in the second eigenmatrix; Determining a first weight of the concept word based on the first feature vector of the concept word and the second feature vector of the text to be classified; wherein the first weight is used to represent the degree of influence of the concept word on the classification result of the text to be classified; determining a second weight of the concept word according to the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set; wherein the second weight is used to represent a first similarity between the concept word and the other concept words in the concept word set; The category of the to-be-classified text is identified according to the concept word set and the first weight and the second weight of each concept word.

2. The method according to claim 1, characterized in that Determining the second weight of the concept word according to the first feature vector of the concept word and the first feature vectors of other concept words in the concept word set includes: determining a second similarity between the first feature vector of the concept word and first feature vectors of other concept words in the concept word set; A second weight of the concept word is determined according to the second similarity corresponding to the concept word and the first mapping relationship.

3. The method according to claim 1, characterized in that The determining of the first weight of the concept word according to the first feature vector of the concept word and the second feature vector of the text to be classified includes: Determining a third similarity between the first feature vector of the concept word and the second feature vector of the text to be classified; A first weight of the concept word is determined according to the third similarity and the second mapping relationship.

4. The method according to claim 1, wherein The determining of the second feature vector of the text to be classified in the second feature matrix includes: Performing feature extraction processing on the original word to obtain a third feature vector of the original word; determining a fourth similarity between the third feature vector of the original word and the third feature vector of at least one other original word of the text to be classified; The second feature vector is determined according to the fourth similarity corresponding to each of the original words and the third feature vector of each of the original words.

5. The method according to claim 1, wherein The step of identifying the category of the text to be classified according to the concept word set and the first weight and the second weight of each concept word includes: Determining a first product of the first weight and a preset first adjustment coefficient; determining a second product of the second weight and a second adjustment coefficient; fusing the first product and the second product to obtain a third weight of the concept word; The category of the to-be-classified text is identified based on the concept word set and the third weight of each concept word.

6. The method according to claim 5, characterized in that The step of identifying the category of the text to be classified according to the concept word set and the third weight of each concept word includes: fusing the third weight of the concept word and the corresponding first feature vector to obtain a fourth feature vector of the concept word; fusing a third feature matrix formed by the fourth feature vector of each of the concept words with a fourth feature matrix formed by the third feature vector of each of the original words to obtain a fifth feature matrix; The fifth feature matrix is ​​input into a classifier to identify the category of the text to be classified.

7. A text classification device, characterized in that: include: A determination module is used to determine concept words whose similarity with the original words of the text to be classified is greater than a threshold, thereby obtaining a concept word set; a processing module, configured to perform mapping processing on the concept word set to obtain a first feature matrix; The processing module is further used to perform mapping processing on the text to be classified to obtain a second feature matrix; A recognition module is used to identify the category of the text to be classified based on the concept word set, the first feature matrix and the second feature matrix; wherein, The determination module is further configured to determine a first eigenvector of the concept word in the first eigenmatrix, and a second eigenvector of the text to be classified in the second eigenmatrix; determine a first weight of the concept word based on the first eigenvector of the concept word and the second eigenvector of the text to be classified; wherein the first weight is used to represent the degree of influence of the concept word on the classification result of the text to be classified; and determine a second weight of the concept word based on the first eigenvector of the concept word and the first eigenvectors of other concept words in the concept word set; wherein the second weight is used to represent a first similarity between the concept word and the other concept words in the concept word set; The recognition module is specifically configured to recognize the category of the text to be classified based on the concept word set and the first weight and the second weight of each concept word.

8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.

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

Citation Information

Patent Citations

  • Text classification method for intelligent voice interaction

    CN110188199A

  • Label mapping method and system and computer readable storage medium

    CN112818117A