pyawabi
pyawabi is a python warapper for awabi(https://github.com/nakagami/awabi).
Requirements
- python3.10+
- Rust https://www.rust-lang.org/learn/get-started
- python3-dev packages https://github.com/PyO3/pyo3#usage
- MeCab dictionary https://github.com/nakagami/awabi#requirements-and-how-to-install
Install
$ pip install pyawabi
How to use
pyawabi command
$ echo 'すもももももももものうち' | pyawabi
すもも 名詞,一般,*,*,*,*,すもも,スモモ,スモモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
の 助詞,連体化,*,*,*,*,の,ノ,ノ
うち 名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
EOS
$ echo 'すもももももももものうち' | pyawabi -N 2
すもも 名詞,一般,*,*,*,*,すもも,スモモ,スモモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
の 助詞,連体化,*,*,*,*,の,ノ,ノ
うち 名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
EOS
すもも 名詞,一般,*,*,*,*,すもも,スモモ,スモモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
の 助詞,連体化,*,*,*,*,の,ノ,ノ
うち 名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
EOS
use as package
use function
>>> import pyawabi
>>> import pprint
>>> pp = pprint.PrettyPrinter()
>>> pp.pprint(pyawabi.tokenize("すもももももももものうち"))
[('すもも', '名詞,一般,*,*,*,*,すもも,スモモ,スモモ'),
('も', '助詞,係助詞,*,*,*,*,も,モ,モ'),
('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
('も', '助詞,係助詞,*,*,*,*,も,モ,モ'),
('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
('の', '助詞,連体化,*,*,*,*,の,ノ,ノ'),
('うち', '名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ')]
>>> pp.pprint(pyawabi.tokenize_n_best("すもももももももものうち", 2))
[[('すもも', '名詞,一般,*,*,*,*,すもも,スモモ,スモモ'),
('も', '助詞,係助詞,*,*,*,*,も,モ,モ'),
('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
('も', '助詞,係助詞,*,*,*,*,も,モ,モ'),
('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
('の', '助詞,連体化,*,*,*,*,の,ノ,ノ'),
('うち', '名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ')],
[('すもも', '名詞,一般,*,*,*,*,すもも,スモモ,スモモ'),
('も', '助詞,係助詞,*,*,*,*,も,モ,モ'),
('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
('も', '助詞,係助詞,*,*,*,*,も,モ,モ'),
('の', '助詞,連体化,*,*,*,*,の,ノ,ノ'),
('うち', '名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ')]]
>>>
use tokenizer object
>>> tok = pyawabi.Tokenizer()
>>> pp.pprint(tok.tokenize("すもももももももものうち"))
[('すもも', '名詞,一般,*,*,*,*,すもも,スモモ,スモモ'),
('も', '助詞,係助詞,*,*,*,*,も,モ,モ'),
('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
('も', '助詞,係助詞,*,*,*,*,も,モ,モ'),
('もも', '名詞,一般,*,*,*,*,もも,モモ,モモ'),
('の', '助詞,連体化,*,*,*,*,の,ノ,ノ'),
('うち', '名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ')]
>>>
Metadata
Release files for pyawabi 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyawabi-0.3.2.tar.gz | 3.7 kB | Without provenance | Details for pyawabi-0.3.2.tar.gz |
Release files / pyawabi-0.3.2.tar.gz
| Download URL | pyawabi-0.3.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a3969c86cc3ff7e07b9cae6f117331de496f1ec8244fd46caf7ab07acedfb98
|
|
BLAKE2b-256 checksum How to use checksums |
7b33fa0d2a16095ace1a126b77659ae8bfddf3988bf928d3b9057ff320232fdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for pyawabi 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.