Mecab-based BPE toknizer for Japanese text
Project description
Byte Pair Encoding for Japanese Language
Summary
The package applies Mecab and Byte Pair Encoding algorithms to tokenize Japanese text.
Usage
To train a new tokenizer, import the module
from jpn_bpe_tokenizer import MecabBPETrainTokenizer
Instantiate the object
tokenizer = MecabBPETrainTokenizer()
Set the arguments with the text, vocab_size and special_tokens to train the tokenizer
tokenizer.train(files,
vocab_size=52000,
special_tokens=["<pad>", "<unk>", "<s>", "</s>", "<mask>"])
Save the trained config files
tokenizer.save_model('config')
When you have config files, use them to tokenize new text with a tokenizer object
from jpn_bpe_tokenizer import MecabBPETokenizer
tokenizer = MecabBPETokenizer('config/vocab.json','config/merges.txt')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Japanese-BPE-Tokenizer-0.1.2.tar.gz.
File metadata
- Download URL: Japanese-BPE-Tokenizer-0.1.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fa9014e890b0cb43912db0e6c4111a82d293807a35cb6426e716fa2dd60bdaf
|
|
| MD5 |
ee15a11bc46e3ddc534a0898cd123662
|
|
| BLAKE2b-256 |
19dcd4a643be54c16d75583617a8bd0ec90fa163330292741a72e454cf44ac71
|
File details
Details for the file Japanese_BPE_Tokenizer-0.1.2-py3-none-any.whl.
File metadata
- Download URL: Japanese_BPE_Tokenizer-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
338c080206eb94b52e1eba9251d4617b6dd9e5e5a1a43441f94bb694feb60b03
|
|
| MD5 |
6077d47b40cbcccd00dbed5e4adcb514
|
|
| BLAKE2b-256 |
5e9eb2c294172d6b714dfc1c2991a3ada7c6d917bc09e4893dcf10380757a522
|