An Intelligent Text Classification Method
The intelligent text classification method addresses inefficiencies in fraudulent information retrieval by using structural and window similarities, sentiment features, and feature vectors to enhance clustering accuracy and efficiency.
Patent Information
- Application Number
- CN202410343408.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-25
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-03-25
AI Technical Summary
Existing methods for identifying fraudulent information are inefficient and inaccurate due to the time-consuming nature of database searches and the similarity of keywords across different fraud methods, leading to low retrieval efficiency and accuracy.
An intelligent text classification method that extracts keywords from sentences, calculates structural and window similarities, determines sentiment features and interchangeability, and uses feature vectors to cluster texts, employing algorithms like TextRank, Word2Vec, and K-means clustering to improve clustering accuracy and efficiency.
Accurately defines sentiment characteristics of keywords, enhances clustering precision, and improves retrieval efficiency by constructing feature curves for text classification, thereby reducing broad clustering and improving retrieval accuracy.
Smart Images

Figure CN118152570B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to an intelligent text classification method. Background Art
[0002] With the development of the Internet, fraud using the Internet and other electronic communication channels has occurred repeatedly. In order to prevent users from falling into fraud traps, it is necessary to identify fraudulent information.
[0003] The common method of identifying fraudulent information is to search and compare the fraudulent information with the fraudulent text stored in the database. However, as the fraud methods are upgraded and the database continues to expand, it takes more time to search for fraudulent information, resulting in low retrieval efficiency. At the same time, because different fraud methods may contain the same keywords, the retrieval accuracy is low, which reduces the retrieval accuracy. Summary of the invention
[0004] In order to solve the above problems, the present invention provides an intelligent text classification method, which comprises:
[0005] Obtain a text consisting of several sentences and extract keywords from each text;
[0006] Calculate the structural similarity of two sentences containing each keyword, and obtain two sentences with similar structure for each keyword according to the structural similarity and a preset first threshold; calculate the window similarity of two sentences with similar structure for each keyword, and obtain two sentences with similar window for each keyword according to the window similarity and a preset second threshold;
[0007] Calculate the sentiment feature value of each keyword based on the structural similarity and window similarity; calculate the degree of interchangeability of each keyword; obtain the feature vector of each keyword based on the sentiment feature value and interchangeability of each keyword;
[0008] According to the feature vectors of the keywords contained in the texts, all the texts are clustered to obtain all the clusters, the sentiment keywords of each cluster are obtained, and all the texts in each cluster are stored according to the sentiment keywords of each cluster.
[0009] Furthermore, the calculation formula for the structural similarity of the two sentences containing each keyword is as follows:
[0010]
[0011] In the formula, f(z,a1,a2) represents the structural similarity between sentence a1 and sentence a2 containing keyword z, and x z,a1 、x z,a2 Respectively represent the position of keyword z in sentence a1 and sentence a2, mz,a1 、m z,a2 They represent the number of keywords in sentence a1 and sentence a2 containing keyword z respectively, and exp() represents an exponential function with a natural constant as the base.
[0012] Furthermore, the calculation formula for the window similarity between two sentences with similar keyword structures is as follows:
[0013] F(z,b1,b2)=exp(-(1+|m z,b1,1 -m z,b2,1 |)×Q b1,b2,1 -(1+|m z,b1,2 -m z,b2,2 |)×Q b1,b2,2 )
[0014] In the formula, F(z,b1,b2) represents the window similarity of two sentences with similar structures about keyword z, sentence b1 and sentence b2 represent two sentences with similar structures about keyword z, and m z,b1,1 Indicates the number of keywords in the sentence adjacent to the left of sentence b1, m z,b2,1 Indicates the number of keywords in the sentence adjacent to the left of sentence b2, m z,b1,2 Indicates the number of keywords in the sentence adjacent to the right of sentence b1, m z,b2,2 represents the number of keywords in the sentence adjacent to the right of sentence b2, Q b1,b2,1 represents the first semantic difference between two sentences with similar structures regarding keyword z, Q b1,b2,2 Indicates the second semantic difference between two sentences with similar structures regarding keyword z.
[0015] Furthermore, the method for obtaining the first semantic difference and the second semantic difference of two sentences with similar structures regarding the keyword z is specifically as follows:
[0016] A method for obtaining the first semantic difference between two sentences with similar structures regarding keyword z is as follows: the two sentences with similar structures regarding keyword z are sentence b1 and sentence b2, a sentence adjacent to the left side of sentence b1 and a sentence adjacent to the left side of sentence b2 are obtained, the sentence with fewer keywords is taken as the target sentence, and the other sentence is recorded as the sentence to be matched, for any keyword in the target sentence, the Euclidean distance between the semantic vector of the keyword and the semantic vectors of all keywords in the sentence to be matched is calculated, the minimum value of the Euclidean distance is recorded as the semantic distance of the keyword, and the sum of the semantic distances of all keywords in the target sentence is recorded as the first semantic difference between the two sentences with similar structures regarding keyword z;
[0017] By analogy, based on the sentence adjacent to the right of sentence b1 and the sentence adjacent to the right of sentence b2, the second semantic difference between the two sentences with similar structures regarding the keyword z is obtained.
[0018] Furthermore, the calculation formula of the sentiment feature value of each keyword is as follows:
[0019]
[0020] Where P z represents the sentiment feature value of keyword z, f(z,c i ,d i ) represents the two sentences c that are similar in the overall sense about the keyword z in the i-th group i and d i The structural similarity of F(z,c i ,d i ) represents the two sentences c that are similar in the overall sense about the keyword z in the i-th group i and d i , M represents the number of two sentences with overall similarity about keyword z in all groups.
[0021] Furthermore, the method for obtaining the degree of replaceability of each keyword is as follows:
[0022] Replace the keyword z in two sentences with similar structures about the keyword z with any other keyword, obtain the window similarity of the two sentences with similar structures about the keyword z after the replacement, and obtain two sentences with overall similarity about the keyword z after the replacement according to the window similarity of the two sentences with similar structures about the keyword z after the replacement and a preset second threshold value Y2;
[0023] Calculate the degree of replaceability of keyword z. The specific calculation formula is as follows:
[0024]
[0025] Where, T z represents the degree of interchangeability of keyword z, N represents the number of all keywords, K represents the number of two sentences with overall similarity about keyword z in all groups, and M j represents the number of two sentences that are similar to the keyword z after all groups are replaced with the jth keyword, F(z,c i ,d i ,j) means that after the jth keyword is replaced, the two sentences c that are similar to the keyword z after the i-th group is replaced i and d i The degree of window similarity.
[0026] Furthermore, the step of obtaining the feature vector of each keyword includes the following specific steps:
[0027] The angle of the keyword's feature vector is θ = arctan(P z ), P z represents the sentiment feature value of keyword z, and the modulus of the feature vector is m = τ × norm (T z ), T z It indicates the degree of interchangeability of keyword z, norm() indicates the linear normalization function, and τ indicates the unit modulus.
[0028] Furthermore, the step of clustering all texts to obtain all clusters and obtaining the sentiment keywords of each cluster includes the following specific steps:
[0029] Using the K-means clustering algorithm, all texts are clustered according to the distance between the characteristic curves of every two texts in all texts to obtain all clusters; where the distance between the characteristic curves of every two texts is the DTW distance;
[0030] Neural network technology is used to analyze the text in each category, and the emotional keywords of each cluster are extracted by collecting the emotional expressions of different words in normal language communication.
[0031] Furthermore, the method for obtaining the characteristic curve of each two texts is specifically as follows:
[0032] The starting point of the characteristic curve of each text is the same. Starting from the starting point of the characteristic curve of each text, the characteristic curve of each text is obtained in turn according to the characteristic vector of each keyword in the text.
[0033] Furthermore, the extracting of keywords from each text includes the following specific steps:
[0034] The TextRank algorithm is used to extract keywords from the text to obtain all the keywords of each text; the keywords of all texts are used as the vocabulary, and the word vector of each keyword is obtained through the Word2Vec algorithm. By performing principal component analysis on the word vectors of all keywords, the word vectors of all keywords are reduced to a two-dimensional space to obtain the semantic vector of each keyword in the two-dimensional space.
[0035] The beneficial effects of the technical solution of the present invention are as follows: the present invention accurately defines the sentiment characteristics of keywords by combining the structural similarity and window similarity of two sentences containing keywords, obtains the feature vector of each keyword based on the sentiment characteristics of the keywords, and constructs the feature curve of each text by combining the feature vectors, so as to cluster different texts. In combination with the sentiment characteristics of the texts, the basis for clustering is improved, and the problem of overly broad clustering results and inaccurate classification caused by clustering texts with the ultimate purpose of fraudulent texts is avoided, thereby improving the accuracy of text retrieval and the efficiency of later retrieval. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 The present invention is a flowchart of an intelligent text classification method. DETAILED DESCRIPTION
[0038] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation, structure, features and effects of an intelligent text classification method proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0039] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0040] The specific scheme of an intelligent text classification method provided by the present invention is described in detail below with reference to the accompanying drawings.
[0041] See also Figure 1 , which shows a method flow chart of a data transmission module of an intelligent text classification method provided by an embodiment of the present invention, the method comprising:
[0042] S001. Convert the fraud information into a text consisting of several sentences.
[0043] In this embodiment, fraud information of fraud cases that have occurred is collected and converted into text, and the words between two punctuation marks in the text form a sentence. The fraud information includes telephone recordings, text messages, chat records, etc. Since punctuation marks cannot be accurately converted during the conversion process, especially punctuation marks in telephone recordings, the punctuation marks in this embodiment only indicate language pauses, and the punctuation marks do not indicate the correlation between the two sentences before and after.
[0044] S002. Extract keywords from each text, calculate the structural similarity of two sentences containing each keyword, obtain two sentences with similar structures for each keyword, calculate the window similarity of the two sentences with similar structures for each keyword, and obtain two sentences with similar windows for each keyword.
[0045] 1. Extract keywords from each text.
[0046] It should be noted that for each sentence, its common components include subject, predicate, object, attributive, adverbial, predicate and independent auxiliary words. For the same vocabulary, its emotional expression is different in different expressions, and the emotional expression of the entire paragraph is also different. Therefore, it is necessary to extract keywords in each sentence.
[0047] In this embodiment, the TextRank algorithm is used to extract keywords from the text to obtain all the keywords of each text; the keywords of all the texts are used as the vocabulary, and the word vector of each keyword is obtained by the Word2Vec algorithm. By performing principal component analysis on the word vectors of all keywords, the word vectors of all keywords are reduced to a two-dimensional space to obtain the semantic vector of each keyword in the two-dimensional space.
[0048] It should be noted that the TextRank algorithm is an algorithm for keyword extraction and text summarization; the Word2Vec algorithm is a language model that learns semantic knowledge from a large amount of text in an unsupervised manner, and ultimately generates word vectors that are closely related to the language model. The word vectors have the characteristics of the language structure of the keywords, such as synonyms, antonyms, related words, etc. The TextRank algorithm and Word2Vec are both well-known technologies and will not be elaborated here.
[0049] 2. Calculate the structural similarity of the two sentences containing each keyword to obtain two sentences with similar structures for each keyword.
[0050] It should be noted that for fraudulent texts, common fraud methods generally guide users through different emotions and different ways of expression. Common sentence emotions include affinity, intimidation, neutrality (imitation of official rhetoric), etc., to mobilize user emotions and increase the success rate of fraud. And for common fraud methods such as phishing emails, fake websites, false advertisements, fraud calls pretending to be regular companies or government agencies, and fraud through social software or media pretending to be friends, celebrities, etc. By summarizing the above different fraud methods, it is found that for any of the texts, there is a set of emotional logic and language trends, and finally a "trap" is proposed. For example, related electronic frauds that impersonate public security organs generally have most sentences to introduce who they are, and then use sentences with official tone and expression to indicate the laws and regulations violated by the user, and inform the possible serious consequences, and finally inform the solution, namely the "trap", threatening the victim to tell the fraudster the bank card password, etc. Therefore, for any type of fraudulent text, some words in the text have certain emotional expressions, and the emotions expressed by these words in any text are the same.
[0051] In this embodiment, for any keyword, the structural similarity between two sentences containing the keyword is obtained, and the specific calculation formula is:
[0052]
[0053] In the formula, f(z,a1,a2) represents the structural similarity between sentence a1 and sentence a2 containing keyword z, and x z,a1 、x z,a2 Respectively represent the position of keyword z in sentence a1 and sentence a2, m z,a1 、m z,a2 They represent the number of keywords in sentence a1 and sentence a2 containing keyword z respectively, and exp() represents an exponential function with a natural constant as the base.
[0054] It should be noted that They respectively represent the relative positions of the same keyword in the two sentences. The smaller the position difference is, the more similar the structures of the two sentences are, and the greater the degree of structural similarity between the two sentences is.
[0055] If the structural similarity between two sentences containing keyword z is greater than a preset first threshold value Y1, the two sentences containing keyword z are recorded as sentences with similar structures regarding keyword z. The implementer can set the first threshold value according to the actual implementation situation, for example, Y1=0.9.
[0056] 3. Calculate the window similarity of two sentences with similar structures for each keyword, and obtain two sentences with similar windows for each keyword.
[0057] It should be noted that the most common form of purpose expression is the "three-step" form. For a text composed of any number of sentences, the causal relationship between any three adjacent sentences is the most obvious. By utilizing the changes in the causal relationship between each sentence and the window composed of two adjacent sentences, the semantics and emotional intensity expressed by the same keyword in the window are different. Therefore, the differences between adjacent sentences with similar structures are judged.
[0058] In this embodiment, each sentence, the sentence adjacent to the left of each sentence, and the sentence adjacent to the right of each sentence are combined into a window of each sentence; for any keyword, the window similarity of two sentences with similar keyword structures is obtained, and the specific calculation formula is as follows:
[0059] F(z,b1,b2)=exp(-(1+|m z,b1,1 -m z,b2,1 |)×Q b1,b2,1 -(1+|m z,b1,2 -m z,b2,2 |)×Q b1,b2,2 )
[0060] In the formula, F(z,b1,b2) represents the window similarity of two sentences with similar structures about keyword z, sentence b1 and sentence b2 represent two sentences with similar structures about keyword z, and m z,b1,1 Indicates the number of keywords in the sentence adjacent to the left of sentence b1, m z,b2,1 Indicates the number of keywords in the sentence adjacent to the left of sentence b2, m z,b1,2 Indicates the number of keywords in the sentence adjacent to the right of sentence b1, m z,b2,2 represents the number of keywords in the sentence adjacent to the right of sentence b2, Q b1,b2,1 represents the first semantic difference between two sentences with similar structures regarding keyword z, Q b1,b2,2 Indicates the second semantic difference between two sentences with similar structures regarding keyword z.
[0061] A method for obtaining the first semantic difference between two sentences with similar structures regarding keyword z is as follows: the two sentences with similar structures regarding keyword z are sentence b1 and sentence b2, the sentence adjacent to the left side of sentence b1 and the sentence adjacent to the left side of sentence b2 are obtained, the sentence with fewer keywords is taken as the target sentence, and the other sentence is recorded as the sentence to be matched, for any keyword in the target sentence, the Euclidean distance between the semantic vector of the keyword and the semantic vectors of all keywords in the sentence to be matched is calculated, the minimum value of the Euclidean distance is recorded as the semantic distance of the keyword, and the sum of the semantic distances of all keywords in the target sentence is recorded as the first semantic difference between the two sentences with similar structures regarding keyword z.
[0062] By analogy, based on the sentence adjacent to the right of sentence b1 and the sentence adjacent to the right of sentence b2, the second semantic difference between the two sentences with similar structures regarding the keyword z is obtained.
[0063] It should be noted that the Euclidean distance of the semantic vectors of two keywords represents the semantic similarity between the two keywords. The smaller the Euclidean distance of the semantic vectors of two keywords, the greater the semantic similarity between the two keywords. By finding the keyword with the greatest semantic similarity in another sentence for each keyword in one sentence, the semantic similarity between the two sentences can be obtained. The semantic similarity between the two sentences is weighted by the difference in the number of keywords in the two sentences to obtain the window similarity between the two sentences.
[0064] If the window similarity of sentences with similar structures regarding keyword z is greater than the preset second threshold Y2, the sentences with similar structures regarding keyword z are recorded as two sentences with overall similarity regarding keyword z. The implementer can set the second threshold according to the actual implementation situation, for example, Y2=0.7.
[0065] S003, calculating the sentiment feature value of each keyword according to the structural similarity and the window similarity, calculating the degree of interchangeability of each keyword, and obtaining the feature vector of each keyword according to the sentiment feature value and the degree of interchangeability of each keyword.
[0066] 1. Calculate the sentiment feature value of each keyword.
[0067] It should be noted that when the structure of the sentences and the semantics of the keywords in two windows are basically the same, it means that the keywords in the two windows obey the same causal relationship, and the emotions expressed in the two windows are also basically the same. Therefore, the emotional feature value of the keyword can be calculated based on the structural similarity and window similarity of all windows with the same emotion.
[0068] In this embodiment, the sentiment feature value of the keyword is calculated, and the specific calculation formula is as follows:
[0069]
[0070] Where P z represents the sentiment feature value of keyword z, f(z,c i ,d i ) represents the two sentences c that are similar in the overall sense about the keyword z in the i-th group i and d i The structural similarity of F(z,c i ,d i ) represents the two sentences c that are similar in the overall sense about the keyword z in the i-th group i and d i, M represents the number of two sentences with overall similarity about keyword z in all groups.
[0071] 2. Calculate the degree of interchangeability of each keyword.
[0072] It should be noted that since different texts may express the same emotions, that is, the semantic feature values of the keywords used in different windows with similar structures are similar, but the emotional intensity expressed by different keywords in different windows is different, it is necessary to judge the emotional expression intensity of different keywords with the same structure.
[0073] In this embodiment, the keyword z in two sentences with similar structures about the keyword z is replaced with any other keyword, and the window similarity of the two sentences with similar structures about the keyword z after the replacement is obtained. According to the window similarity of the two sentences with similar structures about the keyword z after the replacement and the preset second threshold value Y2, two sentences with overall similarity about the keyword z after the replacement are obtained.
[0074] Calculate the degree of replaceability of keyword z. The specific calculation formula is as follows:
[0075]
[0076] Where, T z represents the degree of interchangeability of keyword z, N represents the number of all keywords, K represents the number of two sentences with overall similarity about keyword z in all groups, and M j represents the number of two sentences that are similar to the keyword z after all groups are replaced with the jth keyword, F(z,c i ,d i ,j) means that after the jth keyword is replaced, the two sentences c that are similar to the keyword z after the i-th group is replaced i and d i The degree of window similarity.
[0077] It should be noted that It represents the frequency of occurrence of two sentences with overall similarity about keyword z in all sentences with similar structures. The smaller the frequency, the smaller the degree of interchangeability of keyword z; the larger the value, the greater the degree of interchangeability of keyword z; the smaller the degree of interchangeability of keyword z, the more prominent the emotional expression of keyword z for the three sentences in the window, and the stronger the emotional expression.
[0078] 3. Obtain the feature vector of each keyword based on the sentiment feature value and degree of interchangeability of each keyword.
[0079] It should be noted that, for any keyword, simply using the differences between their semantic expressions obviously cannot accurately express and distinguish the difference between two different texts; for any text, according to the logic of b1, since there is a causal relationship between any three sentences, then for a text, it is composed of the emotional expression and logical direction of the sentences in different windows. Therefore, we can use the single keyword emotional feature calculated in the above steps as the vector direction, use the degree of interchangeability (emotional expression strength) as the vector modulus, and assign a feature vector to each keyword in the text.
[0080] In this embodiment, the feature vector of the keyword is obtained according to the sentiment feature value and the degree of replaceability of the keyword, wherein the angle of the feature vector is θ=arctan(P z ), P z represents the sentiment feature value of keyword z, and the modulus of the feature vector is m = τ × norm (T z ), T z It indicates the degree of interchangeability of the keyword z, norm() indicates the linear normalization function, and τ indicates the unit modulus length. The implementer can set the unit modulus length according to the actual implementation situation, for example, τ=2.
[0081] S004, clustering all texts to obtain all clusters according to the feature vectors of the keywords contained in the texts, obtaining the sentiment keywords of each cluster, and storing all texts in each cluster according to the sentiment keywords of each cluster.
[0082] 1. Cluster all texts according to the feature vectors of the keywords contained in the text to obtain all clusters.
[0083] It should be noted that, due to the number of keywords in different sentences, each keyword corresponds to a two-dimensional feature vector. By connecting the feature vectors of all keywords in a text, we can obtain the feature curve of each text in the two-dimensional space. The difference between the feature curves of different texts can be used as a clustering condition.
[0084] In this embodiment, the characteristic curve of each text is obtained according to the characteristic vectors of the keywords contained in all sentences of each text, and the starting point of the characteristic curve of each text is the same. Starting from the starting point of the characteristic curve of each text, the characteristic curve of each text is obtained in turn according to the characteristic vector of each keyword in the text. Using the K-means clustering algorithm, all texts are clustered according to the distance between the characteristic curves of every two texts in all texts to obtain all clusters; wherein, the distance between the characteristic curves of every two texts is the DTW distance.
[0085] It should be noted that the K-means clustering algorithm is an iterative clustering analysis algorithm, in which the most important thing is to determine the number of clusters. The prior art elbow method is used to take the K value corresponding to the inflection point as the number of clusters, and the corresponding clustering result is the optimal classification result; the DTW distance is obtained by the DTW algorithm. Since the number of keywords in each text is different, the length of the characteristic curve of each text is different, so this embodiment uses the DTW algorithm to calculate the distance between the characteristic curves of two texts; the K-means clustering algorithm and the DTW algorithm are both well-known technologies and will not be described in detail here.
[0086] 2. Obtain the sentiment keywords of each cluster, and store all the texts in each cluster according to the sentiment keywords of each cluster.
[0087] In this embodiment, the text in each cluster is stored in a storage node of the text library, and the text in each category is analyzed using neural network technology. By collecting the emotional expressions of different words in normal language communication, the emotional keywords of each cluster are extracted for subsequent retrieval and comparison when identifying fraudulent information.
[0088] At the same time, since fraudulent texts are constantly changing, the text library should be updated regularly, and all texts in the text library should be re-clustered according to the above method to ensure the accuracy of subsequent retrieval and comparison.
[0089] The present invention accurately defines the sentiment characteristics of keywords by combining the structural similarity and window similarity of two sentences containing keywords, obtains the feature vector of each keyword based on the sentiment characteristics of the keywords, and constructs the feature curve of each text by aggregating the feature vectors, so as to cluster different texts. In combination with the sentiment characteristics of the texts, the basis for clustering is improved, and the problem of overly broad clustering results and inaccurate classification caused by clustering texts with the ultimate purpose of fraudulent texts is avoided, thereby improving the accuracy of text retrieval and the efficiency of later retrieval.
[0090] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An intelligent text classification method, characterized in that: The method comprises: Get a text consisting of several sentences and extract the keywords of each text; Calculate the structural similarity of two sentences containing each keyword, and obtain two sentences with similar structure for each keyword according to the structural similarity and a preset first threshold; calculate the window similarity of two sentences with similar structure for each keyword, and obtain two sentences with similar window for each keyword according to the window similarity and a preset second threshold; Calculate the sentiment feature value of each keyword based on the structural similarity and window similarity; calculate the degree of interchangeability of each keyword; obtain the feature vector of each keyword based on the sentiment feature value and interchangeability of each keyword; According to the feature vectors of the keywords contained in the texts, all the texts are clustered to obtain all clusters, the sentiment keywords of each cluster are obtained, and all the texts in each cluster are stored according to the sentiment keywords of each cluster; The calculation formula for the structural similarity of the two sentences containing each keyword is as follows: In the formula, f(z, a1, a2) represents the structural similarity between sentence a1 and sentence a2 containing keyword z, and x z,a1 、x z,a2 Respectively represent the position of keyword z in sentence a1 and sentence a2, m z,a1 、m z,a2 They represent the number of keywords in sentences a1 and a2 containing keyword z, respectively. exp() represents an exponential function with a natural constant as the base. The calculation formula for the window similarity of two sentences with similar keyword structures is as follows: F(z,b1,b2)=exp(-(1+|m z,b1,1 -m z,b2,1 |)×Q b1,b2,1 -(1+|m z,b1,2 -m z,b2,2 |)×Q b1,b2,2 ) In the formula, F(z, b1, b2) represents the window similarity of two sentences with similar structures about keyword z, sentence b1 and sentence b2 represent two sentences with similar structures about keyword z, and m z,b1,1 Indicates the number of keywords in the sentence adjacent to the left of sentence b1, m z,b2,1 Indicates the number of keywords in the sentence adjacent to the left of sentence b2, m z,b1,2 Indicates the number of keywords in the sentence adjacent to the right of sentence b1, m z,b2,2 represents the number of keywords in the sentence adjacent to the right of sentence b2, Q b1,b2,1 represents the first semantic difference between two sentences with similar structures regarding keyword z, Q b1,b2,2 Indicates the second semantic difference between two sentences with similar structures regarding keyword z; The method for obtaining the first semantic difference and the second semantic difference of two sentences with similar structures regarding the keyword z is specifically as follows: A method for obtaining the first semantic difference between two sentences with similar structures regarding keyword z is as follows: the two sentences with similar structures regarding keyword z are sentence b1 and sentence b2, a sentence adjacent to the left side of sentence b1 and a sentence adjacent to the left side of sentence b2 are obtained, the sentence with fewer keywords is taken as the target sentence, and the other sentence is recorded as the sentence to be matched, for any keyword in the target sentence, the Euclidean distance between the semantic vector of the keyword and the semantic vectors of all keywords in the sentence to be matched is calculated, the minimum value of the Euclidean distance is recorded as the semantic distance of the keyword, and the sum of the semantic distances of all keywords in the target sentence is recorded as the first semantic difference between the two sentences with similar structures regarding keyword z; By analogy, based on the sentence adjacent to the right of sentence b1 and the sentence adjacent to the right of sentence b2, the second semantic difference between the two sentences with similar structures regarding the keyword z is obtained.
2. An intelligent text classification method according to claim 1, characterized in that: The calculation formula of the sentiment feature value of each keyword is as follows: Where P z represents the sentiment feature value of keyword z, f(z, c i , d i ) represents the two sentences c that are similar in the overall sense about the keyword z in the i-th group i and d i The structural similarity of F(z, c i , d i ) represents the two sentences c that are similar in the overall sense about the keyword z in the i-th group i and d i , M represents the number of two sentences with overall similarity about keyword z in all groups.
3. The intelligent text classification method according to claim 1, characterized in that: The method for obtaining the degree of replaceability of each keyword is as follows: Replace the keyword z in two sentences with similar structures about the keyword z with any other keyword, obtain the window similarity of the two sentences with similar structures about the keyword z after the replacement, and obtain two sentences with overall similarity about the keyword z after the replacement according to the window similarity of the two sentences with similar structures about the keyword z after the replacement and a preset second threshold value Y2; Calculate the degree of replaceability of keyword z. The specific calculation formula is as follows: Where, T z represents the degree of interchangeability of keyword z, N represents the number of all keywords, K represents the number of two sentences with overall similarity about keyword z in all groups, and M j represents the number of two sentences that are similar to each other about keyword z after all groups are replaced with the jth keyword, F(z, c i , d i , j) represents two sentences c that are similar to each other in terms of keyword z after being replaced by the jth keyword. i and d i The degree of window similarity.
4. The intelligent text classification method according to claim 1, characterized in that: The specific steps of obtaining the feature vector of each keyword are as follows: The angle of the keyword's feature vector is θ = arctan(P z ), P z represents the sentiment feature value of keyword z, and the modulus of the feature vector is m = τ × norm (T z ), T z It indicates the degree of interchangeability of keyword z, norm() indicates the linear normalization function, and τ indicates the unit modulus.
5. The intelligent text classification method according to claim 1, characterized in that: The specific steps of clustering all texts to obtain all clusters and obtaining the sentiment keywords of each cluster are as follows: Using the K-means clustering algorithm, all texts are clustered according to the distance between the characteristic curves of every two texts in all texts to obtain all clusters; where the distance between the characteristic curves of every two texts is the DTW distance; Neural network technology is used to analyze the text in each category, and the emotional keywords of each cluster are extracted by collecting the emotional expressions of different words in normal language communication.
6. The intelligent text classification method according to claim 5, characterized in that: The method for obtaining the characteristic curve of each two texts is specifically as follows: The starting point of the characteristic curve of each text is the same. Starting from the starting point of the characteristic curve of each text, the characteristic curve of each text is obtained in turn according to the characteristic vector of each keyword in the text.
7. The intelligent text classification method according to claim 1, characterized in that: The specific steps of extracting keywords from each text are as follows: The TextRank algorithm is used to extract keywords from the text to obtain all the keywords of each text; the keywords of all texts are used as the vocabulary, and the word vector of each keyword is obtained through the Word2Vec algorithm. By performing principal component analysis on the word vectors of all keywords, the word vectors of all keywords are reduced to a two-dimensional space to obtain the semantic vector of each keyword in the two-dimensional space.
Citation Information
Patent Citations
Text sentiment classification method and system
CN111881291A
Text analysis system and method, electronic equipment and storage medium
CN115496066A
