Case classification matching method and device based on short text features
Through the case classification matching method based on short text features, using text preprocessing, feature combination and category feature domain selection, combined with the pre-training model, the accuracy and efficiency problems of automatic case classification are solved, and efficient case management is achieved.
Patent Information
- Application Number
- CN202410799101.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-09-10
AI Technical Summary
Existing technology cannot effectively solve the problem of automatic classification of a huge number of cases. Manual classification is costly and has a high error rate. It lacks a unified automatic text classification system and is particularly deficient in feature processing.
A case classification matching method based on short text features is adopted, including text preprocessing, neighbor feature combination, feature selection based on category feature domains and a combination of pre-trained text classification models. The category feature domain is constructed through mutual information, and features are selected and combined to Improve classification accuracy.
It significantly improves the accuracy of case classification, helps managers process and match cases quickly and accurately, and improves the efficiency and quality of case management.
Smart Images

Figure CN118626646A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of language analysis, and in particular to a case classification and matching method and device based on short text features. Background Art
[0002] With the substantial increase in the number of cases, the rapid dispatch and processing of cases has become one of the important issues that need to be addressed and resolved at present and in the future. Given the huge number of cases, if they are manually classified, the workload will be huge, and it will incur great costs and a high error rate. Therefore, it is crucial to find a fast and efficient method for automatic classification of urban management cases.
[0003] Taking urban management cases as an example, the reported content mainly includes case text description, case voice description, case photos, case location, etc. The case text description is a required content and the corresponding case type can be judged by the case text description. Therefore, the automatic classification of urban management cases can be achieved by automatically classifying the case description short text.
[0004] Automatic text classification technology is a hot topic and key technology in the field of information retrieval and natural language processing. It has developed rapidly in recent years and has achieved certain research results. However, so far, there is no unified automatic text classification system that can perfectly solve various types of text classification problems, such as microblogs, news headlines, articles, chat messages, etc. Especially in the feature processing of text, such as feature representation, feature selection, etc. Text feature processing is the basis of text classification and has a huge impact on the final classification effect. Therefore, it is particularly important to choose the most appropriate feature processing method for different practical problems.
[0005] Based on the above situation, the present invention proposes a case classification and matching method and device based on short text features. Summary of the invention
[0006] In order to make up for the defects of the prior art, the present invention provides a simple and efficient case classification and matching method and device based on short text features.
[0007] The present invention is achieved through the following technical solutions:
[0008] A case classification and matching method based on short text features, characterized in that it includes the following steps:
[0009] Step S1: Text preprocessing
[0010] Tokenize the short text of the case description in the text set, remove the stop words in the text, and count the word frequencies; the stop words include both various punctuation marks and emojis, as well as modal particles, prepositions, and conjunctions that have no clear meaning themselves, such as common words like "de" (的) and "zai" (在).
[0011] Step S2, Mutual Neighbor Feature Combination
[0012] After preprocessing the short text of the case description, use the mutual neighbor feature combination algorithm to combine adjacent features in the text feature space pairwise to form new features and expand the feature space; to solve the deficiencies in tokenization and the problem of fewer short text features.
[0013] Step S3, Feature Selection Based on the Category Feature Domain
[0014] Use mutual information as the membership function to construct the category feature domain, and use the category feature domain to perform feature selection on the original text features;
[0015] First, assign a class identification code di to each category ci in the text set (that is, the class identification code for category ci is di);
[0016] Then, process each feature t of text D, and replace the feature t in each category feature domain with the corresponding class identification code di; the specific processing process is as follows:
[0017] ① If the feature t belongs to and only belongs to the category feature domain of category ci, then the class identification code di of category ci will be used as a feature of text D;
[0018] ② If the feature t belongs to the category feature domains of m categories ci1, ci2,..., cim at the same time, then the class identification codes di1, di2,..., dim of the above m categories will all be used as features of text D;
[0019] ③ If the feature t does not belong to the category feature domain of any category, then the feature t itself will be used as a feature of text D;
[0020] If there are multiple features in a short text that belong to the same category feature domain, that is, multiple features correspond to the same class identification code, for each additional feature corresponding to the same class identification code, the weight of the class identification code in the corresponding short text is increased by 1;
[0021] Step S4, Realize Classification Matching Based on the Text Classification Model
[0022] Input the features into a pre-trained text classification model, such as the Word2Vec model, BERT model, RoBERTa model, etc., and use the text classification model to perform classification matching on text D.
[0023] In step S3, the category feature domain refers to the main feature set in each category. Whether a feature belongs to the main feature set of a category is determined by the membership function value between the feature and the corresponding category. The specific determination method is as follows;
[0024] Calculate the membership function value uci(t) of each feature t in category ci respectively. If the membership function value uci(t) is higher than the custom threshold d (the size of the threshold d is determined by the number of retained features in the final feature selection), the corresponding feature t is considered to belong to the category feature domain of category ci.
[0025] In step S3, the membership function value between the category and the feature is calculated using the intra-category and inter-category dispersion. The calculation formula for the membership function value uci(t) of feature t with respect to category ci is as follows:
[0026]
[0027] Among them, tfit represents the word frequency of feature t in category ci; tft represents the word frequency of feature t in all categories; fit represents the number of texts containing feature t in category ci; Ci represents the total number of texts in category ci; ft represents the number of texts containing feature t in all categories; N represents the total number of texts in the text set.
[0028] Used to calculate the inter-class dispersion. The larger the tfit is, the smaller the tft-tfit is, which means that feature t appears in large numbers in a certain category and less in other categories. This means that the feature t contributes more to text classification. To prevent the denominator from being zero, tft-tfit is added by 1.
[0029] Used to calculate the intra-class dispersion, The bigger, The smaller is, the more texts in a certain category contain this feature t, and the fewer texts in all categories contain this feature t, the greater the contribution of this feature t to text classification. Perform addition processing.
[0030] The case classification and matching device based on short text features includes:
[0031] The text preprocessing module is responsible for word segmentation of the short case description texts in the text set, removing stop words in the text, and counting word frequencies; the stop words include various punctuation marks and emoticons, as well as modal particles, prepositions, and conjunctions that have no clear meaning in themselves;
[0032] The adjacent feature combination module is responsible for combining adjacent features in the text feature space in pairs to form new features and expand the feature space;
[0033] The feature selection module is responsible for constructing the category feature domain using mutual information as the membership function, and using the category feature domain to perform feature selection on the original text features;
[0034] First, a class identification code di is assigned to each category ci in the text set (i.e., the class identification code of category ci is di);
[0035] Then, each feature t of the text D is processed, and the feature t in each category feature domain is replaced with the corresponding class identification code di; the specific processing process is as follows:
[0036] ① If feature t belongs to and only belongs to the category feature domain of category ci, then the class identification code di of category ci will be used as a feature of text D;
[0037] ② If feature t belongs to the category feature domain of m categories ci1, ci2, ..., cim at the same time, the class identification codes di1, di2, ..., dim of the above m categories will all be used as features of text D;
[0038] ③ If feature t does not belong to any category feature domain, feature t itself is taken as a feature of text D;
[0039] For each additional feature of the same class identification code, the weight of the class identification code in the corresponding short text increases by 1;
[0040] The classifier has a built-in pre-trained text classification model, such as the Word2Vec model, BERT model, and RoBERTa model, and is responsible for classifying and matching text D using the text classification model.
[0041] The feature selection module also includes a category feature domain construction submodule, which is responsible for determining whether a feature belongs to a main feature set of a certain category. The specific determination method is as follows:
[0042] Calculate the membership function value uci(t) of each feature t in category ci respectively. If the membership function value uci(t) is higher than the custom threshold d (the size of the threshold d is determined by the number of retained features in the final feature selection), the corresponding feature t is considered to belong to the category feature domain of category ci.
[0043] The category feature domain construction submodule calculates the membership function value between the category and the feature using the intra-class and inter-class dispersion. The calculation formula of the membership function value uci(t) of feature t with respect to category ci is as follows:
[0044]
[0045] Among them, tfit represents the word frequency of feature t in category ci; tft represents the word frequency of feature t in all categories; fit represents the number of texts containing feature t in category ci; Ci represents the total number of texts in category ci; ft represents the number of texts containing feature t in all categories; N represents the total number of texts in the text set.
[0046] A case classification and matching device based on short text features, characterized in that it includes a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above-mentioned method steps when executing the computer program.
[0047] A readable storage medium, characterized in that: a computer program is stored on the readable storage medium, and the computer program implements the above method steps when executed by a processor.
[0048] The beneficial effects of the present invention are as follows: the case classification and matching method and device based on short text features introduces combined features to significantly improve the classification accuracy, which helps managers to match and process management cases more quickly and accurately, thereby improving the efficiency and quality of case management. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] 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 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.
[0050] Attached Figure 1 The diagram is a schematic diagram of the case classification and matching method and device based on short text features of the present invention. DETAILED DESCRIPTION
[0051] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0052] The case classification and matching method based on short text features includes the following steps:
[0053] Step S1: Text preprocessing
[0054] Tokenize the short text of the case description in the text set, remove the stop words in the text, and count the word frequencies; the stop words include various punctuation marks and emojis, as well as modal particles, prepositions, and conjunctions that have no clear meaning themselves, such as common words like "de" (的) and "zai" (在).
[0055] When tokenizing, most Chinese word segmentation methods are based on dictionary matching and statistics, and errors are inevitable during the matching and statistics processes. And a large part of the phrases that cannot be matched may have a better improvement on the text classification effect. For example: "manhole cover damaged", after word segmentation, it will generate two words, "manhole cover" and "damaged", and these two words as separate features are obviously less classification-capable than the combined feature "manhole cover damaged".
[0056] Step S2, Mutual Adjacent Feature Combination
[0057] After preprocessing the short text of the case description, use the mutual adjacent feature combination algorithm to combine adjacent features in the text feature space pairwise to form new features and expand the feature space; to solve the deficiencies in word segmentation and the problem of fewer short text features.
[0058] For example, the preliminary word segmentation result of a short text of a case description is as follows:
[0059] S=(w1,w2,w3,w4,w5)
[0060] Among them, w1, w2, w3, w4, and w5 respectively represent the five feature words of the short text S. After executing the mutual adjacent feature combination algorithm, the result is:
[0061] S=(w1,w2,w3,w4,w5,w12,w23,w34,w45)
[0062] Among them, w1, w2, w3, w4, and w5 remain unchanged, w12 is the new feature word formed after connecting the feature words w1 and w2, and the same applies to w23, w34, and w45.
[0063] After feature expansion by the mutual adjacent feature combination algorithm proposed above in this article, the feature space of the entire text becomes very large. While generating combined features with stronger descriptive power for text classification, many features that contribute little or even have an impact on the classification effect are also generated, and feature selection needs to be performed on them. The following will illustrate how to use the category feature domain introduced above to achieve feature selection for short texts.
[0064] Step S3, Feature Selection Based on Category Feature Domain
[0065] Use mutual information as the membership function to construct the category feature domain, and use the category feature domain to perform feature selection on the original text features;
[0066] First, a class identification code di is assigned to each category ci in the text set (i.e., the class identification code of category ci is di);
[0067] Then, each feature t of the text D is processed, and the feature t in each category feature domain is replaced with the corresponding class identification code di; the specific processing process is as follows:
[0068] ① If feature t belongs to and only belongs to the category feature domain of category ci, then the class identification code di of category ci will be used as a feature of text D;
[0069] ② If feature t belongs to the category feature domain of m categories ci1, ci2, ..., cim at the same time, the class identification codes di1, di2, ..., dim of the above m categories will all be used as features of text D;
[0070] ③ If feature t does not belong to any category feature domain, feature t itself is taken as a feature of text D;
[0071] If there are multiple features in a short text that belong to the same category feature domain, that is, multiple features correspond to the same type of identification code, the weight of the same type of identification code in the corresponding short text will increase by 1 for each additional corresponding feature of the same type of identification code; in this way, the main feature will obtain a larger weight value, which will help improve the classification effect of the text.
[0072] Step S4: Implement classification matching based on text classification model
[0073] The features are input into a pre-trained text classification model, such as the Word2Vec model, BERT model, RoBERTa model, etc., and the text classification model is used to classify and match the text D.
[0074] In the process of short text classification, whether a feature item is conducive to the determination of a certain category can be judged by the difference between the frequency of the feature item in the category and the frequency of the feature item in other categories. For example, if a feature appears in large quantities in one category, but in other categories, the feature appears less or does not appear, then it can be preliminarily determined that the feature is conducive to classification. This method of judging the quality of features based on the distribution of features between categories can be calculated by the inter-class dispersion. The opposite of the inter-class dispersion is the intra-class dispersion. Consider that in the same category, if a feature item appears in large quantities in a text, but in other texts, the feature item appears less or does not appear. Then such a feature has little effect on the determination of the category and can even be considered a redundant feature. The intra-class dispersion can better judge the distribution of such intra-class features.
[0075] In step S3, the category feature domain refers to the main feature set in each category. Whether a feature belongs to the main feature set of a category is determined by the membership function value between the feature and the corresponding category. The specific determination method is as follows;
[0076] Calculate the membership function value uci(t) of each feature t in category ci respectively. If the membership function value uci(t) is higher than the custom threshold d (the size of the threshold d is determined by the number of retained features in the final feature selection), the corresponding feature t is considered to belong to the category feature domain of category ci.
[0077] Through the construction of the above category feature domain, if a certain term appears in multiple categories and meets the conditions of the corresponding category feature domain, then the term will belong to the category feature domains of multiple classes at the same time. For example, the word "manhole cover" may be a feature of both the "rainwater manhole cover" class and the "power manhole cover" class. If the feature word "manhole cover" meets the category feature domain judgment conditions of both classes, then the feature word "manhole cover" belongs to the category feature domains of both "rainwater manhole cover" and "power manhole cover" classes.
[0078] In step S3, the membership function value between the category and the feature is calculated using the intra-category and inter-category dispersion. The calculation formula for the membership function value uci(t) of feature t with respect to category ci is as follows:
[0079]
[0080] Among them, tfit represents the word frequency of feature t in category ci; tft represents the word frequency of feature t in all categories; fit represents the number of texts containing feature t in category ci; Ci represents the total number of texts in category ci; ft represents the number of texts containing feature t in all categories; N represents the total number of texts in the text set.
[0081] Used to calculate the inter-class dispersion. The larger the tfit is, the smaller the tft-tfit is, which means that feature t appears in large numbers in a certain category and less in other categories. This means that the feature t contributes more to text classification. To prevent the denominator from being zero, tft-tfit is added by 1.
[0082] Used to calculate the intra-class dispersion, The bigger, The smaller is, the more texts in a certain category contain this feature t, and the fewer texts in all categories contain this feature t, the greater the contribution of this feature t to text classification. Perform addition processing.
[0083] The case classification and matching device based on short text features includes:
[0084] The text preprocessing module is responsible for word segmentation of the short case description texts in the text set, removing stop words in the text, and counting word frequencies; the stop words include various punctuation marks and emoticons, as well as modal particles, prepositions, and conjunctions that have no clear meaning in themselves;
[0085] The adjacent feature combination module is responsible for combining adjacent features in the text feature space in pairs to form new features and expand the feature space; in order to solve the problem of insufficient word segmentation and fewer features in short texts.
[0086] The feature selection module is responsible for constructing the category feature domain using mutual information as the membership function, and using the category feature domain to perform feature selection on the original text features;
[0087] First, a class identification code di is assigned to each category ci in the text set (i.e., the class identification code of category ci is di);
[0088] Then, each feature t of the text D is processed, and the feature t in each category feature domain is replaced with the corresponding class identification code di; the specific processing process is as follows:
[0089] ① If feature t belongs to and only belongs to the category feature domain of category ci, then the class identification code di of category ci will be used as a feature of text D;
[0090] ② If feature t belongs to the category feature domain of m categories ci1, ci2, ..., cim at the same time, the class identification codes di1, di2, ..., dim of the above m categories will all be used as features of text D;
[0091] ③ If feature t does not belong to any category feature domain, feature t itself is taken as a feature of text D;
[0092] For each additional feature of the same class identification code, the weight of the class identification code in the corresponding short text increases by 1;
[0093] The classifier has a built-in pre-trained text classification model, such as the Word2Vec model, BERT model, and RoBERTa model, and is responsible for classifying and matching text D using the text classification model.
[0094] The feature selection module also includes a category feature domain construction submodule, which is responsible for determining whether a feature belongs to a main feature set of a certain category. The specific determination method is as follows:
[0095] Calculate the membership function value uci(t) of each feature t in category ci respectively. If the membership function value uci(t) is higher than the custom threshold d (the size of the threshold d is determined by the number of retained features in the final feature selection), the corresponding feature t is considered to belong to the category feature domain of category ci.
[0096] The category feature domain construction submodule calculates the membership function value between the category and the feature using the intra-class and inter-class dispersion. The calculation formula of the membership function value uci(t) of feature t with respect to category ci is as follows:
[0097]
[0098] Among them, tfit represents the word frequency of feature t in category ci; tft represents the word frequency of feature t in all categories; fit represents the number of texts containing feature t in category ci; Ci represents the total number of texts in category ci; ft represents the number of texts containing feature t in all categories; N represents the total number of texts in the text set.
[0099] The case classification and matching device based on short text features includes a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method steps when executing the computer program.
[0100] The readable storage medium stores a computer program, and when the computer program is executed by a processor, the above method steps are implemented.
[0101] The embodiment described above is only one specific implementation of the present invention. Common changes and substitutions made by those skilled in the art within the scope of the technical solution of the present invention should be included in the protection scope of the present invention.
Claims
1. A case classification and matching method based on short text features, Features: The following steps are involved: Step S1: Text preprocessing Segment the short case description texts in the text set, remove stop words in the text, and count the word frequencies; stop words include various punctuation marks and emoticons, as well as modal particles, prepositions, and conjunctions that have no clear meaning. Step S2: Combination of adjacent features After preprocessing the short text of the case description, the neighboring features in the text feature space are combined in pairs using the neighboring feature combination algorithm to form new features and expand the feature space. Step S3: Feature selection based on category feature domain Mutual information is used as the membership function to construct the category feature domain, and the category feature domain is used to select the original text features; First, a class identification code di is assigned to each category ci in the text set (i.e., the class identification code of category ci is di); Then, each feature t of the text D is processed, and the feature t in each category feature domain is replaced with the corresponding class identification code di; the specific processing process is as follows: ① If feature t belongs to and only belongs to the category feature domain of category ci, then the class identification code di of category ci will be used as a feature of text D; ② If feature t belongs to the category feature domain of m categories ci1, ci2, ..., cim at the same time, the class identification codes di1, di2, ..., dim of the above m categories will all be used as features of text D; ③ If feature t does not belong to any category feature domain, feature t itself is taken as a feature of text D; For each additional feature of the same class identification code, the weight of the class identification code in the corresponding short text is increased by 1; Step S4, class matching based on the text classification model The features are input into the pre-trained text classification model, and the text classification model is used to classify and match the text D.
2. The case classification and matching method based on short text features according to claim 1, Features: In step S3, the category feature domain refers to the main feature set in each category. Whether a feature belongs to the main feature set of a category is determined by the membership function value between the feature and the corresponding category. The specific determination method is as follows; The membership function value uci(t) of each feature t in category ci is calculated respectively. If the membership function value uci(t) is higher than the custom threshold d, the corresponding feature t is considered to belong to the category feature domain of category ci.
3. The case classification and matching method based on short text features according to claim 2, Features: In step S3, the membership function value between the category and the feature is calculated using the intra-category and inter-category dispersion. The calculation formula for the membership function value uci(t) of feature t with respect to category ci is as follows: Among them, tfit represents the word frequency of feature t in category ci; tft represents the word frequency of feature t in all categories; fit represents the number of texts containing feature t in category ci; Ci represents the total number of texts in category ci; ft represents the number of texts containing feature t in all categories; N represents the total number of texts in the text set.
4. A case classification and matching device based on short text features, Features: The text preprocessing module is responsible for word segmentation of the short case description texts in the text set, removing stop words in the text, and counting word frequencies; the stop words include various punctuation marks and emoticons, as well as modal particles, prepositions, and conjunctions that have no clear meaning in themselves; The adjacent feature combination module is responsible for combining adjacent features in the text feature space in pairs to form new features and expand the feature space; The feature selection module is responsible for constructing the category feature domain using mutual information as the membership function, and using the category feature domain to perform feature selection on the original text features; First, a class identification code di is assigned to each category ci in the text set (i.e., the class identification code of category ci is di); Then, each feature t of the text D is processed, and the feature t in each category feature domain is replaced with the corresponding class identification code di; the specific processing process is as follows: ① If feature t belongs to and only belongs to the category feature domain of category ci, then the class identification code di of category ci will be used as a feature of text D; ② If feature t belongs to the category feature domain of m categories ci1, ci2, ..., cim at the same time, the class identification codes di1, di2, ..., dim of the above m categories will all be used as features of text D; ③ If feature t does not belong to any category feature domain, feature t itself is taken as a feature of text D; For each additional feature of the same class identification code, the weight of the class identification code in the corresponding short text increases by 1; The classifier has a built-in pre-trained text classification model and is responsible for classifying and matching text D using the text classification model.
5. The case classification and matching device based on short text features according to claim 4, Features: The feature selection module also includes a category feature domain construction submodule, which is responsible for determining whether a feature belongs to a main feature set of a certain category. The specific determination method is as follows: The membership function value uci(t) of each feature t in category ci is calculated respectively. If the membership function value uci(t) is higher than the custom threshold d, the corresponding feature t is considered to belong to the category feature domain of category ci.
6. The case classification and matching device based on short text features according to claim 5, Features: The category feature domain construction submodule calculates the membership function value between the category and the feature using the intra-class and inter-class dispersion. The calculation formula of the membership function value uci(t) of feature t with respect to category ci is as follows: Among them, tfit represents the word frequency of feature t in category ci; tft represents the word frequency of feature t in all categories; fit represents the number of texts containing feature t in category ci; Ci represents the total number of texts in category ci; ft represents the number of texts containing feature t in all categories; N represents the total number of texts in the text set.
7. A case classification and matching device based on short text features, Features: The method comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the method steps as claimed in any one of claims 1 to 3 when executing the computer program.
8. A readable storage medium, Features: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Short text classification method and apparatus
CN105912716A
Method for classifying city management cases based on text classification
CN106326458A
Feature selection method based on document frequency of within-class and between-class and term frequency statistics
CN108491429A
Text classification system and method based on feature selection
CN114896398A
Short text classification method and system
WO2019228203A1
