WO2020082569A1 - 文本分类方法、装置、计算机设备和存储介质 - Google Patents

文本分类方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2020082569A1
WO2020082569A1 PCT/CN2018/123353 CN2018123353W WO2020082569A1 WO 2020082569 A1 WO2020082569 A1 WO 2020082569A1 CN 2018123353 W CN2018123353 W CN 2018123353W WO 2020082569 A1 WO2020082569 A1 WO 2020082569A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
feature
classifier
classified
preset
Prior art date
Application number
PCT/CN2018/123353
Other languages
English (en)
French (fr)
Inventor
徐冰
汪伟
肖京
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020082569A1 publication Critical patent/WO2020082569A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates

Definitions

  • This application relates to a text classification method, device, computer equipment, and storage medium.
  • Text classification refers to the technology of classifying natural sentences into a specified category, which is widely used in the field of Internet technology.
  • the inventor realizes that in order to ensure the efficiency of news text push, the existing algorithm model can be used to classify the news text, but it is difficult to meet the accuracy requirements of news text push when using the existing algorithm model for classification.
  • a text classification method is provided.
  • a text classification method includes:
  • the text type of the text to be classified is determined according to the preset label with the highest probability.
  • a text classification device includes:
  • the feature fusion module is used to select a combination of text features from a preset text feature library, and extract fusion features corresponding to the combination of text features from the text to be classified;
  • a classifier selection module configured to select multiple pre-trained classifiers from a preset classifier library according to the text feature combination
  • a classifier fusion module used to obtain a fusion classifier according to the classifier
  • An output module for inputting the fusion feature into the fusion classifier to obtain the probability of multiple preset tags; the preset tags correspond to a text type; and
  • the classification module is used to determine the text type of the text to be classified according to the preset label with the highest probability.
  • a computer device includes a memory and one or more processors.
  • the memory stores computer-readable instructions.
  • the one or more processors are executed The following steps:
  • a fusion classifier is obtained
  • the text type of the text to be classified is determined according to the preset label with the highest probability.
  • One or more non-volatile computer-readable storage media storing computer-readable instructions.
  • the computer-readable instructions When executed by one or more processors, the one or more processors perform the following steps:
  • a fusion classifier is obtained
  • the text type of the text to be classified is determined according to the preset label with the highest probability.
  • FIG. 1 is an application scenario diagram of a text classification method according to one or more embodiments.
  • FIG. 2 is a schematic flowchart of a text classification method according to one or more embodiments.
  • FIG. 3 is a schematic flowchart of a step of extracting fusion features according to one or more embodiments.
  • FIG. 4 is a schematic flowchart of a text classification method in other embodiments.
  • FIG. 5 is a schematic flowchart of a text classification method in still other embodiments.
  • FIG. 6 is a structural block diagram of a text classification device according to one or more embodiments.
  • FIG. 7 is an internal structure diagram of a computer device according to one or more embodiments.
  • the text classification method provided in this application can be applied to the application environment shown in FIG. 1.
  • the terminal 102 communicates with the server 104 through the network through the network.
  • the terminal 102 may be, but not limited to, various personal computers and notebook computers, and the server 104 may be implemented by an independent server or a server cluster composed of multiple servers.
  • the terminal 102 may obtain the text to be classified from the server 104 through an HTTP request.
  • the text to be classified may be microblog articles, public account articles, blogs, and news platform channel information.
  • each text to be classified may be stored in the database of the terminal 102.
  • the text to be classified before pushing the text to be classified in the terminal 102 to the platform for publication, the text to be classified needs to be classified, and the text to be classified that meets the preset regulatory requirements can be sent to the platform to complete the platform content Supervision.
  • the terminal 102 when performing text classification, extracts the fusion feature of the text to be classified, then roots the fusion feature, selects the corresponding classifier for fusion, obtains the fusion classifier, and then inputs the fusion feature into the fusion classifier Because the classifier in the fusion classifier is trained according to the regulatory requirements of the platform, the fusion classifier can output the probability of the fusion feature for each preset label, and the preset label corresponds to the text type. The probability of passing the preset label is , You can determine the text type of the text to be classified. Therefore, the terminal 102 may publish the text push value platform corresponding to the text type that meets the regulatory requirements to complete the supervision of the platform content.
  • a text classification method is provided. Taking the method applied to the terminal in FIG. 1 as an example for description, it includes the following steps:
  • a text feature combination is selected from a preset text feature library, and a fusion feature corresponding to the text feature combination is extracted from the text to be classified.
  • the text feature library includes a plurality of pre-constructed text features. If the terminal selects the pre-constructed text feature in the corresponding text feature library when inputting the text to be classified, the terminal will output the text feature of the text to be classified . Therefore, the text features can be selected according to the terminal decision. For example, for the text to be classified in the news title, it is preferable to select text features such as text length features, keyword word frequency features, and word vector similarity features. In this way, the accuracy of classifier prediction can be further improved.
  • a restriction decision model may be preset, and the text feature database may be trained as a feature decision model.
  • the terminal inputs the feature decision model, and then the feature decision model outputs several text feature combinations.
  • the training logic of the feature decision model may be based on the category of the text to be classified, for example: news, For stories and discussions, choose appropriate text features to ensure the accuracy of classification.
  • the terminal can recognize the type of the text to be classified, so that the combination of text features can be automatically output. Therefore, as a whole, the solution of this embodiment is a two-layer stacking of the model, thereby improving the prediction efficiency of the model.
  • a plurality of text features can be fused into a fused feature through feature fusion.
  • Step 204 Select a plurality of pre-trained classifiers from a preset classifier library according to the combination of text features.
  • the classifier library contains multiple different types of classifiers, according to the pre-set regulatory requirements, set the text types of different regulatory requirements, with different classifier labels corresponding to different text types, through the classifier in the classification library For training, you can classify the input text to be classified.
  • the classifier library includes various types of classifiers, each of which has different effects on different text features. Therefore, when inputting fusion features, multiple classifiers can be selected for classification to improve the accuracy of classification.
  • the correspondence relationship between the text feature combination in the fusion feature and the classifier in the classifier library is pre-established in the terminal, that is, by identifying a text feature combination, the corresponding classifier can be automatically selected from the classifier library .
  • both the classifier library and the text feature library are tools pre-stored in the terminal.
  • the terminal can choose to call the tools in the classifier library and the text feature library according to the corresponding logic.
  • Step 206 According to the classifier, obtain a fusion classifier.
  • the fusion when obtaining the fusion classifier, the fusion may be performed on the structure of the classifier to obtain the fusion classifier, and the structure fusion is to fuse the output of each classifier. Another way is to not process the classifier, the terminal collects the output of each classifier, and then the terminal calculates the final structure to obtain the fused classifier.
  • Step 208 Input the fusion feature into the fusion classifier to obtain the probability of multiple preset labels output by the fusion classifier.
  • the preset label corresponds to a text type, for example: the violation text corresponds to a preset label, and when the probability that the classifier outputs the preset label is 20%, the text to be classified is a violation text The probability is 20%.
  • the output of the classifier can be output by softmax, so the probability of each preset label can be obtained, which is convenient for the accurate classification of the text.
  • Step 210 Determine the text type of the text to be classified according to the preset label with the highest probability.
  • the label with the highest probability can be determined in a sorting manner, and then the text type of the text to be classified is determined according to the preset label.
  • the classifier can select the combination of classifiers to classify and predict the combination of text features to ensure that the best classifier is selected. The entire process can accurately classify and predict text without manual operation.
  • a schematic flowchart of the step of extracting fusion features is provided, where the text feature library includes: text length feature, keyword word frequency, word vector similarity feature, TF-
  • the specific steps of IDF weight feature, LDA model probability distribution feature and message source feature are as follows:
  • Step 302 Select two or more of text length feature, keyword word frequency feature, word vector similarity feature, TF-IDF weight feature, probability distribution feature of LDA model, and message source feature from the text feature library to obtain a combination of text features .
  • Step 304 Extract each text feature in the text feature combination from the text to be classified.
  • step 306 each text feature is combined to obtain a fusion feature.
  • the text to be classified includes: title text and body text. Therefore, the length of the title text and the length of the body text of the text to be classified can be obtained; according to the length of the title text And the length of the body text, respectively, the title length vector and the body length vector are obtained; the title length vector and the body length vector are spliced to obtain the text length characteristics of the text to be classified; by obtaining a pre-set keyword table, the title is matched according to the keyword table Text and body text, get the word frequency of the keywords in the keyword list in the text to be classified; vectorize the word frequency to obtain the keyword word frequency feature; by obtaining the title feature vector of the title text and the body feature vector of the body text, the title The feature vector and the text feature vector are stitched together to obtain the word vector similarity feature; or, by obtaining the TF-IDF weight of each keyword in the text to be classified in the preset corpus, according to the average value of the TF-IDF weight of
  • the probability distribution that the text to be classified belongs to each preset theme is obtained, and the probability distribution is vectorized to obtain the pending The probability distribution characteristics of the LDA model of the classified text; or, by obtaining the source of the text to be classified, according to the preset numbering rule, the source number of the source of the message is obtained, and the source number is vectorized to obtain the source characteristics of the message.
  • the text feature combination includes at least two of the above text features, when obtaining the text to be classified, it is necessary to first parse out the title text and the body text therein, and then perform feature extraction through each text feature tool.
  • the step of training the classifier includes:
  • the classifier library includes: decision tree, random forest, extratree, gradient boosting tree, logistic regression, fully connected network and adaptive connection tree; by training the above classifier, the classifier can be obtained Library.
  • multiple text feature combinations corresponding to the annotated text are extracted; each text feature combination is sequentially input to each trained classifier in the classifier library; the probability that each classifier outputs the target label is performed Sort, filter out the classifiers that meet the preset conditions, and establish the correspondence between the combination of text features and multiple classifiers.
  • the step of selecting multiple pre-trained classifiers from the pre-set classifier library according to the combination of text features includes: querying the correspondence relationship according to the text feature combination, and selecting multiple pre-trained Classifier.
  • the fusion features are fused as text length features, word vector similarity features, and probability distribution features of the LDA model, and the fusion classifier is used for decision-making. Trees, random forests, and logistic regression are merged into examples, and from FIG. 4, the classification process of the embodiment of the present application can be clearly displayed.
  • the step of obtaining a fusion classifier may be: according to a preset weighting algorithm, calculate the weights of each classifier in multiple classifiers; according to the weights, weight each classifier to obtain a fusion classifier .
  • the workflow of the weighting algorithm is as follows: extract the fused features of the labeled text, assign initial weights to each classifier, input the fused features into each classifier, and calculate the final preset label based on the initial weights Probability, compare the probability of the preset label with the target label, and if the difference is greater than the preset value, adjust the initial weight until the difference is less than the preset value, so as to obtain the weight of each classifier, and then follow the weight The values are weighted to get the fusion classifier.
  • the step of acquiring the title feature vector of the title text and the body feature vector of the body text may be: separately segmenting the title text and the body text to obtain the first feature word set of the title text and the body text The second characteristic word set; according to the preset positive and negative keyword library and the preset word vector tool, get the first word vector of each characteristic word in the first characteristic word set, and each of the second characteristic word set The second word vector of the feature word; the mean value is obtained from the first word vector to obtain the title feature vector, and the mean value is obtained from the second word vector to obtain the text feature vector.
  • the positive and negative keywords can strengthen the matching result of the feature word, and not only the positive result can be matched.
  • the corresponding reverse word when the feature word is not matched, the corresponding feature word can be matched. Reverse words, thereby improving the matching efficiency of feature words, therefore, when constructing feature vectors, the results are more accurate.
  • FIG. 5 a schematic flow chart of a platform news push solution based on a text classification method is provided, and the specific steps are as follows:
  • Step 502 Receive news text to be pushed.
  • the news text includes a news title and a news body.
  • Step 504 Extract the text length feature, keyword word frequency feature, word vector similarity feature, TF-IDF weight feature, LDA model probability distribution feature, and message source feature of the news text.
  • Step 506 According to the text length feature, keyword word frequency feature, word vector similarity feature, TF-IDF weight feature, LDA model probability distribution feature and message source feature, the fusion feature of the news text is obtained.
  • the fusion method can first vectorize each text feature and then stitch the vectors to obtain the fusion feature.
  • Step 508 Input the fusion feature into the classifier library, sort each classifier according to the probability that each classifier in the classifier library outputs a preset label, and select the three classifiers with the highest probability to fuse to obtain a fusion classifier.
  • weighting can be used for fusion, that is, setting weights for each classifier to weight the results output by the classifier.
  • Step 510 According to the output result of the fusion classifier, the news text is classified and predicted. If the news text classification meets the platform regulatory requirements, the news text is published on the platform. If the news text classification does not meet the receipt regulatory requirements, The news text is not published.
  • a correction strategy when the news text is pushed, a correction strategy may also be set, and the correction strategy may be sensitive word filtering, and whether the news text is included in the news text is detected to determine whether to push the news text to the platform.
  • steps in the flowcharts of FIGS. 2, 3, and 5 are displayed in order according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless clearly stated in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least some of the steps in FIGS. 2, 3, and 5 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. These sub-steps Or the execution order of the stages is not necessarily sequential, but may be executed in turn or alternately with other steps or sub-steps of the other steps or at least a part of the stages.
  • a text classification device including: a feature fusion module 602, a classifier selection module 604, a classifier fusion module 606, an output module 608, and a classification module 610, wherein:
  • the feature fusion module 602 is used to select a combination of text features from a pre-set text feature library, and extract fusion features corresponding to the combination of text features from the text to be classified.
  • the classifier selection module 604 is used to select a plurality of pre-trained classifiers from a preset classifier library according to the text feature combination.
  • the classifier fusion module 606 is used to obtain a fusion classifier according to the classifier.
  • the output module 608 is used to input the fusion feature into the fusion classifier to obtain the probability of multiple preset tags; the preset tags correspond to a text type.
  • the classification module 610 is used to determine the text type of the text to be classified according to the preset label with the highest probability.
  • the labeled text is selected from the pre-set corpus; the classifier is trained according to the target label of the labeled text and the preset termination condition; when the probability that the classifier outputs the target label meets the termination condition To get the trained classifier.
  • the classifier selection module 604 is also used to extract multiple text feature combinations corresponding to the annotated text; each text feature combination is sequentially input to each trained classifier in the classifier library; Sort the probability of each trained classifier to output the target label, filter out the classifiers that meet the preset conditions, and establish the corresponding relationship between the combination of text features and multiple classifiers; query the corresponding relationship according to the combination of text features, from the preset Select multiple pre-trained classifiers in the classifier library.
  • the text feature library includes: text length feature, keyword word frequency feature, word vector similarity feature, TF-IDF weight feature, probability distribution feature of LDA model and message source feature; feature fusion module 602 also It is used to select two or more of the text length feature, keyword word frequency feature, word vector similarity feature, TF-IDF weight feature, probability distribution feature of LDA model, and message source feature from the text feature library; Extract each text feature in the text feature combination from the text to be classified; combine each text feature to get the fusion feature.
  • the text to be classified includes: title text and body text; the feature fusion module 602 is also used to obtain the length of the title text and the length of the body text of the text to be classified; according to the length of the title text and the length of the body text, the title is obtained respectively Length vector and body length vector; the title length vector and body length vector are spliced to obtain the text length characteristics of the text to be classified; or, a pre-set keyword table is obtained, and the title text and the body text are matched according to the keyword table, Obtain the word frequency of the keywords in the keyword list in the text to be classified; vectorize the word frequency to obtain the keyword word frequency feature; or, obtain the title feature vector of the title text and the body feature vector of the body text, and compare the title feature vector and all The textual feature vectors are stitched together to obtain word vector similarity features; or, the TF-IDF weight of each keyword in the text to be classified in the preset corpus is obtained, and the to-be-classified is obtained
  • the output module 608 is further used to calculate the weight of each classifier among the multiple classifiers according to a preset weighting algorithm; according to the weight, each classifier is weighted to obtain a fusion classifier.
  • the feature fusion module 602 is also used to segment the title text and the body text to obtain the first feature word set of the title text and the second feature word set of the body text; according to the preset positive and negative keys Thesaurus and pre-set word vector tools to obtain the first word vector of each feature word in the first feature word set and the second word vector of each feature word in the second feature word set; find according to the first word vector The mean value is used to obtain the title feature vector, and the mean value is obtained from the second word vector to obtain the text feature vector.
  • Each module in the above text classification device may be implemented in whole or in part by software, hardware, or a combination thereof.
  • the above modules may be embedded in the hardware or independent of the processor in the computer device, or may be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure may be as shown in FIG. 7.
  • the computer device includes a processor, memory, network interface, and database connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer-readable instructions, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium.
  • the database of the computer device is used to store text data to be classified.
  • the network interface of the computer device is used to communicate with external terminals through a network connection.
  • the computer readable instructions are executed by the processor to implement a text classification method.
  • FIG. 7 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • the specific computer device may Include more or less components than shown in the figure, or combine certain components, or have a different arrangement of components.
  • a computer device includes a memory and one or more processors.
  • the memory stores computer-readable instructions.
  • the steps of the text classification method provided in any embodiment of the present application are implemented.
  • One or more non-volatile computer-readable storage media storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to implement any one of the embodiments of the present application. The steps of the text classification method provided.
  • Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM) or external cache memory.
  • RAM random access memory
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDRSDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronous chain (Synchlink) DRAM
  • RDRAM direct RAM
  • DRAM direct memory bus dynamic RAM
  • RDRAM memory bus dynamic RAM

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种文本分类方法,包括:从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与文本特征组合相应的融合特征,根据文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器,根据分类器,得到融合分类器,将融合特征输入融合分类器,得到多个预设标签的概率;预设标签对应一个文本类型,根据概率最大的预设标签,确定待分类文本的文本类型。

Description

文本分类方法、装置、计算机设备和存储介质
相关申请的交叉引用
本申请要求于2018年10月26日提交中国专利局,申请号为201811258359.3,申请名称为“文本分类方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及一种文本分类方法、装置、计算机设备和存储介质。
背景技术
文本分类是指将自然语句分类到某一指定类别中的技术,该技术被广泛运用于互联网技术领域中。新闻推送时可以通过文本分类技术对新闻文本进行筛选,具体的,在将新闻文本推送到指定平台时,需要从各个新闻来源获取新闻文本,然后将新闻文本发布在指定平台中,以便平台访问者阅读。为了保证平台中发布的新闻文本的质量,需要对新闻文本进行审核。以政府金融平台为例,需要发布的为金融类的新闻,在从各个新闻来源获取新闻文本之后,需要对新闻文本的内容进行审核,审核主要包括:内容是否可信、是否包含广告、主要内容是否涉及金融以及是否为社会关注的金融新闻等,以此来判断是否要将新闻文本发布在平台上。
然而,发明人意识到,为了保证新闻文本推送的效率,可以通过现有算法模型对新闻文本进行分类,但是利用现有算法模型分类时很难达到新闻文本推送时准确性的要求。
发明内容
根据本申请公开的各种实施例,提供一种文本分类方法、装置、计算机设备和存储介质。
一种文本分类方法,所述方法包括:
从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征;
根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器;
根据所述融合特征选择所述分类器,得到融合分类器;
将所述融合特征输入所述融合分类器,得到多个预设标签的概率;所述预设标签对应一个文本类型;及
根据概率最大的预设标签,确定所述待分类文本的文本类型。
一种文本分类装置,所述装置包括:
特征融合模块,用于从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征;
分类器选择模块,用于根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器;
分类器融合模块,用于根据所述分类器,得到融合分类器;
输出模块,用于将所述融合特征输入所述融合分类器,得到多个预设标签的概率;所述预设标签对应一个文本类型;及
分类模块,用于根据概率最大的预设标签,确定所述待分类文本的文本类型。
一种计算机设备,包括存储器和一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行以下步骤:
从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征;
根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器;
根据所述分类器,得到融合分类器;
将所述融合特征输入所述融合分类器,得到多个预设标签的概率;所述预设标签对应一个文本类型;及
根据概率最大的预设标签,确定所述待分类文本的文本类型。
一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征;
根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器;
根据所述分类器,得到融合分类器;
将所述融合特征输入所述融合分类器,得到多个预设标签的概率;所述预设标签对应一个文本类型;及
根据概率最大的预设标签,确定所述待分类文本的文本类型。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1为根据一个或多个实施例中文本分类方法的应用场景图。
图2为根据一个或多个实施例中文本分类方法的流程示意图。
图3为根据一个或多个实施例中提取融合特征步骤的流程示意图。
图4为另一些实施例中文本分类方法的流程示意图。
图5为又一些实施例中文本分类方法的流程示意图。
图6为根据一个或多个实施例中文本分类装置的结构框图。
图7为根据一个或多个实施例中计算机设备的内部结构图。
具体实施方式
为了使本申请的技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供的文本分类方法,可以应用于如图1所示的应用环境中。其中,终端102通过网络与服务器104通过网络进行通信。其中,终端102可以但不限于是各种个人计算机、笔记本电脑,服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。
其中,终端102可以通过HTTP请求从服务器104获取待分类文本。待分类文本可以是微博文章、公众号文章、博客以及新闻平台渠道的资讯等,终端102获取上述待分类文本后,可以将每条待分类文本存储在终端102的数据库中。
在其中一个实施例中,将终端102中的待分类文本推送至平台进行发布之前,需要对待分类文本进行分类,符合预设监管要求的待分类文本才能被发送至平台中,以此完成平台内容的监管。
在其中一个实施例中,终端102在进行文本分类时,通过提取待分类文本的融合特征,然后根融合特征,选择对应的分类器进行融合,得到融合分类器,然后将融合特征输入融合分类器,由于融合分类器中的分类器根据平台的监管要求进行训练,因此,融合分类器可以输出融合特征针对各个预设标签的概率,而预设标签对应了文本类型,通过预设标签的概率大小,可以确定待分类文本的文本类型。因此,终端102可以将符合监管要求的文本类型对应的文本推送值平台进行发布,完成平台内容的监管。
在其中一个实施例中,如图2所示,提供了一种文本分类方法,以该方法应用于图1中的终端为例进行说明,包括以下步骤:
步骤202,从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与文本特征组合相应的融合特征。
其中,文本特征库中包括多个预先构造的文本特征,若输入待分类文本时,终端决策时,选择了对应的文本特征库中预先构造的文本特征,则会输出待分类文本的该文本特征。因此,文本特征即可以根据终端决策而选定,例如:对于新闻标题的待分类文本,在进行决策是,优选选择文本长度特征、关键词词频特征、词向量相似度特征等文本特征。通过 这种方式,可以进一步提高分类器预测的准确性。
在其中一个实施例中,可以预设限制决策模型,将文本特征库训练为特征决策模型。
在其中一个实施例中,在进行分类时,终端中输入特征决策模型,然后特征决策模型输出若干个文本特征组合,特征决策模型的训练逻辑可以是根据待分类文本的类别,例如:新闻类、故事类、议论类的,选择合适的文本特征,以确保分类的准确性。终端中可以识别出待分类文本的类型,以此可以自动输出文本特征组合,因此,从整体上看,本实施例的方案做了模型的两层堆叠,从而提高模型的预测效率。
在其中一个实施例中,提取待分类文本出针对文本特征组合中的各个文本特征时,可以通过特征融合的方式,将多个文本特征融合为融合特征。
步骤204,根据文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器。
其中,分类器库中包含多个不同类型的分类器,根据预先设置的监管要求,设置不同监管要求的文本类型,以不同的分类器标签对应不同的文本类型,通过对分类库中的分类器进行训练,可以对输入的待分类文本进行分类。
分类器库中包括了各种不同类型的分类器,各个分类器针对不同文本特征效果不同,因此,在输入融合特征时,可以选择多个分类器进行分类,以此提高分类的准确性。
在其中一个实施例中,终端中预先建立融合特征中文本特征组合与分类器库中分类器的对应关系,即通过识别一个文本特征组合,即可以自动从分类器库中选择出对应的分类器。
值得说明的是,分类器库和文本特征库均为预先存储在终端中的工具,终端根据相应的逻辑,可以选择调用分类器库和文本特征库中的工具。
步骤206,根据分类器,得到融合分类器。
其中,在得到融合分类器时,可以从分类器结构上进行融合,得到融合分类器,结构融合即对各个分类器的输出进行融合。另一种方式是不对分类器进行处理,由终端采集各个分类器输出的结果,然后由终端计算最终的结构,以此得到融合分类器。
步骤208,将融合特征输入融合分类器,得到融合分类器输出的多个预设标签的概率。
其中,在进行分类器训练时,将预设标签对应一个文本类型,例如:违规文本对应一个预设标签,在分类器输出该预设标签的概率为20%时,表示待分类文本为违规文本的概率为20%。
具体的,分类器的输出可以由softmax输出,因此可以得到各个预设标签的概率大小,便于文本的准确分类。
步骤210,根据概率最大的预设标签,确定待分类文本的文本类型。
其中,在得到各个预设标签的概率大小时,可以采用排序的方式,确定概率最大的标签,然后根据预设标签确定待分类文本的文本类型。
上述文本分类方法中,通过构建文本特征库,可以针对不同类别的待分类文本,适应性选择不同的文本特征组合,提高特征选择准确性,另外,将文本特征组合作为待分类文 本的特征,输入预先设置的分类器库,分类器可以对应选择分类器组合对文本特征组合进行分类预测,保证选择最佳的分类器,整个过程无需人工操作,也可以准确的对文本进行分类预测。
在其中一个实施例中,如图3所示,提供一种提取融合特征步骤的示意性流程图,其中,文本特征库中包括:文本长度特征、关键词词频、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征和消息来源特征,具体步骤如下:
步骤302,从文本特征库中选择文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征以及消息来源特征中的两个以上,得到文本特征组合。
步骤304,从待分类文本中提取文本特征组合中的各个文本特征。
步骤306,对各个文本特征进行组合,得到融合特征。
本实施例中,通过设置多种文本特征,可以针对各种待分类文本,准确提取出特征,以此提高文本分类的准确性。
针对图3中提到的待分类文本,在一实施例中,该待分类文本包括:标题文本和正文文本,因此,可以通过获取待分类文本的标题文本长度和正文文本长度;根据标题文本长度和正文文本长度,分别得到标题长度向量和正文长度向量;将标题长度向量和正文长度向量进行拼接,得到待分类文本的文本长度特征;通过获取预先设置的关键词表,根据关键词表匹配标题文本和正文文本,得到待分类文本中包含关键词表中关键词的词频;对词频进行向量化,得到关键词词频特征;通过获取标题文本的标题特征向量和正文文本的正文特征向量,对标题特征向量和正文特征向量进行拼接,得到词向量相似度特征;或,通过获取待分类文本中各个关键词在预设语料库中的TF-IDF权重,根据各个关键词的TF-IDF权重的均值,得到待分类文本的平均TF-IDF权重,对平均TF-IDF权重向量化,得到待分类文本的TF-IDF权重特征;或,通过将待分类文本输入预先设置的LDA模型,得到待分类文本属于各个预设主题的概率分布,将概率分布向量化,得到待分类文本的LDA模型的概率分布特征;或,通过获取待分类文本的消息来源,根据预先设置的编号规则,得到消息来源的来源编号,对来源编号进行向量化,得到消息来源特征。
本申请实施例中,由于文本特征组合中至少包括两个上述文本特征,在得到待分类文本时,首先需要解析出其中的标题文本和正文文本,然后通过各个文本特征工具进行特征提取。
在其中一个实施例中,训练分类器的步骤,包括:
从预先设置的语料库中选择已标注文本,根据已标注文本的目标标签和预先设置的终止条件,训练分类器,当分类器输出目标标签的概率满足终止条件时,得到已训练的分类器。
在另一个实施例中,分类器库中包括:决策树、随机森林、extra tree、梯度提升树、逻辑斯蒂回归、全连接网络和自适应连接树;通过训练上述分类器,可以得到分类器库。
在另一个实施例中,提取已标注文本对应的多种文本特征组合;将每一种文本特征组合依次输入分类器库中的各个已训练的分类器;对各个分类器输出目标标签的概率进行排序,筛选出满足预设条件的分类器,建立文本特征组合与多个分类器的对应关系。那么,在根据文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器的步骤包括:根据文本特征组合查询对应关系,从预先设置的分类器库中选择多个预先训练的分类器。
综合以上几个实施例,在其中一些实施例中,如图4所示,以融合特征为文本长度特征、词向量相似度特征以及LDA模型的概率分布特征融合而成,并且融合分类器为决策树、随机森林以及逻辑斯蒂回归融合而成为例,从图4中,可以清楚的展现本申请实施例的分类流程。
在其中一个实施例中,得到融合分类器的步骤可以是:根据预先设置的加权算法,计算多个分类器中各个分类器的权值;根据权值,对各个分类器进行加权得到融合分类器。
在其中一个实施例中,加权算法的工作流程如下:提取已标注文本的融合特征,给各个分类器赋予初始权值,将融合特征输入各个分类器中,根据初始权值计算最终预设标签的概率,将预设标签的概率与目标标签进行对比,若差值大于预设值,则调整初始权值,直至差值小于预设值,从而得到各个分类器的权值,然后跟据该权值进行加权得到融合分类器。
值得说明的是,不同组合的分类器进行融合时,其权值不同,因此,在训练阶段,需要对每种组合的分类器分别计算其进行融合时的权值。
另外,在其中一个实施例中,获取标题文本的标题特征向量和正文文本的正文特征向量的步骤可以是:对标题文本和正文文本分别进行分词,得到标题文本的第一特征词集合以及正文文本的第二特征词集合;根据预先设置的正反关键词库以及预先设置的词向量工具,得到第一特征词集合中每个特征词的第一词向量,以及第二特征词集合中每个特征词的第二词向量;根据第一词向量求均值得到标题特征向量,以及根据第二词向量求均值得到正文特征向量。
本申请实施例中,正反关键词可以强化特征词匹配的结果,不仅可以匹配到正向结果,通过设置对应的反向词,在没有匹配到特征词时,可以匹配到该特征词对应的反向词,从而提高特征词的匹配效率,因此,在构建特征向量时,结果更加准确。
在其中一个实施例中,如图5所示,提供一种基于文本分类方法的平台新闻推送方案的示意性流程图,具体步骤如下:
步骤502,接收待推送新闻文本,新闻文本包括新闻标题和新闻正文。
可以预先设置新闻文本来源,如新浪、新华网等,然后以新闻文章为单位,在终端中保存为一条新闻文本。
步骤504,提取新闻文本的文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征和消息来源特征。
步骤506,根据文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特 征、LDA模型的概率分布特征和消息来源特征,得到新闻文本的融合特征。
其中,融合的方式可以首先将各个文本特征进行向量化后,对向量进行拼接,得到融合特征。
步骤508,将融合特征输入分类器库,根据分类器库中各个分类器输出预设标签的概率对各个分类器进行排序,选择概率靠前的三个分类器进行融合得到融合分类器。
其中,可以采用加权的方式进行融合,即为各个分类器设置权值,对分类器输出的结果进行加权。
步骤510,根据融合分类器的输出结果,对新闻文本进行分类预测,若新闻文本的分类符合平台监管要求,则在平台中发布该新闻文本,若新闻文本的分类不符合凭条监管要求,则不发布该新闻文本。
本实施例中,通过对新闻文本进行分类,实现对平台新闻发布的监控,保证平台新闻的质量。
在另一实施例中,在该新闻文本推送时,还可以设置修正策略,修正策略可以是敏感词过滤,通过检测新闻文本中是否包括敏感词,从而确定是否推送该新闻文本至平台。
应该理解的是,虽然图2、3、5流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2、3、5中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。
在其中一个实施例中,如图6所示,提供了一种文本分类装置,包括:特征融合模块602、分类器选择模块604、分类器融合模块606、输出模块608和分类模块610,其中:
特征融合模块602,用于从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征。
分类器选择模块604,用于根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器。
分类器融合模块606,用于根据分类器,得到融合分类器。
输出模块608,用于将融合特征输入所述融合分类器,得到多个预设标签的概率;预设标签对应一个文本类型。
分类模块610,用于根据概率最大的预设标签,确定待分类文本的文本类型。
在其中一个实施例中,从预先设置的语料库中选择已标注文本;根据所述已标注文本的目标标签和预先设置的终止条件,训练分类器;当分类器输出目标标签的概率满足终止条件时,得到已训练的分类器。
在其中一个实施例中,分类器选择模块604还用于提取已标注文本对应的多种文本特征组合;将每一种文本特征组合依次输入所述分类器库中的各个已训练的分类器;对各个已训练的分类器输出目标标签的概率进行排序,筛选出满足预设条件的分类器,建立文本特征组合与多个分类器的对应关系;根据文本特征组合查询对应关系,从预先设置的分类器库中选择多个预先训练的分类器。
在其中一个实施例中,文本特征库中包括:文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征和消息来源特征;特征融合模块602还用于从文本特征库中选择文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征以及消息来源特征中的两个以上,得到文本特征组合;从待分类文本中提取文本特征组合中的各个文本特征;对各个文本特征进行组合,得到融合特征。
在其中一个实施例中,待分类文本包括:标题文本和正文文本;特征融合模块602还用于获取待分类文本的标题文本长度和正文文本长度;根据标题文本长度和正文文本长度,分别得到标题长度向量和正文长度向量;将标题长度向量和正文长度向量进行拼接,得到待分类文本的文本长度特征;或,获取预先设置的关键词表,根据关键词表匹配标题文本和所述正文文本,得到待分类文本中包含关键词表中关键词的词频;对词频进行向量化,得到关键词词频特征;或,获取标题文本的标题特征向量和正文文本的正文特征向量,对标题特征向量和所述正文特征向量进行拼接,得到词向量相似度特征;或,获取待分类文本中各个关键词在预设语料库中的TF-IDF权重,根据各个关键词的TF-IDF权重的均值,得到待分类文本的平均TF-IDF权重,对平均TF-IDF权重向量化,得到待分类文本的TF-IDF权重特征;或,将待分类文本输入预先设置的LDA模型,得到待分类文本属于各个预设主题的概率分布,将概率分布向量化,得到待分类文本的LDA模型的概率分布特征;或,获取待分类文本的消息来源,根据预先设置的编号规则,得到消息来源的来源编号,对所述来源编号进行向量化,得到消息来源特征。
在其中一个实施例中,输出模块608还用于根据预先设置的加权算法,计算多个分类器中各个分类器的权值;根据权值,对各个分类器进行加权得到融合分类器。
在其中一个实施例中,特征融合模块602还用于对标题文本和正文文本分别进行分词,得到标题文本的第一特征词集合以及正文文本的第二特征词集合;根据预先设置的正反关键词库以及预先设置的词向量工具,得到第一特征词集合中每个特征词的第一词向量,以及第二特征词集合中每个特征词的第二词向量;根据第一词向量求均值得到标题特征向量,以及根据第二词向量求均值得到正文特征向量。
关于文本分类装置的具体限定可以参见上文中对于文本分类方法的限定,在此不再赘述。上述文本分类装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图7所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储待分类文本数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种文本分类方法。
本领域技术人员可以理解,图7中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
一种计算机设备,包括存储器和一个或多个处理器,存储器中存储有计算机可读指令,计算机可读指令被处理器执行时实现本申请任意一个实施例中提供的文本分类方法的步骤。
一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器实现本申请任意一个实施例中提供的文本分类方法的步骤。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能 因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种文本分类方法,所述方法包括:
    从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征;
    根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器;
    根据所述分类器,得到融合分类器;
    将所述融合特征输入所述融合分类器,得到多个预设标签的概率;所述预设标签对应一个文本类型;及
    根据概率最大的预设标签,确定所述待分类文本的文本类型。
  2. 根据权利要求1所述的方法,其特征在于,
    训练分类器的步骤,包括:
    从预先设置的语料库中选择已标注文本;
    根据所述已标注文本的目标标签和预先设置的终止条件,训练分类器;及
    当所述分类器输出所述目标标签的概率满足所述终止条件时,得到已训练的所述分类器。
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    提取所述已标注文本对应的多种所述文本特征组合;
    将每一种所述文本特征组合依次输入所述分类器库中的各个已训练的所述分类器;及
    对所述各个已训练的所述分类器输出所述目标标签的概率进行排序,筛选出满足预设条件的分类器,建立所述文本特征组合与所述多个分类器的对应关系;
    所述根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器,包括:
    根据所述文本特征组合查询所述对应关系,从预先设置的分类器库中选择多个预先训练的分类器。
  4. 根据权利要求1所述的方法,其特征在于,所述文本特征库中包括:文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征和消息来源特征;
    所述从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征,包括:
    从文本特征库中选择文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征以及消息来源特征中的两个以上,得到文本特征组合;
    从待分类文本中提取所述文本特征组合中的各个文本特征;及
    对所述各个文本特征进行组合,得到融合特征。
  5. 根据权利要求4所述的方法,其特征在于,所述待分类文本包括:标题文本和正 文文本;
    所述从待分类文本中提取与所述文本特征组合相应的融合特征,包括:
    获取所述待分类文本的标题文本长度和正文文本长度;根据所述标题文本长度和所述正文文本长度,分别得到标题长度向量和正文长度向量;将所述标题长度向量和所述正文长度向量进行拼接,得到待分类文本的文本长度特征;
    或,
    获取预先设置的关键词表,根据所述关键词表匹配所述标题文本和所述正文文本,得到所述待分类文本中包含关键词表中关键词的词频;对所述词频进行向量化,得到关键词词频特征;
    或,
    获取所述标题文本的标题特征向量和正文文本的正文特征向量,对所述标题特征向量和所述正文特征向量进行拼接,得到词向量相似度特征;
    或,
    获取所述待分类文本中各个所述关键词在预设语料库中的TF-IDF权重,根据所述各个关键词的TF-IDF权重的均值,得到待分类文本的平均TF-IDF权重,对所述平均TF-IDF权重向量化,得到所述待分类文本的TF-IDF权重特征;
    或,
    将所述待分类文本输入预先设置的LDA模型,得到所述待分类文本属于各个预设主题的概率分布,将所述概率分布向量化,得到所述待分类文本的LDA模型的概率分布特征;
    或,
    获取所述待分类文本的消息来源,根据预先设置的编号规则,得到所述消息来源的来源编号,对所述来源编号进行向量化,得到消息来源特征。
  6. 根据权利要求1至5任一项所述的方法,其特征在于,所述根据所述分类器,得到融合分类器,包括:
    根据预先设置的加权算法,计算所述分类器中各个分类器的权值;及
    根据所述权值,对各个分类器进行加权得到融合分类器。
  7. 根据权利要求5所述的方法,其特征在于,所述获取所述标题文本的标题特征向量和正文文本的正文特征向量,包括:
    对所述标题文本和所述正文文本分别进行分词,得到所述标题文本的第一特征词集合以及所述正文文本的第二特征词集合;
    根据预先设置的正反关键词库以及预先设置的词向量工具,得到所述第一特征词集合中每个特征词的第一词向量,以及所述第二特征词集合中每个特征词的第二词向量;及
    根据所述第一词向量求均值得到标题特征向量,以及根据所述第二词向量求均值得到正文特征向量。
  8. 一种文本分类装置,其特征在于,所述装置包括:
    特征融合模块,用于从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征;
    分类器选择模块,用于根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器;
    分类器融合模块,用于根据所述分类器,得到融合分类器;
    输出模块,用于将所述融合特征输入所述融合分类器,得到多个预设标签的概率;所述预设标签对应一个文本类型;及
    分类模块,用于根据概率最大的预设标签,确定所述待分类文本的文本类型。
  9. 根据权利要求8所述的装置,其特征在于,还包括:分类器训练模块,用于从预先设置的语料库中选择已标注文本;
    根据所述已标注文本的目标标签和预先设置的终止条件,训练分类器;及
    当所述分类器输出所述目标标签的概率满足所述终止条件时,得到已训练的所述分类器。
  10. 一种计算机设备,包括存储器及一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:
    从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征;
    根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器;
    根据所述分类器,得到融合分类器;
    将所述融合特征输入所述融合分类器,得到多个预设标签的概率;所述预设标签对应一个文本类型;及
    根据概率最大的预设标签,确定所述待分类文本的文本类型。
  11. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:
    从预先设置的语料库中选择已标注文本;
    根据所述已标注文本的目标标签和预先设置的终止条件,训练分类器;及
    当所述分类器输出所述目标标签的概率满足所述终止条件时,得到已训练的所述分类器。
  12. 根据权利要求11所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:
    将每一种所述文本特征组合依次输入所述分类器库中的各个已训练的所述分类器;
    对所述各个已训练的所述分类器输出所述目标标签的概率进行排序,筛选出满足预设条件的分类器,建立所述文本特征组合与所述多个分类器的对应关系;及
    根据所述文本特征组合查询所述对应关系,从预先设置的分类器库中选择多个预先训练的分类器。
  13. 根据权利要求10所述的计算机设备,其特征在于,所述文本特征库中包括:文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征和消息来源特征;
    所述处理器执行所述计算机可读指令时还执行以下步骤:
    从文本特征库中选择文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征以及消息来源特征中的两个以上,得到文本特征组合;
    从待分类文本中提取所述文本特征组合中的各个文本特征;及
    对所述各个文本特征进行组合,得到融合特征。
  14. 根据权利要求13所述的计算机设备,其特征在于,所述待分类文本包括:标题文本和正文文本;
    所述处理器执行所述计算机可读指令时还执行以下步骤:
    获取所述待分类文本的标题文本长度和正文文本长度;根据所述标题文本长度和所述正文文本长度,分别得到标题长度向量和正文长度向量;将所述标题长度向量和所述正文长度向量进行拼接,得到待分类文本的文本长度特征;
    或,
    获取预先设置的关键词表,根据所述关键词表匹配所述标题文本和所述正文文本,得到所述待分类文本中包含关键词表中关键词的词频;对所述词频进行向量化,得到关键词词频特征;
    或,
    获取所述标题文本的标题特征向量和正文文本的正文特征向量,对所述标题特征向量和所述正文特征向量进行拼接,得到词向量相似度特征;
    或,
    获取所述待分类文本中各个所述关键词在预设语料库中的TF-IDF权重,根据所述各个关键词的TF-IDF权重的均值,得到待分类文本的平均TF-IDF权重,对所述平均TF-IDF权重向量化,得到所述待分类文本的TF-IDF权重特征;
    或,
    将所述待分类文本输入预先设置的LDA模型,得到所述待分类文本属于各个预设主题的概率分布,将所述概率分布向量化,得到所述待分类文本的LDA模型的概率分布特征;
    或,
    获取所述待分类文本的消息来源,根据预先设置的编号规则,得到所述消息来源的来源编号,对所述来源编号进行向量化,得到消息来源特征。
  15. 根据权利要求10至14任一项所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:
    根据预先设置的加权算法,计算所述分类器中各个分类器的权值;及
    根据所述权值,对各个分类器进行加权得到融合分类器。
  16. 一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:
    从预先设置的文本特征库中选择文本特征组合,从待分类文本中提取与所述文本特征组合相应的融合特征;
    根据所述文本特征组合,从预先设置的分类器库中选择多个预先训练的分类器;
    根据所述分类器,得到融合分类器;
    将所述融合特征输入所述融合分类器,得到多个预设标签的概率;所述预设标签对应一个文本类型;及
    根据概率最大的预设标签,确定所述待分类文本的文本类型。
  17. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    从预先设置的语料库中选择已标注文本;
    根据所述已标注文本的目标标签和预先设置的终止条件,训练分类器;及
    当所述分类器输出所述目标标签的概率满足所述终止条件时,得到已训练的所述分类器。
  18. 根据权利要求17所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    将每一种所述文本特征组合依次输入所述分类器库中的各个已训练的所述分类器;
    对所述各个已训练的所述分类器输出所述目标标签的概率进行排序,筛选出满足预设条件的分类器,建立所述文本特征组合与所述多个分类器的对应关系;及
    根据所述文本特征组合查询所述对应关系,从预先设置的分类器库中选择多个预先训练的分类器。
  19. 根据权利要求16所述的存储介质,其特征在于,所述文本特征库中包括:文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征和消息来源特征;
    所述计算机可读指令被所述处理器执行时还执行以下步骤:
    从文本特征库中选择文本长度特征、关键词词频特征、词向量相似度特征、TF-IDF权重特征、LDA模型的概率分布特征以及消息来源特征中的两个以上,得到文本特征组合;
    从待分类文本中提取所述文本特征组合中的各个文本特征;及
    对所述各个文本特征进行组合,得到融合特征。
  20. 根据权利要求19所述的存储介质,其特征在于,所述待分类文本包括:标题文本和正文文本;
    所述计算机可读指令被所述处理器执行时还执行以下步骤:
    获取所述待分类文本的标题文本长度和正文文本长度;根据所述标题文本长度和所述正文文本长度,分别得到标题长度向量和正文长度向量;将所述标题长度向量和所述正文长度向量进行拼接,得到待分类文本的文本长度特征;
    或,
    获取预先设置的关键词表,根据所述关键词表匹配所述标题文本和所述正文文本,得到所述待分类文本中包含关键词表中关键词的词频;对所述词频进行向量化,得到关键词词频特征;
    或,
    获取所述标题文本的标题特征向量和正文文本的正文特征向量,对所述标题特征向量和所述正文特征向量进行拼接,得到词向量相似度特征;
    或,
    获取所述待分类文本中各个所述关键词在预设语料库中的TF-IDF权重,根据所述各个关键词的TF-IDF权重的均值,得到待分类文本的平均TF-IDF权重,对所述平均TF-IDF权重向量化,得到所述待分类文本的TF-IDF权重特征;
    或,
    将所述待分类文本输入预先设置的LDA模型,得到所述待分类文本属于各个预设主题的概率分布,将所述概率分布向量化,得到所述待分类文本的LDA模型的概率分布特征;
    或,
    获取所述待分类文本的消息来源,根据预先设置的编号规则,得到所述消息来源的来源编号,对所述来源编号进行向量化,得到消息来源特征。
PCT/CN2018/123353 2018-10-26 2018-12-25 文本分类方法、装置、计算机设备和存储介质 WO2020082569A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811258359.3 2018-10-26
CN201811258359.3A CN109543032A (zh) 2018-10-26 2018-10-26 文本分类方法、装置、计算机设备和存储介质

Publications (1)

Publication Number Publication Date
WO2020082569A1 true WO2020082569A1 (zh) 2020-04-30

Family

ID=65844943

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/123353 WO2020082569A1 (zh) 2018-10-26 2018-12-25 文本分类方法、装置、计算机设备和存储介质

Country Status (2)

Country Link
CN (1) CN109543032A (zh)
WO (1) WO2020082569A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022134588A1 (zh) * 2020-12-21 2022-06-30 深圳壹账通智能科技有限公司 信息审核分类模型的构建方法和信息审核方法

Families Citing this family (33)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110134785A (zh) * 2019-04-15 2019-08-16 平安普惠企业管理有限公司 论坛文章的管理方法、装置、存储介质及设备
CN110175236B (zh) * 2019-04-24 2023-07-21 平安科技(深圳)有限公司 用于文本分类的训练样本生成方法、装置和计算机设备
CN110795558B (zh) * 2019-09-03 2023-09-29 腾讯科技(深圳)有限公司 标签获取方法和装置、存储介质及电子装置
CN110569361B (zh) * 2019-09-06 2021-10-19 腾讯科技(深圳)有限公司 一种文本识别方法及设备
CN110750643B (zh) * 2019-09-29 2024-02-09 上证所信息网络有限公司 上市公司非定期公告的分类方法、装置及存储介质
CN111008329A (zh) * 2019-11-22 2020-04-14 厦门美柚股份有限公司 基于内容分类的页面内容推荐方法及装置
CN110969208B (zh) * 2019-11-29 2022-04-12 支付宝(杭州)信息技术有限公司 多个模型结果的融合方法和装置
CN111078878B (zh) * 2019-12-06 2023-07-04 北京百度网讯科技有限公司 文本处理方法、装置、设备及计算机可读存储介质
CN111191004B (zh) * 2019-12-27 2023-09-22 咪咕文化科技有限公司 文本标签提取方法、装置及计算机可读存储介质
CN111143568A (zh) * 2019-12-31 2020-05-12 郑州工程技术学院 一种论文分类时的缓冲方法、装置、设备及存储介质
CN111353301B (zh) * 2020-02-24 2023-07-21 成都网安科技发展有限公司 辅助定密方法及装置
CN111309914B (zh) * 2020-03-03 2023-05-09 支付宝(杭州)信息技术有限公司 基于多个模型结果对多轮对话的分类方法和装置
CN111401040B (zh) * 2020-03-17 2021-06-18 上海爱数信息技术股份有限公司 一种适用于word文本的关键词提取方法
CN111475651B (zh) * 2020-04-08 2023-04-07 掌阅科技股份有限公司 文本分类方法、计算设备及计算机存储介质
CN111581381B (zh) * 2020-04-29 2023-10-10 北京字节跳动网络技术有限公司 文本分类模型的训练集合的生成方法、装置和电子设备
CN111666748B (zh) * 2020-05-12 2022-09-13 武汉大学 一种自动化分类器的构造方法以及识别决策的方法
CN111680502B (zh) * 2020-05-14 2023-09-22 深圳平安通信科技有限公司 一种文本处理方法及相关装置
CN111611801B (zh) * 2020-06-02 2021-09-14 腾讯科技(深圳)有限公司 一种识别文本地域属性的方法、装置、服务器及存储介质
CN111797229A (zh) * 2020-06-10 2020-10-20 南京擎盾信息科技有限公司 文本表示方法、装置和文本分类方法
CN111966830A (zh) * 2020-06-30 2020-11-20 北京来也网络科技有限公司 结合rpa和ai的文本分类方法、装置、设备及介质
CN111651566B (zh) * 2020-08-10 2020-12-01 四川大学 基于多任务的小样本学习的裁判文书争议焦点提取方法
CN112749558B (zh) * 2020-09-03 2023-11-24 腾讯科技(深圳)有限公司 一种目标内容获取方法、装置、计算机设备和存储介质
CN112328787B (zh) * 2020-11-04 2024-02-20 中国平安人寿保险股份有限公司 文本分类模型训练方法、装置、终端设备及存储介质
CN112347255B (zh) * 2020-11-06 2021-11-23 天津大学 基于图网络的标题和正文结合的文本分类方法
CN112905793B (zh) * 2021-02-23 2023-06-20 山西同方知网数字出版技术有限公司 一种基于Bilstm+Attention文本分类的案例推荐方法及系统
CN112966766B (zh) * 2021-03-18 2022-06-07 北京三快在线科技有限公司 物品分类方法、装置、服务器及存储介质
CN113064993B (zh) * 2021-03-23 2023-07-21 南京视察者智能科技有限公司 一种基于大数据的自动化文本分类标注系统的设计方法、优化方法及标注方法
CN113239200B (zh) * 2021-05-20 2022-07-12 东北农业大学 内容识别分类方法、装置、系统及存储介质
CN113157927B (zh) * 2021-05-27 2023-10-31 中国平安人寿保险股份有限公司 文本分类方法、装置、电子设备及可读存储介质
CN113935307A (zh) * 2021-09-16 2022-01-14 有米科技股份有限公司 广告文案的特征提取方法及装置
CN116468037A (zh) * 2023-03-17 2023-07-21 北京深维智讯科技有限公司 一种基于nlp的数据处理方法及系统
CN116304717B (zh) * 2023-05-09 2023-12-15 北京搜狐新媒体信息技术有限公司 文本分类方法及装置、存储介质及电子设备
CN117236329B (zh) * 2023-11-15 2024-02-06 阿里巴巴达摩院(北京)科技有限公司 文本分类方法、装置及相关设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107545038A (zh) * 2017-07-31 2018-01-05 中国农业大学 一种文本分类方法与设备
CN108520030A (zh) * 2018-03-27 2018-09-11 深圳中兴网信科技有限公司 文本分类方法、文本分类系统及计算机装置
CN108595632A (zh) * 2018-04-24 2018-09-28 福州大学 一种融合摘要与主体特征的混合神经网络文本分类方法
EP3392780A2 (en) * 2017-04-19 2018-10-24 Tata Consultancy Services Limited Systems and methods for classification of software defect reports

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105373800A (zh) * 2014-08-28 2016-03-02 百度在线网络技术(北京)有限公司 分类方法及装置
US10013659B2 (en) * 2014-11-07 2018-07-03 Conduent Business Services, Llc Methods and systems for creating a classifier capable of predicting personality type of users
CN104951542A (zh) * 2015-06-19 2015-09-30 百度在线网络技术(北京)有限公司 识别社交短文本类别的方法、分类模型训练方法及装置
CN107908715A (zh) * 2017-11-10 2018-04-13 中国民航大学 基于Adaboost和分类器加权融合的微博情感极性判别方法
CN108171280A (zh) * 2018-01-31 2018-06-15 国信优易数据有限公司 一种分类器构建方法及预测分类的方法
CN108388914B (zh) * 2018-02-26 2022-04-01 中译语通科技股份有限公司 一种基于语义计算的分类器构建方法、分类器

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3392780A2 (en) * 2017-04-19 2018-10-24 Tata Consultancy Services Limited Systems and methods for classification of software defect reports
CN107545038A (zh) * 2017-07-31 2018-01-05 中国农业大学 一种文本分类方法与设备
CN108520030A (zh) * 2018-03-27 2018-09-11 深圳中兴网信科技有限公司 文本分类方法、文本分类系统及计算机装置
CN108595632A (zh) * 2018-04-24 2018-09-28 福州大学 一种融合摘要与主体特征的混合神经网络文本分类方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022134588A1 (zh) * 2020-12-21 2022-06-30 深圳壹账通智能科技有限公司 信息审核分类模型的构建方法和信息审核方法

Also Published As

Publication number Publication date
CN109543032A (zh) 2019-03-29

Similar Documents

Publication Publication Date Title
WO2020082569A1 (zh) 文本分类方法、装置、计算机设备和存储介质
US11669750B2 (en) System and/or method for generating clean records from imperfect data using model stack(s) including classification model(s) and confidence model(s)
US11948058B2 (en) Utilizing recurrent neural networks to recognize and extract open intent from text inputs
CN109145153B (zh) 意图类别的识别方法和装置
WO2021042503A1 (zh) 信息分类抽取方法、装置、计算机设备和存储介质
CN109992646B (zh) 文本标签的提取方法和装置
EP3227836B1 (en) Active machine learning
US11321671B2 (en) Job skill taxonomy
US20220171936A1 (en) Analysis of natural language text in document
US9875319B2 (en) Automated data parsing
US10997369B1 (en) Systems and methods to generate sequential communication action templates by modelling communication chains and optimizing for a quantified objective
US10637826B1 (en) Policy compliance verification using semantic distance and nearest neighbor search of labeled content
CN110458324B (zh) 风险概率的计算方法、装置和计算机设备
US11580119B2 (en) System and method for automatic persona generation using small text components
US20170344822A1 (en) Semantic representation of the content of an image
CN109582788A (zh) 垃圾评论训练、识别方法、装置、设备及可读存储介质
US11227183B1 (en) Section segmentation based information retrieval with entity expansion
US11599666B2 (en) Smart document migration and entity detection
CN111709225A (zh) 一种事件因果关系判别方法、装置和计算机可读存储介质
CN114491079A (zh) 知识图谱构建和查询方法、装置、设备和介质
CN114218392A (zh) 面向期货问答的用户意图识别方法和系统
CN110888983A (zh) 一种正负面情感分析方法、终端设备及存储介质
CN115640399A (zh) 一种文本分类的方法、装置、设备及存储介质
US20230138491A1 (en) Continuous learning for document processing and analysis
US20230134218A1 (en) Continuous learning for document processing and analysis

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

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

Country of ref document: EP

Kind code of ref document: A1