Skip to main content

Recursive atomic decomposition of CJK characters with 9-grid spatial encoding

Project description

cjk-semantic-split

Recursive atomic decomposition of CJK characters with 9-grid spatial position encoding.

pip install cjk-semantic-split
from chinese_decompose import decompose

decompose("踩")
# '踩[30]:足[60]:爪[80]:木'

decompose("囚")
# '囚[90]:囗[0]:人'

decompose("踩好", as_tree=True)
# [DecompositionTree('踩'), DecompositionTree('好')]

Position Encoding

Every component sits at a 2-digit position code: cardinals (10/20/30/40), single-cell corners (50/60/70/80), 4-cell layout strips (14/16/34/36), or surround envelopes (9099). See the design spec for full details.

CLI

python -m chinese_decompose                  # DSL string
python -m chinese_decompose  --format json   # JSON output
python -m chinese_decompose --self-test        # coverage report

Data Sources

Decomposition data is bundled for offline use. Coverage extends across four tiers:

  • Tier 1 (Unihan kIDS): ~21k chars
  • Tier 2 (wikimedia Commons): ~22k chars
  • Tier 3 (next-layer harvest): ~80k chars
  • Tier 4 (manual patches): dispute-case overrides

Last-wins resolution: patches > l3 > l2 > l1.

Configuration

from chinese_decompose import set_primitives

set_primitives({"木", "火", "水", ...})  # process-local override

License

MIT — see LICENSE.

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

cjk_semantic_split-0.1.0.tar.gz (87.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cjk_semantic_split-0.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file cjk_semantic_split-0.1.0.tar.gz.

File metadata

  • Download URL: cjk_semantic_split-0.1.0.tar.gz
  • Upload date:
  • Size: 87.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for cjk_semantic_split-0.1.0.tar.gz
Algorithm Hash digest
SHA256 88c9c1f56a029a67a2c831e64b7443100d953c24a389067f3c3991e3a0036cf3
MD5 f540f8dd249b822deeb4c8e011fbedc3
BLAKE2b-256 a449c98aa1269fee0c3f0b9fe3183104513604e18b128648ad689c6b02dcd3cb

See more details on using hashes here.

File details

Details for the file cjk_semantic_split-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cjk_semantic_split-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c1b28fe60dbf947bfc059ee721cdfa4b1b62d82b765d3a0bdbd951b2e439903
MD5 954f7b117b59d413e6030a3e46445176
BLAKE2b-256 13f135ddaf8ff4834a3560c025f41570e5b2ad4422c7e15c336e11eace1af687

See more details on using hashes here.

Supported by

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