# US 2019/0095432 A1 · Method and apparatus for building text classification model, and text classification method and apparatus

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2019/0095432 A1
- Document ID: US20190095432A1
- Status: Published application
- Kind: A1
- Application number: 16/116,710
- Filed: 2018-08-29
- Published: 2019-03-28
- Earliest claimed: 2017-09-26
- Assignees: Baidu Online Network Technology (Beijing) Co., Ltd.
- Applicants: Baidu Online Network Technology (Beijing) Co., Ltd.
- Inventors: Yuan Xia; Jingbo Zhou; Weishan Dong; Wei Fan
- Web page: https://patentgrep.com/patent/US20190095432A1

## CPC

- G06F 40/216: using statistical methods
- G06F 18/2185: {the supervisor being an automated module, e.g. intelligent oracle}
- G06F 18/2413: based on distances to training or reference patterns
- G06F 18/24133: {Distances to prototypes}
- G06F 40/30: Semantic analysis
- G06F 40/44: Statistical methods, e.g. probability models
- G06F 40/53: Processing of non-Latin text (kana-to-kanji conversion G06F40/129; vowelisation G06F40/232)
- G06N 3/0442: characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU]
- G06N 3/045: Combinations of networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/09: Supervised learning
- G06N 7/01: Probabilistic graphical models, e.g. probabilistic networks
- G06V 30/268: {Lexical context}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06V: IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING

## Abstract

The present disclosure provides a method and apparatus for building a text classification model, and a text classification method and apparatus. The method of building a text classification model comprises: obtaining a training sample; obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary; using the vector matrix corresponding to the text and a class of the text to train a first classification model and a second classification model respectively; during the training process, using a loss function of the first classification model and a loss function of the second classification model to obtain a loss function of the text classification model, and using the loss function of the text classification model to adjust parameters for the first classification model and the second classification model, to obtain the text classification model formed by the first classification model and the second classification model. The text classification method comprises: obtaining a to-be-classified text; obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary; inputting the vector matrix into a text classification model, and obtaining a classification result of the text according to output of the text classification model. The text classification effect can be improved through the technical solutions of the present disclosure.

## Claims

### Claim 1

A method of building a text classification model, wherein the method comprises:
obtaining a training sample, wherein the training sample includes a text and a corresponding class;
obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary;
using the vector matrix corresponding to the text and a class of the text to train a first classification model and a second classification model respectively;
during the training process, using a loss function of the first classification model and a loss function of the second classification model to obtain a loss function of the text classification model, and using the loss function of the text classification model to adjust parameters for the first classification model and the second classification model, to obtain the text classification model formed by the first classification model and the second classification model.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the text classification model is used to classify a medical text.

### Claim 3 (depends on 1)

The method according to claim 1, wherein a training target of the first classification model and the second classification model is to minimize the loss function of the text classification model.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the first classification model is a probability-based classification model.

### Claim 5 (depends on 4)

The method according to claim 4, wherein the first classification model comprises a classification model combined based on a bidirectional length memory unit and a convolutional neural network.

### Claim 6 (depends on 4)

The method according to claim 4, wherein the training the first classification model comprises:
training the first classification model by regarding the text as input, and regarding the class of the text as output.

### Claim 7 (depends on 1)

The method according to claim 1, wherein the second classification model is a similarity-based classification model.

### Claim 8 (depends on 7)

The method according to claim 7, wherein the second classification model comprises a classification model based on a deep neural network.

### Claim 9 (depends on 7)

The method according to claim 7, wherein the training the second classification model comprises: training the second classification model by regarding the text and expert's data corresponding to the class of the text as input, and regarding a similarity between the text and the expert's data as output.

### Claim 10 (depends on 1)

The method according to claim 1, wherein the using a loss function of the first classification model and a loss function of the second classification model to obtain a loss function of the text classification model comprises:
using a preset combination form to integrate the loss function of the first classification model and the loss function of the second classification model, to obtain the loss function of the text classification model.

### Claim 11

A text classification method, wherein the method comprises:
obtaining a to-be-classified text;
obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary;
inputting the vector matrix into a text classification model, and obtaining a classification result of the text according to output of the text classification model;
wherein the text classification model is pre-built according to a method of building the text classification model, wherein the method of building the text classification model comprises:
obtaining a training sample, wherein the training sample includes a text and a corresponding class;
obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary;
using the vector matrix corresponding to the text and a class of the text to train a first classification model and a second classification model respectively;
during the training process, using a loss function of the first classification model and a loss function of the second classification model to obtain a loss function of the text classification model, and using the loss function of the text classification model to adjust parameters for the first classification model and the second classification model, to obtain the text classification model formed by the first classification model and the second classification model.

### Claim 12

A device, wherein the device comprises:
one or more processors;
a storage for storing one or more programs;
the one or more programs, when executed by said one or more processors, enable said one or more processors to implement a method of building a text classification model, wherein the method comprises:
obtaining a training sample, wherein the training sample includes a text and a corresponding class;
obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary;
using the vector matrix corresponding to the text and a class of the text to train a first classification model and a second classification model respectively;
during the training process, using a loss function of the first classification model and a loss function of the second classification model to obtain a loss function of the text classification model, and using the loss function of the text classification model to adjust parameters for the first classification model and the second classification model, to obtain the text classification model formed by the first classification model and the second classification model.

### Claim 13 (depends on 12)

The device according to claim 12, wherein the text classification model is used to classify a medical text.

### Claim 14 (depends on 12)

The device according to claim 12, wherein a training target of the first classification model and the second classification model is to minimize the loss function of the text classification model.

### Claim 15 (depends on 12)

The device according to claim 12, wherein the first classification model is a probability-based classification model.

### Claim 16 (depends on 15)

The device according to claim 15, wherein the first classification model comprises a classification model combined based on a bidirectional length memory unit and a convolutional neural network.

### Claim 17 (depends on 15)

The device according to claim 15, wherein the training the first classification model comprises:
training the first classification model by regarding the text as input, and regarding the class of the text as output.

### Claim 18

A device, wherein the device comprises:
one or more processors;
a storage for storing one or more programs;
the one or more programs, when executed by said one or more processors, enable said one or more processors to implement a text classification method, wherein the method comprises:
obtaining a to-be-classified text;
obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary;
inputting the vector matrix into a text classification model, and obtaining a classification result of the text according to output of the text classification model;
wherein the text classification model is pre-built according to a method of building the text classification model, wherein the method of building the text classification model comprises:
obtaining a training sample, wherein the training sample includes a text and a corresponding class;
obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary;
using the vector matrix corresponding to the text and a class of the text to train a first classification model and a second classification model respectively;
during the training process, using a loss function of the first classification model and a loss function of the second classification model to obtain a loss function of the text classification model, and using the loss function of the text classification model to adjust parameters for the first classification model and the second classification model, to obtain the text classification model formed by the first classification model and the second classification model.

### Claim 19

A storage medium including computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, implement a method of building a text classification model, wherein the method comprises:
obtaining a training sample, wherein the training sample includes a text and a corresponding class;
obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary;
using the vector matrix corresponding to the text and a class of the text to train a first classification model and a second classification model respectively;
during the training process, using a loss function of the first classification model and a loss function of the second classification model to obtain a loss function of the text classification model, and using the loss function of the text classification model to adjust parameters for the first classification model and the second classification model, to obtain the text classification model formed by the first classification model and the second classification model.

### Claim 20

A storage medium including computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, implement a text classification method, wherein the method comprises:
obtaining a to-be-classified text;
obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary;
inputting the vector matrix into a text classification model, and obtaining a classification result of the text according to output of the text classification model;
wherein the text classification model is pre-built according to a method of building the text classification model, wherein the method of building the text classification model comprises:
obtaining a training sample, wherein the training sample includes a text and a corresponding class;
obtaining a vector matrix corresponding to the text, after performing word segmentation for the text based on an entity dictionary;
using the vector matrix corresponding to the text and a class of the text to train a first classification model and a second classification model respectively;
during the training process, using a loss function of the first classification model and a loss function of the second classification model to obtain a loss function of the text classification model, and using the loss function of the text classification model to adjust parameters for the first classification model and the second classification model, to obtain the text classification model formed by the first classification model and the second classification model.
