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
## 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)
File details
Details for the file text_classify-0.0.4.tar.gz
.
File metadata
- Download URL: text_classify-0.0.4.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a68eb346edca685a5241ec0e605bcc849ca6c56d12c9d478c58b5464d2623cf4 |
|
MD5 | 87f4ea92fa7c16595e1aed381dc3cd0e |
|
BLAKE2b-256 | e54a6eaa866368075276f524c5b4cdc498f44c35f3c55d6703a9e8d8b782d3f8 |