Text classification methods, devices, storage media and electronic devices
By combining recall and co-occurrence probability matrices, the target tags of multi-labeled texts are obtained, which solves the problem of low recall accuracy caused by long-tail distribution and achieves higher recall and precision.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2026-03-10
AI Technical Summary
In multi-label text classification, existing technologies suffer from low recall accuracy because the training dataset has a long-tail distribution, which causes the model to overfit to the head labels and ignore the tail labels.
By recalling the first set of labels for the text to be classified, and using the co-occurrence probability matrix among multiple preset labels to obtain the second set of labels, the final target label is determined by combining the matching model. The label co-occurrence information is used to cover long-tail labels, thereby improving recall and precision.
By effectively utilizing tag co-occurrence information, the recall rate of multi-tag systems and the accuracy of text classification are improved, solving the problem of low recall accuracy caused by long-tail distribution.
Smart Images

Figure CN116244442B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of natural language processing, and in particular to a text classification method, apparatus, storage medium, and electronic device. Background Technology
[0002] Multi-label text classification (MTC) studies how to recall a suitable set of labels from a massive dataset of labels for a given text. However, referencing the Pareto principle (also known as the 80 / 20 rule), or the idea that 80% of the wealth is concentrated in the hands of 20% of the people, or that 20% of the books in a library satisfy 80% of the customers, in MTC scenarios, it's common to find that 80% of the text in a training dataset contains only two labels, while 20% of the text contains eight labels. This data distribution is known as a long-tailed distribution. MTC models trained on long-tailed datasets often overfit to the head labels, neglecting the tail labels during prediction and recall, resulting in unsatisfactory accuracy for multiple labels output for the text to be classified. Summary of the Invention
[0003] This specification provides a text classification method, apparatus, storage medium, and electronic device, which can solve the problem of difficult recall of long-tail tags and enhance the accuracy of text classification. The technical solution is as follows:
[0004] Firstly, embodiments of this specification provide a text classification method, the method comprising:
[0005] Recall the first set of tags corresponding to the text to be classified, wherein the first set of tags includes at least one first tag;
[0006] Based on the co-occurrence probability matrix among multiple preset tags, a second tag set corresponding to the text to be classified is obtained. The second tag set includes at least one second tag, and the multiple preset tags include at least a portion of the first tags in the first tag set.
[0007] For each of the first tag and the second tag, match it with the text to be classified, and use the tags that match successfully in the first tag set and the second tag set as the target tags of the text to be classified.
[0008] Secondly, embodiments of this specification provide a text classification device, the device comprising:
[0009] The tag recall module is used to recall the first tag set corresponding to the text to be classified, wherein the first tag set includes at least one first tag.
[0010] The co-occurrence tag module is used to obtain a second tag set corresponding to the text to be classified based on the co-occurrence probability matrix among multiple preset tags. The second tag set includes at least one second tag, and the multiple preset tags include at least a portion of the first tags in the first tag set.
[0011] The target matching module is used to match each of the first tag and the second tag with the text to be classified, and to take the tags that are successfully matched in the first tag set and the second tag set as the target tags of the text to be classified.
[0012] Thirdly, embodiments of this specification provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.
[0013] Fourthly, embodiments of this specification provide a computer program product that stores multiple instructions adapted for loading by a processor and executing the above-described method steps.
[0014] Fifthly, embodiments of this specification provide an electronic device that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.
[0015] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following:
[0016] This manual, after recalling the first set of labels corresponding to the text to be classified, also obtains the second set of labels for the text to be classified through a preset co-occurrence probability matrix. This effectively utilizes the label co-occurrence information in the sample text set, covering more potentially relevant long-tail labels in the label recall and prediction stage, thus improving the multi-label recall rate. Furthermore, in the selection stage for the target labels corresponding to the text to be classified, the multi-label classification problem is transformed into a label-to-text matching problem. The recalled first set of labels and the second set of labels obtained through the co-occurrence probability matrix are matched and binary identified with the text to be classified, thereby finally determining the target label corresponding to the text to be classified, thus simply and effectively improving the accuracy of text classification. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a text classification method provided in the embodiments of this specification;
[0019] Figure 2 This is a schematic diagram of a co-occurrence probability matrix calculation provided in the embodiments of this specification;
[0020] Figure 3 This is a schematic diagram of the structure of a text classification method provided in the embodiments of this specification;
[0021] Figure 4 This is a flowchart illustrating another text classification method provided in the embodiments of this specification;
[0022] Figure 5 This is a schematic diagram of the structure of a text classification method provided in the embodiments of this specification;
[0023] Figure 6 This is a schematic diagram of the structure of a text classification device provided in the embodiments of this specification;
[0024] Figure 7 This is a schematic diagram of the structure of an electronic device provided in the embodiments of this specification. Detailed Implementation
[0025] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0026] In the description of this specification, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. In the description of this specification, it should be noted that, unless otherwise expressly specified and limited, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. Those skilled in the art can understand the specific meaning of the above terms in this specification based on the specific circumstances. Furthermore, in the description of this specification, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0027] The present specification will now be described in detail with reference to specific embodiments.
[0028] Multi-label text classification (MTC) studies how to retrieve a suitable set of labels from a massive dataset of labels for a given text. However, referencing the Pareto principle (also known as the 80 / 20 rule), or the idea that 80% of the wealth is concentrated in the hands of 20% of the people, or that 20% of the books in a library satisfy 80% of the customers, in MTC scenarios, it's common to find that 80% of the text in a training dataset covers only two labels, while 20% of the text encompasses eight labels. This data distribution is also known as a long-tailed distribution.
[0029] For example, platforms in consumer finance and e-commerce contain a large amount of original user feedback text, such as process inquiries, product usage feedback, complaints, and suggestions. Analyzing and processing user feedback to accurately identify the user's intent, the recipient of the feedback, and the root cause of the problem is crucial for guiding continuous product optimization. A precise understanding of user needs is also essential for improving the user experience. In large internet platforms, due to the diversity of products, the channels, recipients, and root causes of user feedback constitute a large-scale combination problem. For instance, the same feedback recipient may have multiple feedback issues, different feedback recipients may have the same feedback issue, and a single feedback may involve multiple recipients. This is a large-scale, multi-label classification problem based on feedback content. In other words, for complex feedback text, there is an urgent need for an effective and feasible multi-label classification method to classify and analyze the feedback text.
[0030] However, since training datasets often have a long-tailed distribution, multi-label text classification models trained on such datasets tend to overfit the head labels, thus ignoring the tail labels during prediction and recall. This results in unsatisfactory accuracy for the multiple labels output for the text to be classified.
[0031] Therefore, to address the above problems, this specification proposes a text classification method. In one embodiment, such as... Figure 1 The diagram shown is a flowchart illustrating a text classification method proposed in an embodiment of this specification. This method can be implemented using a computer program and can run on a text classification device based on the von Neumann architecture. This computer program can be integrated into an application or run as a standalone utility application.
[0032] Specifically, the text classification method includes:
[0033] S102. Recall the first set of tags corresponding to the text to be classified.
[0034] The execution subject of the embodiments in this specification is a terminal device, which is an electronic device used by the user. This electronic device can be a personal computer, mobile phone, tablet computer, laptop, or other computer device with certain computing power that runs applications or web pages with text classification functions. It can also be a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. It is understood that the number and type of terminal devices mentioned above are merely illustrative, and the embodiments in this specification do not impose any limitations on them.
[0035] In the embodiments of this specification, the text to be classified can be text data corresponding to different scenarios obtained through different methods. For example, the text to be classified can be travel-related text, health consultation-related text / articles related to health science, etc. The method of obtaining the text to be classified can be that the user inputs it through the input device of the terminal device, or the terminal device can retrieve it from an authorized platform or storage unit through the user's instructions, etc. This embodiment of the specification does not impose any limitations on this. In addition, the length of the text to be classified can be long text (such as thousands or tens of thousands of characters) or short text (such as tens or hundreds of characters), and this embodiment does not impose any limitations on this.
[0036] This embodiment obtains the first tag set corresponding to the text to be classified through recall. Recall refers to triggering as many correct results as possible from the full set of information, returning the correct results, scoring and ranking all returned correct results, and selecting the few results with the highest scores. In other words, in the classification problem of the text to be classified, recall is the first screening and prediction step, obtaining the first tag set corresponding to the text to be classified. The first tag set includes at least one first tag.
[0037] For example, if the text to be classified is related to tropical fruits, the first tag set corresponding to the text to be classified obtained through recall includes the first tag "tropical fruits", the first tag "pineapple", the first tag "pineapple", the first tag "banana", the first tag "mango", etc.
[0038] In one embodiment, a multi-label classification model recalls at least one first label corresponding to the text to be classified. For example, the multi-label classification model may include Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), or Transformer networks based on the attention mechanism, along with a classification layer. The CNN, RNN, or Transformer are used to semantically encode the text to be classified, and the classification layer maps the encoded vector to the label dimension. Another example is a BERT pre-trained model. BERT (Bidirectional Encoder Representation from Transformers) pre-trained models recall at least one first label corresponding to the text to be classified by running a self-supervised learning method on massive amounts of corpus data. Self-supervised learning refers to supervised learning performed on unlabeled data.
[0039] It is understood that the multi-label classification model in the embodiments of this specification is not limited to the above-mentioned BERT pre-trained model and other models, and other multi-label classification models for natural language processing (NLP) can also be applied.
[0040] S104. Based on the co-occurrence probability matrix among multiple preset tags, obtain the second tag set corresponding to the text to be classified.
[0041] The second tag set includes at least one second tag, and the multiple preset tags include at least a portion of the first tags in the first tag set. In other words, the multiple preset tags may include only all the first tags in the first tag set, or only a portion of the first tags in the first tag set, or include other tags besides all the first tags in the first tag set, or include other tags besides a portion of the first tags in the first tag set, where these other tags are different from the first tags. For example, the first tag set includes first tags (A, B, C, D), and the multiple preset tags include all the first tags in the first tag set as well as other tags, i.e., the multiple preset tags include tags (A, B, C, D, E); or the multiple preset tags include part of the information in the first tag set and tags other than the first tags, i.e., the multiple preset tags include tags (A, B, E); or the multiple preset tags include only a portion of the tags in the first tag set, i.e., the multiple preset tags include the information set (A, B, C); or the multiple preset tags include only all the tags in the first tag set, i.e., the multiple preset tags include tags (A, B, C, D).
[0042] The co-occurrence probability matrix is a matrix composed of the probabilities of pairwise label co-occurrence. These probabilities are obtained statistically from a set of sample texts labeled with predefined tags. Label co-occurrence refers to the co-appearance of two predefined tags in the category tags of the same sample text. Specifically, assuming there are predefined tags A and B, the co-occurrence probability of tag A with respect to tag B is the ratio of the frequency of co-occurrence of tags A and B to the frequency of occurrence of tag A. Similarly, the co-occurrence probability of tag B with respect to tag A is the ratio of the frequency of co-occurrence of tags A and B to the frequency of occurrence of tag B. Therefore, the co-occurrence probability of tag A with respect to tag B is not necessarily equal to the co-occurrence probability of tag B with respect to tag A.
[0043] In other words, the co-occurrence probability matrix includes click information among multiple preset labels. Click information (PMI, Point Mutual Information) is generally used to measure the correlation between two events. In the entire event set, the correlation between two events can be determined by calculating their co-occurrence frequency. Therefore, the second label set corresponding to the text to be classified can be obtained through the co-occurrence probability matrix.
[0044] like Figure 2 The diagram shown is a flowchart illustrating a co-occurrence probability matrix calculation method included in an embodiment of this specification. Figure 2 The sample text includes three sample texts: sample text 2011, sample text 2012, and sample text 2013. Sample text 2011 corresponds to labels A, B, C, and D; sample text 2012 corresponds to labels A, B, and E; and sample text 2013 corresponds to labels B and D. For the above three sample texts and the preset labels corresponding to each sample text, the co-occurrence probability matrix 202 is calculated as shown in the figure.
[0045] For example, P(AB / A) represents the probability that preset label A and preset label B appear simultaneously given the presence of preset label A. Therefore, based on the labels A, B, C, and D in sample text 2011, and A, B, and E in sample text 2012, P(AB / A) = 1. P(AB / B) represents the probability that preset label A and preset label B appear simultaneously given the presence of preset label B. Therefore, based on the labels A, B, C, and D in sample text 2011, A, B, and E in sample text 2012, and B and D in sample text 2013, P(AB / A) = 2 / 3. P(CB / C) represents the probability that preset label C and preset label B appear simultaneously given the presence of preset label C. Therefore, based on the labels A, B, C, and D in sample text 2011, and B and D in sample text 2013, P(CB / C) = 1. P(CB / B) represents the probability that preset label C and preset label B appear simultaneously when preset label B appears. Therefore, based on the corresponding labels A, B, C, and D in sample text 2011, labels A, B, and E in sample text 2012, and labels B and D in sample text 2013, P(CB / B) = 1 / 3. Figure 2 The co-occurrence probability matrix 202 of the CPC is used to calculate the co-occurrence probabilities of the others.
[0046] Understandable, Figure 2 The number of sample texts and the preset tags corresponding to each sample text shown are for illustrative purposes only, and this specification does not impose any limitations on them. Sample texts can be obtained by the user inputting them through the input device of the terminal device, or by the terminal device retrieving them from an authorized platform or storage unit according to the user's instructions, etc., and this specification does not impose any limitations on these methods. Furthermore, the length of the sample texts can be long (e.g., thousands or tens of thousands of characters) or short (e.g., tens or hundreds of characters), and this embodiment does not impose any limitations on this.
[0047] In one embodiment, the method for obtaining the second tag set corresponding to the text to be classified based on the co-occurrence probability matrix among multiple preset tags is as follows: Based on the co-occurrence probability matrix among multiple preset tags, obtain the co-occurrence probability between each first tag and each preset tag; select preset tags with co-occurrence probabilities greater than a first probability threshold as second tags, thus obtaining a second tag set including at least one second tag. The multiple preset tags include at least a portion of the first tags in the first tag set.
[0048] For example, multiple preset tags include N first tags in the first tag set. Therefore, the co-occurrence probability matrix includes the co-occurrence probability of each of the N first tags with one or more other preset tags. Furthermore, based on the co-occurrence probability between each first tag and each preset tag, the preset tags with a co-occurrence probability greater than the first probability threshold are used as second tags.
[0049] For example, multiple preset tags include some first tags in the first tag set as well as other preset tags; that is, the first tag set includes first tags (A, C, F, G), and the multiple preset tags include, for example, […]. Figure 2 Given the preset labels (A, B, C, D, E), based on the co-occurrence probabilities of the first label A with the preset labels B, C, D, and E in the co-occurrence probability matrix, the preset label D with a co-occurrence probability higher than the co-occurrence probability threshold is obtained as the second label. Based on the co-occurrence probabilities of the first label C with the preset labels A, B, D, and E in the co-occurrence probability matrix, the preset labels D and E with a co-occurrence probability higher than the co-occurrence probability matrix are obtained as the second labels. Therefore, the final set of second labels includes the second labels (D, E).
[0050] The first probability threshold can be obtained by the user inputting it through the input device of the terminal device, or by the terminal device obtaining it from the authorized platform or storage unit through the user's instructions, etc.
[0051] In one embodiment, the first probability threshold can be obtained through parameter search. Parameter search can be understood as, during the training phase of the text classification model, searching for possible values of the first probability threshold from 1 to 0 using multiple sample texts that have already been labeled with multiple tags, until a first target probability threshold is found. This first target probability threshold can be understood as obtaining a second tag set based on the first target probability threshold, and matching the target tag of the sample text with the second tag set with an accuracy exceeding an expected threshold, thereby using the first target probability threshold when classifying the text to be classified.
[0052] For example, using M labeled sample texts, the value of the first probability threshold is searched sequentially from 1 to 0. Based on the first probability threshold under each value, the second label and even the target label corresponding to each sample text are obtained. The target label of the obtained sample text is compared with the target label of the sample text. At least M first probability thresholds corresponding to the M sample texts that meet the condition that the accuracy is greater than the expected threshold are selected as candidates. The first target probability threshold is obtained from at least M first probability thresholds through screening methods such as mode or mean. The first target probability threshold is used as the first probability threshold for classifying the text to be classified.
[0053] In this embodiment, a first probability threshold is obtained through parameter search. Based on the co-occurrence probability matrix among multiple preset tags, preset tags with a co-occurrence probability greater than the first probability threshold are used as second tags. Thus, the target tag corresponding to the text to be classified is matched in the second tag set and the first tag set. A reasonable value for the first probability threshold can effectively improve the matching success rate of the target tag.
[0054] S106. Match each first label and second label with the text to be classified, and take the labels that match successfully in the first label set and the second label set as the target labels of the text to be classified.
[0055] The first tag set corresponding to the text to be classified is obtained by recall, and the second tag set is obtained by co-occurrence probability matrix and the first tag set. Each first tag in the first tag set and each second tag in the second tag set are matched with the text to be classified. The tags that are successfully matched in the first tag set and the second tag set are used as the target tags of the text to be classified.
[0056] Matching can be understood as the process of determining whether the first tag or the second tag is the target tag. The matching result is 1 or 0. When the matching result is 1, it means that the first tag or the second tag is the target tag corresponding to the text to be classified. When the matching result is 0, it means that the first tag or the second tag is not the target tag corresponding to the text to be classified.
[0057] For example, the first tag set includes first tags (A, C, F, G), and the second tag set includes second tags (D, E) obtained through the co-occurrence probability matrix. Each first tag and second tag is binary matched with the text to be classified, and the target tag corresponding to the text to be classified is determined based on the matching results.
[0058] In one embodiment, before matching the first and second tags included in the first and second tag sets with the text to be classified, the method further includes: performing deduplication on the first and second tag sets to obtain at least one deduplicated first tag and at least one deduplicated second tag; matching each first tag and second tag with the text to be classified, and using the tags that successfully match in the deduplicated first and second tag sets as the target tags of the text to be classified.
[0059] Deduplicating the first and second label sets can be understood as removing identical labels from both sets. Since the second label in the second label set is found in the co-occurrence probability matrix using the first label in the first label set, there are bound to be cases where the co-occurrence probability matrix contains multiple first labels, or where the co-occurrence probability of multiple first labels exceeds a probability threshold, thus leading to the first label being identified as belonging to the second label set.
[0060] For example, multiple preset tags include some first tags in the first tag set as well as other preset tags; that is, the first tag set includes first tags (A, C, F, G), and the multiple preset tags include, for example, […]. Figure 2 Given the preset labels (A, B, C, D, E), based on the co-occurrence probabilities of the first label A with preset labels B, C, D, and E in the co-occurrence probability matrix, preset labels C and D with co-occurrence probabilities higher than a threshold are selected as second labels. Similarly, based on the co-occurrence probabilities of the first label C with preset labels A, B, D, and E in the co-occurrence probability matrix, preset labels D and E with co-occurrence probabilities higher than the threshold are selected as second labels. Therefore, the final set of second labels includes the second labels (C, D, E). Since label C appears repeatedly in both the first label set (A, C, F, G) and the second label set (C, D, E), deduplication of label C is required, resulting in the final set of second labels (D, E).
[0061] In this embodiment, by deduplicating the first tag set and the second tag set, we avoid repeatedly matching the same tag, which wastes time and reduces the efficiency of obtaining the target tag of the text to be classified.
[0062] In one embodiment, each first label and second label is matched with the text to be classified using a matching model, and the labels that match successfully in the first label set and the second label set are used as the target labels of the text to be classified. For example, the matching model includes the BERT-base model. In the BERT-base model, the characters of the text to be classified and the characters of the label are converted into numbers through mapping. Then, the numbers are vectorized to obtain the first initial vector of the text to be classified and the second initial vector corresponding to the label. For example, word embedding can be used to implement the vectorization process. The first initial vector and the second initial vector corresponding to the label are input into the encoding module for semantic encoding to obtain the first encoding result and the second encoding result. For example, the encoding module uses the Encoder module in the Transformer architecture to extract features from the first initial vector to obtain the encoded first vector sequence. For example, the semantic encoding output vector dimension is 768×2048, where 2048 is the length of the input vector. Further, the first encoding result and the second encoding result are input into the classification module for linear transformation to obtain the classification probability vector as the matching result. For example, if the value of the classification probability vector is less than 0.5, it means that the matching result is 0, that is, the matched label does not match the text to be classified. If the value of the classification probability vector is greater than or equal to 0.5, it means that the matching result is 1, that is, the matched label matches the text to be classified. The classification module can be a linear transformation layer that transforms the first encoding result to the label dimension. Alternatively, a dropout layer can be added before the classification module to randomly discard some neurons with a preset probability (e.g., 0.1), and then the first encoding result can be linearly transformed to obtain a probability vector in the label dimension as the matching result.
[0063] like Figure 3 The diagram shown is a structural schematic of a text classification method provided in an embodiment of this specification. Figure 3 The process includes a text to be classified (301). A multi-label classification model is used to predict the recall of the text 301, resulting in a first label set 302 corresponding to the text 301. The first label set 302 includes multiple first labels. Further, based on a co-occurrence probability matrix 303 among multiple preset labels, the co-occurrence probability between each first label and each preset label is obtained. Preset labels with co-occurrence probabilities greater than a first probability threshold are used as second labels, resulting in a second label set 304 including at least one second label. Further, a matching model is used to match each first label and second label with the text 301 to be classified. Labels that successfully match in the first label set and the second label set are used as target labels in the target label set 305 of the text 301 to be classified.
[0064] For example, the multi-label classification module of a convolutional neural network recalls the text 301 to be classified, obtaining a first label set 302, including a first label (A, C, F, G), and multiple preset labels such as... Figure 2 The preset labels (A, B, C, D, E) shown are used to determine the second label set 304, which includes the second labels (D, E), based on the co-occurrence probabilities of the first label A with the preset labels B, C, D, and E in the co-occurrence probability matrix 303, and the co-occurrence probabilities of the first label C with the preset labels A, B, D, and E in the co-occurrence probability matrix 303. Further, each first label and second label is matched with the text to be classified 301 using a matching model, and the successfully matched labels in the first label set 302 and the second label set 304 are used as the target labels (A, D) in the target label set 305 of the text to be classified 301.
[0065] This manual, after recalling the first set of labels corresponding to the text to be classified, also obtains the second set of labels for the text to be classified through a preset co-occurrence probability matrix. This effectively utilizes the label co-occurrence information in the sample text set, covering more potentially relevant long-tail labels in the label recall and prediction stage, thus improving the multi-label recall rate. Furthermore, in the selection stage for the target labels corresponding to the text to be classified, the multi-label classification problem is transformed into a label-to-text matching problem. The recalled first set of labels and the second set of labels obtained through the co-occurrence probability matrix are matched and binary identified with the text to be classified, thereby finally determining the target label corresponding to the text to be classified, thus simply and effectively improving the accuracy of text classification.
[0066] In one embodiment, such as Figure 4 The illustration shows a text classification method proposed in an embodiment of this specification. This method can be implemented using a computer program and can run on a text classification device based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone utility application.
[0067] Specifically, the text classification method includes:
[0068] S202. Based on at least one preset label corresponding to each sample text in the sample text set, calculate the co-occurrence probability matrix among multiple preset labels.
[0069] The co-occurrence probability matrix is a matrix composed of the probabilities of co-occurrence of pairs of labels. The probabilities of co-occurrence of pairs of labels are obtained by statistical analysis of a set of sample texts labeled with preset labels. Label co-occurrence refers to the co-occurrence of two preset labels in the classification labels of the same sample text.
[0070] like Figure 2The diagram shown is a flowchart illustrating a co-occurrence probability matrix calculation method included in an embodiment of this specification. Figure 2 The sample text includes three sample texts: sample text 2011, sample text 2012, and sample text 2013. Sample text 2011 corresponds to labels A, B, C, and D; sample text 2012 corresponds to labels A, B, and E; and sample text 2013 corresponds to labels B and D. For the above three sample texts and the preset labels corresponding to each sample text, the co-occurrence probability matrix 202 is calculated as shown in the figure.
[0071] For example, P(AB / A) represents the probability that preset label A and preset label B appear simultaneously given the presence of preset label A. Therefore, based on the labels A, B, C, and D in sample text 2011, and A, B, and E in sample text 2012, P(AB / A) = 1. P(AB / B) represents the probability that preset label A and preset label B appear simultaneously given the presence of preset label B. Therefore, based on the labels A, B, C, and D in sample text 2011, A, B, and E in sample text 2012, and B and D in sample text 2013, P(AB / A) = 2 / 3. P(CB / C) represents the probability that preset label C and preset label B appear simultaneously given the presence of preset label C. Therefore, based on the labels A, B, C, and D in sample text 2011, and B and D in sample text 2013, P(CB / C) = 1. P(CB / B) represents the probability that preset label C and preset label B appear simultaneously when preset label B appears. Therefore, based on the corresponding labels A, B, C, and D in sample text 2011, labels A, B, and E in sample text 2012, and labels B and D in sample text 2013, P(CB / B) = 1 / 3. Figure 2 The co-occurrence probability matrix 202 of the CPC is used to calculate the co-occurrence probabilities of the others.
[0072] Understandable, Figure 2 The number of sample texts and the preset tags corresponding to each sample text shown are for illustrative purposes only, and this specification does not impose any limitations on them. Sample texts can be obtained by the user inputting them through the input device of the terminal device, or by the terminal device retrieving them from an authorized platform or storage unit according to the user's instructions, etc., and this specification does not impose any limitations on these methods. Furthermore, the length of the sample texts can be long (e.g., thousands or tens of thousands of characters) or short (e.g., tens or hundreds of characters), and this embodiment does not impose any limitations on this.
[0073] S204. Recall the first set of tags corresponding to the text to be classified.
[0074] See S102 above, which will not be repeated here.
[0075] S206. Based on the co-occurrence probability matrix among multiple preset tags, obtain the second tag set corresponding to the text to be classified.
[0076] See S104 above, which will not be repeated here.
[0077] S208. According to preset conditions, obtain at least one tag to be matched and the first target tag of the text to be classified from the first tag set.
[0078] Specifically, the process involves filtering out at least one tag to be matched and the first target tag of the text to be classified from the first tag set. In other words, it involves filtering out the tags to be matched and the first target tags that do not need to be matched from multiple first tags in the first tag set. The first target tag can be understood as a subset of tags in the target tag set corresponding to the text to be classified.
[0079] In one embodiment, the preset condition is that a first label with a probability higher than a second probability threshold is a first target label of the text to be classified, and a first label with a probability less than or equal to the second probability threshold is a label to be matched. Before obtaining at least one label to be matched and the first target label of the text to be classified from the first label set according to the preset condition, the method further includes: obtaining the probability that each first label in the first label set is a target label of the text to be classified.
[0080] Specifically, when recalling at least one first label corresponding to the text to be classified through a multi-label classification model or other methods, it also includes the probability that each first label is the target label of the text to be classified, that is, the confidence that the first label is the target label of the text to be classified. For example, a multi-label classification model may include Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), or Transformer networks based on the attention mechanism and classification layers. Another example is a BERT pre-trained model. The BERT (Bidirectional Encoder Representation from Transformers) pre-trained model recalls at least one first label corresponding to the text to be classified by running a self-supervised learning method on a massive corpus.
[0081] For example, a first set of tags for the text to be classified is retrieved. The first set of tags includes first tags (A, B, C, D), where the probability that first tag A is the target tag of the text to be classified is 0.8, the probability that first tag B is the target tag of the text to be classified is 0.6, the probability that first tag C is the target tag of the text to be classified is 0.4, and the probability that first tag D is the target tag of the text to be classified is 0.2. Furthermore, the second probability threshold is 0.6. First tags with a probability higher than the second probability threshold are designated as the first target tags of the text to be classified, and first tags with a probability less than or equal to the second probability threshold are designated as tags to be matched. Therefore, the set of tags to be matched corresponding to the text to be classified includes tags to be matched (C, D), and the set of first target tags corresponding to the text includes first target tags (A, B).
[0082] In this embodiment, the second probability threshold can be obtained by the user through the input device of the terminal device, or by the terminal device through the user's instructions from the authorized platform or storage unit, etc.
[0083] In another embodiment, the second probability threshold can be obtained through parameter search. Parameter search can be understood as, during the training phase of the text classification model, searching for possible values of the second probability threshold from 1 to 0 using multiple sample texts that have already been labeled with multiple tags, until a second target probability threshold is found. This second target probability threshold can be understood as obtaining a set of tags to be matched based on this second target probability threshold, and using the second target probability threshold when classifying the text if the accuracy of matching the target tags of the sample text with this set of tags exceeds an expected threshold.
[0084] For example, using X labeled sample texts, the value of the second probability threshold is searched sequentially from 1 to 0. Based on the second probability threshold under each value, the set of tags to be matched and even the target tags corresponding to each sample text are obtained. The target tags of the obtained sample texts are compared with the target tags labeled in the sample texts. At least X second probability thresholds corresponding to X sample texts that meet the condition that the accuracy is greater than the expected threshold are selected as candidates. The second target probability threshold is obtained from at least X second probability thresholds through screening methods such as mode or mean. The second target probability threshold is used as the second probability threshold for classifying the text to be classified.
[0085] In this embodiment, a second probability threshold is obtained through parameter search. The first label with a probability higher than the second probability threshold is the first target label of the text to be classified, and the first label with a probability less than or equal to the second probability threshold is the label to be matched. A reasonable value for the second probability threshold can effectively improve the matching success rate of the target label.
[0086] In another embodiment, the preset condition is to sort multiple first tags in the first tag set according to their probability from high to low, and to take the first tags that rank in the top Y% as the first target tags of the text to be classified, and the first tags that rank in the bottom Y% as the tags to be matched. Before obtaining at least one tag to be matched and the first target tag of the text to be classified from the first tag set according to the preset condition, the method further includes: obtaining the probability that each first tag in the first tag set is the target tag of the text to be classified; the specific method for obtaining the probability of the target tag can be found above.
[0087] In this embodiment, specifically, at least one tag to be matched and the first target tag of the text to be classified are selected from the first tag set. That is, multiple first tags in the first tag set are selected to identify the tags to be matched and the first target tags that do not need to be matched, thereby reducing the number of tags that need to be matched in the first tag set and improving the efficiency of text classification.
[0088] S210. Match each tag to be matched and each second tag with the text to be classified, and take at least one tag that is successfully matched from the set of tags to be matched and the set of second tags as the second target tag of the text to be classified.
[0089] See S106 above, which will not be repeated here.
[0090] like Figure 5 The diagram shown is a structural schematic of a text classification method provided in an embodiment of this specification. Figure 5 The dataset includes a text to be classified (401). A multi-label classification model is used to predict the recall of the text to be classified (401), resulting in a first label set (404) corresponding to the text to be classified (401). The first label set (404) includes multiple first labels. Further, using the co-occurrence probability matrix (403) obtained from the sample text set (402), the co-occurrence probability between each first label and each preset label is acquired. Preset labels with co-occurrence probabilities greater than a first probability threshold are used as second labels, resulting in a second label set (405) including at least one second label. Further, through probability comparison, first labels in the first label set (404) with probabilities higher than the second probability threshold are designated as first target labels in the first target label set (4041) of the text to be classified, while first labels with probabilities less than or equal to the second probability threshold are designated as matching labels in the matching label set (4042). Furthermore, each tag to be matched and the second tag are matched with the text to be classified 401 through the matching model. The tags that are successfully matched in the tag set 4042 and the second tag set 405 are used as the second target tags in the second target tag set 406 of the text to be classified. The target tag set corresponding to the text to be classified 401 includes the first target tag set 4041 and the second target tag set 406.
[0091] For example, the multi-label classification module of a convolutional neural network recalls the text 401 to be classified, obtaining a first label set 402, including a first label (A, C, F, G), and multiple preset labels such as... Figure 2 The preset labels (A, B, C, D, E) shown are used to determine the second label set 405, which includes the second labels (D, E), based on the co-occurrence probabilities of the first label A with the preset labels B, C, D, and E in the co-occurrence probability matrix 403, and the co-occurrence probabilities of the first label C with the preset labels A, B, D, and E in the co-occurrence probability matrix 403. Further, through probability comparison, the first labels in the first label set 404 with probabilities higher than a second probability threshold are designated as the first target labels (A, C) in the first target label set 4041 of the text to be classified, while the first labels with probabilities less than or equal to the second probability threshold are designated as the matching labels (F, G) in the matching label set 4042. Further, each matching label and the second label are matched with the text to be classified 401 using a matching model, and the successfully matched labels in the matching label set 4042 and the second label set 405 are designated as the target labels (A, C, F, D) in the target label set of the text to be classified 401.
[0092] This specification, after recalling the first set of labels corresponding to the text to be classified, also obtains the second set of labels for the text to be classified through a preset co-occurrence probability matrix. This effectively utilizes the label co-occurrence information in the sample text set, covering more potentially relevant long-tail labels during the label recall and prediction stage, thus improving the multi-label recall rate. Furthermore, in the selection stage for the target labels corresponding to the text to be classified, the multi-label classification problem is transformed into a label-to-text matching problem. The recalled first set of labels and the second set of labels obtained through the co-occurrence probability matrix are matched with the text to be classified using binary identification, thereby ultimately determining the target labels corresponding to the text to be classified. This simple and effective method improves the accuracy of text classification.
[0093] The following are embodiments of the apparatus described in this specification, which can be used to execute the embodiments of the methods described in this specification. For details not disclosed in the apparatus embodiments of this specification, please refer to the embodiments of the methods described in this specification.
[0094] Please see Figure 6 This diagram illustrates the structure of a text classification device provided in an exemplary embodiment of this specification. The text classification device can be implemented as all or part of a device through software, hardware, or a combination of both. The device includes a query recall tag module 601, a co-occurrence tag module 602, and a target matching module 603.
[0095] The tag recall module 601 is used to recall a first tag set corresponding to the text to be classified, wherein the first tag set includes at least one first tag.
[0096] The co-occurrence tag module 602 is used to obtain a second tag set corresponding to the text to be classified based on the co-occurrence probability matrix among multiple preset tags. The second tag set includes at least one second tag, and the multiple preset tags include at least a portion of the first tags in the first tag set.
[0097] The target matching module 603 is used to match each of the first tag and the second tag with the text to be classified, and to take the tags that are successfully matched in the first tag set and the second tag set as the target tags of the text to be classified.
[0098] In one embodiment, the co-occurrence tag module 602 includes:
[0099] The co-occurrence probability unit is used to obtain the co-occurrence probability between each of the first tags and each of the preset tags based on the co-occurrence probability matrix among multiple preset tags;
[0100] The second tag unit is used to take a preset tag whose co-occurrence probability is greater than a first probability threshold as the second tag, so as to obtain a second tag set including at least one second tag.
[0101] In one embodiment, the text classification device further includes:
[0102] The sample calculation module is used to calculate the co-occurrence probability matrix among multiple preset tags based on at least one preset tag corresponding to each sample text in the sample text set, wherein the sample text set includes at least one sample text.
[0103] In one embodiment, the target matching module 603 includes:
[0104] The tag differentiation unit is used to obtain at least one tag to be matched and the first target tag of the text to be classified from the first tag set according to preset conditions;
[0105] A matching target unit is used to match each of the tags to be matched and each of the second tags with the text to be classified, and to take the tags that are successfully matched in the at least one tag to be matched and the second tag set as the second target tags of the text to be classified. The target tags of the text to be classified include the first target tag and the second target tag.
[0106] In one embodiment, the preset condition is that a first label with a probability higher than a second probability threshold is the first target label of the text to be classified, and a first label with a probability less than or equal to the second probability threshold is the label to be matched.
[0107] Target matching module 603 includes:
[0108] The probability calculation unit is used to obtain the probability that each first tag in the first tag set is the target tag of the text to be classified.
[0109] In one embodiment, the target matching module 603 includes:
[0110] A parameter search unit is used to obtain the probability threshold through parameter search.
[0111] In one embodiment, the target matching module 603 includes:
[0112] The deduplication unit is used to deduplicatize the first tag set and the second tag set to obtain at least one first tag and at least one second tag after deduplication.
[0113] The deduplication matching unit is used to match each of the first tag and the second tag with the text to be classified, and to take the tags that are successfully matched in the deduplicated first tag set and second tag set as the target tags of the text to be classified.
[0114] In one embodiment, the recall tag module 601 includes:
[0115] A multi-label recall unit is used to recall at least one first label corresponding to the text to be classified through a multi-label classification model.
[0116] In one embodiment, the target matching module 603 includes:
[0117] The matching model unit is used to match each of the first tag and the second tag with the text to be classified using a matching model, and to take the tags that are successfully matched in the first tag set and the second tag set as the target tags of the text to be classified.
[0118] This manual, after recalling the first set of labels corresponding to the text to be classified, also obtains the second set of labels for the text to be classified through a preset co-occurrence probability matrix. This effectively utilizes the label co-occurrence information in the sample text set, covering more potentially relevant long-tail labels in the label recall and prediction stage, thus improving the multi-label recall rate. Furthermore, in the selection stage for the target labels corresponding to the text to be classified, the multi-label classification problem is transformed into a label-to-text matching problem. The recalled first set of labels and the second set of labels obtained through the co-occurrence probability matrix are matched and binary identified with the text to be classified, thereby finally determining the target label corresponding to the text to be classified, thus simply and effectively improving the accuracy of text classification.
[0119] It should be noted that the text classification device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the text classification method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the text classification device and the text classification method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0120] The example numbers in this specification are for descriptive purposes only and do not represent the superiority or inferiority of the examples.
[0121] This specification also provides a computer storage medium that can store multiple instructions adapted to be loaded and executed by a processor as described above. Figure 1 - Figure 5 The text classification method of the illustrated embodiment can be found in the following document for a detailed execution process: Figure 1 - Figure 5 The specific details of the illustrated embodiments will not be elaborated here.
[0122] This specification also provides a computer program product storing at least one instruction, which is loaded and executed by the processor as described above. Figure 1 - Figure 5 The text classification method described in the illustrated embodiment can be found in the following documentation for its specific execution process: Figure 1 - Figure 5 The specific details of the illustrated embodiments will not be elaborated here.
[0123] Please see Figure 7 This document provides a schematic diagram of the structure of an electronic device as an embodiment of the present specification. Figure 7 As shown, the electronic device 700 may include: at least one processor 701, at least one network interface 704, a user interface 703, a memory 705, and at least one communication bus 702.
[0124] The communication bus 702 is used to enable communication between these components.
[0125] The user interface 703 may include a display screen and a camera. Optionally, the user interface 703 may also include a standard wired interface and a wireless interface.
[0126] The network interface 704 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0127] The processor 701 may include one or more processing cores. The processor 701 connects to various parts of the server 700 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 705, and by calling data stored in the memory 705. Optionally, the processor 701 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 701 may integrate one or a combination of several of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 701 and may be implemented as a separate chip.
[0128] The memory 705 may include random access memory (RAM) or read-only memory. Optionally, the memory 705 may include a non-transitory computer-readable storage medium. The memory 705 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 705 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 705 may also be at least one storage device located remotely from the aforementioned processor 701. Figure 7 As shown, the memory 705, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a text classification application.
[0129] exist Figure 7 In the illustrated electronic device 700, the user interface 703 is mainly used to provide an input interface for the user and to acquire user input data; while the processor 701 can be used to call the text classification application stored in the memory 705 and specifically perform the following operations:
[0130] Recall the first set of tags corresponding to the text to be classified, wherein the first set of tags includes at least one first tag;
[0131] Based on the co-occurrence probability matrix among multiple preset tags, a second tag set corresponding to the text to be classified is obtained. The second tag set includes at least one second tag, and the multiple preset tags include at least a portion of the first tags in the first tag set.
[0132] For each of the first tag and the second tag, match it with the text to be classified, and use the tags that match successfully in the first tag set and the second tag set as the target tags of the text to be classified.
[0133] In one embodiment, the processor 701 executes the step of obtaining the second tag set corresponding to the text to be classified based on the co-occurrence probability matrix among multiple preset tags, specifically:
[0134] Based on the co-occurrence probability matrix among multiple preset tags, obtain the co-occurrence probability between each first tag and each preset tag;
[0135] By using a preset label whose co-occurrence probability is greater than a first probability threshold as a second label, a second label set including at least one second label is obtained.
[0136] In one embodiment, before the processor 701 executes the step of obtaining the second tag set corresponding to the text to be classified based on the co-occurrence probability matrix among multiple preset tags, it also executes:
[0137] Based on at least one preset tag corresponding to each sample text in the sample text set, a co-occurrence probability matrix among multiple preset tags is calculated, wherein the sample text set includes at least one sample text.
[0138] In one embodiment, the processor 701 performs the matching of each of the first tag and the second tag with the text to be classified, and uses the successfully matched tags in the first tag set and the second tag set as the target tags of the text to be classified. Specifically, the following is executed:
[0139] Based on preset conditions, at least one tag to be matched and the first target tag of the text to be classified are obtained from the first tag set;
[0140] Each of the tags to be matched and each of the second tags are matched with the text to be classified. The tags that are successfully matched in the at least one tag to be matched and the second tag set are taken as the second target tags of the text to be classified. The target tags of the text to be classified include the first target tag and the second target tag.
[0141] In one embodiment, the preset condition is that a first label with a probability higher than a second probability threshold is the first target label of the text to be classified, and a first label with a probability less than or equal to the second probability threshold is the label to be matched.
[0142] In one embodiment, before the processor 701 executes the step of obtaining at least one tag to be matched and the first target tag of the text to be classified from the first tag set according to preset conditions, it also executes:
[0143] Obtain the probability that each first tag in the first tag set is the target tag of the text to be classified.
[0144] In one embodiment, before the processor 701 executes the step of obtaining at least one tag to be matched and the first target tag of the text to be classified from the first tag set according to preset conditions, it also executes:
[0145] The probability threshold is obtained through parameter search.
[0146] In one embodiment, the processor 701 performs the matching of each of the first tag and the second tag with the text to be classified, and uses the successfully matched tags in the first tag set and the second tag set as the target tags of the text to be classified. Specifically, the following is executed:
[0147] The first tag set and the second tag set are deduplicated to obtain at least one first tag and at least one second tag after deduplication;
[0148] For each of the first tag and the second tag, match it with the text to be classified, and use the tags that match successfully in the deduplicated first tag set and second tag set as the target tags of the text to be classified.
[0149] In one embodiment, the processor 701 executes the recall of at least one first tag corresponding to the text to be classified, specifically by:
[0150] The multi-label classification model recalls at least one first label corresponding to the text to be classified.
[0151] In one embodiment, the processor 701 performs the matching of each of the first tag and the second tag with the text to be classified, and uses the successfully matched tags in the first tag set and the second tag set as the target tags of the text to be classified. Specifically, the following is executed:
[0152] The matching model is used to match each of the first tag and the second tag with the text to be classified, and the tags that are successfully matched in the first tag set and the second tag set are used as the target tags of the text to be classified.
[0153] This manual, after recalling the first set of labels corresponding to the text to be classified, also obtains the second set of labels for the text to be classified through a preset co-occurrence probability matrix. This effectively utilizes the label co-occurrence information in the sample text set, covering more potentially relevant long-tail labels in the label recall and prediction stage, thus improving the multi-label recall rate. Furthermore, in the selection stage for the target labels corresponding to the text to be classified, the multi-label classification problem is transformed into a label-to-text matching problem. The recalled first set of labels and the second set of labels obtained through the co-occurrence probability matrix are matched and binary identified with the text to be classified, thereby finally determining the target label corresponding to the text to be classified, thus simply and effectively improving the accuracy of text classification.
[0154] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.
[0155] The above-disclosed embodiments are merely preferred embodiments of this specification and should not be construed as limiting the scope of this specification. Therefore, any equivalent variations made in accordance with the claims of this specification shall still fall within the scope of this specification.
Claims
1. A text classification method, comprising: recalling a first label set corresponding to a text to be classified, the first label set comprising at least one first label; obtaining a second label set corresponding to the text to be classified according to a co-occurrence probability matrix between a plurality of preset labels, the second label set comprising at least one second label, the plurality of preset labels comprising at least part of the first label set; matching each of the first label and the second label with the text to be classified, and taking the labels in the first label set and the second label set that are successfully matched as target labels of the text to be classified; wherein the obtaining of the second label set corresponding to the text to be classified according to the co-occurrence probability matrix between the plurality of preset labels comprises: obtaining a co-occurrence probability between each of the first label and each of the preset labels according to the co-occurrence probability matrix between the plurality of preset labels; taking a preset label with a co-occurrence probability greater than a first probability threshold as a second label, and obtaining the second label set comprising at least one second label. 2.The text classification method of claim 1, before the obtaining of the second label set corresponding to the text to be classified according to the co-occurrence probability matrix between the plurality of preset labels, further comprising: calculating the co-occurrence probability matrix between the plurality of preset labels according to at least one preset label corresponding to each of a plurality of sample texts in a sample text set, the sample text set comprising at least one sample text. 3.The text classification method of claim 1, the matching of each of the first label and the second label with the text to be classified, and the taking of the labels in the first label set and the second label set that are successfully matched as target labels of the text to be classified, comprising: obtaining at least one label to be matched in the first label set and a first target label of the text to be classified according to a preset condition; matching each of the label to be matched and each of the second label with the text to be classified, and taking the labels in the at least one label to be matched and the second label set that are successfully matched as a second target label of the text to be classified, the target label of the text to be classified comprising the first target label and the second target label. 4.The text classification method of claim 3, wherein the preset condition is that a first label with a probability higher than a second probability threshold is the first target label of the text to be classified, and a first label with a probability less than or equal to the second probability threshold is the label to be matched; before the obtaining of the at least one label to be matched in the first label set and the first target label of the text to be classified according to the preset condition, further comprising: obtaining a probability of each of the first labels in the first label set being the target label of the text to be classified. 5.The text classification method of claim 4, before the obtaining of the at least one label to be matched in the first label set and the first target label of the text to be classified according to the preset condition, further comprising: obtaining the probability threshold through parameter search.
6. The text classification method of claim 1, wherein the matching each of the first labels and the second labels with the text to be classified, and taking the matched labels in the first label set and the second label set as target labels of the text to be classified, comprises: performing deduplication processing on the first label set and the second label set to obtain at least one first label and at least one second label after deduplication; and matching each of the first labels and the second labels with the text to be classified, and taking the matched labels in the first label set and the second label set after deduplication as target labels of the text to be classified.
7. The text classification method of claim 1, wherein the recalling at least one first label corresponding to the text to be classified comprises: recalling the at least one first label corresponding to the text to be classified by using a multi-label classification model.
8. The text classification method of claim 1, wherein the matching each of the first labels and the second labels with the text to be classified, and taking the matched labels in the first label set and the second label set as target labels of the text to be classified comprises: matching each of the first labels and the second labels with the text to be classified by using a matching model, and taking the matched labels in the first label set and the second label set as target labels of the text to be classified.
9. A text classification device, comprising: a label recalling module configured to recall a first label set corresponding to a text to be classified, the first label set comprising at least one first label; a co-occurrence label module configured to obtain a second label set corresponding to the text to be classified according to a co-occurrence probability matrix among a plurality of preset labels, the second label set comprising at least one second label, and the plurality of preset labels comprising at least part of the first labels in the first label set; and a target matching module configured to match each of the first labels and the second labels with the text to be classified, and take the matched labels in the first label set and the second label set as target labels of the text to be classified.
10. A computer storage medium storing a plurality of instructions, the instructions being adapted to be loaded and executed by a processor to perform the method steps of any one of claims 1-8.
11. A computer program product storing a plurality of instructions, the instructions being adapted to be loaded and executed by a processor to perform the method steps of any one of claims 1-8. 12. An electronic device comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded and executed by the processor and to perform the method steps of any one of claims 1 to 8.
Citation Information
Patent Citations
Multi-label classification method for obtaining customer intention labels through robot collection
CN112732871A