A data enhancement method, a training method and a device for a text classification model

By processing stop word on the initial training text of the text classification model, augmented data is generated to enrich the training set, which solves the problem of low accuracy of the text classification model and achieves higher accuracy and stability.

CN114491048BActive Publication Date: 2025-08-15BEIJING WEIBOYI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210143275.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-16
Publication Date
2025-08-15
Estimated Expiration
2042-02-16

AI Technical Summary

Technical Problem

The accuracy of existing text classification models is low, mainly due to the small public training data.

Method used

By performing stop word processing on the initial training text, including stop word insertion, deletion, replacement and exchange, augmentation data is generated and mixed with the initial training text to form an enhancement training set for training text classification models.

Benefits of technology

Improve the accuracy and noise immunity of the text classification model while maintaining the syntax and semantic stability of the text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114491048B_ABST
    Figure CN114491048B_ABST
Patent Text Reader

Abstract

The present application proposes a data enhancement method, a training method and a device for a text classification model, and relates to the technical field of text classification. The invention is made to solve the problem of low accuracy of text classification in the prior art. It includes S10, obtaining at least one initial training text and corresponding category for text classification; S20, according to the number of stop words in the word segmentation data corresponding to each initial training text in any first number of initial training texts, performing stop word processing on the word segmentation data corresponding to each initial training text in the any first number of initial training texts, to obtain a first number of enhanced data; S30, judging whether the obtained enhanced data meets the preset data rules; if so, executing step S40; otherwise, executing the step S20; S40, mixing the at least one initial training text and corresponding category with all the enhanced data and corresponding categories to obtain an enhanced training set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of text classification, and in particular to a data enhancement method, a training method and a device for a text classification model. Background Art

[0002] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence, and text classification is an important application in natural language processing, which is mainly used in the fields of sentiment classification, user evaluation classification, etc.

[0003] In existing technologies, the accuracy of text classification models depends on a large amount of training data and high-quality label information.

[0004] Since there is little public training data for text classification models, the accuracy of text classification is low when training text classification models using public training data. Summary of the Invention

[0005] In view of this, the main purpose of this application is to solve the technical problem of low accuracy of existing text classification.

[0006] On the one hand, a data enhancement method is provided, including: S10, obtaining at least one initial training text and corresponding category for text classification; S20, performing stop word processing on the segmentation data corresponding to each initial training text in any first number of initial training texts according to the number of stop words in the segmentation data corresponding to each initial training text in the any first number of initial training texts, to obtain a first number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the first number is a positive integer, and the first number is not greater than the number of the at least one initial training text; S30, judging whether the obtained enhanced data meets the preset data rules; if so, executing step S40; otherwise, executing step S20; S40, mixing the at least one initial training text and the corresponding category with all the enhanced data and the corresponding categories to obtain an enhanced training set.

[0007] On the other hand, a training method for a text classification model is provided, comprising: T10, obtaining an enhanced training set through the above-mentioned data enhancement method; T20, training an initial text classification model through the enhanced training set to obtain a final classification model.

[0008] On the other hand, a training method for a text classification model is provided, comprising: P10, obtaining at least one initial training text and a corresponding category of the text classification model; P20, performing stop word processing on the segmentation data corresponding to each initial training text in any second number of initial training texts according to the number of stop words in the segmentation data corresponding to each initial training text in the initial training texts, to obtain a second number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; The second number is a positive integer, and the second number is not greater than the number of the at least one initial training text; P30, the arbitrary second number of initial training texts and corresponding categories are mixed with the second number of enhanced data and corresponding categories to obtain an enhanced training set; P40, the initial text classification model is trained with the enhanced training set to obtain a training model; P50, whether the current training model complies with the preset training rules; if so, execute step P60; otherwise, the initial text classification model is updated using the current training model and then the step P20 is executed; P60, the current training model that complies with the preset training rules is used as the final classification model.

[0009] In another aspect, a data enhancement device is provided, comprising:

[0010] A data acquisition module, configured to acquire at least one initial training text and corresponding category for text classification;

[0011] a stop word processing module connected to the data acquisition module, configured to perform stop word processing on the segmentation data corresponding to each of the first number of initial training texts based on the number of stop words in the segmentation data corresponding to each of the first number of initial training texts, to obtain a first number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the first number is a positive integer, and the first number is not greater than the number of the at least one initial training text;

[0012] A rule judgment module, connected to the stop word processing module, is used to judge whether the obtained enhanced data conforms to the preset data rules;

[0013] If the rule judgment module determines that the obtained enhanced data meets the preset data rules, the data mixing module performs data mixing; otherwise, the stop word processing module performs stop word processing;

[0014] The data mixing module is connected to the rule judgment module and is used to mix the at least one initial training text and the corresponding category with all the enhanced data and the corresponding categories to obtain an enhanced training set.

[0015] In another aspect, a training device for a text classification model is provided, comprising:

[0016] A training set acquisition module, used to acquire an enhanced training set through the above-mentioned data enhancement device;

[0017] The model training module is connected to the training set acquisition module and is used to train the initial text classification model through the enhanced training set to obtain the final classification model.

[0018] In another aspect, a training device for a text classification model is provided, comprising:

[0019] A data acquisition module, configured to acquire at least one initial training text and corresponding category of a text classification model;

[0020] a stop word processing module connected to the data acquisition module, configured to perform stop word processing on the segmentation data corresponding to each of the arbitrary second number of initial training texts based on the number of stop words in the segmentation data corresponding to each of the arbitrary second number of initial training texts, to obtain a second number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the second number is a positive integer, and the second number is not greater than the number of the at least one initial training text;

[0021] a data mixing module, connected to the data acquisition module and the stop word processing module respectively, for mixing the arbitrary second number of initial training texts and corresponding categories with the second number of enhanced data and corresponding categories to obtain an enhanced training set;

[0022] A model training module, connected to the data mixing module, is used to train the initial text classification model using the enhanced training set to obtain a training model;

[0023] A model judgment module, connected to the model training module, is used to judge whether the current training model conforms to the preset training rules;

[0024] If the current training model meets the preset training rules, the final classification model is obtained through the model acquisition module; otherwise, the model is updated through the update module;

[0025] The updating module is connected to the model judgment module, the model training module and the stop word processing module respectively, and is used to update the initial text classification model with the current training model and then perform stop word processing through the stop word processing module;

[0026] The model acquisition module is connected to the model judgment module and is used to use the current training model that meets the preset training rules as the final classification model.

[0027] In summary, the data enhancement method, text classification model training method, and apparatus provided in the embodiments of the present invention achieve data enhancement by performing stop word processing on the initial training text to obtain enhanced data, and then mixing the enhanced data with the initial training text to obtain an enhanced training set. Because data enhancement is performed before using existing text for model training, the text content is enriched, the noise resistance of the text classification model and the accuracy of text classification are improved, thereby resolving the problem in the prior art of low text classification accuracy when training a text classification model using publicly available training data due to the limited availability of publicly available training data for the text classification model. Furthermore, the technical solution provided by the present invention only performs stop word processing during data enhancement, and does not change the grammar and semantics of the text, thereby ensuring the stability of the text.

[0028] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0030] Figure 1 This is a flow chart of the data enhancement method provided in Example 1 of the present application;

[0031] Figure 2 This is a flow chart of the data enhancement method provided in Example 2 of the present application;

[0032] Figure 3 Flowchart of the training method of the text classification model provided in Example 3 of the present application;

[0033] Figure 4 A flowchart of the text classification model training method provided in Example 4 of the present application;

[0034] Figure 5 A flowchart of the text classification model training method provided in Example 5 of the present application;

[0035] Figure 6 Schematic diagram of the structure of the data enhancement device provided in Example 6 of this application Figure 1 ;

[0036] Figure 7 Schematic diagram of the structure of the data enhancement device provided in Example 6 of this application Figure 2 ;

[0037] Figure 8 A schematic diagram of the structure of a training device for a text classification model provided in Example 7 of the present application;

[0038] Figure 9 Schematic diagram of the structure of the training device of the text classification model provided in Example 8 of this application Figure 1 ;

[0039] Figure 10 Schematic diagram of the structure of the training device for the text classification model provided in Example 8 of this application Figure 2 . DETAILED DESCRIPTION

[0040] The following describes in detail embodiments of the present application, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0041] Example 1

[0042] like Figure 1 As shown, a data enhancement method provided in an embodiment of the present application includes the following steps:

[0043] Step 101: Obtain at least one initial training text and corresponding category for text classification.

[0044] In this embodiment, the at least one initial training text and corresponding category obtained in step 101 can be obtained from public text classification training data or created manually, which is not limited here.

[0045] Step 102 : performing stop word processing on the segmentation data corresponding to each of the first number of initial training texts according to the number of stop words in the segmentation data corresponding to each of the first number of initial training texts to obtain a first number of enhanced data.

[0046] In this embodiment, the stop word processing in step 102 includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the first number is a positive integer, and the first number is no greater than the number of at least one initial training text. The word segmentation data corresponding to the initial training text can be obtained by pre-processing the initial training text and then segmenting it. The pre-processing can include one or more of punctuation filtering, abbreviation padding, space removal, and illegal character filtering, which will not be detailed here; illegal characters include emoticons and special symbols other than punctuation.

[0047] In this embodiment, for any initial training text, the specific process of obtaining enhanced data through step 102 may include: obtaining the number of stop words in the word segmentation data corresponding to the initial training text; when the number of stop words is 0, inserting stop words into the word segmentation data corresponding to the initial training text to obtain initial enhanced data; when the number of stop words is 1, inserting stop words, deleting stop words, or replacing stop words into the word segmentation data corresponding to the initial training text to obtain initial enhanced data; when the number of stop words is greater than 1, inserting stop words, deleting stop words, replacing stop words, or exchanging stop words into the word segmentation data corresponding to the initial training text to obtain initial enhanced data; determining whether the number of stop word processing times reaches a preset second threshold; if so, using the initial enhanced data when the number of stop word processing times reaches the preset second threshold as the corresponding enhanced data; otherwise, updating the initial training text to the current initial enhanced data and re-executing the above-mentioned process of obtaining the number of stop words in the word segmentation data corresponding to the initial training text; the preset second threshold is a positive integer.

[0048] Among them, stop word insertion refers to randomly selecting a stop word A from the stop word list, randomly selecting a position L in the text, and inserting stop word A at position L; stop word deletion refers to randomly determining a stop word A in the text and deleting the stop word A; stop word replacement refers to randomly determining a stop word A in the text, randomly selecting a stop word B from the stop word list, and replacing stop word A with stop word B; stop word exchange refers to randomly determining two stop words A and B in the text and exchanging the two stop words.

[0049] The number of stop words can be obtained by matching the word segmentation data with a preset stop word list, or by other methods, which are not limited here.

[0050] Step 103: determine whether the obtained enhanced data complies with preset data rules.

[0051] In this embodiment, if the obtained enhanced data is determined to meet the preset data rules in step 103, step 104 is executed; otherwise, step 102 is executed. The preset rules may include: the number of all enhanced data reaches a preset third threshold; and / or the ratio of the number of all enhanced data to the number of all initial training texts reaches a preset fourth threshold.

[0052] Step 104 : Mix at least one initial training text and corresponding category with all enhanced data and corresponding categories to obtain an enhanced training set.

[0053] In this embodiment, when the enhanced training set is obtained through step 104, each category may correspond to one initial training text / enhanced data, or the categories may be integrated so that one category corresponds to multiple initial training texts / enhanced data, which is not limited here.

[0054] In this embodiment, after the enhanced training set is obtained in step 104, the initial classification model can be trained with the enhanced training set to obtain a final classification model. After the text to be classified is input into the final classification model, a text classification result can be obtained, thereby achieving text classification.

[0055] The data enhancement method provided in this embodiment only performs stop word processing such as stop word insertion, stop word deletion, stop word replacement, and stop word exchange during data enhancement. This enriches the content of the text without changing the grammar and semantics of the text, improves the accuracy of text classification, and overcomes the technical bias that stop words are useless in text classification.

[0056] Taking the open source dataset TNEWS as an example, the classification accuracy of the classification model trained using the original text is about 56.58%, and the classification accuracy of the classification model trained using the data-enhanced text is about 57.77%; taking the open source dataset IFLYTEK as an example, the classification accuracy of the classification model trained using the original text is about 60.29%, and the classification accuracy of the classification model trained using the data-enhanced text is about 61.37%.

[0057] Furthermore, between step 101 and step 102, the following steps may also be included:

[0058] Each of the at least one initial training text is pre-processed and then segmented to obtain segmentation data corresponding to each of the at least one initial training text.

[0059] In this embodiment, after obtaining at least one initial training text and corresponding category through step 101, the word segmentation data corresponding to each initial training text can be obtained through the above steps, and then stop word processing can be performed on the word segmentation data corresponding to each initial training text in any first number of initial training texts through step 102.

[0060] The pre-processing may include one or more of punctuation filtering, abbreviation filling, space removal, and illegal character filtering, which will not be described in detail here. Illegal characters may include emoticons and special symbols other than punctuation.

[0061] Furthermore, in order to improve the processing speed, the pre-processing word segmentation step can also be replaced by "pre-processing and then word segmenting each of the arbitrary first number of initial training texts, and obtaining the word segmentation data corresponding to each of the arbitrary first number of initial training texts". Since in the specific implementation, the pre-processing word segmentation step is before step 102, the pre-processing word segmentation step at this time is specifically to pre-process and then word segmentate each of the arbitrary first number of initial training texts, and obtain the word segmentation data corresponding to each of the arbitrary first number of initial training texts; step 102 is specifically to perform stop word processing on the word segmentation data corresponding to each of the arbitrary first number of initial training texts according to the number of stop words in the word segmentation data corresponding to each of the arbitrary first number of initial training texts, and obtain the first number of enhanced data.

[0062] In summary, the data enhancement method provided in the embodiment of the present invention achieves data enhancement by performing stop word processing on the initial training text to obtain enhanced data, and then mixing the enhanced data with the initial training text to obtain an enhanced training set. Because data enhancement is performed before using existing text for model training, the content of the text is enriched, the noise resistance of the text classification model and the accuracy of text classification are improved, and the problem in the prior art that the text classification model has low accuracy when trained using public training data due to the lack of public training data for the text classification model is solved. Moreover, the technical solution provided by the present invention only performs stop word processing during data enhancement, and does not change the grammar and semantics of the text, thereby ensuring the stability of the text.

[0063] Example 2

[0064] like Figure 2 As shown, the embodiment of the present application provides a data enhancement method, including:

[0065] Steps 201 to 202, obtain at least one initial training text for text classification, and perform stop word processing on the tokenized data corresponding to each initial training text in any first quantity of initial training texts. This process is similar to Figure 1 the steps 101 to 102 shown, and will not be elaborated here one by one.

[0066] Between steps 201 and 202, a preprocessing tokenization step can also be included, which is similar to the corresponding step in Embodiment 1, and will not be elaborated here one by one.

[0067] Step 203, determine whether the obtained augmented data conforms to the preset data rules.

[0068] In this embodiment, when it is determined through step 203 that the obtained augmented data conforms to the preset data rules, execute step 205; otherwise, execute step 202. This step is similar to Figure 1 the step 103 shown, and will not be elaborated here one by one.

[0069] Step 204, perform one-hot encoding on each category respectively to obtain the corresponding category encoding.

[0070] In this embodiment, step 204 can be parallel to steps 202 and 203, as Figure 2 shown; it can also execute step 204 first and then step 205 when it is determined through step 203 that the obtained augmented data conforms to the preset data rules, and there is no limitation here.

[0071] Step 205, perform encoding conversion on the category encoding corresponding to each augmented data respectively according to the preset encoding conversion rules to obtain the corresponding augmented encoding.

[0072] In this embodiment, for any augmented data, the process of performing encoding conversion through step 205 can include: randomly convert the encoding with a value of 1 in the category encoding corresponding to the augmented data to p according to the preset encoding conversion rules, and convert the encoding with a value of 0 to a number in the interval (0, 0.5), and the sum of all the converted data is 1, where 0.5 < p < 1. Encoding conversion can also be performed in other ways, as long as the absolute value of the one valid data is greater than other data, and will not be elaborated here one by one.

[0073] Step 206, mix at least one initial training text and the corresponding category encoding with all the augmented data and the corresponding augmented encoding to obtain an augmented training set.

[0074] In this embodiment, the process of constructing the augmented training set through step 206 is similar to Figure 1 the step 104 shown, and will not be elaborated here one by one.

[0075] The data enhancement method provided in this embodiment not only performs stop word processing on the text, such as stop word insertion, stop word deletion, stop word replacement, and stop word exchange, but also performs encoding conversion on the labels. This enriches the content of the text without changing the grammar and semantics of the text, further improves the accuracy of text classification, and overcomes the technical bias that stop words are useless in text classification.

[0076] Taking the text "Tiantian won the championship in the finals" as an example, assuming that the category code is (1, 0, 0); the word segmentation data is "Tiantian", "in", "finals", "in", "won", "got", "champion", "where"; taking the stop word list including "ah, ah, got, got", "where" as an example, it can be determined that the number of stop words in the word segmentation data corresponding to the text is 2; optional stop word processing operations include stop word insertion, stop word deletion, stop word replacement or stop word exchange. Taking the second threshold as 1 and the stop word ah inserted at position 3 as an example, the initial enhanced data "Tiantian won the championship in the finals" is obtained; taking p as 0.9 and the other two 0s randomly converted to 0.03 and 0.07 as an example, the enhanced code is (0.9, 0.03, 0.07), thereby obtaining the enhanced data pair of "Tiantian won the championship in the finals" and the enhanced code (0.9, 0.03, 0.07).

[0077] In summary, the data enhancement method provided in the embodiment of the present invention performs stop word processing on the initial training text to obtain enhanced data, and mixes the enhanced data with the initial training text to obtain an enhanced training set, thereby achieving data enhancement. Since data enhancement is performed before using existing text for model training, the content of the text is enriched, the noise resistance of the text classification model and the accuracy of text classification are improved, and the problem in the prior art that the text classification model has low accuracy when training the text classification model using public training data is solved due to the small amount of public training data for the text classification model. Moreover, the technical solution provided by the present invention only performs stop word processing during data enhancement, and does not change the grammar and semantics of the text, thereby ensuring the stability of the text. In addition, during data enhancement, the labels corresponding to the enhanced data are also encoded and converted, further improving the accuracy of text classification.

[0078] Example 3

[0079] like Figure 3 As shown, the embodiment of the present application provides a training method for a text classification model, including:

[0080] Step 301: Obtain an enhanced training set.

[0081] In this embodiment, the process of obtaining the enhanced training set through step 301 is similar to that provided in embodiments 1 and 2 of the present invention, and will not be described in detail here.

[0082] Step 302: Train the initial text classification model by enhancing the training set to obtain a final classification model.

[0083] In this embodiment, after the final classification model is obtained through step 302, the text to be classified can be input into the final classification model to obtain a text classification result, thereby achieving text classification.

[0084] In summary, the training method for a text classification model provided in an embodiment of the present invention performs stop word processing on the initial training text to obtain enhanced data, mixes the enhanced data with the initial training text to obtain an enhanced training set, and implements classification model training using the enhanced training set. Because data enhancement is performed before using existing text for model training, and then training is performed using the enhanced data and the initial training text, the content of the text is enriched, the noise resistance of the text classification model and the accuracy of text classification are improved, and the problem in the prior art that the text classification model has low accuracy when training the text classification model using publicly available training data is solved. Moreover, the technical solution provided by the present invention only performs stop word processing during data enhancement, and does not change the grammar and semantics of the text, thereby ensuring the stability of the text.

[0085] Example 4

[0086] like Figure 4 As shown, the embodiment of the present application provides a training method for a text classification model, including:

[0087] Step 401: Obtain at least one initial training text and corresponding category of a text classification model.

[0088] In this embodiment, the process of obtaining the initial training text and the corresponding category in step 401 is the same as Figure 1 The steps 101 shown are similar and will not be described in detail here.

[0089] Step 402 : performing stop word processing on the segmentation data corresponding to each of the arbitrary second number of initial training texts according to the number of stop words in the segmentation data corresponding to each of the arbitrary second number of initial training texts to obtain a second number of enhanced data.

[0090] In this embodiment, the process of obtaining enhanced data through step 402 is similar to Figure 1 Step 102 is similar and will not be described in detail here. The stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data item is the same as the category of the corresponding initial training text; and the second number is a positive integer, and the second number is not greater than the number of at least one initial training text item.

[0091] Among them, for any initial training text, the enhanced data acquisition process includes: obtaining the number of stop words in the word segmentation data corresponding to the initial training text; when the number of stop words is 0, inserting stop words into the word segmentation data corresponding to the initial training text to obtain initial enhanced data; when the number of stop words is 1, inserting stop words, deleting stop words or replacing stop words into the word segmentation data corresponding to the initial training text to obtain initial enhanced data; when the number of stop words is greater than 1, inserting stop words, deleting stop words, replacing stop words or exchanging stop words into the word segmentation data corresponding to the initial training text to obtain initial enhanced data; judging whether the number of stop word processing times reaches a preset second threshold; if so, taking the initial enhanced data when the number of stop word processing times reaches the preset second threshold as the enhanced data; otherwise, updating the initial training text to the current initial enhanced data and re-executing the above-mentioned process of obtaining the number of stop words in the word segmentation data corresponding to the initial training text; the preset second threshold is a positive integer.

[0092] In this embodiment, a text preprocessing and word segmentation process may be further included between step 401 and step 402. For example, each of the arbitrary second number of initial training texts may be preprocessed and then word segmented to obtain word segmentation data corresponding to each of the arbitrary second number of initial training texts; or each of the at least one initial training text may be preprocessed and then word segmented to obtain word segmentation data corresponding to each of the at least one initial training text. The specific method is similar to the corresponding steps in Example 1 and will not be repeated here.

[0093] Step 403: Mix the second number of initial training texts and corresponding categories with the second number of enhanced data and corresponding categories to obtain an enhanced training set. Figure 1 The steps 104 shown are similar and will not be described in detail here.

[0094] Step 404: Train the initial text classification model using the enhanced training set to obtain a training model.

[0095] Step 405: Determine whether the current training model complies with the preset training rules.

[0096] In this embodiment, if it is determined through step 405 that the current training model meets the preset training rules, step 406 is executed; otherwise, step 407 is executed.

[0097] Step 406: Use the current training model that meets the preset training rules as the final classification model.

[0098] In this embodiment, the preset training rules include the total number of model training times reaching a preset fifth threshold; and / or the classification effect of the training model obtained after b consecutive training times is the same or decreases, where b is a positive integer.

[0099] Step 407: Use the current training model to update the initial text classification model.

[0100] In this embodiment, after the initial text classification model is updated in step 407 , step 402 is executed.

[0101] In summary, the training method for a text classification model provided in an embodiment of the present invention performs stop word processing on the initial training text to obtain enhanced data, mixes the enhanced data with the initial training text to obtain an enhanced training set, and implements classification model training using the enhanced training set. Because data enhancement is performed before using existing text for model training, and then training is performed using the enhanced data and the initial training text, the content of the text is enriched, the noise resistance of the text classification model and the accuracy of text classification are improved, and the problem in the prior art that the text classification model has low accuracy when training the text classification model using publicly available training data is solved. Moreover, the technical solution provided by the present invention only performs stop word processing during data enhancement, and does not change the grammar and semantics of the text, thereby ensuring the stability of the text.

[0102] Example 5

[0103] like Figure 5 As shown, the embodiment of the present application provides a training method for a text classification model, including:

[0104] Steps 501 to 502 are to obtain at least one initial training text of the text classification model, and to perform stop word processing on the word segmentation data corresponding to each initial training text in any second number of initial training texts. Figure 4 Steps 401 and 402 are similar and will not be described in detail here.

[0105] Steps 503 to 504 are to perform one-bit effective encoding on each category to obtain the corresponding category code; and to perform code conversion on the category code corresponding to each enhanced data in the second amount of enhanced data according to the preset code conversion rule to obtain the corresponding enhanced code. Figure 2 Steps 204 and 205 are similar and will not be described in detail here.

[0106] In this embodiment, step 503 can be performed in parallel with step 502. Figure 2 As shown; step 503 can also be after step 502, which is not limited here. Step 504 is after step 502 and step 503, and before step 505.

[0107] Among them, for any enhanced data, the specific way of encoding conversion can be to randomly convert the encoding with a value of 1 in the category encoding corresponding to the enhanced data to p according to a preset encoding conversion rule, and randomly convert the encoding with a value of 0 to a number within the interval (0, 0.5). The sum of all the converted data is 1, where 0.5 < p < 1. Encoding conversion can also be performed in other ways, as long as one valid piece of data is absolutely greater than the other data, which will not be elaborated here one by one.

[0108] Step 505: Mix the arbitrary second quantity of initial training texts and corresponding category encodings with the second quantity of enhanced data and corresponding enhanced encodings to obtain an enhanced training set. This process is similar to Figure 2 the step 206 shown, which will not be elaborated here one by one.

[0109] Steps 506 to 509: Train the initial text classification model through the enhanced training set to obtain a final classification model. This process is similar to Figure 4 the steps 404 to 407 shown, which will not be elaborated here one by one.

[0110] In summary, for the training method of the text classification model provided by the embodiments of the present invention, by performing stop word processing on the initial training texts to obtain enhanced data, mixing the enhanced data and the initial training texts to obtain an enhanced training set, and implementing the training of the classification model through the enhanced training set. Since data enhancement is performed before using the existing texts for model training, and then the enhanced data and the initial training texts are jointly used for training, the content of the texts is enriched, the anti-noise ability of the text classification model and the accuracy of text classification are improved, and the problem in the prior art that the accuracy of text classification is relatively low when training the text classification model with the publicly available training data because the publicly available training data for the text classification model is very few is solved. Moreover, for the technical solution provided by the present invention, only stop word processing is performed during data enhancement, which will not change the grammar and semantics of the texts, ensuring the stability of the texts. In addition, during data enhancement, encoding conversion is also performed on the labels corresponding to the enhanced data, further improving the accuracy of text classification.

[0111] Embodiment 6

[0112] As Figure 6 shown, the embodiments of the present application provide a data enhancement device, including:

[0113] A data acquisition module 601, configured to acquire at least one initial training text and corresponding category for text classification;

[0114] A stop word processing module 602 is connected to the data acquisition module and is configured to perform stop word processing on the segmentation data corresponding to each of the first number of initial training texts based on the number of stop words in the segmentation data corresponding to each of the first number of initial training texts to obtain a first number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the first number is a positive integer and is not greater than the number of at least one initial training text;

[0115] A rule judgment module 603, connected to the stop word processing module, is used to judge whether the obtained enhanced data conforms to the preset data rules;

[0116] If the rule judgment module determines that the obtained enhanced data meets the preset data rules, the data mixing module performs data mixing; otherwise, the stop word processing module performs stop word processing;

[0117] The data mixing module 604 is connected to the rule judgment module and is used to mix at least one initial training text and corresponding category with all enhanced data and corresponding categories to obtain an enhanced training set.

[0118] In this embodiment, the process of implementing data enhancement through the above modules is similar to that provided in Example 1 of the present invention and will not be described in detail here.

[0119] The data enhancement device provided in this embodiment only performs stop word processing such as stop word insertion, stop word deletion, stop word replacement and stop word exchange during data enhancement. It enriches the content of the text without changing the grammar and semantics of the text, improves the accuracy of text classification, and overcomes the technical bias that stop words are useless in text classification.

[0120] Taking the open source dataset TNEWS as an example, the classification accuracy of the classification model trained using the original text is about 56.58%, and the classification accuracy of the classification model trained using the data-enhanced text is about 57.77%; taking the open source dataset IFLYTEK as an example, the classification accuracy of the classification model trained using the original text is about 60.29%, and the classification accuracy of the classification model trained using the data-enhanced text is about 61.37%.

[0121] Further, such as Figure 7 As shown, the data enhancement device provided in this embodiment further includes:

[0122] The code conversion module 605 is connected to the data acquisition module and is used to perform a one-bit effective encoding on each category to obtain the corresponding category code;

[0123] The code enhancement module 606 is connected to the stop word processing module and the code conversion module respectively, and is used to perform code conversion on the category code corresponding to each enhanced data according to a preset code conversion rule to obtain a corresponding enhanced code;

[0124] The data mixing module 604 is also connected to the code enhancement module, and is specifically configured to mix at least one initial training text and corresponding category code with all enhanced data and corresponding enhanced codes to obtain an enhanced training set.

[0125] In this embodiment, when the data enhancement device further includes modules such as the encoding conversion module 605, the process of implementing data enhancement is similar to that provided in Example 2 of the present invention and will not be described in detail here.

[0126] The data enhancement method provided in this embodiment not only performs stop word processing on the text, such as stop word insertion, stop word deletion, stop word replacement, and stop word exchange, but also performs encoding conversion on the labels. This enriches the content of the text without changing the grammar and semantics of the text, further improves the accuracy of text classification, and overcomes the technical bias that stop words are useless in text classification.

[0127] Furthermore, for any initial training text, the stop word processing module in the data enhancement device provided in this embodiment includes:

[0128] A number acquisition submodule is used to obtain the number of stop words in the word segmentation data corresponding to the initial training text;

[0129] The first processing submodule is connected to the number acquisition submodule and is used to insert stop words into the word segmentation data corresponding to the initial training text when the number of stop words is 0 to obtain initial enhanced data;

[0130] The second processing submodule is connected to the number acquisition submodule and is used to insert, delete or replace stop words in the word segmentation data corresponding to the initial training text when the number of stop words is 1, so as to obtain initial enhanced data;

[0131] The third processing submodule is connected to the number acquisition submodule and is used to insert, delete, replace or exchange stop words in the word segmentation data corresponding to the initial training text when the number of stop words is greater than 1, so as to obtain initial enhanced data;

[0132] A number judgment submodule, connected to the first processing submodule, the second processing submodule and the third processing submodule respectively, for judging whether the number of stop word processing times reaches a preset second threshold;

[0133] If the number judgment submodule determines that the number of stop word processing times reaches a preset second threshold, the data acquisition submodule obtains enhanced data; otherwise, the update submodule performs data update; the preset second threshold is a positive integer;

[0134] The updating submodule is connected to the number judging submodule and the number obtaining submodule respectively, and is used to update the initial training text to the current initial enhanced data and then obtain the number of stop words through the number obtaining submodule;

[0135] The data acquisition submodule is connected to the number judgment submodule and is used to use the initial enhanced data when the number of stop word processing times reaches a preset second threshold as the enhanced data.

[0136] In this embodiment, the process of the stop word processing module acquiring enhanced data is similar to that provided in Example 1 of the present invention and will not be described in detail here.

[0137] Furthermore, for any enhanced data, the encoding enhancement module in this embodiment is specifically configured to randomly convert the code with a value of 1 in the category code corresponding to the enhanced data into p according to the preset encoding conversion rule, and randomly convert the code with a value of 0 into a number in the interval (0, 0.5). The sum of all the converted data is 1, 0.5. <p<1。

[0138] Furthermore, the data enhancement device provided in this embodiment may further include:

[0139] A first word segmentation module or a second word segmentation module connected to the data acquisition module and the stop word processing module respectively;

[0140] A first word segmentation module is used to perform pre-processing and word segmentation on each of the arbitrary first number of initial training texts to obtain word segmentation data corresponding to each of the arbitrary first number of initial training texts;

[0141] The second word segmentation module is used to perform pre-processing and word segmentation on each of the at least one initial training text to obtain word segmentation data corresponding to each of the at least one initial training text.

[0142] In this embodiment, when the data enhancement device further includes a first word segmentation module or a second word segmentation module, the process of implementing data enhancement is similar to the corresponding steps in Example 1 and will not be described in detail here.

[0143] In summary, the data enhancement device provided in the embodiment of the present invention performs stop word processing on the initial training text to obtain enhanced data, and then mixes the enhanced data with the initial training text to obtain an enhanced training set, thereby achieving data enhancement. Since data enhancement is performed before using existing text for model training, the content of the text is enriched, the noise resistance of the text classification model and the accuracy of text classification are improved, and the problem in the prior art that the text classification model has low accuracy when training the text classification model using public training data is solved due to the small amount of public training data for the text classification model. Moreover, the technical solution provided by the present invention only performs stop word processing during data enhancement, and does not change the grammar and semantics of the text, thereby ensuring the stability of the text.

[0144] Example 7

[0145] like Figure 8 As shown, the embodiment of the present application provides a training device for a text classification model, comprising:

[0146] The training set acquisition module 801 is used to acquire an enhanced training set through a data enhancement device;

[0147] The model training module 802 is connected to the training set acquisition module and is used to train the initial text classification model by enhancing the training set to obtain the final classification model.

[0148] In this embodiment, the structure of the data enhancement device is similar to that provided in Example 6 of this application, and will not be repeated here. The training process of the text classification model implemented by the above modules is similar to that provided in Example 3 of this application, and will not be repeated here.

[0149] In summary, the training device for a text classification model provided by an embodiment of the present invention obtains enhanced data by performing stop word processing on the initial training text, mixes the enhanced data with the initial training text to obtain an enhanced training set, and implements classification model training through the enhanced training set. Because data enhancement is performed before using existing text for model training, and then training is performed together with the enhanced data and the initial training text, the content of the text is enriched, the noise resistance of the text classification model and the accuracy of text classification are improved, and the problem in the prior art that the text classification model has a low accuracy rate when training the text classification model using the public training data is solved due to the small amount of public training data for the text classification model. Moreover, the technical solution provided by the present invention only performs stop word processing during data enhancement, and does not change the grammar and semantics of the text, thereby ensuring the stability of the text.

[0150] Example 8

[0151] like Figure 9 As shown, the embodiment of the present application provides a training device for a text classification model, comprising:

[0152] A data acquisition module 901 is used to acquire at least one initial training text and corresponding category of a text classification model;

[0153] A stop word processing module 902 is connected to the data acquisition module and is configured to perform stop word processing on the segmentation data corresponding to each of the arbitrary second number of initial training texts based on the number of stop words in the segmentation data corresponding to each of the arbitrary second number of initial training texts, to obtain a second number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the second number is a positive integer and is not greater than the number of at least one initial training text;

[0154] a data mixing module 903 , connected to the data acquisition module and the stop word processing module, respectively, for mixing the arbitrary second number of initial training texts and corresponding categories with the second number of enhanced data and corresponding categories to obtain an enhanced training set;

[0155] A model training module 904, connected to the data mixing module, is used to train the initial text classification model using the enhanced training set to obtain a training model;

[0156] The model judgment module 905 is connected to the model training module and is used to judge whether the current training model meets the preset training rules;

[0157] If the current training model meets the preset training rules, the final classification model is obtained through the model acquisition module; otherwise, the model is updated through the update module;

[0158] An updating module 906 is connected to the model judgment module, the model training module and the stop word processing module respectively, and is used to update the initial text classification model using the current training model and then perform stop word processing through the stop word processing module;

[0159] The model acquisition module 907 is connected to the model judgment module and is used to use the current training model that meets the preset training rules as the final classification model.

[0160] In this embodiment, the training process of the text classification model is implemented through the above modules, which is similar to that provided in Example 4 of the present invention and will not be described in detail here.

[0161] Further, such as Figure 10 As shown, the training device for the text classification model provided in this embodiment may further include:

[0162] The code conversion module 908 is connected to the data acquisition module and is used to perform a one-bit effective encoding on each category to obtain the corresponding category code;

[0163] a coding enhancement module 909, connected to the stop word processing module and the coding conversion module, and configured to perform coding conversion on the category code corresponding to each enhanced data in the second amount of enhanced data according to a preset coding conversion rule to obtain a corresponding enhanced code;

[0164] The data mixing module 903 is also connected to the code enhancement module, and is specifically configured to mix the arbitrary second number of initial training texts and corresponding category codes with the second number of enhanced data and corresponding enhanced codes to obtain an enhanced training set.

[0165] In this embodiment, when the classification device of the text classification model also includes modules such as a coding conversion module, the training process of the text classification model is similar to that provided in Example 5 of the present application and will not be repeated here.

[0166] Furthermore, for any initial training text, the data mixing module in the training device for the text classification model in this embodiment includes:

[0167] A number acquisition submodule is used to obtain the number of stop words in the word segmentation data corresponding to the initial training text;

[0168] The first processing submodule is connected to the number acquisition submodule and is used to insert stop words into the word segmentation data corresponding to the initial training text when the number of stop words is 0 to obtain initial enhanced data;

[0169] The second processing submodule is connected to the number acquisition submodule and is used to insert, delete or replace stop words in the word segmentation data corresponding to the initial training text when the number of stop words is 1, so as to obtain initial enhanced data;

[0170] The third processing submodule is connected to the number acquisition submodule and is used to insert, delete, replace or exchange stop words in the word segmentation data corresponding to the initial training text when the number of stop words is greater than 1, so as to obtain initial enhanced data;

[0171] A number judgment submodule, connected to the first processing submodule, the second processing submodule and the third processing submodule respectively, for judging whether the number of stop word processing times reaches a preset second threshold;

[0172] If the number judgment submodule determines that the number of stop word processing times reaches a preset second threshold, the data acquisition submodule obtains enhanced data; otherwise, the update submodule performs data update; the preset second threshold is a positive integer;

[0173] The updating submodule is connected to the number judging submodule and the number obtaining submodule respectively, and is used to update the initial training text to the current initial enhanced data and then obtain the number of stop words through the number obtaining submodule;

[0174] The data acquisition submodule is connected to the number judgment submodule and is used to use the initial enhanced data when the number of stop word processing times reaches a preset second threshold as the enhanced data.

[0175] In this embodiment, the process of the data mixing module obtaining enhanced data through the above-mentioned submodules is similar to the corresponding process in the embodiment of the present application, and will not be repeated here.

[0176] Furthermore, the text classification model training device provided in this embodiment may also include:

[0177] A first word segmentation module or a second word segmentation module connected to the data acquisition module and the stop word processing module respectively;

[0178] A first word segmentation module is used to perform pre-processing and word segmentation on each of the arbitrary second number of initial training texts to obtain word segmentation data corresponding to each of the arbitrary second number of initial training texts;

[0179] The second word segmentation module is used to perform pre-processing and word segmentation on each of the at least one initial training text to obtain word segmentation data corresponding to each of the at least one initial training text.

[0180] In this embodiment, when the training device further includes a first word segmentation module or a second word segmentation module, the process of implementing data enhancement is similar to the corresponding steps in Example 1 and will not be described in detail here.

[0181] Furthermore, in the training device of the text classification model provided in this embodiment, for any enhanced data, the encoding enhancement module is specifically used to randomly convert the code with a value of 1 in the category code corresponding to the enhanced data into p according to the preset encoding conversion rule, and randomly convert the code with a value of 0 into a number in the interval of (0, 0.5). The sum of all the converted data is 1, 0.5. <p<1。

[0182] In summary, the training device for a text classification model provided by an embodiment of the present invention obtains enhanced data by performing stop word processing on the initial training text, mixes the enhanced data with the initial training text to obtain an enhanced training set, and implements classification model training through the enhanced training set. Because data enhancement is performed before using existing text for model training, and then training is performed together with the enhanced data and the initial training text, the content of the text is enriched, the noise resistance of the text classification model and the accuracy of text classification are improved, and the problem in the prior art that the text classification model has low accuracy when training the text classification model using public training data is solved due to the small amount of public training data for the text classification model. Moreover, the technical solution provided by the present invention only performs stop word processing during data enhancement, and does not change the grammar and semantics of the text, thereby ensuring the stability of the text.

[0183] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.

[0184] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. Throughout the description of this application, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined.

[0185] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application belong.

[0186] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and a portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in another suitable manner if necessary, and then storing it in a computer memory.

[0187] It should be understood that various parts of the present application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0188] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.

[0189] In addition, the functional units in the various embodiments of the present application can be integrated into a preprocessing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0190] The storage medium mentioned above may be a read-only memory, a magnetic disk, or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application. Persons skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present application.

Claims

1. A data enhancement method, characterized in that: include: S10, obtaining at least one initial training text and corresponding category for text classification; S20. Based on the number of stop words in the word segmentation data corresponding to each initial training text in any first number of initial training texts, perform stop word processing on the word segmentation data corresponding to each initial training text in the arbitrary first number of initial training texts to obtain a first number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the first number is a positive integer, and the first number is not greater than the number of the at least one initial training text; S30, determining whether the obtained enhanced data complies with preset data rules; If yes, go to step S40; Otherwise, execute step S20; S40, mixing the at least one initial training text and the corresponding category with all enhanced data and the corresponding categories to obtain an enhanced training set; For any initial training text, S20 includes: S201, obtaining the number of stop words in the word segmentation data corresponding to the initial training text; S202: When the number of stop words is 0, insert stop words into the word segmentation data corresponding to the initial training text to obtain initial enhanced data; S203: When the number of stop words is 1, insert stop words, delete stop words, or replace stop words in the word segmentation data corresponding to the initial training text to obtain initial enhanced data; S204: When the number of stop words is greater than 1, performing stop word insertion, stop word deletion, stop word replacement, or stop word exchange on the word segmentation data corresponding to the initial training text to obtain initial enhanced data; S205, determining whether the number of stop word processing times reaches a preset second threshold; If yes, execute step S206; otherwise, update the initial training text to the current initial enhanced data and then execute step S201; the preset second threshold is a positive integer; S206 : Using the initial enhanced data when the number of stop word processing times reaches a preset second threshold as the corresponding enhanced data.

2. The data enhancement method according to claim 1, wherein: Before the S40, the method further includes: S31, perform one-bit effective encoding on each category to obtain the corresponding category code; S32, performing code conversion on the category code corresponding to each enhanced data according to a preset code conversion rule to obtain a corresponding enhanced code; Specifically, S40 is to mix the at least one initial training text and the corresponding category code with all enhanced data and the corresponding enhanced codes to obtain an enhanced training set.

3. The data enhancement method according to claim 2, wherein: For any enhanced data, the S32 includes: According to the preset code conversion rules, the code with a value of 1 in the category code corresponding to the enhanced data is randomly converted to p, and the code with a value of 0 is randomly converted to a number in the interval (0, 0.5). The sum of all the converted data is 1, 0.

5. <p<1。 4. The data enhancement method according to claim 1 or 2, characterized in that: Before the S20, the method further includes: S11, pre-processing and segmenting each of the first number of initial training texts to obtain segmentation data corresponding to each of the first number of initial training texts; or S12 , performing pre-processing and subsequent word segmentation on each of the at least one initial training text to obtain word segmentation data corresponding to each of the at least one initial training text.

5. The data enhancement method according to claim 4, characterized in that The pretreatment includes: One or more of punctuation filtering, abbreviation completion, space removal, and illegal character filtering.

6. The data enhancement method according to claim 1 or 2, characterized in that: The preset data rules include: The number of all enhanced data reaches a preset third threshold; and / or, The ratio of the number of all enhanced data to the number of all initial training texts reaches a preset fourth threshold.

7. A training method for a text classification model, characterized in that: include: T10. Obtain an enhanced training set by using any data enhancement method as claimed in claims 1-6; T20. Train the initial text classification model using the enhanced training set to obtain a final classification model.

8. A training method for a text classification model, characterized in that: include: P10. Obtain at least one initial training text and corresponding category of the text classification model; P20. Based on the number of stop words in the word segmentation data corresponding to each initial training text in any second number of initial training texts, perform stop word processing on the word segmentation data corresponding to each initial training text in the arbitrary second number of initial training texts to obtain a second number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the second number is a positive integer, and the second number is not greater than the number of the at least one initial training text; P30, mixing the arbitrary second number of initial training texts and corresponding categories with the second number of enhanced data and corresponding categories to obtain an enhanced training set; P40, train the initial text classification model using the enhanced training set to obtain a training model; P50, determine whether the current training model complies with the preset training rules; If yes, go to step P60; Otherwise, the initial text classification model is updated using the current training model and then step P20 is performed; P60: The current training model that meets the preset training rules is used as the final classification model; For any initial training text, the P20 includes: P201, obtain the number of stop words in the word segmentation data corresponding to the initial training text; P202: When the number of stop words is 0, insert stop words into the word segmentation data corresponding to the initial training text to obtain initial enhanced data; P203. When the number of stop words is 1, stop word insertion, stop word deletion, or stop word replacement is performed on the word segmentation data corresponding to the initial training text to obtain initial enhanced data; P204. When the number of stop words is greater than 1, stop word insertion, stop word deletion, stop word replacement, or stop word exchange is performed on the word segmentation data corresponding to the initial training text to obtain initial enhanced data; P205, determining whether the number of stop word processing times reaches a preset second threshold; If yes, execute step P206; otherwise, update the initial training text to the current initial enhanced data and execute step P201; P206. Use the initial enhanced data when the number of stop word processing times reaches a preset second threshold as the corresponding enhanced data.

9. The text classification model training method according to claim 8, characterized in that: Before step P30, the method further includes: P21. Perform one-bit effective encoding on each category to obtain the corresponding category code; P22. Perform code conversion on the category code corresponding to each enhanced data in the second amount of enhanced data according to a preset code conversion rule to obtain a corresponding enhanced code; Specifically, P30 is to mix the arbitrary second number of initial training texts and corresponding category codes with the second number of enhanced data and corresponding enhanced codes to obtain an enhanced training set.

10. The text classification model training method according to claim 9, characterized in that: For any enhanced data, the P22 includes: According to the preset code conversion rules, the code with a value of 1 in the category code corresponding to the enhanced data is randomly converted to p, and the code with a value of 0 is randomly converted to a number in the interval (0, 0.5). The sum of all the converted data is 1, 0.

5. <p<1。 11. The text classification model training method according to claim 8 or 9, characterized in that: Before the P20, it also includes: P11, pre-processing and segmenting each of the arbitrary second number of initial training texts to obtain segmentation data corresponding to each of the arbitrary second number of initial training texts; or P12. Pre-process and segment each initial training text in the at least one initial training text to obtain segmentation data corresponding to each initial training text in the at least one initial training text.

12. The text classification model training method according to claim 8 or 9, characterized in that: The preset training rules include: The total number of model training times reaches the preset fifth threshold; and / or, The classification effect of the training model obtained after b consecutive trainings is the same or decreases, where b is a positive integer.

13. A data enhancement device, characterized in that: include: A data acquisition module, configured to acquire at least one initial training text and corresponding category for text classification; a stop word processing module connected to the data acquisition module, configured to perform stop word processing on the segmentation data corresponding to each of the first number of initial training texts based on the number of stop words in the segmentation data corresponding to each of the first number of initial training texts, to obtain a first number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the first number is a positive integer, and the first number is not greater than the number of the at least one initial training text; A rule judgment module, connected to the stop word processing module, is used to judge whether the obtained enhanced data conforms to the preset data rules; If the rule judgment module determines that the obtained enhanced data meets the preset data rules, the data mixing module performs data mixing; Otherwise, stop word processing is performed by the stop word processing module; The data mixing module is connected to the rule judgment module and is used to mix the at least one initial training text and corresponding category with all enhanced data and corresponding categories to obtain an enhanced training set; For any initial training text, the stop word processing module includes: A number acquisition submodule is used to obtain the number of stop words in the word segmentation data corresponding to the initial training text; A first processing submodule is connected to the number acquisition submodule, and is used to insert stop words into the segmentation data corresponding to the initial training text when the number of stop words is 0, so as to obtain initial enhanced data; A second processing submodule is connected to the number acquisition submodule, and is used to insert, delete or replace stop words in the word segmentation data corresponding to the initial training text when the number of stop words is 1, to obtain initial enhanced data; a third processing submodule, connected to the number acquisition submodule, for performing stop word insertion, stop word deletion, stop word replacement, or stop word exchange on the word segmentation data corresponding to the initial training text when the number of stop words is greater than 1, to obtain initial enhanced data; A number judgment submodule, connected to the first processing submodule, the second processing submodule and the third processing submodule respectively, for judging whether the number of stop word processing times reaches a preset second threshold; If the number judgment submodule determines that the number of stop word processing times reaches a preset second threshold, the data acquisition submodule acquires enhanced data; otherwise, the update submodule performs data update; the preset second threshold is a positive integer; The updating submodule is connected to the number judging submodule and the number obtaining submodule respectively, and is used to obtain the number of stop words through the number obtaining submodule after updating the initial training text to the current initial enhanced data; The data acquisition submodule is connected to the number judgment submodule, and is used to use the initial enhanced data when the number of stop word processing reaches a preset second threshold as the corresponding enhanced data.

14. The data enhancement device according to claim 13, wherein: Also includes: A coding conversion module, connected to the data acquisition module, is used to perform a one-bit effective coding on each category to obtain a corresponding category code; A coding enhancement module, connected to the stop word processing module and the coding conversion module, respectively, for performing coding conversion on the category code corresponding to each enhanced data according to a preset coding conversion rule to obtain a corresponding enhanced code; The data mixing module is also connected to the code enhancement module, and is specifically used to mix the at least one initial training text and the corresponding category code with all enhanced data and the corresponding enhanced code to obtain an enhanced training set.

15. The data enhancement device according to claim 14, characterized in that: For any enhanced data, the coding enhancement module is specifically used to randomly convert the code with a value of 1 in the category code corresponding to the enhanced data into p according to the preset coding conversion rules, and randomly convert the code with a value of 0 into a number in the interval of (0, 0.5). The sum of all the converted data is 1, 0.

5. <p<1。 16. The data enhancement device according to claim 13 or 14, characterized in that: Also includes: a first word segmentation module or a second word segmentation module connected to the data acquisition module and the stop word processing module respectively; The first word segmentation module is used to perform pre-processing and word segmentation on each of the arbitrary first number of initial training texts to obtain word segmentation data corresponding to each of the arbitrary first number of initial training texts; The second word segmentation module is used to perform pre-processing and word segmentation on each of the at least one initial training text to obtain word segmentation data corresponding to each of the at least one initial training text.

17. A training device for a text classification model, characterized in that: include: A training set acquisition module, configured to acquire an enhanced training set by using any data enhancement device according to claims 13 to 16; The model training module is connected to the training set acquisition module and is used to train the initial text classification model through the enhanced training set to obtain the final classification model.

18. A training device for a text classification model, characterized in that: include: A data acquisition module, configured to acquire at least one initial training text and corresponding category of a text classification model; a stop word processing module connected to the data acquisition module, configured to perform stop word processing on the segmentation data corresponding to each of the arbitrary second number of initial training texts based on the number of stop words in the segmentation data corresponding to each of the arbitrary second number of initial training texts, to obtain a second number of enhanced data; the stop word processing includes one or more of stop word insertion, stop word deletion, stop word replacement, and stop word exchange; the category of each enhanced data is the same as the category of the corresponding initial training text; the second number is a positive integer, and the second number is not greater than the number of the at least one initial training text; a data mixing module, connected to the data acquisition module and the stop word processing module respectively, for mixing the arbitrary second number of initial training texts and corresponding categories with the second number of enhanced data and corresponding categories to obtain an enhanced training set; A model training module, connected to the data mixing module, is used to train the initial text classification model using the enhanced training set to obtain a training model; A model judgment module, connected to the model training module, is used to judge whether the current training model conforms to the preset training rules; If the current training model meets the preset training rules, the final classification model is obtained through the model acquisition module; Otherwise, update the model through the update module; The updating module is connected to the model judgment module, the model training module and the stop word processing module respectively, and is used to update the initial text classification model with the current training model and then perform stop word processing through the stop word processing module; The model acquisition module is connected to the model judgment module and is used to use the current training model that meets the preset training rules as the final classification model; For any initial training text, the stop word processing module includes: A number acquisition submodule is used to obtain the number of stop words in the word segmentation data corresponding to the initial training text; A first processing submodule is connected to the number acquisition submodule, and is used to insert stop words into the segmentation data corresponding to the initial training text when the number of stop words is 0, so as to obtain initial enhanced data; A second processing submodule is connected to the number acquisition submodule, and is used to insert, delete or replace stop words in the word segmentation data corresponding to the initial training text when the number of stop words is 1, to obtain initial enhanced data; a third processing submodule, connected to the number acquisition submodule, for performing stop word insertion, stop word deletion, stop word replacement, or stop word exchange on the word segmentation data corresponding to the initial training text when the number of stop words is greater than 1, to obtain initial enhanced data; A number judgment submodule, connected to the first processing submodule, the second processing submodule and the third processing submodule respectively, for judging whether the number of stop word processing times reaches a preset second threshold; If the number judgment submodule determines that the number of stop word processing times reaches a preset second threshold, the data acquisition submodule acquires enhanced data; otherwise, the update submodule performs data update; the preset second threshold is a positive integer; The updating submodule is connected to the number judging submodule and the number obtaining submodule respectively, and is used to obtain the number of stop words through the number obtaining submodule after updating the initial training text to the current initial enhanced data; The data acquisition submodule is connected to the number determination submodule and is used to use the initial enhanced data when the number of stop word processing times reaches a preset second threshold as the enhanced data.

19. The text classification model training device according to claim 18, characterized in that: Also includes: A coding conversion module, connected to the data acquisition module, is used to perform a one-bit effective coding on each category to obtain a corresponding category code; a coding enhancement module, connected to the stop word processing module and the coding conversion module, respectively, for performing coding conversion on the category code corresponding to each enhanced data in the second amount of enhanced data according to a preset coding conversion rule to obtain a corresponding enhanced code; The data mixing module is also connected to the coding enhancement module, and is specifically used to mix the arbitrary second number of initial training texts and corresponding category codes with the second number of enhanced data and corresponding enhanced codes to obtain an enhanced training set.

20. The text classification model training device according to claim 18 or 19, characterized in that: Also includes: a first word segmentation module or a second word segmentation module connected to the data acquisition module and the stop word processing module respectively; The first word segmentation module is used to perform pre-processing and word segmentation on each of the arbitrary second number of initial training texts to obtain word segmentation data corresponding to each of the arbitrary second number of initial training texts; The second word segmentation module is used to perform pre-processing and word segmentation on each of the at least one initial training text to obtain word segmentation data corresponding to each of the at least one initial training text.

21. The text classification model training device according to claim 19, characterized in that: For any enhanced data, the coding enhancement module is specifically used to randomly convert the code with a value of 1 in the category code corresponding to the enhanced data into p according to the preset coding conversion rules, and randomly convert the code with a value of 0 into a number in the interval of (0, 0.5). The sum of all the converted data is 1, 0.

5. <p<1。

Citation Information

Patent Citations

  • Noise data augmentation for natural language processing

    US20210304733A1