Skip to main content

Simple tool to predict text classes with various models.

Project description

# TextClassify

## Model

* fastText char
* fastText word
* CNN char embedding
* CNN word embedding
* CNN char & word embedding
* CNN + BiGRU + char & word embedding

## Segment Model

* pyltp
* jieba

## Embedding

* fastText (CBOW / skip-gram)
* gensim

char or word embedding

## Usage

```python
from text_classify import TextClassify

# default params
t = TextClassify(
model='fasttext',
cut=False,
cut_model='pyltp',
fasttext_char_model = '/data_hdd/embedding/fasttext/zhihu_char_model.bin', # default path
...
)

text = ''
logtis = t.predict(text)

# get index2label
t.index2label

# get top label
t.get_top_label(text, k=5)
```

* model: 'fasttext' (default), 'cnn', 'mcnn', 'mgcnn'
* cut: True, False (default)
* cut_model: 'pyltp' (default), 'jieba'
* everything in config

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

text_classify-0.0.4.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file text_classify-0.0.4.tar.gz.

File metadata

File hashes

Hashes for text_classify-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a68eb346edca685a5241ec0e605bcc849ca6c56d12c9d478c58b5464d2623cf4
MD5 87f4ea92fa7c16595e1aed381dc3cd0e
BLAKE2b-256 e54a6eaa866368075276f524c5b4cdc498f44c35f3c55d6703a9e8d8b782d3f8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page