Text classification method, device, electronic device and medium based on artificial intelligence

By building search space and preset search strategies, the text enhancement strategy is automatically determined, which solves the problem of accurate and inefficient text classification in the existing technology, and achieves efficient text classification results.

CN113792146BActive Publication Date: 2024-11-22PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111093400.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-17
Publication Date
2024-11-22
Estimated Expiration
2041-09-17

AI Technical Summary

Technical Problem

The prior art requires a lot of manpower and time to mark and hyperparameter settings in text classification, resulting in inaccuracy and inefficiency of text classification results.

Method used

By building a search space, a preset search strategy is used to randomly select text enhancement strategies to enhance the original text, and through neural network training and verification, the optimal text enhancement strategy is determined to improve the accuracy of text classification.

Benefits of technology

Automatically determine the optimal text enhancement strategy without manual annotation, which improves the accuracy and efficiency of text classification and reduces labor and time costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113792146B_ABST
    Figure CN113792146B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and provides a text classification method, device, electronic device and medium based on artificial intelligence, the method comprising: constructing a search space; randomly selecting a target text enhancement strategy using a preset search strategy; performing text enhancement on an original text set using the target text enhancement strategy to obtain a first enhanced text set; calculating a verification pass rate according to the original text set and the first enhanced text set; and determining a target text classification model and an optimal text enhancement strategy; performing text enhancement on a to-be-classified text set using the optimal text enhancement strategy to obtain a third enhanced text set, and inputting the third enhanced text set and the to-be-classified text set into the target text classification model to obtain a text classification result. The present invention improves the accuracy of text classification by constructing a search space and adopting a preset search strategy to customize and search for the optimal text enhancement strategy for each data set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an artificial intelligence-based text classification method, device, electronic equipment and medium. Background Art

[0002] Text classification is one of the most important tasks in natural language processing. At present, deep learning models have been widely used in text classification tasks, such as CNN, RNN and other models, which perform text enhancement after annotating a large amount of text.

[0003] However, the existing technology of text annotation consumes a lot of manpower and time. At the same time, some hyperparameters need to be manually set when performing text enhancement. The hyperparameters are obtained through manual experience and a large number of comparative experiments. It is impossible to quickly and accurately find the optimal text enhancement strategy during text enhancement, resulting in low accuracy and efficiency of text classification results.

[0004] Therefore, it is necessary to propose a method that can accurately classify text. Summary of the invention

[0005] In view of the above, it is necessary to propose an artificial intelligence-based text classification method, device, electronic device and medium. By constructing a search space and adopting a preset search strategy, a customized search for the optimal text enhancement strategy is performed for each data set, thereby improving the accuracy of text classification.

[0006] A first aspect of the present invention provides a text classification method based on artificial intelligence, the method comprising:

[0007] Parsing the received text classification request and constructing a search space, wherein the search space includes a plurality of text enhancement strategies;

[0008] A text enhancement strategy is randomly selected from the search space using a preset search strategy as a target text enhancement strategy, wherein the preset search strategy includes a controller;

[0009] Perform text enhancement on each text in the original text set in the text classification request using the target text enhancement strategy to obtain a first enhanced text set;

[0010] Inputting the original text set and the first enhanced text set into a preset neural network for training to obtain a first text classification model;

[0011] Inputting the verification set in the text classification request into the first text classification model for verification, and calculating the verification pass rate;

[0012] Determining a target text classification model and an optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate;

[0013] The optimal text enhancement strategy is used to perform text enhancement on the text set to be classified in the text classification request to obtain a third enhanced text set, and the third enhanced text set and the text set to be classified are input into the target text classification model to obtain a text classification result.

[0014] Optionally, parsing the received text classification request and constructing a search space includes:

[0015] Parse the received text classification request and obtain four types of hyperparameters: category label, operation type, probability value of application type, and the proportion of words with application operations in each text;

[0016] Performing a combination operation on the four types of hyperparameters to obtain a plurality of text enhancement strategies, wherein each of the text enhancement strategies is composed of the four types of hyperparameters;

[0017] A search space is constructed based on the multiple text enhancement strategies.

[0018] Optionally, the operation type includes a combination of one or more of the following modes: synonym replacement, random insertion, random exchange, and random deletion.

[0019] Optionally, the adopting a preset search strategy to randomly select a text enhancement strategy from the search space as a target text enhancement strategy includes:

[0020] The multiple text enhancement strategies are input into the controller of the preset search strategy, the controller randomly selects a hyperparameter of any type of hyperparameters from the multiple text enhancement strategies as an input parameter of the current time step of the controller, inputs the input parameter of the current time step into the controller, and outputs an output value of the current time step;

[0021] The controller randomly selects a hyperparameter from any remaining hyperparameter category from the multiple text enhancement strategies as an input parameter for a next time step, uses the first input parameter for the next time step and the output value of the current time step as target input parameters for the next time step, inputs the target input parameter for the next time step into the controller, and outputs the output value for the next time step;

[0022] The selection of the four types of hyperparameters and the determination of the input parameters are executed cyclically until the output parameters corresponding to each of the hyperparameters are obtained, and the four output values ​​corresponding to the four types of hyperparameters are determined as the target text enhancement strategy.

[0023] Optionally, the step of using the target text enhancement strategy to perform text enhancement on each text in the original text set in the text classification request to obtain a first enhanced text set includes:

[0024] Identify an output value corresponding to each hyperparameter in the target text enhancement strategy;

[0025] Based on the output value corresponding to each of the hyperparameters, text enhancement is performed on each text in the original text set to obtain a first enhanced text.

[0026] Optionally, determining a target text classification model and an optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate includes:

[0027] When the verification pass rate satisfies a preset convergence condition in the text classification request, the first text classification model is determined as a target text classification model and the target text enhancement strategy is determined as an optimal text enhancement strategy.

[0028] Optionally, the method further comprises:

[0029] When the verification pass rate does not meet the preset convergence condition in the text classification request, updating the model parameters in the controller based on the verification pass rate to obtain an updated controller;

[0030] Using the updated controller to randomly select a new text addition strategy from the search space as a new target text enhancement strategy, and using the new target text enhancement strategy to perform text enhancement on the original text set to obtain a second enhanced text set;

[0031] Inputting the original text set and the second enhanced file set into the preset neural network for training to obtain a second text classification model, inputting the verification set in the text classification request into the second text classification model for verification, and calculating the verification pass rate;

[0032] Repeat the step of updating the model parameters in the controller according to the verification pass rate and reselecting a new text enhancement strategy for text enhancement to obtain the verification pass rate, until the verification pass rate satisfies the preset convergence condition corresponding to the controller, determine the text classification model corresponding to the verification pass rate as the target text classification model, and determine the new target text enhancement strategy corresponding to the verification pass rate as the optimal text enhancement strategy.

[0033] A second aspect of the present invention provides a text classification device based on artificial intelligence, the device comprising:

[0034] A parsing module, used to parse the received text classification request and construct a search space, wherein the search space includes multiple text enhancement strategies;

[0035] A selection module, used to randomly select a text enhancement strategy from the search space using a preset search strategy as a target text enhancement strategy, wherein the preset search strategy includes a controller;

[0036] A text enhancement module, configured to perform text enhancement on each text in an original text set in a text classification request using the target text enhancement strategy to obtain a first enhanced text set;

[0037] A first input module, used for inputting the original text set and the first enhanced text set into a preset neural network for training to obtain a first text classification model;

[0038] A verification module, used for inputting the verification set in the text classification request into the first text classification model for verification, and calculating the verification pass rate;

[0039] A determination module, used to determine a target text classification model and an optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate;

[0040] The second input module is used to perform text enhancement on the text set to be classified in the text classification request by adopting the optimal text enhancement strategy to obtain a third enhanced text set, and input the third enhanced text set and the text set to be classified into the target text classification model to obtain a text classification result.

[0041] A third aspect of the present invention provides an electronic device, comprising a processor and a memory, wherein the processor is configured to implement the artificial intelligence-based text classification method when executing a computer program stored in the memory.

[0042] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the artificial intelligence-based text classification method is implemented.

[0043] In summary, the artificial intelligence-based text classification method, device, electronic device and medium described in the present invention, on the one hand, construct a search space by adopting all the text enhancement strategies corresponding to the text classification request, thereby ensuring the integrity of the text enhancement strategies in the search space and improving the accuracy of the optimal text enhancement strategy subsequently selected from the search space; on the other hand, a controller in a preset search strategy is adopted to randomly select a text enhancement strategy from the search space. Since the input parameters of the next time step of the controller are jointly determined by the output value of the previous time step and the input parameters of the next time step, when the next text is processed, the previous output also has an impact on it, thereby improving the relevance of the text, ensuring the reliability of the output value of each hyperparameter obtained, and improving the accuracy of the randomly selected text enhancement strategy; finally, by adopting the randomly selected target text enhancement strategy to perform text enhancement on each text in the original text set, there is no need for manual annotation, no need to consume a lot of manpower and time, and the efficiency and accuracy of text enhancement are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 This is a flowchart of an artificial intelligence-based text classification method provided in Example 1 of the present invention.

[0045] Figure 2 It is a structural diagram of an artificial intelligence-based text classification device provided in Embodiment 2 of the present invention.

[0046] Figure 3 It is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0047] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0049] Embodiment 1

[0050] Figure 1 This is a flowchart of an artificial intelligence-based text classification method provided in Example 1 of the present invention.

[0051] In this embodiment, the artificial intelligence-based text classification method can be applied to electronic devices. For electronic devices that need to perform artificial intelligence-based text classification, the artificial intelligence-based text classification function provided by the method of the present invention can be directly integrated into the electronic device, or run in the electronic device in the form of a software development kit (Software Development Kit, SDK).

[0052] The embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0053] The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. Artificial intelligence software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, as well as machine learning and deep learning.

[0054] like Figure 1 As shown, the artificial intelligence-based text classification method specifically includes the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some can be omitted.

[0055] S11, parsing the received text classification request and constructing a search space, wherein the search space includes multiple text enhancement strategies.

[0056] In this embodiment, when the user performs text classification, the user initiates a text classification request to the server through the client. Specifically, the client can be a smart phone, an IPAD or other existing smart devices, and the server can be a text classification subsystem. During the text classification process, the client can send a text classification request to the text classification subsystem. The text classification subsystem is used to receive the text classification request sent by the client, parse the text classification request, and build a search space according to the parsing result.

[0057] In an optional embodiment, the parsing the received text classification request and constructing a search space includes:

[0058] Parse the received text classification request and obtain four types of hyperparameters: category label, operation type, probability value of application type, and the proportion of words with application operations in each text;

[0059] Performing a combination operation on the four types of hyperparameters to obtain a plurality of text enhancement strategies, wherein each of the text enhancement strategies is composed of the four types of hyperparameters;

[0060] A search space is constructed based on the multiple text enhancement strategies.

[0061] In this embodiment, if the text classification request contains 5 category labels, 4 operation types, probability values ​​of 11 application types, and proportions of words of 11 application operations, the constructed search space contains 5×4×11×11=2420 text enhancement strategies.

[0062] Specifically, the category labels refer to texts of the same type.

[0063] Specifically, the operation type includes one or a combination of the following modes: synonym replacement, random insertion, random exchange, and random deletion.

[0064] In this embodiment, the probability of the application type refers to the probability of text enhancement, which can be discretized into 11 values ​​of 0-1, where the interval between 0-1 is set to 0.1; the proportion of words applied to the operation refers to the proportion of words selected from each text, which can be discretized into 11 values ​​of 0-0.5, where the interval between 0-0.5 is set to 0.05.

[0065] In this embodiment, a search space is constructed by adopting all text enhancement strategies corresponding to the text classification request, thereby ensuring the integrity of the text enhancement strategies in the search space and improving the accuracy of the optimal text enhancement strategy subsequently selected from the search space.

[0066] S12, randomly selecting a text enhancement strategy from the search space using a preset search strategy as a target text enhancement strategy, wherein the preset search strategy includes a controller.

[0067] In this embodiment, the preset search strategy may be an ENAS (Efficient Neural Architecture Search) search strategy, which efficiently implements the exploration of the neural network model structure by sharing model parameters. Specifically, the preset search strategy uses a controller, which is an RNN model, and the RNN model determines the calculation type of each node and selects the activated edge.

[0068] In an optional embodiment, the method of randomly selecting a text enhancement strategy from the search space using a preset search strategy as a target text enhancement strategy includes:

[0069] The multiple text enhancement strategies are input into the controller of the preset search strategy, the controller randomly selects a hyperparameter of any type of hyperparameters from the multiple text enhancement strategies as an input parameter of the current time step of the controller, inputs the input parameter of the current time step into the controller, and outputs an output value of the current time step;

[0070] The controller randomly selects a hyperparameter from any remaining hyperparameter category from the multiple text enhancement strategies as an input parameter for a next time step, uses the first input parameter for the next time step and the output value of the current time step as target input parameters for the next time step, inputs the target input parameter for the next time step into the controller, and outputs the output value for the next time step;

[0071] The selection of the four types of hyperparameters and the determination of the input parameters are executed cyclically until the output parameters corresponding to each of the hyperparameters are obtained, and the four output values ​​corresponding to the four types of hyperparameters are determined as the target text enhancement strategy.

[0072] In this embodiment, the controller has an input at each time step. In this embodiment, there are four hyperparameters. Each time step corresponds to any one of the four hyperparameters. The output parameter of each time step is input into the value controller, and the output value corresponding to each hyperparameter is obtained through the Softmax layer of the controller. Since the input parameter of the next time step of the controller is jointly determined by the output value of the previous time step and the input parameter of the next time step, the previous output also has an impact on the next text processing, which improves the relevance of the text, ensures the reliability of the output value of each hyperparameter, and improves the accuracy of the randomly selected text enhancement strategy.

[0073] S13, using the target text enhancement strategy to perform text enhancement on each text in the original text set in the text classification request to obtain a first enhanced text set.

[0074] In this embodiment, the text classification request also includes an original text set, and the original text set includes multiple texts.

[0075] In an optional embodiment, before performing text enhancement on each text in the original text set in the text classification request using the target text enhancement strategy to obtain a first enhanced text set, the method further includes:

[0076] Each text in the original text set is cleaned according to a preset text cleaning strategy.

[0077] In this embodiment, a text cleaning strategy can be pre-set, and the preset text cleaning strategy can be used to clean text with inconsistent display formats such as time, date, numerical value, full-width and half-width, characters that should not exist in the content, and text that does not match the content of the field.

[0078] In this embodiment, by cleaning each text in the original text set, factors interfering with subsequent text enhancement are reduced, thereby improving the efficiency and accuracy of text enhancement.

[0079] In an optional embodiment, using the target text enhancement strategy to perform text enhancement on each text in the original text set in the text classification request to obtain a first enhanced text set includes:

[0080] Identify an output value corresponding to each hyperparameter in the target text enhancement strategy;

[0081] Based on the output value corresponding to each of the hyperparameters, text enhancement is performed on each text in the original text set to obtain a first enhanced text.

[0082] Exemplarily, if the hyperparameters included in the target text enhancement strategy are: the category label is Class A, the output value corresponding to the operation type is: random deletion, the output value corresponding to the proportion of words to which the operation is applied is: 0.2, the probability of the application type is: 1, and a text in the original text set is: "I am Chinese", the first enhanced text obtained by using the target text enhancement strategy is: "I am China" or "I am Chinese" or "I am Chinese".

[0083] Exemplarily, if the hyperparameters included in the target text enhancement strategy are: the category label is Class A, the output value corresponding to the operation type is: random deletion, the output value corresponding to the proportion of words to which the operation is applied is: 0.4, the probability of the application type is: 1, and a text in the original text set is: "I am Chinese", the first enhanced text obtained by using the target text enhancement strategy is: "I am Chinese" or "I am Chinese" or "my countrymen" or "I am China" or "I am a Chinese" or "Chinese".

[0084] In this embodiment, data enhancement technology is widely used to effectively utilize limited annotated corpus to improve the efficiency of the model and reduce the dependence on the amount of annotated data. This embodiment uses a randomly selected target text enhancement strategy to perform text enhancement on each text in the original text set, thereby ensuring the diversity and completeness of the text set in the neural network preset by the subsequent input value. In particular, for small sample data sets and data sets with unbalanced categories, the text enhancement strategy can be used to enhance the data volume of the small sample data set and enhance the data set with unbalanced categories to a balanced level, thereby improving the effectiveness and robustness of the model subsequently trained with the enhanced data set. At the same time, by using a randomly selected target text enhancement strategy to perform text enhancement on each text in the original text set, there is no need for manual annotation, and no need to consume a lot of manpower and time, thereby improving the efficiency and accuracy of text enhancement.

[0085] S14, inputting the original text set and the first enhanced text set into a preset neural network for training to obtain a first text classification model.

[0086] In this embodiment, a neural network can be preset, and the preset neural network can be an existing convolutional neural network or an inverse graph network, etc. After obtaining the original text set and the first enhanced text set, a text classification model is trained based on the original text set and the first enhanced file set.

[0087] S15, inputting the verification set in the text classification request into the first text classification model for verification, and calculating the verification pass rate.

[0088] In this embodiment, the text classification request also includes a verification set. After the first text classification model is trained, the pass rate of the first text classification model is calculated based on the verification set. Whether the first text classification model is stable can be determined based on the verification pass rate.

[0089] S16, determining a target text classification model and an optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate.

[0090] In this embodiment, the target text classification model refers to the text classification model corresponding to the verification pass rate, and the optimal text enhancement strategy refers to the verification pass rate of the trained target text classification model obtained after text enhancement using the selected text enhancement strategy, so that the verification pass rate reaches the preset convergence condition in the text classification request. Specifically, the preset convergence condition refers to whether the controller can be determined based on the verification pass rate. Only when the controller converges, the obtained text enhancement strategy is determined as the optimal text enhancement strategy. For example, the preset convergence condition may be that the verification pass rate is greater than or equal to a preset verification pass rate threshold, or that the verification pass rate on the text classification model is no longer improved by the optimal text enhancement strategy.

[0091] In an optional embodiment, determining the target text classification model and the optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate includes:

[0092] When the verification pass rate satisfies a preset convergence condition in the text classification request, determining the first text classification model as a target text classification model and determining the target text enhancement strategy as an optimal text enhancement strategy; or

[0093] When the verification pass rate does not meet the preset convergence condition in the text classification request, the model parameters in the controller are updated based on the verification pass rate to obtain an updated controller, the updated controller is used to randomly select a new text addition strategy from the search space as a new target text enhancement strategy, and the original text set is enhanced using the new target text enhancement strategy to obtain a second enhanced text set, and the original text set and the second enhanced file set are input into the preset neural network for training to obtain a second text classification model, the verification set in the text classification request is input into the second text classification model for verification, and the verification pass rate is calculated, and the updating of the model parameters in the controller according to the verification pass rate to reselect a new text enhancement strategy for text enhancement is repeated to obtain the verification pass rate, until the verification pass rate meets the preset convergence condition corresponding to the controller, the text classification model corresponding to the verification pass rate is determined as the target text classification model, and the new target text enhancement strategy corresponding to the verification pass rate is determined as the optimal text enhancement strategy.

[0094] In this embodiment, the second enhanced text set is obtained by updating the text enhancement strategy in the controller and then adopting a new text enhancement strategy.

[0095] In this embodiment, by constructing a search space and adopting a preset search strategy, an optimal text enhancement strategy is customized and searched for each data set, thereby improving the accuracy of text classification.

[0096] S17, using the optimal text enhancement strategy to perform text enhancement on the text set to be classified in the text classification request to obtain a third enhanced text set, and inputting the third enhanced text set and the text set to be classified into the target text classification model to obtain a text classification result.

[0097] In this embodiment, the optimal text enhancement strategy is determined by constructing a search space, using a preset search strategy to search for a target text enhancement strategy, and based on the verification pass rate of the target text enhancement strategy in the target text classification model. The optimal text enhancement strategy is not obtained through artificial setting of hyperparameters through artificial experience and a large number of comparative experiments, but is obtained by searching using a search strategy, thereby improving the accuracy and efficiency of the determined optimal text enhancement strategy.

[0098] In this embodiment, the optimal text enhancement strategy and the target text classification model are determined by adopting a search strategy, and the optimal text enhancement strategy is used to perform text enhancement on the text set to be classified, ensuring that the obtained third enhanced text set is the most stable. At the same time, the text set to be classified and the third enhanced text set are input into the target text classification model for text classification, thereby improving the accuracy of text classification.

[0099] In summary, the artificial intelligence-based text classification method described in this embodiment, on the one hand, constructs a search space by adopting all the text enhancement strategies corresponding to the text classification request, thereby ensuring the integrity of the text enhancement strategies in the search space and improving the accuracy of the optimal text enhancement strategy subsequently selected from the search space; on the other hand, a controller in a preset search strategy is adopted to randomly select a text enhancement strategy from the search space. Since the input parameters of the next time step of the controller are jointly determined by the output value of the previous time step and the input parameters of the next time step, when the next text is processed, the previous output also has an impact on it, thereby improving the relevance of the text, ensuring the reliability of the output value of each hyperparameter obtained, and improving the accuracy of the randomly selected text enhancement strategy; finally, by adopting a randomly selected target text enhancement strategy to perform text enhancement on each text in the original text set, there is no need for manual annotation, and no need to consume a lot of manpower and time, thereby improving the efficiency and accuracy of text enhancement.

[0100] Embodiment 2

[0101] Figure 2 It is a structural diagram of an artificial intelligence-based text classification device provided in Embodiment 2 of the present invention.

[0102] In some embodiments, the artificial intelligence-based text classification device 20 may include a plurality of functional modules composed of program code segments. The program code of each program segment in the artificial intelligence-based text classification device 20 may be stored in a memory of the electronic device and executed by the at least one processor to perform (see Figure 1 Description) Function of text classification based on artificial intelligence.

[0103] In this embodiment, the text classification device 20 based on artificial intelligence can be divided into multiple functional modules according to the functions it performs. The functional modules may include: a parsing module 201, a selection module 202, a text enhancement module 203, a first input module 204, a verification module 205, a determination module 206 and a second input module 207. The module referred to in the present invention refers to a series of computer-readable instruction segments that can be executed by at least one processor and can complete fixed functions, which are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0104] The parsing module 201 is used to parse the received text classification request and construct a search space, wherein the search space includes multiple text enhancement strategies.

[0105] In this embodiment, when the user performs text classification, the user initiates a text classification request to the server through the client. Specifically, the client can be a smart phone, an IPAD or other existing smart devices, and the server can be a text classification subsystem. During the text classification process, the client can send a text classification request to the text classification subsystem. The text classification subsystem is used to receive the text classification request sent by the client, parse the text classification request, and build a search space according to the parsing result.

[0106] In an optional embodiment, the parsing module 201 parses the received text classification request, and constructs a search space including:

[0107] Parse the received text classification request and obtain four types of hyperparameters: category label, operation type, probability value of application type, and the proportion of words with application operations in each text;

[0108] Performing a combination operation on the four types of hyperparameters to obtain a plurality of text enhancement strategies, wherein each of the text enhancement strategies is composed of the four types of hyperparameters;

[0109] A search space is constructed based on the multiple text enhancement strategies.

[0110] In this embodiment, if the text classification request contains 5 category labels, 4 operation types, probability values ​​of 11 application types, and proportions of words of 11 application operations, the constructed search space contains 5×4×11×11=2420 text enhancement strategies.

[0111] Specifically, the category labels refer to texts of the same type.

[0112] Specifically, the operation type includes one or a combination of the following modes: synonym replacement, random insertion, random exchange, and random deletion.

[0113] In this embodiment, the probability of the application type refers to the probability of text enhancement, which can be discretized into 11 values ​​of 0-1, where the interval between 0-1 is set to 0.1; the proportion of words applied to the operation refers to the proportion of words selected from each text, which can be discretized into 11 values ​​of 0-0.5, where the interval between 0-0.5 is set to 0.05.

[0114] In this embodiment, a search space is constructed by adopting all text enhancement strategies corresponding to the text classification request, thereby ensuring the integrity of the text enhancement strategies in the search space and improving the accuracy of the optimal text enhancement strategy subsequently selected from the search space.

[0115] The selection module 202 is used to randomly select a text enhancement strategy from the search space using a preset search strategy as a target text enhancement strategy, wherein the preset search strategy includes a controller.

[0116] In this embodiment, the preset search strategy may be an ENAS (Efficient Neural Architecture Search) search strategy, which efficiently implements the exploration of the neural network model structure by sharing model parameters. Specifically, the preset search strategy uses a controller, which is an RNN model, and the RNN model determines the calculation type of each node and selects the activated edge.

[0117] In an optional embodiment, the selection module 202 uses a preset search strategy to randomly select a text enhancement strategy from the search space as the target text enhancement strategy including:

[0118] The multiple text enhancement strategies are input into the controller of the preset search strategy, the controller randomly selects a hyperparameter of any type of hyperparameters from the multiple text enhancement strategies as an input parameter of the current time step of the controller, inputs the input parameter of the current time step into the controller, and outputs an output value of the current time step;

[0119] The controller randomly selects a hyperparameter from any remaining hyperparameter category from the multiple text enhancement strategies as an input parameter for a next time step, uses the first input parameter for the next time step and the output value of the current time step as target input parameters for the next time step, inputs the target input parameter for the next time step into the controller, and outputs the output value for the next time step;

[0120] The selection of the four types of hyperparameters and the determination of the input parameters are executed cyclically until the output parameters corresponding to each of the hyperparameters are obtained, and the four output values ​​corresponding to the four types of hyperparameters are determined as the target text enhancement strategy.

[0121] In this embodiment, the controller has an input at each time step. In this embodiment, there are four hyperparameters. Each time step corresponds to any one of the four hyperparameters. The output parameter of each time step is input into the value controller, and the output value corresponding to each hyperparameter is obtained through the Softmax layer of the controller. Since the input parameter of the next time step of the controller is jointly determined by the output value of the previous time step and the input parameter of the next time step, the previous output also has an impact on the next text processing, which improves the relevance of the text, ensures the reliability of the output value of each hyperparameter, and improves the accuracy of the randomly selected text enhancement strategy.

[0122] The text enhancement module 203 is configured to perform text enhancement on each text in the original text set in the text classification request using the target text enhancement strategy to obtain a first enhanced text set.

[0123] In this embodiment, the text classification request also includes an original text set, and the original text set includes multiple texts.

[0124] In an optional embodiment, before the text enhancement module 203 uses the target text enhancement strategy to perform text enhancement on each text in the original text set in the text classification request to obtain the first enhanced text set, the method further includes:

[0125] Each text in the original text set is cleaned according to a preset text cleaning strategy.

[0126] In this embodiment, a text cleaning strategy can be pre-set, and the preset text cleaning strategy can be used to clean text with inconsistent display formats such as time, date, numerical value, full-width and half-width, characters that should not exist in the content, and text that does not match the content of the field.

[0127] In this embodiment, by cleaning each text in the original text set, factors interfering with subsequent text enhancement are reduced, thereby improving the efficiency and accuracy of text enhancement.

[0128] In an optional embodiment, the text enhancement module 203 uses the target text enhancement strategy to perform text enhancement on each text in the original text set in the text classification request, and obtains a first enhanced text set including:

[0129] Identify an output value corresponding to each hyperparameter in the target text enhancement strategy;

[0130] Based on the output value corresponding to each of the hyperparameters, text enhancement is performed on each text in the original text set to obtain a first enhanced text.

[0131] Exemplarily, if the hyperparameters included in the target text enhancement strategy are: the category label is Class A, the output value corresponding to the operation type is: random deletion, the output value corresponding to the proportion of words to which the operation is applied is: 0.2, the probability of the application type is: 1, and a text in the original text set is: "I am Chinese", the first enhanced text obtained by using the target text enhancement strategy is: "I am China" or "I am Chinese" or "I am Chinese".

[0132] Exemplarily, if the hyperparameters included in the target text enhancement strategy are: the category label is Class A, the output value corresponding to the operation type is: random deletion, the output value corresponding to the proportion of words to which the operation is applied is: 0.4, the probability of the application type is: 1, and a text in the original text set is: "I am Chinese", the first enhanced text obtained by using the target text enhancement strategy is: "I am Chinese" or "I am Chinese" or "my countrymen" or "I am China" or "I am a Chinese" or "Chinese".

[0133] In this embodiment, data enhancement technology is widely used to effectively utilize limited annotated corpus to improve the efficiency of the model and reduce the dependence on the amount of annotated data. This embodiment uses a randomly selected target text enhancement strategy to perform text enhancement on each text in the original text set, thereby ensuring the diversity and completeness of the text set in the neural network preset by the subsequent input value. In particular, for small sample data sets and data sets with unbalanced categories, the text enhancement strategy can be used to enhance the data volume of the small sample data set and enhance the data set with unbalanced categories to a balanced level, thereby improving the effectiveness and robustness of the model subsequently trained with the enhanced data set. At the same time, by using a randomly selected target text enhancement strategy to perform text enhancement on each text in the original text set, there is no need for manual annotation, and no need to consume a lot of manpower and time, thereby improving the efficiency and accuracy of text enhancement.

[0134] The first input module 204 is used to input the original text set and the first enhanced text set into a preset neural network for training to obtain a first text classification model.

[0135] In this embodiment, a neural network can be preset, and the preset neural network can be an existing convolutional neural network or an inverse graph network, etc. After obtaining the original text set and the first enhanced text set, a text classification model is trained based on the original text set and the first enhanced file set.

[0136] The verification module 205 is used to input the verification set in the text classification request into the first text classification model for verification and calculate the verification pass rate.

[0137] In this embodiment, the text classification request also includes a verification set. After the first text classification model is trained, the pass rate of the first text classification model is calculated based on the verification set. Whether the first text classification model is stable can be determined based on the verification pass rate.

[0138] The determination module 206 is used to determine the target text classification model and the optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate.

[0139] In this embodiment, the target text classification model refers to the text classification model corresponding to the verification pass rate, and the optimal text enhancement strategy refers to the verification pass rate of the trained target text classification model obtained after text enhancement using the selected text enhancement strategy, so that the verification pass rate reaches the preset convergence condition in the text classification request. Specifically, the preset convergence condition refers to whether the controller can be determined based on the verification pass rate. Only when the controller converges, the obtained text enhancement strategy is determined as the optimal text enhancement strategy. For example, the preset convergence condition may be that the verification pass rate is greater than or equal to a preset verification pass rate threshold, or that the verification pass rate on the text classification model is no longer improved by the optimal text enhancement strategy.

[0140] In an optional embodiment, the determination module 206 determines the target text classification model and the optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate, including:

[0141] When the verification pass rate satisfies a preset convergence condition in the text classification request, determining the first text classification model as a target text classification model and determining the target text enhancement strategy as an optimal text enhancement strategy; or

[0142] When the verification pass rate does not meet the preset convergence condition in the text classification request, the model parameters in the controller are updated based on the verification pass rate to obtain an updated controller, the updated controller is used to randomly select a new text addition strategy from the search space as a new target text enhancement strategy, and the original text set is enhanced using the new target text enhancement strategy to obtain a second enhanced text set, and the original text set and the second enhanced file set are input into the preset neural network for training to obtain a second text classification model, the verification set in the text classification request is input into the second text classification model for verification, and the verification pass rate is calculated, and the updating of the model parameters in the controller according to the verification pass rate to reselect a new text enhancement strategy for text enhancement is repeated to obtain the verification pass rate, until the verification pass rate meets the preset convergence condition corresponding to the controller, the text classification model corresponding to the verification pass rate is determined as the target text classification model, and the new target text enhancement strategy corresponding to the verification pass rate is determined as the optimal text enhancement strategy.

[0143] In this embodiment, the second enhanced text set is obtained by updating the text enhancement strategy in the controller and then adopting a new text enhancement strategy.

[0144] In this embodiment, by constructing a search space and adopting a preset search strategy, an optimal text enhancement strategy is customized and searched for each data set, thereby improving the accuracy of text classification.

[0145] The second input module 207 is used to perform text enhancement on the text set to be classified in the text classification request by adopting the optimal text enhancement strategy to obtain a third enhanced text set, and input the third enhanced text set and the text set to be classified into the target text classification model to obtain a text classification result.

[0146] In this embodiment, the optimal text enhancement strategy is determined by constructing a search space, using a preset search strategy to search for a target text enhancement strategy, and based on the verification pass rate of the target text enhancement strategy in the target text classification model. The optimal text enhancement strategy is not obtained through artificial setting of hyperparameters through artificial experience and a large number of comparative experiments, but is obtained by searching using a search strategy, thereby improving the accuracy and efficiency of the determined optimal text enhancement strategy.

[0147] In this embodiment, the optimal text enhancement strategy and the target text classification model are determined by adopting a search strategy, and the optimal text enhancement strategy is used to perform text enhancement on the text set to be classified, ensuring that the obtained third enhanced text set is the most stable. At the same time, the text set to be classified and the third enhanced text set are input into the target text classification model for text classification, thereby improving the accuracy of text classification.

[0148] In summary, the artificial intelligence-based text classification device described in this embodiment, on the one hand, constructs a search space by adopting all the text enhancement strategies corresponding to the text classification request, thereby ensuring the integrity of the text enhancement strategies in the search space and improving the accuracy of the optimal text enhancement strategy subsequently selected from the search space; on the other hand, a controller in a preset search strategy is adopted to randomly select a text enhancement strategy from the search space. Since the input parameters of the next time step of the controller are jointly determined by the output value of the previous time step and the input parameters of the next time step, when the next text is processed, the previous output also has an impact on it, thereby improving the relevance of the text, ensuring the reliability of the output value of each hyperparameter obtained, and improving the accuracy of the randomly selected text enhancement strategy; finally, by adopting a randomly selected target text enhancement strategy to perform text enhancement on each text in the original text set, there is no need for manual annotation, and no need to consume a lot of manpower and time, thereby improving the efficiency and accuracy of text enhancement.

[0149] Embodiment 3

[0150] See also Figure 3 FIG. 2 is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. In a preferred embodiment of the present invention, the electronic device 3 includes a memory 31 , at least one processor 32 , at least one communication bus 33 and a transceiver 34 .

[0151] Those skilled in the art should understand that Figure 3 The structure of the electronic device shown does not constitute a limitation of the embodiments of the present invention, and may be a bus structure or a star structure. The electronic device 3 may also include more or less other hardware or software than shown in the figure, or a different component arrangement.

[0152] In some embodiments, the electronic device 3 is an electronic device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices. The electronic device 3 may also include client devices, which include but are not limited to any electronic product that can interact with a client through a keyboard, mouse, remote control, touchpad, or voice-controlled device, such as a personal computer, tablet computer, smart phone, digital camera, etc.

[0153] It should be noted that the electronic device 3 is only an example, and other existing or future electronic products that are suitable for the present invention should also be included in the protection scope of the present invention and included here by reference.

[0154] In some embodiments, the memory 31 is used to store program codes and various data, such as the artificial intelligence-based text classification device 20 installed in the electronic device 3, and to achieve high-speed and automatic access to programs or data during the operation of the electronic device 3. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0155] In some embodiments, the at least one processor 32 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The at least one processor 32 is the control core (Control Unit) of the electronic device 3, and uses various interfaces and lines to connect various components of the entire electronic device 3, and executes various functions and processes data of the electronic device 3 by running or executing programs or modules stored in the memory 31, and calling data stored in the memory 31.

[0156] In some embodiments, the at least one communication bus 33 is configured to implement connection and communication between the memory 31 and the at least one processor 32, etc.

[0157] Although not shown, the electronic device 3 may also include a power source (such as a battery) for supplying power to each component. Optionally, the power source may be logically connected to the at least one processor 32 through a power management device, so that the power management device can manage charging, discharging, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 3 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0158] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0159] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, electronic device, or network device, etc.) or a processor to execute a part of the method described in each embodiment of the present invention.

[0160] In a further embodiment, in combination Figure 2 The at least one processor 32 can execute the operating device of the electronic device 3 and various installed application programs (such as the artificial intelligence-based text classification device 20), program codes, etc., for example, the above-mentioned modules.

[0161] The memory 31 stores program codes, and the at least one processor 32 can call the program codes stored in the memory 31 to execute related functions. For example, Figure 2 The modules described are program codes stored in the memory 31 and are executed by the at least one processor 32, thereby realizing the functions of the modules to achieve the purpose of text classification based on artificial intelligence.

[0162] Exemplarily, the program code may be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 32 to complete the present application. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the program code in the electronic device 3. For example, the program code may be divided into a parsing module 201, a selection module 202, a text enhancement module 203, a first input module 204, a verification module 205, a determination module 206, and a second input module 207.

[0163] In one embodiment of the present invention, the memory 31 stores a plurality of computer-readable instructions, and the plurality of computer-readable instructions are executed by the at least one processor 32 to implement the function of text classification based on artificial intelligence.

[0164] Specifically, the specific implementation method of the at least one processor 32 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0165] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0166] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0167] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0168] It is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "including" does not exclude other units or, and the singular does not exclude the plural. The multiple units or devices stated in the present invention can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0169] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A text classification method based on artificial intelligence, characterized in that: The method comprises: Parsing the received text classification request and constructing a search space, wherein the search space includes a plurality of text enhancement strategies; A preset search strategy is adopted to randomly select a text enhancement strategy from the search space as a target text enhancement strategy, wherein the preset search strategy includes a controller, including: inputting the multiple text enhancement strategies into the controller of the preset search strategy, the controller randomly selects a hyperparameter of any one type of hyperparameters from the multiple text enhancement strategies as an input parameter of the current time step of the controller, inputs the input parameter of the current time step into the controller, and outputs an output value of the current time step; the controller randomly selects a hyperparameter of any one type of remaining hyperparameters from the multiple text enhancement strategies as an input parameter of the next time step, uses the first input parameter of the next time step and the output value of the current time step as the target input parameter of the next time step, inputs the target input parameter of the next time step into the controller, and outputs an output value of the next time step; the selection of four types of hyperparameters and the determination of input parameters are cyclically executed until the output parameter corresponding to each of the hyperparameters is obtained, and the four output values ​​corresponding to the four types of hyperparameters are determined as the target text enhancement strategy; Perform text enhancement on each text in the original text set in the text classification request using the target text enhancement strategy to obtain a first enhanced text set; Inputting the original text set and the first enhanced text set into a preset neural network for training to obtain a first text classification model; Inputting the verification set in the text classification request into the first text classification model for verification, and calculating the verification pass rate; Determining a target text classification model and an optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate; The optimal text enhancement strategy is used to perform text enhancement on the text set to be classified in the text classification request to obtain a third enhanced text set, and the third enhanced text set and the text set to be classified are input into the target text classification model to obtain a text classification result.

2. The text classification method based on artificial intelligence as claimed in claim 1, characterized in that: The parsing of the received text classification request and constructing a search space includes: Parse the received text classification request and obtain four types of hyperparameters: category label, operation type, probability value of application type, and the proportion of words with application operations in each text; Performing a combination operation on the four types of hyperparameters to obtain a plurality of text enhancement strategies, wherein each of the text enhancement strategies is composed of the four types of hyperparameters; A search space is constructed based on the multiple text enhancement strategies.

3. The text classification method based on artificial intelligence as claimed in claim 2, characterized in that: The operation type includes one or a combination of the following modes: synonym replacement, random insertion, random exchange, and random deletion.

4. The text classification method based on artificial intelligence as claimed in claim 1, characterized in that: The step of using the target text enhancement strategy to perform text enhancement on each text in the original text set in the text classification request to obtain a first enhanced text set includes: Identify an output value corresponding to each hyperparameter in the target text enhancement strategy; Based on the output value corresponding to each of the hyperparameters, text enhancement is performed on each text in the original text set to obtain a first enhanced text.

5. The text classification method based on artificial intelligence as claimed in claim 4, characterized in that: Determining the target text classification model and the optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate includes: When the verification pass rate satisfies a preset convergence condition in the text classification request, the first text classification model is determined as a target text classification model and the target text enhancement strategy is determined as an optimal text enhancement strategy.

6. The text classification method based on artificial intelligence as claimed in claim 5, characterized in that: The method further comprises: When the verification pass rate does not meet the preset convergence condition in the text classification request, updating the model parameters in the controller based on the verification pass rate to obtain an updated controller; Using the updated controller to randomly select a new text addition strategy from the search space as a new target text enhancement strategy, and using the new target text enhancement strategy to perform text enhancement on the original text set to obtain a second enhanced text set; Inputting the original text set and the second enhanced file set into the preset neural network for training to obtain a second text classification model, inputting the verification set in the text classification request into the second text classification model for verification, and calculating the verification pass rate; Repeat the step of updating the model parameters in the controller according to the verification pass rate and reselecting a new text enhancement strategy for text enhancement to obtain the verification pass rate, until the verification pass rate satisfies the preset convergence condition corresponding to the controller, determine the text classification model corresponding to the verification pass rate as the target text classification model, and determine the new target text enhancement strategy corresponding to the verification pass rate as the optimal text enhancement strategy.

7. A text classification device based on artificial intelligence, characterized in that: The device is used to implement the artificial intelligence-based text classification method according to any one of claims 1 to 6, and the device comprises: A parsing module, used to parse the received text classification request and construct a search space, wherein the search space includes multiple text enhancement strategies; A selection module, used to randomly select a text enhancement strategy from the search space using a preset search strategy as a target text enhancement strategy, wherein the preset search strategy includes a controller; A text enhancement module, configured to perform text enhancement on each text in an original text set in a text classification request using the target text enhancement strategy to obtain a first enhanced text set; A first input module, used for inputting the original text set and the first enhanced text set into a preset neural network for training to obtain a first text classification model; A verification module, used for inputting the verification set in the text classification request into the first text classification model for verification, and calculating the verification pass rate; A determination module, used to determine a target text classification model and an optimal text enhancement strategy corresponding to the text classification request according to the verification pass rate; The second input module is used to perform text enhancement on the text set to be classified in the text classification request by adopting the optimal text enhancement strategy to obtain a third enhanced text set, and input the third enhanced text set and the text set to be classified into the target text classification model to obtain a text classification result.

8. An electronic device, characterized in that: The electronic device includes a processor and a memory, and the processor is used to implement the artificial intelligence-based text classification method as described in any one of claims 1 to 6 when executing the computer program stored in the memory.

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