WO2020073673A1 - 一种文本分析方法及终端 - Google Patents

一种文本分析方法及终端 Download PDF

Info

Publication number
WO2020073673A1
WO2020073673A1 PCT/CN2019/091502 CN2019091502W WO2020073673A1 WO 2020073673 A1 WO2020073673 A1 WO 2020073673A1 CN 2019091502 W CN2019091502 W CN 2019091502W WO 2020073673 A1 WO2020073673 A1 WO 2020073673A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
classification result
classification
vectors
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2019/091502
Other languages
English (en)
French (fr)
Inventor
金戈
徐亮
肖京
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2020073673A1 publication Critical patent/WO2020073673A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • This application belongs to the field of computer technology, and particularly relates to a text analysis 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.
  • Neural networks are, for example, convolutional neural networks (Convolutional Neural Network (CNN), recurrent neural networks (Recurrent Neural Network, RNN).
  • CNN convolutional Neural Network
  • RNN Recurrent Neural Network
  • the neural network-based text analysis method in the prior art can capture the local features of the text, after the text is superparametrically adjusted, the text classification result may still not reach the required accuracy rate; among them, the superparameter is based on The parameters to be adjusted in the training set.
  • the embodiments of the present application provide a text analysis method and terminal to solve the problem that in the prior art, after the text is superparameter adjusted by the text analysis method based on the neural network, the classification result of the text may still not reach the required accuracy rate .
  • the first aspect of the embodiments of the present application provides a text analysis method, including:
  • the first classification result and the second classification result are fused to obtain a final classification result of the target text.
  • a second aspect of the embodiments of the present application provides a terminal, including:
  • the conversion unit is used to convert the target text to be classified into multiple character vectors and multiple word vectors, respectively;
  • a classification unit configured to input the plurality of word vectors into a pre-trained first text classification model for processing to obtain a first classification result; input the plurality of character vectors into a pre-trained second text classification model for processing to obtain Second classification result;
  • a classification result fusion unit is used to fuse the first classification result and the second classification result to obtain the final classification result of the target text.
  • 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 first classification result and the second classification result are fused to obtain a final classification result of the target text.
  • 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 first classification result and the second classification result are fused to obtain a final classification result of the target text.
  • the terminal converts the target text to be classified into multiple character vectors and multiple word vectors at the same time, processes multiple character vectors and multiple word vectors through different text classification models, and classifies all the text classification models
  • the obtained probability values of each text category are fused to determine the classification result of the target text.
  • Processing the same text through at least two text classification models can reduce the error of the classification results due to the different classification results output by different classification models, improve the accuracy of the classification results, and use the word vector as the minimum granularity for the target text. Processing can further improve the accuracy of the classification results of the target text.
  • FIG. 1 is an implementation flowchart of a text analysis method provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of a terminal provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a terminal provided by another embodiment of the present application.
  • FIG. 1 is a flowchart of a text analysis method provided by an embodiment of the present application.
  • the execution subject of the text analysis method 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 analysis method as shown in the figure may include:
  • S101 Convert the target text to be classified into multiple character vectors and multiple word vectors, respectively.
  • the terminal obtains the target text to be classified selected by the user, or the terminal obtains the target text to be classified from the network database, for example, obtains the product description information of a certain merchant's online store from the network database; Get the webpage content, and get the target text from the webpage content.
  • the text to be classified is cut into words to obtain N word units and M character units; after that, the terminal encodes the N word units to obtain N word vectors, and M Character vectors are encoded to obtain M character vectors.
  • N word vectors and M character vectors are obtained from the same target text. Both M and N are positive integers greater than or equal to 3.
  • S102 Input the multiple word vectors into a pre-trained first text classification model for processing to obtain a first classification result; input the multiple character vectors into a pre-trained second text classification model for processing to obtain a second classification result.
  • the terminal inputs the multiple word vectors corresponding to the target text into the pre-trained first text classification model for processing, and outputs the classification results corresponding to the multiple word vectors, thereby obtaining the first classification result of the target text;
  • the character vector is input to the pre-trained second text classification model for processing, and the classification results corresponding to multiple character vectors are output to obtain the second classification result of the target text.
  • the first classification result and the second classification result are used to identify that the target text belongs to one or at least two text categories.
  • the pre-trained first text classification model is obtained by using a machine learning algorithm to train the word vector of the text sample data in the training sample set.
  • the input of the first text classification model is the text sample data in the training sample set
  • the output of the word vector is the probability corresponding to each known text category.
  • the training sample set includes a preset number of text sample data. The preset number can be 100, 500, 1000, etc., which can be set according to actual needs.
  • TextCNN convolutional text classification model
  • TextRNN recurrent neural network text classification model
  • TextRCNN TextRCNN
  • Convolutional Neural Network CNN
  • TextRNN Recurrent Neural Network
  • TextRCNN is based on Bidirectional Recurrent Neural Network (Recurrent Convolutional Neural Network, RCNN) training.
  • the pre-trained second text classification model is obtained by using a machine learning algorithm to train the character vectors of the text sample data in the training sample set.
  • the input of the second text classification model is the characters of the text sample data in the training sample set Vector
  • the output is the probability corresponding to each known text category. For example, TextCNN, TextRCNN.
  • Both the first text classification model and the second text classification model are multi-classification models, including an input layer, an intermediate layer, and an output layer.
  • the intermediate layer includes a convolutional layer, a pooling layer, and a fully connected layer;
  • the intermediate layer is a hidden layer;
  • TextRCNN the intermediate layer includes a double loop structure, a convolutional layer, a pooling layer, and Fully connected layer.
  • the input layer is used to input the word vector or character vector corresponding to the text to be classified.
  • the middle layer is used to process word vectors or character vectors; among them, the two-way loop structure: less noise than traditional window-based neural networks, which can maximize the extraction of context information; pooling layer: automatic decision which feature is more important The role.
  • the output layer is used to further process the data processed by the middle layer through the softmax function to obtain the probability values of multiple categories.
  • softmax function
  • the following uses the TextRCNN model to process the word vector corresponding to the text to be classified as an example: First, after going through a layer of bidirectional long-term and short-term memory recurrent neural network LSTM, the word on the left side of the word is input forward to obtain a word vector, and the Enter the side reverse input to get a word vector. Combined with the word vector of the word, a 1 ⁇ 3k vector is generated; then through the fully connected layer, tanh is a nonlinear function, and the vector y2 is obtained; the vector y2 is processed through the maximum pooling layer to obtain the maximized vector y3; y3 Then through the fully connected layer for processing, the classification results are obtained.
  • LSTM long-term and short-term memory recurrent neural network
  • the terminal may perform equal probability fusion on the first classification result and the second classification result to obtain the final classification result of the target text. At this time, the terminal assigns a weight value of 0.5 to the first classification result and the second classification result.
  • the probability that the target text belongs to the first text category in the first classification result is 0.7, the probability that the target text belongs to the second text category is 0.1, and the probability that the target text belongs to the third text category is 0.2; the target text in the second classification result
  • the probability of belonging to the first text category is 0.6, the probability of the target text belonging to the second text category is 0.3, and the probability of the target text belonging to the third text category is 0.1; then the first classification result and the second classification result are subjected to equal probability fusion, Available:
  • the terminal determines that the target text belongs to the first text category, and obtains the final classification result of the target text.
  • the terminal may assign different weight values to the first classification result and the second classification result, fuse the first classification result and the second classification result to obtain the final classification result of the target text.
  • the sum of the weight of the first classification result and the weight value of the second classification result is 1.
  • the terminal converts the target text to be classified into multiple character vectors and multiple word vectors at the same time, processes multiple character vectors and multiple word vectors through different text classification models, and classifies all the text classification models
  • the obtained probability values of each text category are fused to determine the classification result of the target text.
  • Processing the same text through at least two text classification models can reduce the error of the classification results due to the different classification results output by different classification models, improve the accuracy of the classification results, and use the word vector as the minimum granularity for the target text. Processing can further improve the accuracy of the classification results of the target text.
  • FIG. 2 is a flowchart of an implementation method of a text analysis method according to another embodiment of the present application.
  • the execution subject of the text analysis method 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 analysis method of this embodiment includes the following steps:
  • S201 Convert the target text to be classified into multiple character vectors and multiple word vectors, respectively.
  • S201 is the same as S101 in the previous embodiment.
  • S101 in the previous embodiment please refer to the relevant description of S101 in the previous embodiment, which is not repeated here.
  • S202 Call a corpus enhancement function to process the multiple word vectors to obtain a target word vector sequence.
  • the corpus enhancement function includes a first corpus enhancement function for randomly arranging multiple word vectors, and / or a second corpus enhancement function for pruning multiple word vectors contained in the short text.
  • the first corpus enhancement function is, for example, the shuffle function
  • the second corpus enhancement function is, for example, the drop function.
  • the target word vector sequence is composed of multiple target word vectors, and there is an arrangement order among the multiple target word vectors.
  • the terminal can call the corpus enhancement function to delete the initial word vector sequence or randomly shuffle the order, etc. to obtain the target word vector sequence, so that the terminal can process the word vector after data enhancement through the first text classification model Can improve the accuracy of classification results.
  • the initial word vector sequence is composed of multiple word vector sequences corresponding to the target text, and the arrangement order of the multiple word vectors is determined by the position corresponding to each word vector in the target text.
  • S202 may include S2021: calling the first corpus enhancement function to randomly disrupt the arrangement order of the plurality of word vectors to obtain a plurality of randomly arranged target word vector sequences.
  • the terminal may call the first corpus enhancement function to process multiple word vectors corresponding to the target text to randomly disrupt the arrangement order of the multiple word vectors corresponding to the target text, so as to obtain a randomly arranged target word vector sequence.
  • Each target word vector sequence includes multiple word vectors.
  • the number of target word vector sequences can be one or at least two. When the number of target word vector sequences is at least two, the word vectors included in the at least two word vector sequences processed by the first corpus enhancement function are the same, and the relative positions of the word vectors are different.
  • the word vector corresponding to the target text is "A, B, C, D, E, F”
  • the initial word vector sequence is "ABCDEF”, which is obtained by processing the initial word vector sequence through the first corpus enhancement function
  • the target word vector sequence is "ABDEFC”, “CABDEF”, “ACDEFB”, etc.
  • S202 may include S2022: calling a second corpus enhancement function to randomly delete the plurality of word vectors to obtain a target word vector sequence after a plurality of randomly deleted word vectors.
  • the terminal can also call the second corpus enhancement function to process multiple word vectors corresponding to the target text to randomly cut down the multiple word vectors contained in the target text, so as to obtain the target word vector after multiple randomly cut down word vectors sequence.
  • Each target word vector sequence includes at least two word vectors, and each word vector sequence contains different word vector parts.
  • the word vector corresponding to the target text is "A, B, C, D, E, F”
  • the initial word vector sequence is "ABCDEF”, which is obtained by processing the initial word vector sequence through the second corpus enhancement function
  • the target word vector sequence is: "ABC”, “ABD”, “ABDF”, “ACEF”, “AF”, etc.
  • the word vector set corresponding to the target text includes the initial word vector sequence corresponding to the target text, and may also include the target word vector sequence obtained by processing the corpus enhancement function.
  • the word vector set corresponding to the target text includes the initial word vector sequence corresponding to the target text, and may also include the target word vector sequence obtained by the first corpus enhancement function and the second corpus enhancement function The target word vector sequence obtained by processing.
  • S203 Input the word vector set corresponding to the target text into the pre-trained first text classification model for processing to obtain a first classification result; input the plurality of character vectors into a pre-trained second text classification model for processing to obtain The second classification result; wherein, the word vector set includes the target word vector sequence and the plurality of word vectors.
  • the terminal inputs the initial word vector sequence included in the word vector set corresponding to the target text and the target word vector sequence obtained by the corpus enhancement function into the pre-trained first text classification model for processing to obtain the first classification result;
  • the character vector is input and processed in a pre-trained second text classification model to obtain a second classification result.
  • the initial word vector sequence is composed of multiple word vectors in S201.
  • the terminal inputs a plurality of character vectors into the pre-trained second text classification model for processing.
  • the relevant description of S102 in the previous embodiment which is not repeated here.
  • the terminal may call a corpus enhancement function to process the word vectors of the training samples to obtain multiple target word vector sequences corresponding to the training samples, thereby obtaining expanded training
  • the sample word vector set is trained by using the processed training sample word vector set.
  • the terminal may perform equal probability fusion on the first classification result and the second classification result to obtain the final classification result of the target text. At this time, the terminal assigns a weight value of 0.5 to the first classification result and the second classification result.
  • the probability that the target text belongs to the first text category in the first classification result is 0.7, the probability that the target text belongs to the second text category is 0.1, and the probability that the target text belongs to the third text category is 0.2; the target text in the second classification result
  • the probability of belonging to the first text category is 0.6, the probability of the target text belonging to the second text category is 0.3, and the probability of the target text belonging to the third text category is 0.1; then the first classification result and the second classification result are subjected to equal probability fusion, Available:
  • the terminal determines that the target text belongs to the first text category, and obtains the final classification result of the target text.
  • the first text classification model includes TextCNN1, TextRNN1, and TextRCNN1
  • the second text classification model includes TextCNN2 and TextRCNN2
  • the terminal may assign different weight values to the first classification result and the second classification result, fuse the first classification result and the second classification result to obtain the final classification result of the target text.
  • the sum of the weight of the first classification result and the weight value of the second classification result is 1.
  • S204 may specifically include S2041 to S2042, as follows:
  • S2041 Determine the first weight value of the first classification result and the second weight value of the second classification result based on the performance indexes of the first text classification model and the second text classification model.
  • the performance index includes the accuracy of the classification result, and may also include the stability of the classification result. Among them, the higher the accuracy of the classification result of the text classification model, the greater the corresponding weight value; the higher the stability of the classification result of the text classification model, the greater the corresponding weight value.
  • the terminal may determine key performance indexes from the at least two performance indexes, and assign weight values based on the key performance indexes.
  • the key performance indicators are the indicators that best reflect the pros and cons of the classification model.
  • the first text classification model includes TextCNN1, TextRNN1, and TextRCNN1
  • the second text classification model includes TextCNN2 and TextRCNN2.
  • the weight values corresponding to TextRCNN1 and TextRCNN2 are higher than those of TextCNN1, TextRNN1, and TextCNN2.
  • the sum of the weight values corresponding to TextCNN1, TextRNN1, TextRCNN1, TextCNN2, and TextRCNN2 is 1, respectively.
  • S2042 Calculate the final classification result of the target text based on the first classification result, the first weight value, the second classification result, and the second weight value.
  • the terminal Based on the first classification result, the first weight value, the second classification result, and the second weight value, the terminal calculates the product of the weight value of each text classification model and the probability value of each corresponding category, and corresponds the same text category The products of are added to get the final probability value of the text category, and the classification result is determined based on the final probability value of each text category.
  • the total weight value is 1, based on the final probability value of each category, the terminal selects K probability values in order from high to low, and the category corresponding to the K probability values is used as the classification result of the target text.
  • K is an integer greater than or equal to 1.
  • the terminal converts the target text to be classified into multiple character vectors and multiple word vectors at the same time, processes multiple character vectors and multiple word vectors through different text classification models, and classifies all the text classification models
  • the obtained probability values of each text category are fused to determine the classification result of the target text.
  • Processing the same text through at least two text classification models can reduce the error of the classification results due to the different classification results output by different classification models, improve the accuracy of the classification results, and use the word vector as the minimum granularity for the target text. Processing can further improve the accuracy of the classification results of the target text.
  • FIG. 3 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. 2. For details, please refer to the relevant descriptions in the corresponding embodiments of FIGS. 1 to 2. For ease of explanation, only parts related to this embodiment are shown.
  • the terminal 3 includes:
  • the conversion unit 310 is configured to convert the target text to be classified into multiple character vectors and multiple word vectors, respectively;
  • the classification unit 320 is configured to input the plurality of word vectors into a pre-trained first text classification model for processing to obtain a first classification result; input the plurality of character vectors into a pre-trained second text classification model for processing, Get the second classification result;
  • the classification result fusion unit 330 is configured to fuse the first classification result and the second classification result to obtain the final classification result of the target text.
  • the terminal may further include:
  • a corpus enhancement unit used to call a corpus enhancement function to process the multiple word vectors to obtain a target word vector sequence
  • the classification unit 320 is specifically configured to: input the word vector set corresponding to the target text into a pre-trained first text classification model for processing to obtain a first classification result; input the plurality of character vectors into a pre-trained second text classification The model is processed to obtain a second classification result; wherein the word vector set includes the target word vector sequence and the plurality of word vectors.
  • the corpus enhancement unit is specifically configured to: call the first corpus enhancement function to randomly disrupt the arrangement order of the plurality of word vectors to obtain a plurality of randomly arranged target word vector sequences.
  • the corpus enhancement unit is specifically configured to: call a second corpus enhancement function to randomly delete the plurality of word vectors to obtain a target word vector sequence after a plurality of randomly deleted word vectors.
  • classification result fusion unit 330 is specifically used to:
  • a final classification result of the target text is calculated.
  • FIG. 4 is a schematic diagram of a terminal provided by another embodiment of the present application.
  • the terminal 4 of this embodiment includes: a processor 40, a memory 41, and computer-readable instructions 42 stored in the memory 41 and executable on the processor 40.
  • the processor 40 executes the computer-readable instruction 42
  • the steps in the above embodiments of the text analysis method of each terminal are implemented, for example, S101 to S103 shown in FIG. 1.
  • the processor 40 executes the computer-readable instructions 42
  • the functions of the units in the foregoing device embodiments are realized, for example, the functions of the units 310 to 330 shown in FIG. 3.
  • the computer-readable instructions 42 may be divided into one or more units, and the one or more units are stored in the memory 41 and executed by the processor 40 to complete the application .
  • the one or more units may be an instruction segment of a series of computer-readable instructions capable of performing specific functions, and the instruction segment is used to describe the execution process of the computer-readable instructions 42 in the terminal 4.
  • the computer-readable instructions 42 may be divided into a conversion unit, a classification unit, and a classification result fusion unit, and the specific functions of each unit are as described above.
  • the terminal may include, but is not limited to, the processor 40 and the memory 41.
  • FIG. 4 is only an example of the terminal 4 and does not constitute a limitation on the terminal 4, and may include more or less components than those illustrated, or combine certain components, or different components, for example
  • the terminal may also include an input-output terminal, a network access terminal, a bus, and so on.
  • the so-called processor 40 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 41 may be an internal storage unit of the terminal 4, such as a hard disk or a memory of the terminal 4.
  • the memory 41 may also be an external storage terminal of the terminal 4, for example, a plug-in hard disk equipped on the terminal 4, a smart memory card (Smart) Media (SMC), a secure digital (SD) card, Flash card (Flash Card), etc.
  • the memory 41 may include both an internal storage unit of the terminal 4 and an external storage terminal.
  • the memory 41 is used to store the computer-readable instructions and other programs and data required by the terminal.
  • the memory 41 can also be used to temporarily store data that has been or will be output.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

一种文本分析方法及终端,适用于计算机技术领域,该方法包括:将待分类的目标文本分别转换为多个字符向量以及多个词向量(S101);将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果(S102);将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果(S103)。上述方法通过至少两个文本分类模型对同一文本进行处理,能够减小因不同分类模型输出的分类结果不同而导致分类结果产生的误差,提高分类结果的准确度。

Description

一种文本分析方法及终端
本申请要求于2018年10月11日提交中国专利局、申请号为201811182140.X、发明名称为“一种文本分析方法及终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于计算机技术领域,尤其涉及一种文本分析方法及终端。
背景技术
文本分析是指对文本的表示及其特征项的选取;文本分析是文本挖掘、信息检索的一个基本问题,它把从文本中抽取出的特征词进行量化来表示文本信息。由于文本的语义不可避免地会反映人的特定立场、观点、价值和利益,因此,由文本内容分析,可以推断文本提供者的意图和目的。
近年来随着深度学习和各种神经网络模型的发展,基于神经网络的文本分析方法在信息检索、电子商务、新闻门户等众多领域得到广泛应用,以有效帮助用户从海量的文本资源中发掘用户所关注的有用的特定信息。神经网络例如,卷积神经网络(ConvolutionalNeuralNetwork,CNN)、循环神经网络(Recurrent Neural Network,RNN)。
然而,现有技术中基于神经网络的文本分析方法虽然能够捕捉文本的局部特征,但是,在文本进行超参调节后,文本的分类结果可能仍然无法达到需求的准确率;其中,超参是根据训练集要调整的参数。
技术问题
本申请实施例提供了一种文本分析方法及终端,以解决现有技术中,基于神经网络的文本分析方法在文本进行超参调节后,文本的分类结果可能仍然无法达到需求的准确率的问题。
技术解决方案
本申请实施例的第一方面提供了一种文本分析方法,包括:
将待分类的目标文本分别转换为多个字符向量以及多个词向量;
将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;
将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
本申请实施例的第二方面提供了一种终端,包括:
转换单元,用于将待分类的目标文本分别转换为多个字符向量以及多个词向量;
分类单元,用于将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;
分类结果融合单元,用于将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
本申请实施例的第三方面提供了一种终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现以下步骤:
将待分类的目标文本分别转换为多个字符向量以及多个词向量;
将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;
将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
本申请实施例的第四方面提供了一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现以下步骤:
将待分类的目标文本分别转换为多个字符向量以及多个词向量;
将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;
将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
有益效果
本申请实施例,终端通过将待分类的目标文本同时转换成多个字符向量以及多个词向量,通过不同的文本分类模型分别处理多个字符向量以及多个词向量,将所有的文本分类模型得到的每种文本类别的概率值进行融合,确定该目标文本的分类结果。通过至少两个文本分类模型对同一文本进行处理,能够减小因不同分类模型输出的分类结果不同而导致分类结果产生的误差,提高分类结果的准确度,以词向量为最小粒度对目标文本进行处理,能够进一步提升目标文本的分类结果的准确度。
附图说明
图1是本申请一实施例提供的文本分析方法的实现流程图;
图2是本申请另一实施例提供的一种文本分析方法的实现流程图;
图3是本申请一实施例提供的一种终端的示意图;
图4是本申请另一实施例提供的一种终端的示意图。
本发明的实施方式
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
请参见图1,图1是本申请实施例提供的一种文本分析方法的实现流程图。本实施例中文本分析方法的执行主体为终端。终端包括但不限于智能手机、平 板电脑、可穿戴设备等移动终端,还可以是台式电脑等。如图所示的文本分析方法可包括:
S101:将待分类的目标文本分别转换为多个字符向量以及多个词向量。
终端获取用户选择的待分类的目标文本,或者终端从网络数据库中获取待分类的目标文本,例如,从网络数据库中获取某商家的网店的商品描述信息;或者终端通过网络爬虫(Crawler)技术获取网页内容,并从网页内容中获取目标文本。
终端在获取到待分类的目标文本时,对待分类的文本进行切词处理,得到N个词单元以及M个字符单元;之后,终端对N个词单元进行编码得到N个词向量,对M个字符向量进行编码得到M个字符向量。其中,N个词向量以及M个字符向量由同一个目标文本得到。M、N均为大于或等于3的正整数。
S102:将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果。
终端将目标文本对应的多个词向量输入预先训练的第一文本分类模型进行处理,并输出多个词向量对应的分类结果,从而得到目标文本的第一分类结果;将目标文件对应的多个字符向量输入预先训练的第二文本分类模型进行处理,并输出多个字符向量对应的分类结果,得到目标文本的第二分类结果。第一分类结果以及第二分类结果用于标识目标文本属于一种或至少两种文本类别。
其中,预先训练的第一文本分类模型是通过使用机器学习算法对训练样本集中文本样本数据的词向量进行训练得到,在训练的过程中,第一文本分类模型的输入是训练样本集中文本样本数据的词向量,输出是每个已知的文本类别对应的概率。训练样本集包括预设数目的文本样本数据。预设数目可以是100、500、1000等,具体可根据实际需要设置。
第一文本分类模型可以为至少两个,例如卷积文本分类模型(TextCNN)、循环神经网络文本分类模型(TextRNN)、TextRCNN。TextCNN是基于卷积 神经网络(ConvolutionalNeuralNetwork,CNN)训练得到;TextRNN是基于循环神经网络(Recurrent Neural Network,RNN)训练得到;TextRCNN基于双向循环神经网络(Recurrent Convolutional Neural Network,RCNN)训练得到。
预先训练的第二文本分类模型是通过使用机器学习算法对训练样本集中文本样本数据的字符向量进行训练得到,在训练的过程中,第二文本分类模型的输入为训练样本集中文本样本数据的字符向量,输出为每个已知的文本类别对应的概率。例如,TextCNN、TextRCNN。
第一文本分类模型以及第二文本分类模型均为多分类模型,包括输入层、中间层以及输出层。对于TextCNN而言中间层包括卷积层、池化层以及全连接层;对于TextRNN而言,中间层为隐藏层;对于TextRCNN而言,中间层包括双重循环结构、卷积层、池化层以及全连接层。
输入层用于输入待分类文本对应的词向量或字符向量。
中间层用于对词向量或字符向量进行处理;其中,双向循环结构:比传统的基于窗口的神经网络噪声要小,能够最大化地提取上下文信息;池化层:自动决策哪个特征占有更加重要的作用。
输出层用于通过softmax函数对中间层处理得到的数据进行进一步处理,得到多个类别的概率值。其中,softmax函数
Figure PCTCN2019091502-appb-000001
可以看到它有多个值,所有值加起来刚好等于1,每个输出都映射到了0到1区间,可以看成是概率问题。
Figure PCTCN2019091502-appb-000002
为多个输入,训练其实就是为了逼近最佳的θ T
下面以TextRCNN模型处理待分类文本对应的词向量为例进行说明:先经过1层双向长短时记忆循环神经网络LSTM,该词的左侧的词正向输入进去得到一个词向量,该词的右侧反向输入进去得到一个词向量。再结合该词的词向量,生成一个1×3k的向量;再经过全连接层,tanh为非线性函数,得到向量y2;向量y2再经过最大池化层进行处理,得到最大化向量y3;y3再经过全连接层进行处理,得到分类结果。
S103:将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
终端可以将第一分类结果以及第二分类结果进行等概率融合,得到目标文本的最终分类结果。此时,终端为第一分类结果以及第二分类结果分配的权重值均为0.5。
假设,第一分类结果中目标文本属于第一文本类别的概率为0.7,目标文本属于第二文本类别的概率为0.1,目标文本属于第三文本类别的概率为0.2;第二分类结果中目标文本属于第一文本类别的概率为0.6,目标文本属于第二文本类别的概率为0.3,目标文本属于第三文本类别的概率为0.1;那么将第一分类结果以及第二分类结果进行等概率融合,可得:
目标文本属于第一文本类别的概率为:0.7×0.5+0.6×0.5=0.65;
目标文本属于第二文本类别的概率为:0.1×0.5+0.3×0.5=0.2;
目标文本属于第三文本类别的概率为:0.2×0.5+0.1×0.5=0.15。
基于上述结果,终端判定目标文本属于第一文本类别,得到目标文本的最终分类结果。
在另一实施方式中,终端可以为第一分类结果以及第二分类结果分配不同的权重值,将第一分类结果以及第二分类结果进行融合,得到目标文本的最终分类结果。第一分类结果的权重与第二分类结果的权重值之和为1。
本申请实施例,终端通过将待分类的目标文本同时转换成多个字符向量以及多个词向量,通过不同的文本分类模型分别处理多个字符向量以及多个词向量,将所有的文本分类模型得到的每种文本类别的概率值进行融合,确定该目标文本的分类结果。通过至少两个文本分类模型对同一文本进行处理,能够减小因不同分类模型输出的分类结果不同而导致分类结果产生的误差,提高分类结果的准确度,以词向量为最小粒度对目标文本进行处理,能够进一步提升目标文本的分类结果的准确度。
请参见图2,图2是本申请另一实施例提供的一种文本分析方法的实现流 程图。本实施例中文本分析方法的执行主体为终端。终端包括但不限于智能手机、平板电脑、可穿戴设备等移动终端,还可以是台式电脑等。本实施例的文本分析方法包括以下步骤:
S201:将待分类的目标文本分别转换为多个字符向量以及多个词向量。
本实施例中S201与上一实施例中S101相同,具体请参阅上一实施例中S101的相关描述,此处不赘述。
S202:调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列。
语料增强函数包括用于随机排列多个词向量的第一语料增强函数,和/或,用于对短文本包含的多个词向量进行删减的第二语料增强函数。第一语料增强函数例如shuffle函数,第二语料增强函数例如,drop函数。
目标词向量序列有多个目标词向量组成,多个目标词向量之间具有排列顺序。
终端可以调用语料增强函数对初始的词向量序列进行删减或随机打乱排列顺序等处理,得到目标词向量序列,以使得终端在通过第一文本分类模型对进行数据增强后的词向量进行处理时,能够提升分类结果的准确率。其中,初始的词向量序列由目标文本对应的多个词向量序列构成,多个词向量的排列顺序由目标文本中每个词向量对应的位置确定。
进一步地,S202可以包括S2021:调用第一语料增强函数随机打乱所述多个词向量的排列顺序,得到多个随机排列的目标词向量序列。
终端可以调用第一语料增强函数对目标文本对应的多个词向量进行处理,以随机打乱目标文本对应的多个词向量的排列顺序,从而得到随机排列的目标词向量序列。每个目标词向量序列包括多个词向量。目标词向量序列的数目可以为一个,也可以为至少两个。当目标词向量序列的数目为至少两个时,经过第一语料增强函数处理得到的至少两个词向量序列中所包含的词向量相同,且各词向量的相对位置各不相同。
例如,目标文本对应的词向量为“A、B、C、D、E、F”,初始的词向量序列为“ABCDEF”,经过第一语料增强函数对初始的词向量序列进行处理后得到的目标词向量序列为“ABDEFC”、“CABDEF”“ACDEFB”等。
进一步地,S202可以包括S2022:调用第二语料增强函数对所述多个词向量进行随机删减,得到多个随机删减词向量后的目标词向量序列。
终端还可以调用第二语料增强函数对目标文本对应的多个词向量进行处理,以随机对目标文本包含的多个词向量进行删减,从而得到多个随机删减词向量后的目标词向量序列。每个目标词向量序列包括至少两个词向量,且每个词向量序列包含的词向量部分不同。
例如,目标文本对应的词向量为“A、B、C、D、E、F”,初始的词向量序列为“ABCDEF”,经过第二语料增强函数对初始的词向量序列进行处理后得到的目标词向量序列为:“ABC”、“ABD”、“ABDF”、“ACEF”、“AF”等。
目标文本对应的词向量集包括目标文本对应的初始的词向量序列,还可以包括经过语料增强函数处理得到的目标词向量序列。
可以理解的是,S2021与S2022为并列步骤,可同时执行。当同时执行S2021以及S2022时,目标文本对应的词向量集包括目标文本对应的初始的词向量序列、还可以包括经过第一语料增强函数处理得到的目标词向量序列,以及经过第二语料增强函数处理得到的目标词向量序列。
S203:将所述目标文本对应的词向量集输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;其中,所述词向量集包括所述目标词向量序列以及所述多个词向量。
终端将目标文本对应的词向量集包含的初始的词向量序列以及经过语料增强函数处理得到的目标词向量序列,输入预先训练的第一文本分类模型进行处 理,得到第一分类结果;将多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果。初始的词向量序列由S201中的多个词向量组成。
本实施例第一分类模型对词向量序列中的词向量进行处理的过程,请参阅上一实施例中S102第一分类模型对多个词向量的处理过程,此处不赘述。终端将多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果的具体实现方式请参阅上一实施例中S102的相关描述,此处不赘述。
进一步地,终端在采用训练样本的词向量训练第一文本分类模型时,可以调用语料增强函数对训练样本的词向量进行处理,得到训练样本对应的多个目标词向量序列,从而得到扩充的训练样本词向量集,以采用处理后的训练样本词向量集进行训练。样本增强方法请参阅上述S202的相关描述。
S204:将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
终端可以将第一分类结果以及第二分类结果进行等概率融合,得到目标文本的最终分类结果。此时,终端为第一分类结果以及第二分类结果分配的权重值均为0.5。
假设,第一分类结果中目标文本属于第一文本类别的概率为0.7,目标文本属于第二文本类别的概率为0.1,目标文本属于第三文本类别的概率为0.2;第二分类结果中目标文本属于第一文本类别的概率为0.6,目标文本属于第二文本类别的概率为0.3,目标文本属于第三文本类别的概率为0.1;那么将第一分类结果以及第二分类结果进行等概率融合,可得:
目标文本属于第一文本类别的概率为:0.7×0.5+0.6×0.5=0.65;
目标文本属于第二文本类别的概率为:0.1×0.5+0.3×0.5=0.2;
目标文本属于第三文本类别的概率为:0.2×0.5+0.1×0.5=0.15。
基于上述结果,终端判定目标文本属于第一文本类别,得到目标文本的最终分类结果。
再例如,假设第一文本分类模型包括TextCNN1、TextRNN1以及 TextRCNN1,第二文本分类模型包括TextCNN2以及TextRCNN2,那么TextCNN1、TextRNN1、TextRCNN1、TextCNN2以及TextRCNN2各自对应的权重值为0.2。
在另一实施方式中,终端可以为第一分类结果以及第二分类结果分配不同的权重值,将第一分类结果以及第二分类结果进行融合,得到目标文本的最终分类结果。第一分类结果的权重与第二分类结果的权重值之和为1。
进一步地,为了提高分类结果的准确度,S204可以具体包括S2041~S2042,具体如下:
S2041:基于所述第一文本分类模型以及所述第二文本分类模型的性能指标,确定所述第一分类结果的第一权重值以及所述第二分类结果的第二权重值。
性能指标包括分类结果的准确度,还可以包括分类结果的稳定性。其中,文本分类模型的分类结果的准确度越高,其对应的权重值越大;文本分类模型的分类结果的稳定性越高,其对应的权重值越大。
当性能指标包括至少两项时,终端可以从至少两项性能指标中确定关键的性能指标,并基于关键的性能指标分配权重值。关键的性能指标是最能体现分类模型的优劣的指标。
例如,第一文本分类模型包括TextCNN1、TextRNN1以及TextRCNN1,第二文本分类模型包括TextCNN2以及TextRCNN2。当TextRCNN1以及TextRCNN2的性能较优时,TextRCNN1以及TextRCNN2对应的权重值高于TextCNN1、TextRNN1以及TextCNN2的权重值。TextCNN1、TextRNN1、TextRCNN1、TextCNN2以及TextRCNN2各自对应的权重值的总和为1。
S2042:基于所述第一分类结果、所述第一权重值、所述第二分类结果以及所述第二权重值,计算所述目标文本的最终分类结果。
终端基于第一分类结果、第一权重值、第二分类结果以及第二权重值,分别计算每个文本分类模型的权重值与其对应的每种类别的概率值的乘积,并将相同文本类别对应的乘积相加得到该文本类别最终的概率值,基于每种文本类 别最终的概率值确定分类结果。其中,所有权重值之和为1,终端基于每种类别最终的概率值,按从高到低的顺序依次选取K个概率值,根据K个概率值对应的类别作为目标文本的分类结果。K为大于或等于1的整数。
本申请实施例,终端通过将待分类的目标文本同时转换成多个字符向量以及多个词向量,通过不同的文本分类模型分别处理多个字符向量以及多个词向量,将所有的文本分类模型得到的每种文本类别的概率值进行融合,确定该目标文本的分类结果。通过至少两个文本分类模型对同一文本进行处理,能够减小因不同分类模型输出的分类结果不同而导致分类结果产生的误差,提高分类结果的准确度,以词向量为最小粒度对目标文本进行处理,能够进一步提升目标文本的分类结果的准确度。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
请参阅图3,图3是本申请一实施例提供的一种终端的示意图。终端包括的各单元用于执行图1~图2对应的实施例中的各步骤。具体请参阅图1~图2各自对应的实施例中的相关描述。为了便于说明,仅示出了与本实施例相关的部分。参见图3,终端3包括:
转换单元310,用于将待分类的目标文本分别转换为多个字符向量以及多个词向量;
分类单元320,用于将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;
分类结果融合单元330,用于将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
可选地,终端还可以包括:
语料增强单元,用于调用语料增强函数对所述多个词向量进行处理,得到 目标词向量序列;
分类单元320具体用于:将所述目标文本对应的词向量集输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;其中,所述词向量集包括所述目标词向量序列以及所述多个词向量。
进一步地,语料增强单元具体用于:调用第一语料增强函数随机打乱所述多个词向量的排列顺序,得到多个随机排列的目标词向量序列。
进一步地,语料增强单元具体用于:调用第二语料增强函数对所述多个词向量进行随机删减,得到多个随机删减词向量后的目标词向量序列。
进一步地,分类结果融合单元330具体用于:
基于所述第一文本分类模型以及所述第二文本分类模型的性能指标,确定所述第一分类结果的第一权重值以及所述第二分类结果的第二权重值;
基于所述第一分类结果、所述第一权重值、所述第二分类结果以及所述第二权重值,计算所述目标文本的最终分类结果。
图4是本申请另一实施例提供的一种终端的示意图。如图4所示,该实施例的终端4包括:处理器40、存储器41以及存储在所述存储器41中并可在所述处理器40上运行的计算机可读指令42。所述处理器40执行所述计算机可读指令42时实现上述各个终端的文本分析方法实施例中的步骤,例如图1所示的S101至S103。或者,所述处理器40执行所述计算机可读指令42时实现上述各装置实施例中各单元的功能,例如图3所示单元310至330功能。
示例性的,所述计算机可读指令42可以被分割成一个或多个单元,所述一个或者多个单元被存储在所述存储器41中,并由所述处理器40执行,以完成本申请。所述一个或多个单元可以是能够完成特定功能的一系列计算机可读指令的指令段,该指令段用于描述所述计算机可读指令42在所述终端4中的执行过程。例如,所述计算机可读指令42可以被分割成转换单元、分类单元以及分类结果融合单元,各单元具体功能如上所述。
所述终端可包括,但不仅限于,处理器40、存储器41。本领域技术人员可以理解,图4仅仅是终端4的示例,并不构成对终端4的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端还可以包括输入输出终端、网络接入终端、总线等。
所称处理器40可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器41可以是所述终端4的内部存储单元,例如终端4的硬盘或内存。所述存储器41也可以是所述终端4的外部存储终端,例如所述终端4上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器41还可以既包括所述终端4的内部存储单元也包括外部存储终端。所述存储器41用于存储所述计算机可读指令以及所述终端所需的其他程序和数据。所述存储器41还可以用于暂时地存储已经输出或者将要输出的数据。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种文本分析方法,其特征在于,包括:
    将待分类的目标文本分别转换为多个字符向量以及多个词向量;
    将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;
    将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
  2. 根据权利要求1所述的文本分析方法,其特征在于,所述将待分类的目标文本分别转换为多个字符向量以及多个词向量之后,还包括:
    调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列;
    所述将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果,包括:
    将所述目标文本对应的词向量集输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;其中,所述词向量集包括所述目标词向量序列以及所述多个词向量。
  3. 根据权利要求2所述的文本分析方法,其特征在于,所述调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列,包括:
    调用第一语料增强函数随机打乱所述多个词向量的排列顺序,得到多个随机排列的目标词向量序列。
  4. 根据权利要求2所述的文本分析方法,其特征在于,所述调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列,包括:
    调用第二语料增强函数对所述多个词向量进行随机删减,得到多个随机删 减词向量后的目标词向量序列。
  5. 根据权利要求1至4任一项所述的文本分析方法,其特征在于,所述将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果,包括:
    基于所述第一文本分类模型以及所述第二文本分类模型的性能指标,确定所述第一分类结果的第一权重值以及所述第二分类结果的第二权重值;
    基于所述第一分类结果、所述第一权重值、所述第二分类结果以及所述第二权重值,计算所述目标文本的最终分类结果。
  6. 一种终端,其特征在于,包括:
    转换单元,用于将待分类的目标文本分别转换为多个字符向量以及多个词向量;
    分类单元,用于将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;
    分类结果融合单元,用于将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
  7. 根据权利要求6所述的终端,其特征在于,所述终端还包括:
    语料增强单元,用于调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列;
    所述分类单元具体用于:将所述目标文本对应的词向量集输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;其中,所述词向量集包括所述目标词向量序列以及所述多个词向量。
  8. 根据权利要求7所述的终端,其特征在于,所述语料增强单元具体用于:调用第一语料增强函数随机打乱所述多个词向量的排列顺序,得到多个随机排列的目标词向量序列。
  9. 根据权利要求7所述的终端,其特征在于,所述语料增强单元具体用于:调用第二语料增强函数对所述多个词向量进行随机删减,得到多个随机删减词向量后的目标词向量序列。
  10. 根据权利要求6至9任一项所述的终端,其特征在于,所述分类结果融合单元具体用于:
    基于所述第一文本分类模型以及所述第二文本分类模型的性能指标,确定所述第一分类结果的第一权重值以及所述第二分类结果的第二权重值;
    基于所述第一分类结果、所述第一权重值、所述第二分类结果以及所述第二权重值,计算所述目标文本的最终分类结果。
  11. 一种终端,其特征在于,所述终端包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
    将待分类的目标文本分别转换为多个字符向量以及多个词向量;
    将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;
    将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果。
  12. 根据权利要求11所述的终端,其特征在于,所述将待分类的目标文本分别转换为多个字符向量以及多个词向量之后,所述处理器执行所述计算机可读指令时还实现如下步骤:
    调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列;
    所述将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果,包括:
    将所述目标文本对应的词向量集输入预先训练的第一文本分类模型进行处 理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;其中,所述词向量集包括所述目标词向量序列以及所述多个词向量。
  13. 根据权利要求12所述的终端,其特征在于,所述调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列,包括:
    调用第一语料增强函数随机打乱所述多个词向量的排列顺序,得到多个随机排列的目标词向量序列。
  14. 根据权利要求12所述的终端,其特征在于,所述调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列,包括:
    调用第二语料增强函数对所述多个词向量进行随机删减,得到多个随机删减词向量后的目标词向量序列。
  15. 根据权利要求11至14任一项所述的终端,其特征在于,所述将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果,包括:
    基于所述第一文本分类模型以及所述第二文本分类模型的性能指标,确定所述第一分类结果的第一权重值以及所述第二分类结果的第二权重值;
    基于所述第一分类结果、所述第一权重值、所述第二分类结果以及所述第二权重值,计算所述目标文本的最终分类结果。
  16. 一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:
    将待分类的目标文本分别转换为多个字符向量以及多个词向量;
    将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;
    将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本 的最终分类结果。
  17. 根据权利要求16所述的计算机非易失性可读存储介质,其特征在于,所述将待分类的目标文本分别转换为多个字符向量以及多个词向量之后,所述计算机可读指令被至少一个处理器执行时还实现如下步骤:
    调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列;
    所述将所述多个词向量输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果,包括:
    将所述目标文本对应的词向量集输入预先训练的第一文本分类模型进行处理,得到第一分类结果;将所述多个字符向量输入预先训练的第二文本分类模型进行处理,得到第二分类结果;其中,所述词向量集包括所述目标词向量序列以及所述多个词向量。
  18. 根据权利要求17所述的计算机非易失性可读存储介质,其特征在于,所述调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列,包括:
    调用第一语料增强函数随机打乱所述多个词向量的排列顺序,得到多个随机排列的目标词向量序列。
  19. 根据权利要求17所述的计算机非易失性可读存储介质,其特征在于所述调用语料增强函数对所述多个词向量进行处理,得到目标词向量序列,包括:
    调用第二语料增强函数对所述多个词向量进行随机删减,得到多个随机删减词向量后的目标词向量序列。
  20. 根据权利要求16至19任一项所述的计算机非易失性可读存储介质,其特征在于,所述将所述第一分类结果以及所述第二分类结果进行融合,得到所述目标文本的最终分类结果,包括:
    基于所述第一文本分类模型以及所述第二文本分类模型的性能指标,确定所述第一分类结果的第一权重值以及所述第二分类结果的第二权重值;
    基于所述第一分类结果、所述第一权重值、所述第二分类结果以及所述第二权重值,计算所述目标文本的最终分类结果。
PCT/CN2019/091502 2018-10-11 2019-06-17 一种文本分析方法及终端 Ceased WO2020073673A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811182140.X 2018-10-11
CN201811182140.XA CN109376240A (zh) 2018-10-11 2018-10-11 一种文本分析方法及终端

Publications (1)

Publication Number Publication Date
WO2020073673A1 true WO2020073673A1 (zh) 2020-04-16

Family

ID=65403533

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/091502 Ceased WO2020073673A1 (zh) 2018-10-11 2019-06-17 一种文本分析方法及终端

Country Status (2)

Country Link
CN (1) CN109376240A (zh)
WO (1) WO2020073673A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115329380A (zh) * 2022-08-18 2022-11-11 成都卫士通信息产业股份有限公司 一种数据库表分类分级方法、装置、设备及存储介质
WO2023043481A1 (en) * 2021-09-17 2023-03-23 Rakuten Mobile, Inc. Sentiment analysis

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376240A (zh) * 2018-10-11 2019-02-22 平安科技(深圳)有限公司 一种文本分析方法及终端
CN110175236B (zh) * 2019-04-24 2023-07-21 平安科技(深圳)有限公司 用于文本分类的训练样本生成方法、装置和计算机设备
CN110362677B (zh) * 2019-05-31 2022-12-27 平安科技(深圳)有限公司 文本数据类别的识别方法及装置、存储介质、计算机设备
CN112052331A (zh) * 2019-06-06 2020-12-08 武汉Tcl集团工业研究院有限公司 一种处理文本信息的方法及终端
CN112241490A (zh) * 2019-07-19 2021-01-19 阿里巴巴集团控股有限公司 分类处理及数据搜索方法、装置、电子设备、智能音箱
CN110598206B (zh) * 2019-08-13 2023-04-07 平安国际智慧城市科技股份有限公司 文本语义识别方法、装置、计算机设备和存储介质
CN110782002B (zh) * 2019-09-12 2022-04-05 成都四方伟业软件股份有限公司 一种lstm神经网络训练方法及装置
CN110765889B (zh) * 2019-09-29 2024-06-25 平安直通咨询有限公司上海分公司 法律文书的特征提取方法、相关装置及存储介质
CN112685374B (zh) * 2019-10-17 2023-04-11 中国移动通信集团浙江有限公司 日志分类方法、装置及电子设备
CN112947928A (zh) * 2019-12-10 2021-06-11 北京沃东天骏信息技术有限公司 代码评价的方法、装置、电子设备和存储介质
CN112948575B (zh) * 2019-12-11 2023-09-26 京东科技控股股份有限公司 文本数据处理方法、装置和计算机可读存储介质
US11288115B1 (en) 2020-11-05 2022-03-29 International Business Machines Corporation Error analysis of a predictive model
CN112307209B (zh) * 2020-11-05 2024-04-26 江西高创保安服务技术有限公司 一种基于字符向量的短文本分类方法及系统
CN112364131B (zh) * 2020-11-10 2024-05-17 中国平安人寿保险股份有限公司 一种语料处理方法及其相关装置
CN112417154B (zh) * 2020-11-25 2023-01-24 上海创米数联智能科技发展股份有限公司 确定文献相似度的方法和装置
CN115422348A (zh) * 2021-05-12 2022-12-02 中移雄安信息通信科技有限公司 文件识别方法、装置、电子设备和存储介质
CN113535960A (zh) * 2021-08-02 2021-10-22 中国工商银行股份有限公司 一种文本分类方法、装置和设备
CN113868416A (zh) * 2021-09-18 2021-12-31 恒安嘉新(北京)科技股份公司 异常短信的检测方法、装置、计算机设备及介质
CN114443835B (zh) * 2021-12-22 2024-12-24 天翼云科技有限公司 一种基于多模型融合的分类方法及装置
CN119493860A (zh) * 2025-01-16 2025-02-21 国网浙江省电力有限公司电力科学研究院 一种文本分类方法、装置、设备、存储介质及程序产品

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853250A (zh) * 2009-04-03 2010-10-06 华为技术有限公司 对文档进行分类的方法及装置
CN108334605A (zh) * 2018-02-01 2018-07-27 腾讯科技(深圳)有限公司 文本分类方法、装置、计算机设备及存储介质
WO2018150453A1 (ja) * 2017-02-14 2018-08-23 三菱電機株式会社 データ分析装置およびデータ分析方法
CN108536679A (zh) * 2018-04-13 2018-09-14 腾讯科技(成都)有限公司 命名实体识别方法、装置、设备及计算机可读存储介质
CN109376240A (zh) * 2018-10-11 2019-02-22 平安科技(深圳)有限公司 一种文本分析方法及终端

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9053391B2 (en) * 2011-04-12 2015-06-09 Sharp Laboratories Of America, Inc. Supervised and semi-supervised online boosting algorithm in machine learning framework
CN107301225B (zh) * 2017-06-20 2021-01-26 挖财网络技术有限公司 短文本分类方法及装置
CN108108351B (zh) * 2017-12-05 2020-05-22 华南理工大学 一种基于深度学习组合模型的文本情感分类方法
CN108595590A (zh) * 2018-04-19 2018-09-28 中国科学院电子学研究所苏州研究院 一种基于融合注意力模型的中文文本分类方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853250A (zh) * 2009-04-03 2010-10-06 华为技术有限公司 对文档进行分类的方法及装置
WO2018150453A1 (ja) * 2017-02-14 2018-08-23 三菱電機株式会社 データ分析装置およびデータ分析方法
CN108334605A (zh) * 2018-02-01 2018-07-27 腾讯科技(深圳)有限公司 文本分类方法、装置、计算机设备及存储介质
CN108536679A (zh) * 2018-04-13 2018-09-14 腾讯科技(成都)有限公司 命名实体识别方法、装置、设备及计算机可读存储介质
CN109376240A (zh) * 2018-10-11 2019-02-22 平安科技(深圳)有限公司 一种文本分析方法及终端

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023043481A1 (en) * 2021-09-17 2023-03-23 Rakuten Mobile, Inc. Sentiment analysis
US12086544B2 (en) 2021-09-17 2024-09-10 Rakuten Mobile, Inc. Sentiment analysis
CN115329380A (zh) * 2022-08-18 2022-11-11 成都卫士通信息产业股份有限公司 一种数据库表分类分级方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN109376240A (zh) 2019-02-22

Similar Documents

Publication Publication Date Title
WO2020073673A1 (zh) 一种文本分析方法及终端
CN112633973B (zh) 一种商品推荐方法及其相关设备
US11227118B2 (en) Methods, devices, and systems for constructing intelligent knowledge base
WO2020073507A1 (zh) 一种文本分类方法及终端
CN107944629B (zh) 一种基于异质信息网络表示的推荐方法及装置
CN112559747B (zh) 事件分类处理方法、装置、电子设备和存储介质
WO2023045605A9 (zh) 数据处理方法、装置、计算机设备及存储介质
JP6661754B2 (ja) コンテンツ配信方法および装置
CN106874253A (zh) 识别敏感信息的方法及装置
CN111797622A (zh) 用于生成属性信息的方法和装置
CN110689359A (zh) 对模型进行动态更新的方法及装置
CN111324725B (zh) 一种话题获取方法、终端、计算机可读存储介质
CN115129885A (zh) 实体链指方法、装置、设备及存储介质
WO2020082890A1 (zh) 一种文本还原方法、装置及电子设备
CN114328884A (zh) 一种图文去重方法及装置
CN112257959A (zh) 用户风险预测方法、装置、电子设备及存储介质
CN115880018A (zh) 用户个性化商品推荐方法及装置
CN115392235A (zh) 字符匹配方法、装置、电子设备及可读存储介质
CN111858917A (zh) 文本分类方法和装置
WO2022142010A1 (zh) 一种非均衡样本的分类方法、装置、设备及存储介质
CN113535939A (zh) 文本处理方法和装置、电子设备以及计算机可读存储介质
CN115544379A (zh) 基于四元数图卷积神经网络的推荐方法和装置
CN116186388A (zh) 用户的兴趣推荐方法、电子设备及存储介质
CN116166800A (zh) 一种文本数据增强的方法、装置和电子设备
CN116010689A (zh) 推荐模型的训练方法、装置、电子设备及存储介质

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: 19870614

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: 19870614

Country of ref document: EP

Kind code of ref document: A1