WO2020073507A1 - 一种文本分类方法及终端 - Google Patents
一种文本分类方法及终端 Download PDFInfo
- Publication number
- WO2020073507A1 WO2020073507A1 PCT/CN2018/124300 CN2018124300W WO2020073507A1 WO 2020073507 A1 WO2020073507 A1 WO 2020073507A1 CN 2018124300 W CN2018124300 W CN 2018124300W WO 2020073507 A1 WO2020073507 A1 WO 2020073507A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- text
- target
- classification
- classification model
- target text
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/35—Clustering; Classification
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- This application belongs to the field of computer technology, and particularly relates to a text classification method and terminal.
- Text analysis refers to the selection of text representation and its feature items; text analysis is a basic problem of text mining and information retrieval. It quantifies the feature words extracted from the text to represent the text information. Since the semantics of the text will inevitably reflect people's specific positions, opinions, values and interests, the analysis of the text content can infer the intention and purpose of the text provider, so as to classify the text.
- Neural network for example, Convolutional Neural Network (Convolutional Neural Network, CNN), Recurrent Neural Network (Recurrent Neural Network, RNN).
- the classification results obtained by text analysis using the existing neural network-based text classification method are not accurate.
- Embodiments of the present application provide a text classification method and terminal, to solve the problem that the existing neural network-based text classification method is used for text analysis in a scenario where the text is multi-category and independent and not mutually exclusive. The problem of inaccurate classification results.
- a first aspect of an embodiment of the present application provides a text classification method, including:
- the multi-classification model is composed of a recurrent neural network and a plurality of the two classifiers, and the recurrent neural network is used to extract input Feature data of the text data of the recurrent neural network, the two classifiers are used to process the feature data and output the classification results;
- the multi-classification model Pre-train the multi-classification model based on the text sample set, and input the word vector corresponding to the target text into the multi-classification model that has completed training to output the text classification result corresponding to the target text; the text
- the classification result is used to identify at least two independent and non-mutually exclusive target text categories to which the target text belongs, and the identification of the target text category is determined from the plurality of text category identifiers.
- a second aspect of the embodiments of the present application provides a terminal, including:
- An obtaining unit used to obtain target text to be processed, and obtain multiple text category identifiers to be classified;
- a conversion unit configured to convert the target text into a word vector
- a determining unit configured to determine the number of two classifiers included in the multi-classification model according to the number of text category identifiers;
- the multi-classification model is composed of a recurrent neural network and a plurality of the two classifiers, and the recurrent neural network uses To extract feature data of text data input to the recurrent neural network, a plurality of the two classifiers are used to process the feature data and output a classification result;
- the classification unit is used to pre-train the multi-classification model based on the text sample set, and input the word vector corresponding to the target text into the multi-classification model that has been trained to process, and output the text classification corresponding to the target text Results; the text classification result is used to identify at least two independent and non-mutually exclusive target text categories to which the target text belongs, and the identification of the target text category is determined from the plurality of text category identifiers.
- a third aspect of the embodiments of the present application provides a terminal, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor.
- the processor executes the computer The following steps are realized when reading instructions:
- the multi-classification model is composed of a recurrent neural network and a plurality of the two classifiers, and the recurrent neural network is used to extract input Feature data of the text data of the recurrent neural network, and a plurality of the two classifiers are used to process the feature data and output classification results;
- the multi-classification model Pre-train the multi-classification model based on the text sample set, and input the word vector corresponding to the target text into the multi-classification model that has completed training to output the text classification result corresponding to the target text; the text
- the classification result is used to identify at least two independent and non-mutually exclusive target text categories to which the target text belongs, and the identification of the target text category is determined from the plurality of text category identifiers.
- a fourth aspect of the embodiments of the present application provides a computer nonvolatile readable storage medium, the computer nonvolatile readable storage medium stores computer readable instructions, and the computer readable instructions are executed by a processor The following steps are implemented:
- the multi-classification model is composed of a recurrent neural network and a plurality of the two classifiers, and the recurrent neural network is used to extract input Feature data of the text data of the recurrent neural network, and a plurality of the two classifiers are used to process the feature data and output classification results;
- the multi-classification model Pre-train the multi-classification model based on the text sample set, and input the word vector corresponding to the target text into the multi-classification model that has completed training to output the text classification result corresponding to the target text; the text
- the classification result is used to identify at least two independent and non-mutually exclusive target text categories to which the target text belongs, and the identification of the target text category is determined from the plurality of text category identifiers.
- the number of the two classifiers included in the multi-classification model is determined according to the number of text category identifiers to be classified, and the target text is processed using the multi-classification model that has completed training, and the text classification result corresponding to the target text is output.
- the result is used to identify that the target text belongs to multiple independent and non-mutually exclusive text categories, which can improve the accuracy of the text classification results in scenarios where the text is multi-category and independent and not mutually exclusive.
- FIG. 1 is an implementation flowchart of a text classification method provided by an embodiment of the present application
- FIG. 4 is a schematic diagram of a terminal provided by an embodiment of the present application.
- FIG. 5 is a schematic diagram of a terminal provided by another embodiment of the present application.
- FIG. 1 is a flowchart of a text classification method according to an embodiment of the present application.
- the execution subject of the text classification method in this embodiment is a terminal.
- Terminals include but are not limited to mobile terminals such as smart phones, tablet computers, and wearable devices, and may also be desktop computers.
- the text classification method as shown in the figure may include:
- S101 Acquire target text to be processed, and acquire multiple text category identifiers to be classified.
- the terminal obtains the target text to be processed selected by the user, or the terminal obtains the target text to be processed from the network database, for example, the product description information of a certain merchant's online store is obtained from the network database; or the terminal uses a web crawler (Crawler) technology Get the webpage content, and get the target text from the webpage content.
- the terminal uses a web crawler (Crawler) technology Get the webpage content, and get the target text from the webpage content.
- the multiple text category identifiers to be classified may be preset, or the terminal may extract from the target text.
- the target text is "Children's Large Ultraman and Schoolbag”
- the text category identifiers extracted from the target text by the terminal to be classified are "Altman", "Schoolbag”, and "Children”.
- the plurality of text category identifiers to be classified include identifiers of text categories to which the target text belongs, so that the terminal can determine at least two independent and non-mutually exclusive text categories to which the target text belongs.
- a text category ID set composed of multiple text category IDs belongs to a text category ID set composed of known text category IDs contained in the target text.
- the terminal performs semantic analysis on the target text to analyze the sentence structure of the target text, delete the adverbial components and part of the attributive components in the target text according to the sentence structure of the target text, extract the feature data of the target text; and cut the feature data After processing, N units are obtained, and N units are encoded to obtain N word vectors.
- the feature data of the target text may include nouns and connecting words in the target text, such as "and”, "and”, "or” and so on.
- the nouns in the text are usually the object components corresponding to the target text.
- the nouns in the text can also come from the attributive components in the target text.
- S103 Determine the number of two classifiers included in the multi-classification model according to the number of text category identifiers; the multi-classification model is composed of a recurrent neural network and a plurality of the two classifiers, and the recurrent neural network is used to extract input The feature data of the text data of the recurrent neural network, and a plurality of the two classifiers are used to process the feature data and output a classification result.
- the terminal counts the number of text class identifiers to be classified and identified based on the multiple text class identifiers to be classified and identified, and determines the number of two classifiers included in the multi-classification model based on the number of text class identifiers to be classified and identified.
- the feature data of the text data input to the recurrent neural network may be a vector corresponding to the text, such as a word vector; or it may be unprocessed text.
- the recurrent neural network may include an input layer, a hidden layer, and an output layer.
- the input layer is used to receive input data from the outside, including more than two input layer nodes.
- the input layer nodes of the recurrent neural network can correspond one-to-one with the number of text category identifiers. For example, if a sample data contains 3 text category identifiers, namely text category identifier 1, text category identifier 2 and text category identifier 3, then the number of corresponding input layer nodes of the recurrent neural network should also be 3, respectively Input layer node 1, input layer node 2 and input layer node 3, where input layer node 1 corresponds to text category ID 1, input layer node 2 corresponds to text category ID 2, input layer node 3 corresponds to text category ID 3 .
- the hidden layer is used to process the input data, including more than two hidden layer nodes, and the nodes between the hidden layers are connected, and the input of the hidden layer includes not only the output of the input layer but also the last hidden time The output of the layer.
- the output layer includes an output layer node for processing the data output by the hidden layer using a preset loss function to output the processing result.
- the processing results output by the output layer nodes of the recurrent neural network are used to input multiple two classifiers for training, and the multiple two classifiers output the classification results respectively.
- the two classifiers can be trained using a support vector machine (support vector machine, SVM), or they can be trained by a K-Nearest Neighbor (KNN) classification algorithm.
- SVM support vector machine
- KNN K-Nearest Neighbor
- the SVM and KNN algorithms are existing technologies, and the method of training the two classifiers by using the SVM or KNN algorithm is the existing technology, which will not be repeated here.
- Each binary classifier is used to process the feature data to determine the probability value of the two candidate text classification category identifiers corresponding to the text data.
- the probability values of the two candidate text classification category identifiers select the candidate text with a high probability value
- the classification category identifier is used as the text category identifier corresponding to the text data.
- S103 may include S1031 or S1032.
- the two classifiers include: a two classifier C1 for classifying AB, a target two classifier C2 for classifying AC, and a two classifier C3 for classifying AD, and a classifier C3
- the number of two classifiers is 5.
- S104 Pre-train the multi-classification model based on the text sample set, and input the word vector corresponding to the target text into the multi-classification model that has completed training to output the text classification result corresponding to the target text;
- the text classification result is used to identify at least two independent and non-mutually exclusive target text categories to which the target text belongs, and the identification of the target text category is determined from the plurality of candidate text category identifiers.
- the input of the multi-classification model is text data
- the output of the multi-classification model is the classification result.
- Each sample text in the text sample set contains multiple labeled text category labels.
- the number of training texts in the text sample set can be 500, 1000, etc., without specific restrictions. The more the number of training samples to a certain extent, the more accurate the results are when using the multi-classification model obtained by training to classify.
- the terminal inputs the training text or the corresponding word vector of the training text in the text sample set into the input layer of the recurrent neural network of the multi-classification model, and processes the training text through the recurrent neural network to obtain the feature data of each training text , And input the feature data of each training text into multiple binary classifiers for prediction, to obtain the probability values of multiple text category identifiers, and determine at least two predicted text category labels based on the probability values of multiple text category identifiers, by Compare the error between the predicted text category label and the marked text category label to modify or update the parameters of the multi-class model, such as updating the parameters or weights in the recurrent neural network, and modifying the relevant parameters in the second classifier.
- the multi-classification model completes the training.
- the terminal inputs the word vector corresponding to the target text into the trained multi-classification model, processes the word vector corresponding to the target text through the recurrent neural network in the completed multi-classification model, extracts the feature data of the target text, and combines the target text ’s
- Feature data input is processed in multiple target binary classifiers trained by machine learning algorithms to obtain the probability value of each candidate text category, and each target binary classifier determines the text based on the probability values of the two candidate text categories determined by each
- the text category identification corresponding to the data is based on the text category identification determined by each target two classifier in the multi-classification model to determine at least two independent and non-mutually exclusive target text categories, thereby obtaining the text classification result of the target text.
- At least two independent and non-mutually exclusive target text categories determined from multiple candidate text categories are used to identify at least two independent and non-mutually exclusive target text categories to which the target text belongs.
- Non-mutually exclusive text categories refer to text categories that can exist simultaneously and are not contradictory.
- the terminal identifies the candidate text category with the highest probability value as the classification result output by the two classifiers based on the probability values of the two candidate text categories output by each two classifiers, and performs the classification results output by all target two classifiers Summarize to get multiple independent and non-exclusive classification results.
- the classifier C1 outputs the classification result that the target text belongs to the text category A;
- the text classification result output by the second classifier C2 is that the target text belongs to the text category A ;
- the classification result output by the second classifier C3 is that the target text belongs to the text category A;
- the classification result output by the second classifier C4 is that the target text belongs to the text category B;
- the classification result output by the second classifier C5 is that the target text belongs to the text category B;
- the classification result output by the second classifier C6 is that the target text belongs to the text category C;
- the final classification result of the multi-classification model is that the target text belongs to text category A, text category B, and text category C.
- Text category A, text category B, and text category C are not mutually exclusive.
- FIG. 2 is a specific implementation flowchart of S104 in a text classification method provided by an embodiment of the present application.
- S104 may include S1041 to S1042, as follows:
- the output layer includes an output layer node, which is used to process the data output by the hidden layer using a preset loss function and output the processing result.
- the terminal converts the text samples in the text sample set into word vectors, inputs the word vectors of the text samples into the recurrent neural network in the multi-classification model, and processes the word vectors of the text samples using a preset loss function to obtain the processing result;
- the processing result is input into a plurality of two classifiers, based on the machine learning algorithm and the processing result, a plurality of two classifiers are trained, and the difference between the probability value of the classification result output by the two classifiers and the preset probability value is calculated.
- the value of the loss function within the preset number of trainings for example, 1000
- the difference between the probability value of the classification result output by each two classifiers and the preset probability value is the smallest, it is judged that there is more
- the classification model converges, and the parameters (weights, etc.) of the recurrent neural network and the parameters of the second classifier are used as final parameters, and the multi-classification model completes the training.
- FIG. 3 is a specific implementation flowchart of S1041 in a text classification method provided by an embodiment of the present application.
- S1041 may specifically include S10411 to S10412, as follows:
- S10411 Input a single-column vector matrix composed of word vectors corresponding to the target text into a multi-classification model for training, and output the value of each word vector in the single-column vector matrix.
- each word vector in the single-column vector matrix is 1, and each row of word vectors corresponds to a text category.
- the terminal converts all word vectors corresponding to the target text into a single-column vector matrix, and inputs the single-column vector matrix into the trained multi-classification model for processing, and outputs the value corresponding to each word vector in the single-column vector matrix.
- the method for the terminal to input the single-column vector matrix into the trained multi-classification model is similar to the above method for inputting the word vector corresponding to the target text into the trained multi-classification model for processing. Please refer to the relevant description above. Repeat.
- the terminal inputs a vector matrix of 8 rows and 1 column composed of 8 word vectors into the multi-classification model that has been trained to process, and outputs
- the value corresponding to each word vector in the vector matrix, the word vector in each row corresponds to a text category, and the value corresponding to each word vector represents the probability value that the target text belongs to the text category corresponding to the word vector.
- S10412 Determine a text classification result corresponding to the target text based on the value of each word vector in the single-column vector matrix.
- the terminal When the terminal obtains the value of each word vector in the single-column vector matrix, it selects at least two target word vectors based on the word vector values from high to low, and determines the target based on the text category corresponding to the word vectors in each row
- the target text category corresponding to the word vector recognizes the target text category corresponding to the selected target word vector as the text category to which the target text belongs, thereby obtaining the text classification result of the target text.
- S10412 may be specifically: determining at least two target word vectors based on the value of each of the word vectors in the single-column vector matrix; identifying the text category corresponding to each of the target word vectors as the The target text category to which the target text belongs; wherein, the values of the target word vectors are all greater than or equal to a preset threshold.
- the terminal selects at least two target word vectors with a filtering value greater than a preset threshold (for example, 0.5) from the values corresponding to each word vector in the word vector matrix, and identifies the text categories corresponding to the selected target word vectors as targets The text category to which the text belongs.
- a preset threshold for example, 0.5
- S1042 Input the word vector corresponding to the target text into the multi-classification model that has completed training for processing, and output a text classification result corresponding to the target text.
- the terminal inputs the word vector corresponding to the target text into the trained multi-classification model, processes the word vector corresponding to the target text through the recurrent neural network in the completed multi-classification model, extracts the word vector corresponding to the target text, and extracts the target
- the feature data of the text is input and processed in multiple target binary classifiers trained by a machine learning algorithm to obtain the probability value of each candidate text category.
- Each target binary classifier is based on the probability values of the two candidate text categories determined by each Determine the text category identifier corresponding to the text data.
- the terminal determines at least two independent and non-mutually exclusive target text categories based on the text category identifier determined by each target second classifier in the multi-classification model, thereby obtaining the text classification result of the target text.
- Non-mutually exclusive text categories refer to text categories that can exist simultaneously and are not contradictory.
- the number of the two classifiers included in the multi-classification model is determined according to the number of text category identifiers to be classified, and the target text is processed using the multi-classification model that has completed training, and the text classification result corresponding to the target text is output.
- the result is used to identify that the target text belongs to multiple independent and non-mutually exclusive text categories, which can improve the accuracy of the text classification results in scenarios where the text is multi-category and independent and not mutually exclusive.
- FIG. 4 is a schematic diagram of a terminal according to an embodiment of the present application. Each unit included in the terminal is used to execute each step in the embodiments corresponding to FIG. 1 to FIG. 3. For details, please refer to the relevant descriptions in the embodiments corresponding to FIGS. 1 to 3. For ease of explanation, only parts related to this embodiment are shown.
- the terminal 4 includes:
- An obtaining unit 410 configured to obtain target text to be processed, and obtain multiple text category identifiers to be classified;
- a conversion unit 420 configured to convert the target text into a word vector
- the determining unit 430 is configured to determine the number of two classifiers included in the multi-classification model according to the number of text category identifiers;
- the multi-classification model is composed of a recurrent neural network and a plurality of the two classifiers, the recurrent neural network For extracting feature data of text data input to the recurrent neural network, and a plurality of the two classifiers are used to process the feature data and output classification results;
- the classification unit 440 is used to pre-train the multi-classification model based on the text sample set, and input the word vector corresponding to the target text into the multi-classification model that has been trained for processing, and output text corresponding to the target text Classification result; the text classification result is used to identify at least two independent and non-mutually exclusive target text categories to which the target text belongs, and the identification of the target text category is determined from the plurality of text category identifiers.
- classification unit 440 includes:
- a training unit configured to train the multi-classification model based on the text sample set using a machine learning algorithm and a preset loss function to obtain the multi-classification model that has completed training;
- a text processing unit configured to input the word vector corresponding to the target text into the trained multi-classification model for processing, and output a text classification result corresponding to the target text;
- the value range of m is (0.5, 1), which indicates that the multi-classification model pays more attention to the sample data whose classification probability is between 0.5 and m.
- the text processing unit includes:
- the calculation unit is configured to input a single-column vector matrix composed of word vectors corresponding to the target text into the multi-classification model for training, and output the value of each word vector in the single-column vector matrix;
- the classification result determining unit is configured to determine a text classification result corresponding to the target text based on the value of each word vector in the single-column vector matrix.
- the classification result determination unit is specifically configured to: determine at least two target word vectors based on the value of each of the word vectors in the single-column vector matrix; the values of the target word vectors are all greater than or equal to a preset threshold; The text category corresponding to each of the target word vectors is identified as the target text category to which the target text belongs.
- the determining unit 430 is specifically configured to: when the number of text category identifiers is N, the number of two classifiers included in the multi-classification model is N is a positive integer greater than 2.
- FIG. 5 is a schematic diagram of a device provided by another embodiment of the present application.
- the terminal 5 of this embodiment includes: a processor 50, a memory 51, and computer-readable instructions 52 stored in the memory 51 and executable on the processor 50.
- the processor 50 executes the computer-readable instruction 52
- the steps in the above embodiments of the text classification method of each terminal are implemented, for example, S101 to S104 shown in FIG. 1.
- the processor 50 executes the computer-readable instructions 52
- the functions of the units in the foregoing device embodiments are realized, for example, the functions of the units 410 to 440 shown in FIG.
- the computer-readable instructions 52 may be divided into one or more units, the one or more units are stored in the memory 51, and executed by the processor 50 to complete the application .
- the one or more units may be an instruction segment of a series of computer-readable instructions capable of performing a specific function.
- the instruction segment is used to describe the execution process of the computer-readable instruction 52 in the terminal 5.
- the computer-readable instructions 52 may be divided into an acquisition unit, a conversion unit, a determination unit, and a classification unit, and the specific functions of each unit are as described above.
- the terminal may include, but is not limited to, the processor 50 and the memory 51.
- FIG. 5 is only an example of the terminal 5 and does not constitute a limitation on the terminal 5, and may include more or less components than those illustrated, or combine certain components, or different components, for example
- the terminal may also include input and output devices, network access devices, buses, and the like.
- the so-called processor 50 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- the general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
- the memory 51 may be an internal storage unit of the terminal 5, such as a hard disk or a memory of the terminal 5.
- the memory 51 may also be an external storage terminal of the terminal 5, for example, a plug-in hard disk equipped on the terminal 5, a smart memory card (Smart) Media (SMC), a secure digital (SD) card, Flash card (Flash Card), etc.
- the memory 51 may also include both an internal storage unit of the terminal 5 and an external storage terminal.
- the memory 51 is used to store the computer-readable instructions and other programs and data required by the terminal.
- the memory 51 can also be used to temporarily store data that has been or will be output.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Machine Translation (AREA)
Abstract
一种文本分类方法及终端,该方法包括:获取待处理的目标文本,以及获取待分类的多个文本类别标识(S101);将所述目标文本转换为词向量(S102);根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目(S103);多分类模型由循环神经网络及多个二分类器构成;基于文本样本集对多分类模型进行预训练,并将目标文本对应的词向量输入完成训练的多分类模型进行处理,输出目标文本对应的文本分类结果(S104);文本分类结果用于标识目标文本所属的至少两个独立且不互斥的目标文本类别。可在文本多类别且独立不互斥的场景下,提高分类结果的准确性。
Description
本申请要求于2018年10月11日提交中国专利局、申请号为201811182173.4、发明名称为“一种文本分类方法及终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请属于计算机技术领域,尤其涉及一种文本分类方法及终端。
文本分析是指对文本的表示及其特征项的选取;文本分析是文本挖掘、信息检索的一个基本问题,它把从文本中抽取出的特征词进行量化来表示文本信息。由于文本的语义不可避免地会反映人的特定立场、观点、价值和利益,因此,由文本内容分析,可以推断文本提供者的意图和目的,从而对文本进行分类。
近年来随着深度学习和各种神经网络模型的发展,基于神经网络的文本分类方法在信息检索、电子商务、新闻门户等众多领域得到广泛应用,以有效帮助用户从海量的文本资源中发掘用户所关注的有用的特定信息。例如,基于神经网络对文本中多类别且互斥的商品进行分类。神经网络例如,卷积神经网络(Convolutional Neural Network,CNN)、循环神经网络(Recurrent Neural Network,RNN)。
然而,在文本多类别且独立不互斥的场景下,采用现有的基于神经网络的文本分类方法进行文本分析得到的分类结果不准确。
本申请实施例提供了一种文本分类方法及终端,以解决现有技术中,在文本多类别且独立不互斥的场景下,采用现有的基于神经网络的文本分类方法进行文本分析得到的分类结果不准确的问题。
本申请实施例的第一方面提供了一种文本分类方法,包括:
获取待处理的目标文本,以及获取待分类的多个文本类别标识;
将所述目标文本转换为词向量;
根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,所述二分类器用于对所述特征数据进行处理,输出分类结果;
基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述多个文本类别标识中确定。
本申请实施例的第二方面提供了一种终端,包括:
获取单元,用于获取待处理的目标文本,以及获取待分类的多个文本类别标识;
转换单元,用于将所述目标文本转换为词向量;
确定单元,用于根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,多个所述二分类器用于对所述特征数据进行处理并输出分类结果;
分类单元,用于基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述多个文本类别标识中确定。
本申请实施例的第三方面提供了一种终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行 所述计算机可读指令时实现以下步骤:
获取待处理的目标文本,以及获取待分类的多个文本类别标识;
将所述目标文本转换为词向量;
根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,多个所述二分类器用于对所述特征数据进行处理并输出分类结果;
基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述多个文本类别标识中确定。
本申请实施例的第四方面提供了一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现以下步骤:
获取待处理的目标文本,以及获取待分类的多个文本类别标识;
将所述目标文本转换为词向量;
根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,多个所述二分类器用于对所述特征数据进行处理并输出分类结果;
基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述多个文本类别标识中确定。
本申请实施例,根据待分类的文本类别标识的数目确定多分类模型包含的二分类器的数目,使用完成训练的多分类模型对目标文本进行处理,输出目标文本对应的文本分类结果,文本分类结果用于标识目标文本属于多个独立且不互斥的文本类别,能够在文本多类别且独立不互斥的场景下,提高文本分类结果的准确性。
图1是本申请一实施例提供的一种文本分类方法的实现流程图;
图2是本申请实施例提供的一种文本分类方法中S104的具体实现流程图;
图3是本申请实施例提供的一种文本分类方法中S1041的具体实现流程图;
图4是本申请一实施例提供的一种终端的示意图;
图5是本申请另一实施例提供的一种终端的示意图。
以下描述中,为了说明而不是为了限定,提出了诸如特定***结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的***、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
请参见图1,图1是本申请实施例提供的一种文本分类方法的实现流程图。本实施例中文本分类方法的执行主体为终端。终端包括但不限于智能手机、平板电脑、可穿戴设备等移动终端,还可以是台式电脑等。如图所示的文本分类方法可包括:
S101:获取待处理的目标文本,以及获取待分类的多个文本类别标识。
终端获取用户选择的待处理的目标文本,或者终端从网络数据库中获取待处理的目标文本,例如,从网络数据库中获取某商家的网店的商品描述信息;或者终端通过网络爬虫(Crawler)技术获取网页内容,并从网页内容中获取目 标文本。
其中,待分类的多个文本类别标识可以是预先设定的,也可以是终端从目标文本中提取。例如,目标文本为“儿童大号奥特曼和书包”,终端从目标文本中提取的待分类的文本类别标识为“奥特曼”、“书包”、“儿童”。待分类的多个文本类别标识包含目标文本所属的文本类别的标识,以便终端能够从中确定目标文本所属的至少两个独立且不互斥的文本类别。
由多个文本类别标识组成的文本类别标识集属于由目标文本中包含的已知的文本类别标识组成的文本类别标识集。
S102:将所述目标文本转换为词向量。
例如,终端对目标文本进行语义分析,以分析目标文本的句子结构,根据目标文本的句子结构删除目标文本中的状语成分以及部分定语成分,提取目标文本的特征数据;并对特征数据进行切词处理,得到N个单元,并对N个单元进行编码得到N个词向量。
目标文本的特征数据可以包括目标文本中的名词以及连接词,连接词例如“和”、“与”、“或”等。文本中的名词通常为目标文本对应的宾语成分,文本中的名词还可以来自目标文本中的定语成分。
S103:根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,多个所述二分类器用于对所述特征数据进行处理并输出分类结果。
终端基于待分类待识别的多个文本类别标识,统计待分类待识别的文本类别标识的数目,并基于待分类待识别的文本类别标识的数目确定多分类模型包含的二分类器的数目。输入循环神经网络的文本数据的特征数据可以是文本对应的向量,例如词向量;也可以是未经处理的文本。
循环神经网络可以包括输入层、隐含层和输出层。
输入层用于从外部接收输入数据,包括两个以上的输入层节点。其中,循 环神经网络的输入层节点可以与文本类别标识的数目一一对应。例如,若某样本数据包含3个文本类别标识,分别为文本类别标识1、文本类别标识2和文本类别标识3,那么对应的循环神经网络的输入层节点的个数也应为3个,分别为输入层节点1、输入层节点2和输入层节点3,其中,输入层节点1与文本类别标识1对应,输入层节点2与文本类别标识2对应,输入层节点3与文本类别标识3对应。
隐含层用于对输入数据进行处理,包括两个以上的隐含层节点,且隐藏层之间的节点是有连接的,并且隐藏层的输入不仅包括输入层的输出还包括上一时刻隐藏层的输出。
输出层包括一个输出层节点,用于使用预设的损失函数对隐藏层输出的数据进行处理输出处理结果。
循环神经网络的输出层节点输出的处理结果用于输入多个二分类器进行训练,多个二分类器分别输出分类结果。二分类器可以采用支持向量机(support vector machine,SVM)进行训练得到,也可以由K最近邻(k-NearestNeighbor,KNN)分类算法训练得到。SVM以及KNN算法为现有技术,采用SVM或KNN算法训练二分类器的方法为现有技术,此处不赘述。
每个二分类器用于对所述特征数据进行处理,确定文本数据对应的两个候选文本分类类别标识的概率值,聪两个候选文本分类类别标识的概率值中,选择概率值高的候选文本分类类别标识,作为文本数据对应的文本类别标识。
进一步地,S103可以包括S1031或S1032。
例如,目标文本中包含的文本类别标识为A、B、C、D,那么多分类模型包含的二分类器的数目为
具体地二分类器包括:用于对AB进行分类的二分类器C1,用于对AC进行分类的目标二分类器C2,用于对AD进行分类的二分类器C3,用于对BC进行分类的二分类器C4,用于对BD进行分类的二 分类器C5,用于对CD进行分类的二分类器C6。
S1032:当所述文本类别标识的数目为N时,所述多分类模型包含的二分类器的数目M=log
2N;N为大于2的正整数,M为正数;当M不为整数时,取大于M且与M最接近的正整数。
例如,当4<M<5时,二分类器的数目为5。
S104:基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述候选的多个文本类别标识中确定。
终端在使用机器学习算法进行训练的过程中,多分类模型的输入为文本数据,所述多分类模型的输出为分类结果。文本样本集中的每个样本文本中包含多个标记的文本类别标签。文本样本集中的训练文本的条数可以为500、1000等,具体不做限制,在一定程度上训练的样本数量越多,使用训练得到的多分类模型进行分类时,结果越准确。
具体地,终端将文本样本集中的训练文本或训练文本各自对应的词向量,输入多分类模型的循环神经网络的输入层,通过循环神经网络对训练文本进行处理,得到每个训练文本的特征数据,并将每个训练文本的特征数据输入多个二分类器中进行预测,得到多个文本类别标识的概率值,基于多个文本类别标识的概率值确定至少两个预测的文本类别标签,通过比对预测的文本类别标签和标记的文本类别标签之间的误差,来修改或更新多分类模型的参数,例如更新循环神经网络中的各参数或权重、修改二分类器中的相关参数。
在训练预设次数(例如,1000)内,每个二分类器输出的分类结果的概率值与预设的概率值之间的差值最小时,则判定多分类模型收敛,将此时循环神经网络的各项参数(权重等)以及二分类器的各项参数作为最终参数,多分类模型完成训练。
终端使用完成训练的多分类模型对目标文本进行分类的具体实现过程如下:
终端将目标文本对应的词向量输入完成训练的多分类模型,通过完成训练的多分类模型中的循环神经网络对目标文本对应的词向量进行处理,提取目标文本的特征数据,并将目标文本的特征数据输入采用机器学习算法训练得到的多个目标二分类器中进行处理,得到每个候选文本类别的概率值,每个目标二分类器基于各自确定的两个候选文本类别的概率值确定文本数据对应的文本类别标识,基于多分类模型中每个目标二分类器确定的文本类别标识,确定至少两个独立且不互斥的目标文本类别,从而得到目标文本的文本分类结果。其中,从多个候选文本类别中确定的至少两个独立且不互斥的目标文本类别用于标识目标文本所属的至少两个独立且不互斥的目标文本类别。不互斥的文本类别是指可同时存在且不矛盾的文本类别。
其中,终端基于每个二分类器输出的两个候选文本类别的概率值,将概率值最大的候选文本类别识别为该二分类器输出的分类结果,将所有目标二分类器输出的分类结果进行汇总,得到多个独立且不互斥的分类结果。
例如,假设二分类器C1输出的结果为目标文本属于文本类别A的概率值为0.6,目标文本属于文本类别B的概率值为0.4,那么二分类器C1输出的分类结果为目标文本属于文本类别A;
假设二分类器C2输出的结果为目标文本属于文本类别A的概率值为0.6,目标文本属于文本类别C的概率值为0.4,那么二分类器C2输出的文本分类结果为目标文本属于文本类别A;
假设二分类器C3输出的结果为目标文本属于文本类别A的概率值为0.6,目标文本属于文本类别D的概率值为0.4,那么二分类器C3输出的分类结果为目标文本属于文本类别A;
假设二分类器C4输出的结果为目标文本属于文本类别B的概率值为0.7,目标文本属于文本类别C的概率值为0.3,那么二分类器C4输出的分类结果为目标文本属于文本类别B;
假设二分类器C5输出的结果为目标文本属于文本类别B的概率值为0.8,目标文本属于文本类别D的概率值为0.2,那么二分类器C5输出的分类结果为目标文本属于文本类别B;
假设二分类器C6输出的结果为目标文本属于文本类别C的概率值为0.9,目标文本属于文本类别D的概率值为0.1,那么二分类器C6输出的分类结果为目标文本属于文本类别C;
多分类模型最终输出的分类结果为目标文本属于文本类别A、文本类别B以及文本类别C。文本类别A、文本类别B以及文本类别C之间均不互斥。
进一步地,请一并参阅图2,图2是本申请实施例提供的一种文本分类方法中S104的具体实现流程图。为了提高分类结果的准确度,S104可以包括S1041~S1042,具体如下:
S1041:基于所述文本样本集采用采用机器学习算法以及预设的损失函数对所述多分类模型进行训练,得到所述完成训练的多分类模型;其中,所述预设的损失函数具体为:
y为样本数据的数量,y
ture为标记的已知文本类别标签,y
pred为预测得到的文本类别标签;λ(y
true-y
pred)=1-θ(y
true-m)×θ(y
pred-m)-θ(1-m-y
true)×θ(1-m-y
pred),θ(x)为跃阶函数,
m的取值范围为(0.5,1),标识让所述多分类模型更关注分类概率在0.5到m之间的样本数据。
其中,当(y
true-m)的值大于0时,θ(y
true-m)=1;当(y
true-m)的值等于0时,θ(y
true-m)=1/2;当(y
true-m)的值小于0时,θ(y
true-m)=0。同理可得到,θ(y
pred-m)、θ(1-m-y
true)以及θ(1-m-y
pred)各自的值。
输出层包括一个输出层节点,用于使用预设的损失函数对隐藏层输出的数据进行处理,输出处理结果。
终端将文本样本集中的文本样本转换为词向量,将文本样本的词向量输入 多分类模型中的循环神经网络,并使用预设的损失函数对文本样本的词向量进行处理,得到处理结果;将处理结果输入多个二分类器,基于机器学习算法以及处理结果训练多个二分类器,并计算二分类器输出的分类结果的概率值与预设的概率值之间的差值。当训练预设次数(例如,1000)内损失函数的值基本不再降低,且每个二分类器输出的分类结果的概率值与预设的概率值之间的差值最小时,则判定多分类模型收敛,将此时循环神经网络的各项参数(权重等)以及二分类器的各项参数作为最终参数,多分类模型完成训练。
进一步地,为了提高模糊样本的分类结果的准确度,m的取值范围优选为(0.5,0.7),m=a标识多分类模型关注分类概率在0.5~a的样本。a为0.5到0.7之间的任意值。
可选地,请一并参阅图3,图3是本申请实施例提供的一种文本分类方法中S1041的具体实现流程图。为了提高分类结果的准确度,S1041可以具体包括S10411~S10412,具体如下:
S10411:将由所述目标文本对应的词向量组成的单列向量矩阵输入完成训练的多分类模型进行处理,输出所述单列向量矩阵中每个词向量的值。
单列向量矩阵中每个词向量的值之和为1,每行词向量对应一文本类别。
终端将目标文本对应的所有词向量转换成单列向量矩阵,并将单列向量矩阵输入完成训练的多分类模型进行处理,输出单列向量矩阵中每个词向量对应的值。其中,终端将单列向量矩阵输入完成训练的多分类模型进行处理的方法,与上述将目标文本对应的词向量输入完成训练的多分类模型进行处理的方法类似,请参阅上述相关描述,此处不赘述。
例如,假设目标文本中待分类的文本类别标识为8个,目标文本转换成8个词向量;终端将由8个词向量组成的8行一列的向量矩阵输入完成训练的多分类模型进行处理,输出向量矩阵中每个词向量对应的值,每行的词向量对应一个文本类别,每个词向量对应的值表示目标文本属于该词向量对应的文本类别的概率值。
S10412:基于所述单列向量矩阵中每个所述词向量的值确定所述目标文本对应的文本分类结果。
终端在得到单列向量矩阵中每个词向量的值时,基于词向量的值从高到低的顺序筛选出至少两个目标词向量,并基于每行的词向量所对应的文本类别,确定目标词向量对应的目标文本类别,将筛选出的目标词向量对应的目标文本类别识别为目标文本所属的文本类别,从而得到目标文本的文本分类结果。
进一步地,S10412可以具体为:基于所述单列向量矩阵中每个所述词向量的值,确定至少两个目标词向量;将每个所述目标词向量各自对应的文本类别,识别为所述目标文本所属的目标文本类别;其中,所述目标词向量的值均大于或等于预设阈值。
终端从词向量矩阵中每个词向量对应的值中,筛选值大于预设阈值(例如,0.5)的至少两个目标词向量,并将筛选出的目标词向量各自对应的文本类别识别为目标文本所属的文本类别。
S1042:将所述目标文本对应的所述词向量输入所述完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果。
终端将目标文本对应的词向量输入完成训练的多分类模型,通过完成训练的多分类模型中的循环神经网络对目标文本对应的词向量进行处理,提取出目标文本对应的词向量,并将目标文本的特征数据输入采用机器学习算法训练得到的多个目标二分类器中进行处理,得到每个候选文本类别的概率值,每个目标二分类器基于各自确定的两个候选文本类别的概率值确定文本数据对应的文本类别标识。终端基于多分类模型中每个目标二分类器确定的文本类别标识,确定至少两个独立且不互斥的目标文本类别,从而得到目标文本的文本分类结果。不互斥的文本类别是指可同时存在且不矛盾的文本类别。
本申请实施例,根据待分类的文本类别标识的数目确定多分类模型包含的二分类器的数目,使用完成训练的多分类模型对目标文本进行处理,输出目标文本对应的文本分类结果,文本分类结果用于标识目标文本属于多个独立且不 互斥的文本类别,能够在文本多类别且独立不互斥的场景下,提高文本分类结果的准确性。
请参阅图4,图4是本申请一实施例提供的一种终端的示意图。终端包括的各单元用于执行图1~图3对应的实施例中的各步骤。具体请参阅图1~图3各自对应的实施例中的相关描述。为了便于说明,仅示出了与本实施例相关的部分。参见图4,终端4包括:
获取单元410,用于获取待处理的目标文本,以及获取待分类的多个文本类别标识;
转换单元420,用于将所述目标文本转换为词向量;
确定单元430,用于根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,多个所述二分类器用于对所述特征数据进行处理并输出分类结果;
分类单元440,用于基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述多个文本类别标识中确定。
进一步地,分类单元440包括:
训练单元,用于基于所述文本样本集采用采用机器学习算法以及预设的损失函数对所述多分类模型进行训练,得到所述完成训练的多分类模型;
文本处理单元,用于将所述目标文本对应的所述词向量输入所述完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;
其中,所述预设的损失函数具体为:
y为样本数据的数量,y
ture为标记的已知文本类别标签,y
pred为预测得到的文本类别标签;λ(y
true-y
pred)=1-θ(y
true-m)×θ(y
pred-m)-θ(1-m-y
true)×θ(1-m-y
pred),θ(x) 为跃阶函数,
m的取值范围为(0.5,1),标识让所述多分类模型更关注分类概率在0.5到m之间的样本数据。
进一步地,文本处理单元包括:
计算单元,用于将由所述目标文本对应的词向量组成的单列向量矩阵输入完成训练的多分类模型进行处理,输出所述单列向量矩阵中每个词向量的值;
分类结果确定单元,用于基于所述单列向量矩阵中每个所述词向量的值确定所述目标文本对应的文本分类结果。
进一步地,分类结果确定单元具体用于:基于所述单列向量矩阵中每个所述词向量的值,确定至少两个目标词向量;所述目标词向量的值均大于或等于预设阈值;将每个所述目标词向量各自对应的文本类别,识别为所述目标文本所属的目标文本类别。
进一步地,确定单元430具体用于:当所述文本类别标识的数目为N时,所述多分类模型包含的二分类器的数目M=log
2N;N为大于2的正整数,M为正数;当M不为整数时,取大于M且与M最接近的正整数。
图5是本申请另一实施例提供的一种设备的示意图。如图5所示,该实施例的终端5包括:处理器50、存储器51以及存储在所述存储器51中并可在所述处理器50上运行的计算机可读指令52。所述处理器50执行所述计算机可读指令52时实现上述各个终端的文本分类方法实施例中的步骤,例如图1所示的S101至S104。或者,所述处理器50执行所述计算机可读指令52时实现上述各装置实施例中各单元的功能,例如图4所示单元410至440功能。
示例性的,所述计算机可读指令52可以被分割成一个或多个单元,所述一个或者多个单元被存储在所述存储器51中,并由所述处理器50执行,以完成本申请。所述一个或多个单元可以是能够完成特定功能的一系列计算机可读指 令的指令段,该指令段用于描述所述计算机可读指令52在所述终端5中的执行过程。例如,所述计算机可读指令52可以被分割成,获取单元、转换单元、确定单元以及分类单元,各单元具体功能如上所述。
所述终端可包括,但不仅限于,处理器50、存储器51。本领域技术人员可以理解,图5仅仅是终端5的示例,并不构成对终端5的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端还可以包括输入输出设备、网络接入设备、总线等。
所称处理器50可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器51可以是所述终端5的内部存储单元,例如终端5的硬盘或内存。所述存储器51也可以是所述终端5的外部存储终端,例如所述终端5上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器51还可以既包括所述终端5的内部存储单元也包括外部存储终端。所述存储器51用于存储所述计算机可读指令以及所述终端所需的其他程序和数据。所述存储器51还可以用于暂时地存储已经输出或者将要输出的数据。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。
Claims (20)
- 一种文本分类方法,其特征在于,包括:获取待处理的目标文本,以及获取待分类的多个文本类别标识;将所述目标文本转换为词向量;根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,多个所述二分类器用于对所述特征数据进行处理并输出分类结果;基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述多个文本类别标识中确定。
- 根据权利要求1所述的文本分类方法,其特征在于,所述基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果,包括:基于所述文本样本集采用采用机器学习算法以及预设的损失函数对所述多分类模型进行训练,得到所述完成训练的多分类模型;将所述目标文本对应的所述词向量输入所述完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;
- 根据权利要求2所述的文本分类方法,其特征在于,所述将所述目标文本对应的所述词向量输入所述完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果,包括:将由所述目标文本对应的词向量组成的单列向量矩阵输入完成训练的多分类模型进行处理,输出所述单列向量矩阵中每个词向量的值;基于所述单列向量矩阵中每个所述词向量的值确定所述目标文本对应的文本分类结果。
- 根据权利要求3所述的文本分类方法,其特征在于,所述基于所述单列向量矩阵中每个所述词向量的值确定所述目标文本对应的文本分类结果,包括:基于所述单列向量矩阵中每个所述词向量的值,确定至少两个目标词向量;所述目标词向量的值均大于或等于预设阈值;将每个所述目标词向量各自对应的文本类别,识别为所述目标文本所属的目标文本类别。
- 根据权利要求1至4任一项所述的文本分类方法,其特征在于,所述根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目,包括:当所述文本类别标识的数目为N时,所述多分类模型包含的二分类器的数目M=log 2N;N为大于2的正整数,M为正数;当M不为整数时,取大于M且与M最接近的正整数。
- 一种终端,其特征在于,包括:获取单元,用于获取待处理的目标文本,以及获取待分类的多个文本类别标识;转换单元,用于将所述目标文本转换为词向量;确定单元,用于根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,多个所述二分类器用于对所述特征数据进行处理并输出分类结果;分类单元,用于基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述多个文本类别标识中确定。
- 如权利要求7所述的终端,其特征在于,所述分类单元包括:训练单元,用于基于所述文本样本集采用采用机器学习算法以及预设的损失函数对所述多分类模型进行训练,得到所述完成训练的多分类模型;文本处理单元,用于将所述目标文本对应的所述词向量输入所述完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;
- 如权利要求8所述的终端,其特征在于,所述文本处理单元包括:计算单元,用于将由所述目标文本对应的词向量组成的单列向量矩阵输入 完成训练的多分类模型进行处理,输出所述单列向量矩阵中每个词向量的值;分类结果确定单元,用于基于所述单列向量矩阵中每个所述词向量的值确定所述目标文本对应的文本分类结果。
- 如权利要求9所述的终端,其特征在于,分类结果确定单元具体用于:基于所述单列向量矩阵中每个所述词向量的值,确定至少两个目标词向量;所述目标词向量的值均大于或等于预设阈值;将每个所述目标词向量各自对应的文本类别,识别为所述目标文本所属的目标文本类别。
- 一种终端,其特征在于,所述终端包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:获取待处理的目标文本,以及获取待分类的多个文本类别标识;将所述目标文本转换为词向量;根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,多个所述二分类器用于对所述特征数据进行处理并输出分类结果;基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述多个文本类别标识中确定。
- 如权利要求11所述的终端,其特征在于,所述基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果,包括:基于所述文本样本集采用采用机器学习算法以及预设的损失函数对所述多 分类模型进行训练,得到所述完成训练的多分类模型;将所述目标文本对应的所述词向量输入所述完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;
- 如权利要求12所述的终端,其特征在于,所述将所述目标文本对应的所述词向量输入所述完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果,包括:将由所述目标文本对应的词向量组成的单列向量矩阵输入完成训练的多分类模型进行处理,输出所述单列向量矩阵中每个词向量的值;基于所述单列向量矩阵中每个所述词向量的值确定所述目标文本对应的文本分类结果。
- 如权利要求13所述的终端,其特征在于,所述基于所述单列向量矩阵中每个所述词向量的值确定所述目标文本对应的文本分类结果,包括:基于所述单列向量矩阵中每个所述词向量的值,确定至少两个目标词向量;所述目标词向量的值均大于或等于预设阈值;将每个所述目标词向量各自对应的文本类别,识别为所述目标文本所属的目标文本类别。
- 一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:获取待处理的目标文本,以及获取待分类的多个文本类别标识;将所述目标文本转换为词向量;根据所述文本类别标识的数目确定多分类模型包含的二分类器的数目;所述多分类模型由循环神经网络以及多个所述二分类器构成,所述循环神经网络用于提取输入所述循环神经网络的文本数据的特征数据,多个所述二分类器用于对所述特征数据进行处理并输出分类结果;基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;所述文本分类结果用于标识所述目标文本所属的至少两个独立且不互斥的目标文本类别,所述目标文本类别的标识从所述多个文本类别标识中确定。
- 如权利要求16所述的计算机非易失性可读存储介质,其特征在于,所述基于文本样本集对所述多分类模型进行预训练,并将所述目标文本对应的所述词向量输入完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果,包括:基于所述文本样本集采用采用机器学习算法以及预设的损失函数对所述多分类模型进行训练,得到所述完成训练的多分类模型;将所述目标文本对应的所述词向量输入所述完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果;
- 如权利要求17所述的计算机非易失性可读存储介质,其特征在于,所述将所述目标文本对应的所述词向量输入所述完成训练的多分类模型进行处理,输出所述目标文本对应的文本分类结果,包括:将由所述目标文本对应的词向量组成的单列向量矩阵输入完成训练的多分类模型进行处理,输出所述单列向量矩阵中每个词向量的值;基于所述单列向量矩阵中每个所述词向量的值确定所述目标文本对应的文本分类结果。
- 如权利要求18所述的计算机非易失性可读存储介质,其特征在于,所述基于所述单列向量矩阵中每个所述词向量的值确定所述目标文本对应的文本分类结果,包括:基于所述单列向量矩阵中每个所述词向量的值,确定至少两个目标词向量;所述目标词向量的值均大于或等于预设阈值;将每个所述目标词向量各自对应的文本类别,识别为所述目标文本所属的目标文本类别。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811182173.4 | 2018-10-11 | ||
CN201811182173.4A CN109471938B (zh) | 2018-10-11 | 2018-10-11 | 一种文本分类方法及终端 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020073507A1 true WO2020073507A1 (zh) | 2020-04-16 |
Family
ID=65664843
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/124300 WO2020073507A1 (zh) | 2018-10-11 | 2018-12-27 | 一种文本分类方法及终端 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109471938B (zh) |
WO (1) | WO2020073507A1 (zh) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111696636A (zh) * | 2020-05-15 | 2020-09-22 | 平安科技(深圳)有限公司 | 一种基于深度神经网络的数据处理方法及装置 |
CN111737464A (zh) * | 2020-06-12 | 2020-10-02 | 网易(杭州)网络有限公司 | 文本分类方法、装置和电子设备 |
CN111753091A (zh) * | 2020-06-30 | 2020-10-09 | 北京小米松果电子有限公司 | 分类方法、分类模型的训练方法、装置、设备及存储介质 |
CN111814538A (zh) * | 2020-05-25 | 2020-10-23 | 北京达佳互联信息技术有限公司 | 目标对象的类别识别方法、装置、电子设备及存储介质 |
CN111881295A (zh) * | 2020-07-31 | 2020-11-03 | 中国光大银行股份有限公司 | 文本分类模型训练方法及装置、文本标注方法及装置 |
CN112101042A (zh) * | 2020-09-14 | 2020-12-18 | 平安科技(深圳)有限公司 | 文本情绪识别方法、装置、终端设备和存储介质 |
CN112115268A (zh) * | 2020-09-28 | 2020-12-22 | 支付宝(杭州)信息技术有限公司 | 基于特征编码器的训练方法及装置、分类方法及装置 |
CN112182214A (zh) * | 2020-09-27 | 2021-01-05 | 中国建设银行股份有限公司 | 一种数据分类方法、装置、设备及介质 |
CN112182229A (zh) * | 2020-11-05 | 2021-01-05 | 江西高创保安服务技术有限公司 | 一种文本分类模型构建方法、文本分类方法及装置 |
CN113361787A (zh) * | 2021-06-11 | 2021-09-07 | 上海跨境电子商务公共服务有限公司 | 商品归类***、方法、存储介质及终端 |
CN113626587A (zh) * | 2020-05-08 | 2021-11-09 | 武汉金山办公软件有限公司 | 一种文本类别识别方法、装置、电子设备及介质 |
CN113704467A (zh) * | 2021-07-29 | 2021-11-26 | 大箴(杭州)科技有限公司 | 基于数据模板的海量文本监控方法及装置、介质、设备 |
CN113849640A (zh) * | 2021-09-14 | 2021-12-28 | 支付宝(杭州)信息技术有限公司 | 一种数据处理方法、装置、设备及介质 |
Families Citing this family (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110163252B (zh) * | 2019-04-17 | 2023-11-24 | 平安科技(深圳)有限公司 | 数据分类方法及装置、电子设备、存储介质 |
CN113826116A (zh) * | 2019-05-15 | 2021-12-21 | 北京嘀嘀无限科技发展有限公司 | 用于多类分类的对抗性多二元神经网络 |
CN110362677B (zh) * | 2019-05-31 | 2022-12-27 | 平安科技(深圳)有限公司 | 文本数据类别的识别方法及装置、存储介质、计算机设备 |
CN110377748A (zh) * | 2019-06-13 | 2019-10-25 | 北京百度网讯科技有限公司 | 实体关注点挖掘方法、装置、计算机设备及存储介质 |
CN110597985A (zh) * | 2019-08-15 | 2019-12-20 | 重庆金融资产交易所有限责任公司 | 基于数据分析的数据分类方法、装置、终端及介质 |
CN110516041A (zh) * | 2019-08-28 | 2019-11-29 | 深圳勇艺达机器人有限公司 | 一种人机对话***的文本分类方法 |
CN110659367B (zh) * | 2019-10-12 | 2022-03-25 | 中国科学技术信息研究所 | 文本分类号的确定方法、装置以及电子设备 |
CN110852082B (zh) * | 2019-10-23 | 2023-08-11 | 北京明略软件***有限公司 | 同义词的确定方法及装置 |
CN112948575B (zh) * | 2019-12-11 | 2023-09-26 | 京东科技控股股份有限公司 | 文本数据处理方法、装置和计算机可读存储介质 |
CN111177388B (zh) * | 2019-12-30 | 2023-07-21 | 联想(北京)有限公司 | 一种处理方法及计算机设备 |
CN111611386B (zh) * | 2020-05-28 | 2024-03-29 | 北京明略昭辉科技有限公司 | 文本分类方法和装置 |
CN111737436A (zh) * | 2020-06-24 | 2020-10-02 | 网易(杭州)网络有限公司 | 语料的意图识别方法及装置、电子设备、存储介质 |
CN112329823B (zh) * | 2020-10-23 | 2022-02-01 | 北京中科智加科技有限公司 | 文本分类方法及装置、设备及介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170140042A1 (en) * | 2015-11-12 | 2017-05-18 | GM Global Technology Operations LLC | Extracting content from multilingual diagnostic records |
CN108197337A (zh) * | 2018-03-28 | 2018-06-22 | 北京搜狐新媒体信息技术有限公司 | 一种文本分类方法及装置 |
CN108228622A (zh) * | 2016-12-15 | 2018-06-29 | 平安科技(深圳)有限公司 | 业务问题的分类方法及装置 |
CN108334605A (zh) * | 2018-02-01 | 2018-07-27 | 腾讯科技(深圳)有限公司 | 文本分类方法、装置、计算机设备及存储介质 |
CN108416032A (zh) * | 2018-03-12 | 2018-08-17 | 腾讯科技(深圳)有限公司 | 一种文本分类方法、装置及存储介质 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103246655A (zh) * | 2012-02-03 | 2013-08-14 | 腾讯科技(深圳)有限公司 | 一种文本分类方法、装置及*** |
CN108304364A (zh) * | 2017-02-23 | 2018-07-20 | 腾讯科技(深圳)有限公司 | 关键词提取方法和装置 |
CN106909654B (zh) * | 2017-02-24 | 2020-07-21 | 北京时间股份有限公司 | 一种基于新闻文本信息的多级分类***及方法 |
CN108090503B (zh) * | 2017-11-28 | 2021-05-07 | 东软集团股份有限公司 | 多分类器的在线调整方法、装置、存储介质及电子设备 |
CN108491406B (zh) * | 2018-01-23 | 2021-09-24 | 深圳市阿西莫夫科技有限公司 | 信息分类方法、装置、计算机设备和存储介质 |
CN108509484B (zh) * | 2018-01-31 | 2022-03-11 | 腾讯科技(深圳)有限公司 | 分类器构建及智能问答方法、装置、终端及可读存储介质 |
-
2018
- 2018-10-11 CN CN201811182173.4A patent/CN109471938B/zh active Active
- 2018-12-27 WO PCT/CN2018/124300 patent/WO2020073507A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170140042A1 (en) * | 2015-11-12 | 2017-05-18 | GM Global Technology Operations LLC | Extracting content from multilingual diagnostic records |
CN108228622A (zh) * | 2016-12-15 | 2018-06-29 | 平安科技(深圳)有限公司 | 业务问题的分类方法及装置 |
CN108334605A (zh) * | 2018-02-01 | 2018-07-27 | 腾讯科技(深圳)有限公司 | 文本分类方法、装置、计算机设备及存储介质 |
CN108416032A (zh) * | 2018-03-12 | 2018-08-17 | 腾讯科技(深圳)有限公司 | 一种文本分类方法、装置及存储介质 |
CN108197337A (zh) * | 2018-03-28 | 2018-06-22 | 北京搜狐新媒体信息技术有限公司 | 一种文本分类方法及装置 |
Cited By (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113626587A (zh) * | 2020-05-08 | 2021-11-09 | 武汉金山办公软件有限公司 | 一种文本类别识别方法、装置、电子设备及介质 |
CN113626587B (zh) * | 2020-05-08 | 2024-03-29 | 武汉金山办公软件有限公司 | 一种文本类别识别方法、装置、电子设备及介质 |
CN111696636A (zh) * | 2020-05-15 | 2020-09-22 | 平安科技(深圳)有限公司 | 一种基于深度神经网络的数据处理方法及装置 |
CN111696636B (zh) * | 2020-05-15 | 2023-09-22 | 平安科技(深圳)有限公司 | 一种基于深度神经网络的数据处理方法及装置 |
CN111814538A (zh) * | 2020-05-25 | 2020-10-23 | 北京达佳互联信息技术有限公司 | 目标对象的类别识别方法、装置、电子设备及存储介质 |
CN111814538B (zh) * | 2020-05-25 | 2024-03-05 | 北京达佳互联信息技术有限公司 | 目标对象的类别识别方法、装置、电子设备及存储介质 |
CN111737464A (zh) * | 2020-06-12 | 2020-10-02 | 网易(杭州)网络有限公司 | 文本分类方法、装置和电子设备 |
CN111753091A (zh) * | 2020-06-30 | 2020-10-09 | 北京小米松果电子有限公司 | 分类方法、分类模型的训练方法、装置、设备及存储介质 |
CN111881295A (zh) * | 2020-07-31 | 2020-11-03 | 中国光大银行股份有限公司 | 文本分类模型训练方法及装置、文本标注方法及装置 |
CN112101042A (zh) * | 2020-09-14 | 2020-12-18 | 平安科技(深圳)有限公司 | 文本情绪识别方法、装置、终端设备和存储介质 |
CN112182214B (zh) * | 2020-09-27 | 2024-03-19 | 中国建设银行股份有限公司 | 一种数据分类方法、装置、设备及介质 |
CN112182214A (zh) * | 2020-09-27 | 2021-01-05 | 中国建设银行股份有限公司 | 一种数据分类方法、装置、设备及介质 |
CN112115268A (zh) * | 2020-09-28 | 2020-12-22 | 支付宝(杭州)信息技术有限公司 | 基于特征编码器的训练方法及装置、分类方法及装置 |
CN112115268B (zh) * | 2020-09-28 | 2024-04-09 | 支付宝(杭州)信息技术有限公司 | 基于特征编码器的训练方法及装置、分类方法及装置 |
CN112182229A (zh) * | 2020-11-05 | 2021-01-05 | 江西高创保安服务技术有限公司 | 一种文本分类模型构建方法、文本分类方法及装置 |
CN113361787A (zh) * | 2021-06-11 | 2021-09-07 | 上海跨境电子商务公共服务有限公司 | 商品归类***、方法、存储介质及终端 |
CN113704467A (zh) * | 2021-07-29 | 2021-11-26 | 大箴(杭州)科技有限公司 | 基于数据模板的海量文本监控方法及装置、介质、设备 |
CN113849640A (zh) * | 2021-09-14 | 2021-12-28 | 支付宝(杭州)信息技术有限公司 | 一种数据处理方法、装置、设备及介质 |
Also Published As
Publication number | Publication date |
---|---|
CN109471938B (zh) | 2023-06-16 |
CN109471938A (zh) | 2019-03-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020073507A1 (zh) | 一种文本分类方法及终端 | |
US10438091B2 (en) | Method and apparatus for recognizing image content | |
CN108182279B (zh) | 基于文本特征的对象分类方法、装置和计算机设备 | |
CN112164391B (zh) | 语句处理方法、装置、电子设备及存储介质 | |
WO2020007138A1 (zh) | 一种事件识别的方法、模型训练的方法、设备及存储介质 | |
WO2020073673A1 (zh) | 一种文本分析方法及终端 | |
US10262272B2 (en) | Active machine learning | |
CN110069709B (zh) | 意图识别方法、装置、计算机可读介质及电子设备 | |
US10637826B1 (en) | Policy compliance verification using semantic distance and nearest neighbor search of labeled content | |
CN105022754B (zh) | 基于社交网络的对象分类方法及装置 | |
CN111831826B (zh) | 跨领域的文本分类模型的训练方法、分类方法以及装置 | |
WO2020114108A1 (zh) | 聚类结果的解释方法和装置 | |
CN112612898B (zh) | 文本分类的方法和装置 | |
Bharadwaj et al. | Pattern recognition and machine learning | |
US11550996B2 (en) | Method and system for detecting duplicate document using vector quantization | |
WO2022143511A1 (zh) | 一种恶意流量识别方法及相关装置 | |
CN113656660B (zh) | 跨模态数据的匹配方法、装置、设备及介质 | |
CN110598869B (zh) | 基于序列模型的分类方法、装置、电子设备 | |
Tahir et al. | Multi-label classification using stacked spectral kernel discriminant analysis | |
Aziguli et al. | A robust text classifier based on denoising deep neural network in the analysis of big data | |
CN114817538A (zh) | 文本分类模型的训练方法、文本分类方法及相关设备 | |
WO2023155304A1 (zh) | 关键词推荐模型训练方法、推荐方法和装置、设备、介质 | |
Samal et al. | Obscene image detection using transfer learning and feature fusion | |
US20230214679A1 (en) | Extracting and classifying entities from digital content items | |
Mandlik et al. | Mapping the internet: Modelling entity interactions in complex heterogeneous networks |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18936633 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 18936633 Country of ref document: EP Kind code of ref document: A1 |