WO2020147393A1 - 基于卷积神经网络的文本分类方法及相关设备 - Google Patents

基于卷积神经网络的文本分类方法及相关设备 Download PDF

Info

Publication number
WO2020147393A1
WO2020147393A1 PCT/CN2019/117008 CN2019117008W WO2020147393A1 WO 2020147393 A1 WO2020147393 A1 WO 2020147393A1 CN 2019117008 W CN2019117008 W CN 2019117008W WO 2020147393 A1 WO2020147393 A1 WO 2020147393A1
Authority
WO
WIPO (PCT)
Prior art keywords
word vector
word
text
vector
neural network
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/117008
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 WO2020147393A1 publication Critical patent/WO2020147393A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • 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
    • G06N3/09Supervised learning
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • 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 relates to the field of artificial intelligence, and in particular to a text classification method and related equipment based on a convolutional neural network.
  • Text classification is to classify a large amount of unstructured text information (text documents, web pages, etc.) into designated categories according to the content of the text information according to a given classification system. It is a guided learning process.
  • the word matching method is the earliest proposed classification algorithm. This method only judges whether the document belongs to a certain category based on whether the same word as the category name appears in the document. Obviously, this too simple mechanical method cannot bring good classification results.
  • statistical learning methods have become the absolute mainstream in the field of text classification. The main reason is that many of these technologies have a solid theoretical foundation, clear evaluation criteria, and good actual performance. After the statistical classification algorithm successfully converts the sample data into a vector representation, the computer can begin the real "learning" process.
  • Commonly used classification algorithms are: Decision Tree, Rocchio, Naive Bayes, Neural Network, Support Vector Machine, Linear Least Square Fitting, kNN, Genetic Algorithm, Maximum Entropy, Generalized Instance Set, etc.
  • word vectors are better than word vectors in text classification models, word vectors can represent text semantics at the character level, which is a good supplement to the application of word vectors.
  • the current text classification methods are not aimed at word vectors and word vectors, and the lack of word vectors will significantly reduce the accuracy of text classification, which is not conducive to text analysis.
  • the purpose of this application is to address the shortcomings of the prior art and provide a text classification method and related equipment based on a convolutional neural network, by extracting word vectors and word vectors from the text to be classified, and inputting the word vectors and word vectors Convolutional neural network fusion can effectively improve the accuracy of text classification.
  • the technical solution of the present application provides a text classification method and related equipment based on a convolutional neural network.
  • This application discloses a text classification method based on a convolutional neural network, which includes the following steps:
  • the word vectors and word vectors are input into a convolutional neural network text classification model, and the word vectors and word vectors are fused through the convolutional neural network text classification model to obtain the type of the text to be classified.
  • the application also discloses a text classification device based on a convolutional neural network, the device comprising:
  • Vector mapping module set to obtain the mapping relationship between words and word vectors and the mapping relationship between words and word vectors;
  • Vector generation module configured to obtain the text to be classified, and convert the text to be classified into word vectors and word vectors according to the mapping relationship between the word and the word vector and the mapping relationship between the word and the word vector;
  • Text classification module configured to input the word vector and word vector into a convolutional neural network text classification model, and merge the word vector and word vector through the convolutional neural network text classification model to obtain the to-be-classified The type of text.
  • the application also discloses a computer device, the computer device includes a memory and a processor, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by one or more of the processors, One or more of the processors perform the following steps:
  • the word vectors and word vectors are input into a convolutional neural network text classification model, and the word vectors and word vectors are fused through the convolutional neural network text classification model to obtain the type of the text to be classified.
  • the application also discloses a storage medium that can be read and written by a processor, and the storage medium stores computer instructions.
  • the computer-readable instructions are executed by one or more processors, one or more Each processor performs the following steps:
  • the word vectors and word vectors are input into a convolutional neural network text classification model, and the word vectors and word vectors are fused through the convolutional neural network text classification model to obtain the type of the text to be classified.
  • the beneficial effect of this application is that this application can effectively improve the accuracy of text classification by extracting word vectors and word vectors from the text to be classified, and inputting the word vectors and word vectors into the convolutional neural network for fusion.
  • FIG. 1 is a schematic flowchart of a text classification method based on convolutional neural network according to an embodiment of the application
  • FIG. 2 is a schematic flowchart of a text classification method based on convolutional neural network according to an embodiment of the application
  • FIG. 3 is a schematic flowchart of a text classification method based on convolutional neural network according to an embodiment of the application
  • FIG. 4 is a schematic flowchart of a text classification method based on convolutional neural network according to an embodiment of the application
  • FIG. 5 is a schematic flowchart of a text classification method based on convolutional neural network according to an embodiment of the application
  • FIG. 6 is a schematic flowchart of a text classification method based on convolutional neural network according to an embodiment of the application
  • FIG. 7 is a schematic flowchart of a text classification method based on a convolutional neural network according to an embodiment of the application.
  • FIG. 8 is a schematic structural diagram of a text classification device based on a convolutional neural network according to an embodiment of the application.
  • FIG. 1 The flow of a method for text classification based on convolutional neural network in an embodiment of the present application is shown in FIG. 1, and this embodiment includes the following steps:
  • Step s101 acquiring the mapping relationship between the word and the word vector and the mapping relationship between the word and the word vector;
  • the classification of text is based on word vectors and word vectors, and the text to be classified can be regarded as a text composed of words and characters. Therefore, before the vector conversion of the text to be classified, the relationship between words and word vectors can be preset The mapping relationship and the mapping relationship between words and word vectors.
  • Step s102 Obtain the text to be classified, and convert the text to be classified into a word vector and a word vector according to the mapping relationship between the word and the word vector and the mapping relationship between the word and the word vector;
  • the text to be classified when a text to be classified is obtained, the text to be classified can be segmented into words and characters. Since the text to be classified is also composed of words and characters, the text to be classified can be divided into words. ⁇ , obtain word data and word data respectively, and then convert the word data into word vectors according to the mapping relationship between words and word vectors, and convert the word data into words according to the mapping relationship between words and word vectors vector.
  • Step s103 Input the word vector and word vector into a convolutional neural network text classification model, and merge the word vector and word vector through the convolutional neural network text classification model to obtain the type of the text to be classified .
  • the word vector and word vector of the text to be classified can be input into the convolutional neural network text classification model at the same time, and the convolutional neural network text classification model includes convolution Layer and fully connected layer, the convolution layer performs convolution operation on the word vector and word vector, extracts the features of the word vector and the word vector respectively, and then inputs the features of the word vector and the word vector into the full connection
  • the layer is fused. After the feature information of the word vector and the word vector is fused through the fully connected layer, the input and output layer is used to obtain the type of the text to be classified.
  • Figure 2 is a schematic flow chart of a text classification method based on convolutional neural network according to an embodiment of the application. As shown in the figure, in step s101, the mapping relationship between words and word vectors and the relationship between words and word vectors are obtained.
  • the mapping relationship includes:
  • Step s201 Obtain text training data, perform word segmentation on the text training data, and obtain word data;
  • the text training data can use Chinese Wikipedia as the training corpus.
  • the training data can be word segmented through the jieba module in Python, that is, the training text can be divided by the jieba word segmentation tool Into a set of word data.
  • Step s202 perform word segmentation on the text training data to obtain word data
  • each word in the training text can be extracted to obtain a set of word data.
  • step s203 the word data and the word data are converted through the word2vec model to obtain the word vector and the word vector, and the mapping relationship between the word and the word vector and the mapping relationship between the word and the word vector are established respectively.
  • the word data may be first loaded into the word2vec module in the gensim library, the word data may be converted into a word vector, and the mapping relationship between the word and the word vector may be saved; and then the word The data is also loaded into the word2vec module in the gensim library, the word data is also converted into a word vector, and the mapping relationship between the word and the word vector is saved.
  • the mapping relationship between words and word vectors and the mapping relationship between words and word vectors can be effectively obtained.
  • FIG. 3 is a schematic flowchart of a text classification method based on convolutional neural network according to an embodiment of the application.
  • step s102 the text to be classified is obtained, and according to the mapping relationship between the word and the word vector
  • step s102 the text to be classified is obtained, and according to the mapping relationship between the word and the word vector
  • step s102 the mapping relationship between words and word vectors converts the text to be classified into word vectors and word vectors, including:
  • Step s301 Obtain the text to be classified, segment the text to be classified to obtain word data, and convert the word data into a word vector according to the mapping relationship between the word and the word vector;
  • the text to be classified may be a document or a web page.
  • a word segmentation tool such as jieba word segmentation tool, can be used to segment the text to be classified to obtain
  • the word data is then converted into a word vector according to the mapping relationship between the word and the word vector in step s101.
  • Step s302 Perform word segmentation on the text to be classified to obtain word data, and convert the word data into a word vector according to the mapping relationship between the word and the word vector.
  • the text to be classified may be divided into words one by one to obtain a set of word data, and then the word data is converted into a word vector according to the mapping relationship between the word and the word vector in step s101.
  • the text to be classified can be converted into word vectors and word vectors.
  • Figure 4 is a schematic flow chart of a text classification method based on convolutional neural network according to an embodiment of the application.
  • the word vector and word vector are input into the convolutional neural network text classification model, and
  • the fusion of the word vector and the word vector through the convolutional neural network text classification model to obtain the type of the text to be classified includes:
  • Step s401 input the word vector and the word vector into the convolutional layer of the convolutional neural network text classification model, and perform a convolution operation on the word vector and the word vector through the convolutional layer to obtain the word vector and the word vector.
  • the word vector and word vector can be first input to the convolutional layer of the convolutional neural network text classification model, and one-dimensional convolution kernels with scales of 1, 3, and 5 can be established in the convolutional layer.
  • step s402 the features of the word vector and the word vector are fused through the fully connected layer to obtain the fusion information of the word vector and the word vector, and the information of the text to be classified is obtained according to the fusion information of the word vector and the word vector. Types of.
  • the fully connected layer connects all convolution channels, and the convolution channel contains two channels of information, namely word vector information and word vector information.
  • the fully connected layer obtains the word vector information and the word vector After information, the word vector information and word vector information can be fused, that is, the word vector information and word vector information are converted into text type information, and then the probability of belonging to each text type is calculated according to the text type information, and Select the text type corresponding to the highest probability as the type of text to be classified.
  • the text type can be effectively obtained and the accuracy of text classification can be improved.
  • Fig. 5 is a schematic flow chart of a text classification method based on convolutional neural network according to an embodiment of the application.
  • the word vector and word vector are input into the convolutional neural network text classification model.
  • the product layer through the convolution layer to perform convolution operations on the word vector and the word vector to obtain the characteristics of the word vector and the word vector respectively, and send them to the fully connected layer, including:
  • Step s501 input the word vector and the word vector into the convolutional layer of the convolutional neural network text classification model, obtain the characteristics of the word vector and the word vector through the convolution operation of the convolutional layer, and send them to the attention Force layer
  • the word vector and word vector can be first input to the convolutional layer of the convolutional neural network text classification model, and one-dimensional convolution kernels with scales of 1, 3, and 5 can be established in the convolutional layer.
  • the function is activated and input to the pooling layer for data compression, and then the feature information of the word vector and the word vector is sent to the attention layer.
  • step s502 the word vector and the word vector are respectively weighted through the attention layer and then sent to the fully connected layer.
  • the attention layer can assign weights to the word vector channel information and the word vector channel information respectively, and the attention layer is parallel to the fully connected layer A fully connected structure of, connect the convolution output, and output through the softmax function.
  • the softmax function is used to assign weights to the channels. Take the word vector channel as an example. For example, the word vector channel has 128 channels, and each channel corresponds to a word The feature of the vector, then the 128 channels can be weighted through the softmax function, and the channels containing important feature information will be assigned a larger weight, so that unnecessary phrase information can be filtered.
  • each channel The feature information of the channel multiplied by the weight and then added is the total feature information of the word vector channel; similarly, after the word vector channel is weighted and weighted, the word vector information and word vector information are sent to the fully connected layer For information fusion.
  • the weight distribution is performed by the attention layer, which can filter the unimportant feature information in the word vector and the word vector, and improve the efficiency of text classification.
  • step s103 the word vector and word vector are input into the convolutional neural network text classification model, and
  • the fusion of the word vector and the word vector through the convolutional neural network text classification model to obtain the type of the text to be classified includes:
  • Step s601 Input the word vector and the word vector into the first convolutional layer of the convolutional neural network text classification model, and send the word vector and the word vector to the first convolutional layer through the first convolutional layer.
  • a fully connected layer
  • the word vector and word vector can be first input into the first convolutional layer of the convolutional neural network text classification model, and one-dimensional scales of 1, 3, and 5 can be established in the first convolutional layer.
  • the convolution kernel performs convolution operations on the word vector and word vector to extract the features of the word vector and word vector.
  • the number of channels of the one-dimensional convolution kernel of each scale is 128.
  • the result of the convolution operation It can be activated by the ReLU activation function and input to the pooling layer for data compression, and then the word vector and the characteristic information of the word vector are sent to the first fully connected layer.
  • Step s602 after fusing the word vector and the word vector through the first fully connected layer, obtain first fusion information, and send the first fusion information to a second convolutional layer;
  • the first fully concatenated layer receives the feature information of the word vector and the word vector, it fuses the two-way feature information of the word vector and the word vector to obtain the first fusion information, and the first fusion information Send to the second convolutional layer.
  • Step s603 Perform convolution operation on the first fusion information through the second convolution layer and send it to the second fully connected layer. After fusion through the second fully connected layer, the second fusion information is obtained, and according to The second fusion information obtains the type of the text to be classified.
  • the second convolutional layer when it receives the first fusion information, it establishes a channel for the first fusion information and performs the convolution operation again, extracts the characteristic information in the first fusion information, and sends it to the second A fully connected layer, through the second fully connected layer to re-fuse the output information of the convolution channel to obtain the second fusion information, and then calculate the probability of each text type according to the second fusion information, and select the largest The text type corresponding to that probability of is used as the type of text to be classified.
  • FIG. 7 is a schematic flow chart of a method for text classification based on convolutional neural network according to an embodiment of the application.
  • the second fusion information is obtained after fusion is performed through the second fully connected layer, and Obtaining the type of the text to be classified according to the second fusion information includes:
  • Step s701 Obtain second fusion information after fusion is performed through the second fully connected layer, and send the second fusion information to the output layer;
  • the second fused information is obtained, and the second fused information is sent to the output layer.
  • Step s702 Obtain the probability of each text type according to the second fusion information through the softmax function of the output layer, obtain the largest probability among the probabilities, and use the text type corresponding to the largest probability as the The type of text to be classified is output.
  • the second fusion information can be regarded as the distribution of text features in each text type.
  • the second Fusion information refers to how much information contains sports features, how much information contains financial features, and then calculates the probability of belonging to the sports type and the probability of belonging to the financial type through the softmax function of the output layer, and then selects the type with the highest probability as the output Type, for example, the probability of belonging to the sports type is 0.8, and the probability of belonging to the financial type is 0.2, then the type of the text to be classified is the sports type.
  • the type of the text to be classified can be effectively obtained.
  • FIG. 8 The structure of a text classification device based on a convolutional neural network in an embodiment of the present application is shown in FIG. 8, and includes:
  • the vector mapping module includes:
  • Word segmentation unit set to obtain text training data, perform word segmentation on the text training data, and obtain word data
  • Word segmentation unit set to segment the text training data to obtain word data
  • Conversion unit set to convert the word data and word data through the word2vec model to obtain word vectors and word vectors, and establish the mapping relationship between words and word vectors and the mapping relationship between words and word vectors respectively.
  • the vector generation module includes:
  • the first vector conversion unit configured to obtain the text to be classified, segment the text to be classified to obtain word data, and convert the word data into a word vector according to the mapping relationship between the word and the word vector;
  • the second vector conversion unit configured to divide the text to be classified to obtain word data, and convert the word data into a word vector according to the mapping relationship between the word and the word vector.
  • the text classification module includes:
  • the first convolution unit configured to input the word vector and word vector into the convolution layer of the convolutional neural network text classification model, and perform convolution operations on the word vector and word vector through the convolution layer to obtain the The characteristics of the predicate vector and the word vector are sent to the fully connected layer;
  • the first fusion unit configured to merge the features of the word vector and the word vector through the fully connected layer to obtain the fusion information of the word vector and the word vector, and obtain the fusion information of the word vector and the word vector The type of text to be classified.
  • the text classification module includes:
  • Feature acquisition unit configured to input the word vector and word vector into the convolutional layer of the convolutional neural network text classification model, and obtain the characteristics of the word vector and word vector through the convolution operation of the convolutional layer, and Sent to the attention layer;
  • Weight distribution unit configured to distribute the weights of the word vectors and word vectors through the attention layer, and then send them to the fully connected layer.
  • the text classification module includes:
  • the second convolution unit configured to input the word vector and the word vector into the first convolution layer of the convolutional neural network text classification model, and convolve the word vector and the word vector through the first convolution layer Send to the first fully connected layer after calculation;
  • the second fusion unit configured to obtain first fusion information after fusing the word vector and the word vector through the first fully connected layer, and send the first fusion information to the second convolutional layer;
  • Classification unit configured to perform convolution operation on the first fusion information through the second convolution layer and send it to the second fully connected layer, and obtain the second fusion information after fusion through the second fully connected layer, And obtain the type of the text to be classified according to the second fusion information.
  • the text classification module includes:
  • Sending unit configured to obtain second fusion information after fusion through the second fully connected layer, and send the second fusion information to the output layer;
  • Output unit set to obtain the probability of each text type according to the second fusion information through the softmax function of the output layer, obtain the largest probability among the probabilities, and use the text type corresponding to the largest probability as The type of the text to be classified is output.
  • An embodiment of the present application also discloses a computer device that includes a memory and a processor.
  • the memory stores computer-readable instructions.
  • the computer-readable instructions are executed by one or more of the processors, , Enabling one or more of the processors to execute the steps in the text classification methods in the foregoing embodiments.
  • the embodiment of the present application also discloses a storage medium that can be read and written by a processor, and the memory stores computer-readable instructions.
  • the computer-readable instructions are executed by one or more processors, One or more processors execute the steps in the text classification method described in the foregoing embodiments.
  • the computer program can be stored in a computer readable storage medium. When executed, it may include the procedures of the above-mentioned method embodiments.
  • the aforementioned storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), etc.

Landscapes

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

Abstract

一种基于卷积神经网络的文本分类方法及相关设备,所述方法包括:获取词与词向量之间的映射关系以及字与字向量之间的映射关系(S101);获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量(S102);将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型(S103)。上述方法通过将待分类文本提取词向量和字向量,并将所述词向量和字向量输入卷积神经网络进行融合,可以有效的提高文本分类的准确度。

Description

基于卷积神经网络的文本分类方法及相关设备
本申请要求于2019年01月17日提交中国专利局、申请号为201910042629.5、发明名称为“基于卷积神经网络的文本分类方法及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能领域,特别涉及一种基于卷积神经网络的文本分类方法及相关设备。
背景技术
文本分类是对大量非结构化的文字信息(文本文档、网页等)按照给定的分类体系,根据文字信息内容分到指定的类别中去,是一种有指导的学习过程。词匹配法是最早被提出的分类算法。这种方法仅根据文档中是否出现了与类名相同的词来判断文档是否属于某个类别。很显然,这种过于简单机械的方法无法带来良好的分类效果。现如今,统计学习方法已经成为了文本分类领域绝对的主流。主要的原因在于其中的很多技术拥有坚实的理论基础,存在明确的评价标准,以及实际表现良好。统计分类算法将样本数据成功转化为向量表示之后,计算机才算开始真正意义上的“学习”过程。常用的分类算法为:决策树,Rocchio,朴素贝叶斯,神经网络,支持向量机,线性最小平方拟合,kNN,遗传算法,最大熵,Generalized Instance Set等。
现有神经网络文本分类模型主要基于词向量,尽管词向量在文本分类模型中的应用优于字向量,但是字向量能够通过字符层面表示文本语义,对词向量的应用是很好的补充。目前对文本分类的方法没有针对词向量和字向量的,而少了字向量,会显著降低文本分类的准确度,不利于对文本的分析。
发明内容
本申请的目的在于针对现有技术的不足,提供一种基于卷积神经网络的文本分类方法及相关设备,通过将待分类文本提取词向量和字向量,并将所述词向量和字向量输入卷积神经网络进行融合,可以有效的提高文本分类的准确度。
为达到上述目的,本申请的技术方案提供一种基于卷积神经网络的文本分类方法及相关设备。
本申请公开了一种基于卷积神经网络的文本分类方法,包括以下步骤:
获取词与词向量之间的映射关系以及字与字向量之间的映射关系;
获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;
将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
本申请还公开了一种基于卷积神经网络的文本分类装置,所述装置包括:
向量映射模块:设置为获取词与词向量之间的映射关系以及字与字向量之间的映射关系;
向量生成模块:设置为获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;
文本分类模块:设置为将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
本申请还公开了一种计算机设备,所述计算机设备包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被一个或多个所述处理器执行时,使得一个或多个所述处理器执行以下步骤:
获取词与词向量之间的映射关系以及字与字向量之间的映射关系;
获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;
将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
本申请还公开了一种存储介质,所述存储介质可被处理器读写,所述存储介质存储有计算机指令,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
获取词与词向量之间的映射关系以及字与字向量之间的映射关系;
获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;
将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
本申请的有益效果是:本申请通过将待分类文本提取词向量和字向量,并将所述词向量和字向量输入卷积神经网络进行融合,可以有效地提高文本分类的准确度。
附图说明
图1为本申请实施例的一种基于卷积神经网络的文本分类方法的流程示意图;
图2为本申请实施例的一种基于卷积神经网络的文本分类方法的流程示意图;
图3为本申请实施例的一种基于卷积神经网络的文本分类方法的流程示意图;
图4为本申请实施例的一种基于卷积神经网络的文本分类方法的流程示意图;
图5为本申请实施例的一种基于卷积神经网络的文本分类方法的流程示意图;
图6为本申请实施例的一种基于卷积神经网络的文本分类方法的流程示意图;
图7为本申请实施例的一种基于卷积神经网络的文本分类方法的流程示意图;
图8为本申请实施例的一种基于卷积神经网络的文本分类装置结构示意图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅 仅用以解释本申请,并不用于限定本申请。
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本申请的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。
本申请实施例的一种基于卷积神经网络的文本分类方法流程如图1所示,本实施例包括以下步骤:
步骤s101,获取词与词向量之间的映射关系以及字与字向量之间的映射关系;
具体的,文本的分类是基于词向量和字向量,而待分类文本可看成是由词和字组成的文本,因此在对待分类文本进行向量转换之前,可预先设定词与词向量之间的映射关系及字与字向量之间的映射关系。
步骤s102,获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;
具体的,当获取一篇待分类文本后,可先将所述待分类文本进行分词和分字,由于所述待分类文本也是有词和字组成,因此可将所述待分类文本分割成词和字,分别获得词数据和字数据,然后根据词与词向量之间的映射关系将所述词数据转换成词向量,根据字与字向量之间的映射关系将所述字数据转换成字向量。
步骤s103,将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
具体的,当获取到所述待分类文本的词向量及字向量后,可将所述词向量和字向量同时输入卷积神经网络文本分类模型,所述卷积神经网络文本分类模型包含卷积层及全连接层,所述卷积层对所述词向量和字向量进行卷积运算,分别提取所述词向量和字向量的特征,然后将所述词向量和字向量的特征输入全连接层进行融合,当通过所述全连接层对所述词向量和字向量的特征信息进 行融合后,输入输出层,获取所述待分类文本的类型。
本实施例中,通过将待分类文本提取词向量和字向量,并将所述词向量和字向量输入卷积神经网络进行融合,可以有效的提高文本分类的准确度。
图2为本申请实施例的一种基于卷积神经网络的文本分类方法流程示意图,如图所示,所述步骤s101,获取词与词向量之间的映射关系以及字与字向量之间的映射关系,包括:
步骤s201,获取文本训练数据,对所述文本训练数据进行分词,获得词数据;
具体的,所述文本训练数据可以采用中文维基百科作为训练语料,当获取到所述训练数据后,可通过Python中的jieba模块对所述训练数据进行分词,即对训练文本通过jieba分词工具划分成一组词数据。
步骤s202,对所述文本训练数据进行分字,获得字数据;
具体的,通过分词工具jieba对所述训练文本进行分词后,可将训练文本中的每个字提取出来,获得一组字数据。
步骤s203,对所述词数据和字数据通过word2vec模型进行转换,获得词向量和字向量,并分别建立词与词向量之间的映射关系及字与字向量之间的映射关系。
具体的,可先将所述词数据载入gensim库中的word2vec模块,将所述词数据转换成词向量,并将所述词与词向量之间的映射关系保存下来;然后将所述字数据也载入gensim库中的word2vec模块,将所述字数据也转换成字向量,并将所述字与字向量之间的映射关系保存下来。
本实施例中,通过jieba模块和word2vec模块对训练文本向量的转换,可以有效获取词与词向量之间的映射关系及字与字向量之间的映射关系。
图3为本申请实施例的一种基于卷积神经网络的文本分类方法流程示意图,如图所示,所述步骤s102,获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量,包括:
步骤s301,获取待分类文本,将所述待分类文本进行分词,获得词数据, 并根据所述词与词向量之间的映射关系将所述词数据转换为词向量;
具体的,所述待分类文本可以是一篇文档,也可以是一个网页,当获取到所述待分类文本后,可通过分词工具,如jieba分词工具,对所述待分类文本进行分词,获得词数据,然后将所述词数据根据步骤s101中词与词向量之间的映射关系转换为词向量。
步骤s302,对所述待分类文本进行分字,获得字数据,并根据所述字与字向量之间的映射关系将所述字数据转换为字向量。
具体的,可先将所述待分类文本分割成一个一个字,获得一组字数据,然后将所述字数据根据步骤s101中字与字向量之间的映射关系转换为字向量。
本实施例中,通过词与词向量之间的映射关系及字与字向量之间的映射关系,可将所述待分类文本转换成词向量及字向量。
图4为本申请实施例的一种基于卷积神经网络的文本分类方法流程示意图,如图所示,所述步骤s103,将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型,包括:
步骤s401,将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层对所述词向量及字向量进行卷积运算分别获得所述词向量及字向量的特征,并发送给全连接层;
具体的,可先将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,在所述卷积层中可先建立尺度为1、3、5的一维卷积核,分别对所述词向量和字向量进行卷积运算以提取所述词向量和字向量的特征,每种尺度的一维卷积核的通道数为128,卷积运算后的结果可通过激活函数ReLU激活,并输入到池化层进行数据压缩,然后将所述词向量和字向量的特征信息发送给全连接层。
步骤s402,通过所述全连接层对所述词向量及字向量的特征进行融合,获得词向量和字向量的融合信息,根据所述词向量和字向量的融合信息获得所述待分类文本的类型。
具体的,所述全连接层连接所有的卷积通道,所述卷积通道包含两路信息, 即词向量信息和字向量信息,当所述全连接层获取到所述词向量信息和字向量信息后,可对所述词向量信息和字向量信息进行融合,即将所述词向量信息和字向量信息转换为文本类型信息,然后根据所述文本类型信息计算出属于各个文本类型的概率,并从中选取最大的那个概率对应的文本类型作为待分类文本的类型。
本实施例中,通过卷积层成运算和全连接层的信息融合,可以有效获取文本类型,提高文本分类准确度。
图5为本申请实施例的一种基于卷积神经网络的文本分类方法流程示意图,如图所示,所述步骤s401,将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层对所述词向量及字向量进行卷积运算分别获得所述词向量及字向量的特征,并发送给全连接层,包括:
步骤s501,将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层的卷积运算分别获得所述词向量及字向量的特征,并发送给注意力层;
具体的,可先将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,在所述卷积层中可先建立尺度为1、3、5的一维卷积核,分别对所述词向量和字向量进行卷积运算以提取所述词向量和字向量的特征,每种尺度的一维卷积核的通道数为128,卷积运算后的结果可通过ReLU激活函数激活,并输入到池化层进行数据压缩,然后将所述词向量和字向量的特征信息发送给注意力层。
步骤s502,通过所述注意力层分别对所述词向量和字向量进行权重分配后发送给全连接层。
具体的,当注意力层获取到所述词向量和字向量的两路特征信息后,可分别对词向量通道信息和字向量通道信息进行权重分配,所述注意力层是平行于全连接层的一个全连接结构,连接卷积输出,并通过softmax函数输出,所述softmax函数用于对通道进行权重分配,以词向量通道为例,如词向量通道有128个通道,每个通道对应词向量的特征,那么通过softmax函数可对所述128个通道进行权重分配,包含重要特征信息的通道会分配较大的权重,这样可以 过滤不必要的词组信息,当分配好权重以后,对每条通道的特征信息乘以权重然后相加即为词向量通道总的特征信息;同样的,对字向量通道进行权重分配并加权计算后,将所述词向量信息和字向量信息发送给全连接层进行信息融合。
本实施例中,通过注意力层进行权重分配,可以过滤词向量和字向量中不重要的特征信息,提高文本分类的效率。
图6为本申请实施例的一种基于卷积神经网络的文本分类方法流程示意图,如图所示,所述步骤s103,将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型,包括:
步骤s601,将所述词向量及字向量输入卷积神经网络文本分类模型的第一卷积层,通过所述第一卷积层对所述词向量及字向量进行卷积运算后发送至第一全连接层;
具体的,可先将所述词向量及字向量输入卷积神经网络文本分类模型的第一个卷积层,在第一个卷积层中可先建立尺度为1、3、5的一维卷积核,分别对所述词向量和字向量进行卷积运算以提取所述词向量和字向量的特征,每种尺度的一维卷积核的通道数为128,卷积运算后的结果可通过ReLU激活函数激活,并输入到池化层进行数据压缩,然后将所述词向量和字向量的特征信息发送给第一个全连接层。
步骤s602,通过所述第一全连接层对所述词向量和字向量进行融合后,获得第一融合信息,并将所述第一融合信息发送至第二卷积层;
具体的,当第一个全接连层收到词向量和字向量的特征信息后,对词向量和字向量的两路特征信息进行融合,获得第一个融合信息,并将第一个融合信息发送至第二个卷积层。
步骤s603,通过所述第二卷积层对所述第一融合信息进行卷积运算后发送至第二全连接层,通过所述第二全连接层进行融合后获得第二融合信息,并根据所述第二融合信息获得所述待分类文本的类型。
具体的,当第二个卷积层收到第一个融合信息后,对第一个融合信息建立通道并再次进行卷积运算,提取第一个融合信息中的特征信息,并发送给第二 个全连接层,通过第二个全连接层对卷积通道的输出信息进行再次融合,获得第二个融合信息,然后根据第二个融合信息计算出属于各个文本类型的概率,并从中选取最大的那个概率对应的文本类型作为待分类文本的类型。
本实施例中,通过两个卷积层的卷积运算和两个全连接层的信息融合,可以有效提高文本分类的准确度。
图7为本申请实施例的一种基于卷积神经网络的文本分类方法流程示意图,如图所示,所述步骤s603,通过所述第二全连接层进行融合后获得第二融合信息,并根据所述第二融合信息获得所述待分类文本的类型,包括:
步骤s701,通过所述第二全连接层进行融合后获得第二融合信息,并将所述第二融合信息发送给输出层;
具体的,通过第二全连接层对卷积运算后的第一个融合信息进行再次融合后,获得第二个融合信息,并将第二个融合信息发送给输出层。
步骤s702,通过所述输出层的softmax函数根据所述第二融合信息获取每个文本类型的概率,在所述概率中获取最大的概率,并将所述最大的概率对应的文本类型作为所述待分类文本的类型进行输出。
具体的,输出层收到第二个融合信息后,所述第二个融合信息可看做文本特征在各个文本类型上的分布,例如,本次文本分类的类型是体育或者财经,那么第二融合信息就是指有多少信息是包含体育特征的,有多少信息是包含财经特征的,然后通过输出层的softmax函数计算属于体育类型的概率及属于财经类型的概率,然后选择概率最大的类型作为输出类型,例如,属于体育类型的概率为0.8,属于财经类型的概率为0.2,那么待分类文本的类型为体育类型。
本实施例中,通过输出层对融合信息的分析计算,可以有效获取待分类文本的类型。
本申请实施例的一种基于卷积神经网络的文本分类装置结构如图8所示,包括:
向量映射模块801、向量生成模块802及文本分类模块803;其中,向量映射模块801与向量生成模块802相连,向量生成模块802与文本分类模块803相连;向量映射模块801设置为获取词与词向量之间的映射关系以及字与字向 量之间的映射关系;向量生成模块802设置为获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;文本分类模块803设置为将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
在一个实施例中,向量映射模块,包括:
分词单元:设置为获取文本训练数据,对所述文本训练数据进行分词,获得词数据;
分字单元:设置为对所述文本训练数据进行分字,获得字数据;
转换单元:设置为对所述词数据和字数据通过word2vec模型进行转换,获得词向量和字向量,并分别建立词与词向量之间的映射关系及字与字向量之间的映射关系。
在一个实施例中,向量生成模块,包括:
第一向量转换单元:设置为获取待分类文本,将所述待分类文本进行分词,获得词数据,并根据所述词与词向量之间的映射关系将所述词数据转换为词向量;
第二向量转换单元:设置为对所述待分类文本进行分字,获得字数据,并根据所述字与字向量之间的映射关系将所述字数据转换为字向量。
在一个实施例中,文本分类模块,包括:
第一卷积单元:设置为将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层对所述词向量及字向量进行卷积运算分别获得所述词向量及字向量的特征,并发送给全连接层;
第一融合单元:设置为通过所述全连接层对所述词向量及字向量的特征进行融合,获得词向量和字向量的融合信息,根据所述词向量和字向量的融合信息获得所述待分类文本的类型。
在一个实施例中,文本分类模块,包括:
特征获取单元:设置为将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层的卷积运算分别获得所述词向量及字向量的特 征,并发送给注意力层;
权重分配单元:设置为通过所述注意力层分别对所述词向量和字向量进行权重分配后发送给全连接层。
在一个实施例中,文本分类模块,包括:
第二卷积单元:设置为将所述词向量及字向量输入卷积神经网络文本分类模型的第一卷积层,通过所述第一卷积层对所述词向量及字向量进行卷积运算后发送至第一全连接层;
第二融合单元:设置为通过所述第一全连接层对所述词向量和字向量进行融合后,获得第一融合信息,并将所述第一融合信息发送至第二卷积层;
分类单元:设置为通过所述第二卷积层对所述第一融合信息进行卷积运算后发送至第二全连接层,通过所述第二全连接层进行融合后获得第二融合信息,并根据所述第二融合信息获得所述待分类文本的类型。
在一个实施例中,文本分类模块,包括:
发送单元:设置为通过所述第二全连接层进行融合后获得第二融合信息,并将所述第二融合信息发送给输出层;
输出单元:设置为通过所述输出层的softmax函数根据所述第二融合信息获取每个文本类型的概率,在所述概率中获取最大的概率,并将所述最大的概率对应的文本类型作为所述待分类文本的类型进行输出。
本申请实施例还公开了一种计算机设备,所述计算机设备包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被一个或多个所述处理器执行时,使得一个或多个所述处理器执行上述各实施例中所述文本分类方法中的步骤。
本申请实施例还公开了一种存储介质,所述存储介质可被处理器读写,所述存储器存储有计算机可读指令,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述各实施例中所述文本分类方法中的步骤。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流 程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random Access Memory,RAM)等。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种基于卷积神经网络的文本分类方法,包括以下步骤:
    获取词与词向量之间的映射关系以及字与字向量之间的映射关系;
    获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;
    将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
  2. 如权利要求1所述的基于卷积神经网络的文本分类方法,其中,所述获取词与词向量之间的映射关系以及字与字向量之间的映射关系,包括:
    获取文本训练数据,对所述文本训练数据进行分词,获得词数据;
    对所述文本训练数据进行分字,获得字数据;
    对所述词数据和字数据通过word2vec模型进行转换,获得词向量和字向量,并分别建立词与词向量之间的映射关系及字与字向量之间的映射关系。
  3. 如权利要求1所述的基于卷积神经网络的文本分类方法,其中,所述获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量,包括:
    获取待分类文本,将所述待分类文本进行分词,获得词数据,并根据所述词与词向量之间的映射关系将所述词数据转换为词向量;
    对所述待分类文本进行分字,获得字数据,并根据所述字与字向量之间的映射关系将所述字数据转换为字向量。
  4. 如权利要求1所述的基于卷积神经网络的文本分类方法,其中,所述将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型包括:
    将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层对所述词向量及字向量进行卷积运算分别获得所述词向量及字向量的特征,并发送给全连接层;
    通过所述全连接层对所述词向量及字向量的特征进行融合,获得词向量和字向量的融合信息,根据所述词向量和字向量的融合信息获得所述待分类文本的类型。
  5. 如权利要求4所述的基于卷积神经网络的文本分类方法,其中,所述将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层对所述词向量及字向量进行卷积运算分别获得所述词向量及字向量的特征,并发送给全连接层,包括:
    将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层的卷积运算分别获得所述词向量及字向量的特征,并发送给注意力层;
    通过所述注意力层分别对所述词向量和字向量进行权重分配后发送给全连接层。
  6. 如权利要求1所述的基于卷积神经网络的文本分类方法,其中,所述将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型,包括:
    将所述词向量及字向量输入卷积神经网络文本分类模型的第一卷积层,通过所述第一卷积层对所述词向量及字向量进行卷积运算后发送至第一全连接层;
    通过所述第一全连接层对所述词向量和字向量进行融合后,获得第一融合信息,并将所述第一融合信息发送至第二卷积层;
    通过所述第二卷积层对所述第一融合信息进行卷积运算后发送至第二全连接层,通过所述第二全连接层进行融合后获得第二融合信息,并根据所述第二融合信息获得所述待分类文本的类型。
  7. 如权利要求6所述的基于卷积神经网络的文本分类方法,其中,所述通过所述第二全连接层进行融合后获得第二融合信息,并根据所述第二融合信息获得所述待分类文本的类型,包括:
    通过所述第二全连接层进行融合后获得第二融合信息,并将所述第二融合信息发送给输出层;
    通过所述输出层的softmax函数根据所述第二融合信息获取每个文本类型的概率,在所述概率中获取最大的概率,并将所述最大的概率对应的文本类型作为所述待分类文本的类型进行输出。
  8. 一种基于卷积神经网络的文本分类装置,所述装置包括:
    向量映射模块:设置为获取词与词向量之间的映射关系以及字与字向量之间的映射关系;
    向量生成模块:设置为获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;
    文本分类模块:设置为将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
  9. 根据权利要求8所述的基于卷积神经网络的文本分类装置,其中,所述向量映射模块,包括:
    分词单元:设置为获取文本训练数据,对所述文本训练数据进行分词,获得词数据;
    分字单元:设置为对所述文本训练数据进行分字,获得字数据;
    转换单元:设置为对所述词数据和字数据通过word2vec模型进行转换,获得词向量和字向量,并分别建立词与词向量之间的映射关系及字与字向量之间的映射关系。
  10. 根据权利要求8所述的基于卷积神经网络的文本分类装置,其中,所述向量生成模块,包括:
    第一向量转换单元:设置为获取待分类文本,将所述待分类文本进行分词,获得词数据,并根据所述词与词向量之间的映射关系将所述词数据转换为词向量;
    第二向量转换单元:设置为对所述待分类文本进行分字,获得字数据,并根据所述字与字向量之间的映射关系将所述字数据转换为字向量。
  11. 根据权利要求8所述的基于卷积神经网络的文本分类装置,其中,所 述文本分类模块,包括:
    第一卷积单元:设置为将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层对所述词向量及字向量进行卷积运算分别获得所述词向量及字向量的特征,并发送给全连接层;
    第一融合单元:设置为通过所述全连接层对所述词向量及字向量的特征进行融合,获得词向量和字向量的融合信息,根据所述词向量和字向量的融合信息获得所述待分类文本的类型。
  12. 根据权利要求11所述的基于卷积神经网络的文本分类装置,其中,所述文本分类模块,包括:
    特征获取单元:设置为将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层的卷积运算分别获得所述词向量及字向量的特征,并发送给注意力层;
    权重分配单元:设置为通过所述注意力层分别对所述词向量和字向量进行权重分配后发送给全连接层。
  13. 根据权利要求8所述的基于卷积神经网络的文本分类装置,其中,所述文本分类模块,包括:
    第二卷积单元:设置为将所述词向量及字向量输入卷积神经网络文本分类模型的第一卷积层,通过所述第一卷积层对所述词向量及字向量进行卷积运算后发送至第一全连接层;
    第二融合单元:设置为通过所述第一全连接层对所述词向量和字向量进行融合后,获得第一融合信息,并将所述第一融合信息发送至第二卷积层;
    分类单元:设置为通过所述第二卷积层对所述第一融合信息进行卷积运算后发送至第二全连接层,通过所述第二全连接层进行融合后获得第二融合信息,并根据所述第二融合信息获得所述待分类文本的类型。
  14. 根据权利要求13所述的基于卷积神经网络的文本分类装置,其中,所述文本分类模块,包括:
    发送单元:设置为通过所述第二全连接层进行融合后获得第二融合信息,并将所述第二融合信息发送给输出层;
    输出单元:设置为通过所述输出层的softmax函数根据所述第二融合信息获取每个文本类型的概率,在所述概率中获取最大的概率,并将所述最大的概率对应的文本类型作为所述待分类文本的类型进行输出。
  15. 一种计算机设备,所述计算机设备包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被一个或多个所述处理器执行时,使得一个或多个所述处理器执行以下步骤:
    获取词与词向量之间的映射关系以及字与字向量之间的映射关系;
    获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;
    将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
  16. 根据权利要求15所述的计算机设备,其中,所述将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型时,使得所述处理器执行以下步骤:
    将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层对所述词向量及字向量进行卷积运算分别获得所述词向量及字向量的特征,并发送给全连接层;
    通过所述全连接层对所述词向量及字向量的特征进行融合,获得词向量和字向量的融合信息,根据所述词向量和字向量的融合信息获得所述待分类文本的类型。
  17. 根据权利要求15所述的计算机设备,其中,所述将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型时,使得所述处理器执行以下步骤:
    将所述词向量及字向量输入卷积神经网络文本分类模型的第一卷积层,通 过所述第一卷积层对所述词向量及字向量进行卷积运算后发送至第一全连接层;
    通过所述第一全连接层对所述词向量和字向量进行融合后,获得第一融合信息,并将所述第一融合信息发送至第二卷积层;
    通过所述第二卷积层对所述第一融合信息进行卷积运算后发送至第二全连接层,通过所述第二全连接层进行融合后获得第二融合信息,并根据所述第二融合信息获得所述待分类文本的类型。
  18. 一种存储介质,所述存储介质可被处理器读写,所述存储介质存储有计算机指令,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
    获取词与词向量之间的映射关系以及字与字向量之间的映射关系;
    获取待分类文本,并根据所述词与词向量之间的映射关系以及字与字向量之间的映射关系将所述待分类文本转换成词向量及字向量;
    将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型。
  19. 根据权利要求18所述的存储介质,其中,所述将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所述词向量及字向量进行融合,获得所述待分类文本的类型时,使得一个或多个所述处理器执行以下步骤:
    将所述词向量及字向量输入卷积神经网络文本分类模型的卷积层,通过所述卷积层对所述词向量及字向量进行卷积运算分别获得所述词向量及字向量的特征,并发送给全连接层;
    通过所述全连接层对所述词向量及字向量的特征进行融合,获得词向量和字向量的融合信息,根据所述词向量和字向量的融合信息获得所述待分类文本的类型。
  20. 根据权利要求18所述的存储介质,其中,所述将所述词向量及字向量输入卷积神经网络文本分类模型,并通过所述卷积神经网络文本分类模型对所 述词向量及字向量进行融合,获得所述待分类文本的类型时,使得一个或多个所述处理器执行以下步骤:
    将所述词向量及字向量输入卷积神经网络文本分类模型的第一卷积层,通过所述第一卷积层对所述词向量及字向量进行卷积运算后发送至第一全连接层;
    通过所述第一全连接层对所述词向量和字向量进行融合后,获得第一融合信息,并将所述第一融合信息发送至第二卷积层;
    通过所述第二卷积层对所述第一融合信息进行卷积运算后发送至第二全连接层,通过所述第二全连接层进行融合后获得第二融合信息,并根据所述第二融合信息获得所述待分类文本的类型。
PCT/CN2019/117008 2019-01-17 2019-11-11 基于卷积神经网络的文本分类方法及相关设备 Ceased WO2020147393A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910042629.5 2019-01-17
CN201910042629.5A CN109918500A (zh) 2019-01-17 2019-01-17 基于卷积神经网络的文本分类方法及相关设备

Publications (1)

Publication Number Publication Date
WO2020147393A1 true WO2020147393A1 (zh) 2020-07-23

Family

ID=66960386

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117008 Ceased WO2020147393A1 (zh) 2019-01-17 2019-11-11 基于卷积神经网络的文本分类方法及相关设备

Country Status (2)

Country Link
CN (1) CN109918500A (zh)
WO (1) WO2020147393A1 (zh)

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930942A (zh) * 2020-08-07 2020-11-13 腾讯云计算(长沙)有限责任公司 文本分类方法、语言模型训练方法、装置及设备
CN112307209A (zh) * 2020-11-05 2021-02-02 江西高创保安服务技术有限公司 一种基于字符向量的短文本分类方法及系统
CN112380855A (zh) * 2020-11-20 2021-02-19 北京百度网讯科技有限公司 确定语句通顺度的方法、确定概率预测模型的方法和装置
CN112487813A (zh) * 2020-11-24 2021-03-12 中移(杭州)信息技术有限公司 命名实体识别方法及系统、电子设备及存储介质
CN112883166A (zh) * 2021-03-18 2021-06-01 江西师范大学 融合笔画和义原的双通道注意力卷积神经网络情感分析模型
CN113505222A (zh) * 2021-06-21 2021-10-15 山东师范大学 一种基于文本循环神经网络的政务文本分类方法及系统
CN113535960A (zh) * 2021-08-02 2021-10-22 中国工商银行股份有限公司 一种文本分类方法、装置和设备
CN113722495A (zh) * 2021-10-25 2021-11-30 之江实验室 一种融合正则表达式的金融文本关系抽取与分类方法
CN113761201A (zh) * 2021-08-27 2021-12-07 河北工程大学 院前急救信息处理装置
CN114139533A (zh) * 2021-12-06 2022-03-04 北京邮电大学 一种面向中文小说领域的文本内容审核方法
CN114528840A (zh) * 2022-01-21 2022-05-24 深圳大学 融合上下文信息的中文实体识别方法、终端及存储介质
CN114638227A (zh) * 2020-12-15 2022-06-17 中国移动通信有限公司研究院 一种命名实体识别方法、装置及存储介质
CN114911926A (zh) * 2021-12-07 2022-08-16 天翼数字生活科技有限公司 一种引入注意力机制的卷积神经网络与支持向量机分类器结合的文本分类方法
CN114942992A (zh) * 2022-03-30 2022-08-26 北京快确信息科技有限公司 一种基于融合网络的交易对手识别方法、装置及电子设备
CN115809332A (zh) * 2021-09-15 2023-03-17 北京京东尚科信息技术有限公司 一种篇章关系识别方法和装置
CN116912845A (zh) * 2023-06-16 2023-10-20 广东电网有限责任公司佛山供电局 一种基于nlp与ai的智能内容识别与分析方法及装置
CN116932898A (zh) * 2023-07-17 2023-10-24 平安科技(深圳)有限公司 新闻推荐方法、装置、存储介质及计算机设备
CN117009531A (zh) * 2023-08-23 2023-11-07 航天科工深圳(集团)有限公司 基于特征融合的军事领域项目文本分类方法及装置
CN118069785A (zh) * 2024-02-26 2024-05-24 郑州大学 一种多特征融合冒犯性文本检测方法及装置
CN118747216A (zh) * 2024-06-12 2024-10-08 北京达道至简科技有限公司 一种基于卷积神经网络的贷款用途文本分类方法和系统

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109918500A (zh) * 2019-01-17 2019-06-21 平安科技(深圳)有限公司 基于卷积神经网络的文本分类方法及相关设备
CN110362597A (zh) * 2019-06-28 2019-10-22 华为技术有限公司 一种结构化查询语言sql注入检测方法及装置
CN110399488B (zh) * 2019-07-05 2021-11-30 深圳数联天下智能科技有限公司 文本分类方法及装置
CN110569500A (zh) * 2019-07-23 2019-12-13 平安国际智慧城市科技股份有限公司 文本语义识别方法、装置、计算机设备和存储介质
CN110472053A (zh) * 2019-08-05 2019-11-19 广联达科技股份有限公司 一种面向公共资源招投标公告数据的自动分类方法及其系统
CN110598206B (zh) * 2019-08-13 2023-04-07 平安国际智慧城市科技股份有限公司 文本语义识别方法、装置、计算机设备和存储介质
CN110580288B (zh) * 2019-08-23 2022-09-09 腾讯科技(深圳)有限公司 基于人工智能的文本分类方法和装置
CN110851596B (zh) * 2019-10-11 2023-06-27 平安科技(深圳)有限公司 文本分类方法、装置及计算机可读存储介质
CN111581335B (zh) * 2020-05-14 2023-11-24 腾讯科技(深圳)有限公司 一种文本表示方法及装置
CN111611393A (zh) * 2020-06-29 2020-09-01 支付宝(杭州)信息技术有限公司 一种文本分类方法、装置及设备
CN111813896B (zh) * 2020-07-13 2022-12-02 重庆紫光华山智安科技有限公司 文本三元组关系识别方法、装置、训练方法及电子设备
CN112232164B (zh) * 2020-10-10 2024-08-06 腾讯科技(深圳)有限公司 一种视频分类方法和装置
CN113254595B (zh) * 2021-06-22 2021-10-22 北京沃丰时代数据科技有限公司 闲聊识别方法、装置、电子设备及存储介质
CN113553844B (zh) * 2021-08-11 2023-07-25 四川长虹电器股份有限公司 一种基于前缀树特征与卷积神经网络的领域识别方法
CN114048748B (zh) * 2021-11-17 2024-04-05 上海勃池信息技术有限公司 命名实体识别系统、方法、电子设备及介质
CN114882515B (zh) * 2022-05-30 2025-08-01 深圳壹账通智能科技有限公司 基于神经网络模型的表格类型判定方法、设备及介质
CN115048515A (zh) * 2022-06-09 2022-09-13 广西力意智能科技有限公司 文档分类方法、装置、设备和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301225A (zh) * 2017-06-20 2017-10-27 挖财网络技术有限公司 短文本分类方法及装置
CN107656990A (zh) * 2017-09-14 2018-02-02 中山大学 一种基于字和词两个层面特征信息的文本分类方法
CN108875034A (zh) * 2018-06-25 2018-11-23 湖南丹尼尔智能科技有限公司 一种基于层次化长短期记忆网络的中文文本分类方法
CN109918500A (zh) * 2019-01-17 2019-06-21 平安科技(深圳)有限公司 基于卷积神经网络的文本分类方法及相关设备

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107247702A (zh) * 2017-05-05 2017-10-13 桂林电子科技大学 一种文本情感分析处理方法和系统
CN108334492B (zh) * 2017-12-05 2021-11-02 腾讯科技(深圳)有限公司 文本分词、即时消息处理方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301225A (zh) * 2017-06-20 2017-10-27 挖财网络技术有限公司 短文本分类方法及装置
CN107656990A (zh) * 2017-09-14 2018-02-02 中山大学 一种基于字和词两个层面特征信息的文本分类方法
CN108875034A (zh) * 2018-06-25 2018-11-23 湖南丹尼尔智能科技有限公司 一种基于层次化长短期记忆网络的中文文本分类方法
CN109918500A (zh) * 2019-01-17 2019-06-21 平安科技(深圳)有限公司 基于卷积神经网络的文本分类方法及相关设备

Cited By (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930942B (zh) * 2020-08-07 2023-08-15 腾讯云计算(长沙)有限责任公司 文本分类方法、语言模型训练方法、装置及设备
CN111930942A (zh) * 2020-08-07 2020-11-13 腾讯云计算(长沙)有限责任公司 文本分类方法、语言模型训练方法、装置及设备
CN112307209A (zh) * 2020-11-05 2021-02-02 江西高创保安服务技术有限公司 一种基于字符向量的短文本分类方法及系统
CN112307209B (zh) * 2020-11-05 2024-04-26 江西高创保安服务技术有限公司 一种基于字符向量的短文本分类方法及系统
CN112380855A (zh) * 2020-11-20 2021-02-19 北京百度网讯科技有限公司 确定语句通顺度的方法、确定概率预测模型的方法和装置
CN112380855B (zh) * 2020-11-20 2024-03-08 北京百度网讯科技有限公司 确定语句通顺度的方法、确定概率预测模型的方法和装置
CN112487813B (zh) * 2020-11-24 2024-05-10 中移(杭州)信息技术有限公司 命名实体识别方法及系统、电子设备及存储介质
CN112487813A (zh) * 2020-11-24 2021-03-12 中移(杭州)信息技术有限公司 命名实体识别方法及系统、电子设备及存储介质
CN114638227A (zh) * 2020-12-15 2022-06-17 中国移动通信有限公司研究院 一种命名实体识别方法、装置及存储介质
CN112883166A (zh) * 2021-03-18 2021-06-01 江西师范大学 融合笔画和义原的双通道注意力卷积神经网络情感分析模型
CN113505222A (zh) * 2021-06-21 2021-10-15 山东师范大学 一种基于文本循环神经网络的政务文本分类方法及系统
CN113535960A (zh) * 2021-08-02 2021-10-22 中国工商银行股份有限公司 一种文本分类方法、装置和设备
CN113761201A (zh) * 2021-08-27 2021-12-07 河北工程大学 院前急救信息处理装置
CN113761201B (zh) * 2021-08-27 2023-12-22 河北工程大学 院前急救信息处理装置
CN115809332A (zh) * 2021-09-15 2023-03-17 北京京东尚科信息技术有限公司 一种篇章关系识别方法和装置
CN113722495A (zh) * 2021-10-25 2021-11-30 之江实验室 一种融合正则表达式的金融文本关系抽取与分类方法
CN114139533A (zh) * 2021-12-06 2022-03-04 北京邮电大学 一种面向中文小说领域的文本内容审核方法
CN114911926A (zh) * 2021-12-07 2022-08-16 天翼数字生活科技有限公司 一种引入注意力机制的卷积神经网络与支持向量机分类器结合的文本分类方法
CN114528840A (zh) * 2022-01-21 2022-05-24 深圳大学 融合上下文信息的中文实体识别方法、终端及存储介质
CN114942992A (zh) * 2022-03-30 2022-08-26 北京快确信息科技有限公司 一种基于融合网络的交易对手识别方法、装置及电子设备
CN116912845A (zh) * 2023-06-16 2023-10-20 广东电网有限责任公司佛山供电局 一种基于nlp与ai的智能内容识别与分析方法及装置
CN116912845B (zh) * 2023-06-16 2024-03-19 广东电网有限责任公司佛山供电局 一种基于nlp与ai的智能内容识别与分析方法及装置
CN116932898A (zh) * 2023-07-17 2023-10-24 平安科技(深圳)有限公司 新闻推荐方法、装置、存储介质及计算机设备
CN117009531A (zh) * 2023-08-23 2023-11-07 航天科工深圳(集团)有限公司 基于特征融合的军事领域项目文本分类方法及装置
CN118069785A (zh) * 2024-02-26 2024-05-24 郑州大学 一种多特征融合冒犯性文本检测方法及装置
CN118747216A (zh) * 2024-06-12 2024-10-08 北京达道至简科技有限公司 一种基于卷积神经网络的贷款用途文本分类方法和系统

Also Published As

Publication number Publication date
CN109918500A (zh) 2019-06-21

Similar Documents

Publication Publication Date Title
WO2020147393A1 (zh) 基于卷积神经网络的文本分类方法及相关设备
CN111984791B (zh) 一种基于注意力机制的长文分类方法
US10354170B2 (en) Method and apparatus of establishing image search relevance prediction model, and image search method and apparatus
CN111985228B (zh) 文本关键词提取方法、装置、计算机设备和存储介质
CN106844632B (zh) 基于改进支持向量机的产品评论情感分类方法及装置
CN116756303B (zh) 一种多主题文本摘要自动生成方法及系统
CN108596199A (zh) 基于EasyEnsemble算法和SMOTE算法的不均衡数据分类方法
CN114818719B (zh) 一种基于复合网络与图注意力机制的社区话题分类方法
CN111782817A (zh) 一种面向信息系统的知识图谱构建方法、装置及电子设备
CN107491425A (zh) 确定方法、确定装置、计算机装置和计算机可读存储介质
CN111062431A (zh) 图像聚类方法、图像聚类装置、电子设备及存储介质
WO2022116324A1 (zh) 搜索模型训练方法、装置、终端设备及存储介质
CN114579734B (zh) 基于gcn网络融合要素关联图的汉越新闻抽取式摘要方法
CN116844011A (zh) 图像描述文本的生成方法、装置、电子设备及存储介质
CN115205583A (zh) 图像分类模型训练方法、电子设备和计算机可读存储介质
Zhu et al. Adaptive confidence multi-view hashing for multimedia retrieval
CN112861046B (zh) 搜索引擎优化的seo网站、方法、系统、终端、介质
CN115204407A (zh) 数据分析方法、装置、计算设备和系统
CN117176471B (zh) 一种文、数网络协议异常的双重高效检测方法、装置和存储介质
CN112632229A (zh) 文本聚类方法及装置
CN116204622B (zh) 一种跨语言稠密检索中的查询表示增强方法
CN117744634A (zh) 一种业务敏感数据词库构建方法、装置、介质及设备
CN110347824A (zh) 一种基于词汇相似性的lda主题模型最优主题数确定方法
Huang Research on sentiment classification of tourist destinations based on convolutional neural network
CN117076664A (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: 19910746

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

Country of ref document: EP

Kind code of ref document: A1