Lightweight dictionary-independent Japanese morphological analyzer
Project description
suzume
Lightweight, dictionary-independent Japanese morphological analyzer (tokenizer + part-of-speech tagging). This package is a thin ctypes binding over the native suzume C++ core; the compiled library and dictionaries are bundled in the wheel, so there is nothing else to install.
Full documentation: suzume.libraz.net/docs/python.
Installation
pip install suzume
Quick start
from suzume import Suzume
with Suzume() as sz:
for m in sz.analyze("東京都に住む"):
print(m.surface, m.pos, m.base_form)
Generate keyword tags:
from suzume import Suzume
with Suzume() as sz:
for tag in sz.generate_tags("東京都に住んでいます"):
print(tag.tag, tag.pos)
# Restrict to selected parts of speech by name (or a raw bitmask).
nouns = sz.generate_tags("美味しいラーメンを食べた", pos_filter=["noun"])
API
Suzume(*, mode="normal", preserve_vu=True, preserve_case=True, preserve_symbols=False, lemmatize=True, merge_compounds=False)
An analyzer instance. Use it as a context manager (or call close()); it is not
thread-safe, so use one instance per thread.
mode—"normal","search", or"split"(or aModeenum member).analyze(text) -> list[Morpheme]— tokenize with full POS information.generate_tags(text, **options) -> list[Tag]— extract keyword tags. Thepos_filteroption accepts a raw bitmask (1=noun, 2=verb, 4=adjective, 8=adverb) or an iterable of POS names such as["noun", "verb"].load_user_dict(csv)— add a user dictionary from CSV text.load_binary_dict(data)— load a compiled.dicdictionary from memory.dictionary_warnings— warnings raised while auto-loading dictionaries.
Morpheme
A frozen dataclass with surface, pos, base_form, pos_ja, conj_type,
conj_form, extended_pos, start, end, the is_* flags, and score.
conj_type and conj_form are None for non-conjugating words.
Tag
A frozen dataclass with tag and pos.
suzume.version()
Returns the native library version string.
License
Apache-2.0. See LICENSE.
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 Distributions
Built Distributions
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 suzume-0.9.6-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: suzume-0.9.6-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 675.8 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
176475301d95f3f6470dc1e07d92e0928c5704f85ab8e544d4824ba85e1508fb
|
|
| MD5 |
38a2b22a3e8fea16dd7b02cb314fb2f0
|
|
| BLAKE2b-256 |
007b7315ead4594d57f36a94b188f54ae9e715f19d2dc2fc2411a206adfe0fdf
|
Provenance
The following attestation bundles were made for suzume-0.9.6-py3-none-manylinux_2_17_x86_64.whl:
Publisher:
publish.yml on libraz/suzume
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
suzume-0.9.6-py3-none-manylinux_2_17_x86_64.whl -
Subject digest:
176475301d95f3f6470dc1e07d92e0928c5704f85ab8e544d4824ba85e1508fb - Sigstore transparency entry: 2209736040
- Sigstore integration time:
-
Permalink:
libraz/suzume@c6e5d668b30405ec0e6f5232f6404593a4aa5adb -
Branch / Tag:
refs/tags/v0.9.6 - Owner: https://github.com/libraz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c6e5d668b30405ec0e6f5232f6404593a4aa5adb -
Trigger Event:
push
-
Statement type:
File details
Details for the file suzume-0.9.6-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: suzume-0.9.6-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 490.9 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7eff8421650222da3e014667ac32b828d1133c9c10d848ef52794ba5a0e24d1
|
|
| MD5 |
c4b3766fc95df7fa209ed1fac22652eb
|
|
| BLAKE2b-256 |
9f31c9e2e2d9c32c7cb533b2e07809f996818c4da854545ab77d0599acbdb5bb
|
Provenance
The following attestation bundles were made for suzume-0.9.6-py3-none-macosx_11_0_arm64.whl:
Publisher:
publish.yml on libraz/suzume
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
suzume-0.9.6-py3-none-macosx_11_0_arm64.whl -
Subject digest:
c7eff8421650222da3e014667ac32b828d1133c9c10d848ef52794ba5a0e24d1 - Sigstore transparency entry: 2209735946
- Sigstore integration time:
-
Permalink:
libraz/suzume@c6e5d668b30405ec0e6f5232f6404593a4aa5adb -
Branch / Tag:
refs/tags/v0.9.6 - Owner: https://github.com/libraz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c6e5d668b30405ec0e6f5232f6404593a4aa5adb -
Trigger Event:
push
-
Statement type: