Skip to main content

ja-itaiji

ja-itaiji is a Python package for handling Japanese 異体字 (itaiji), which are variant forms of kanji characters. This package allows you to find equivalent characters, check if two kanji characters or words are equivalent, and generate a list of similar words by replacing kanji with their itaiji.

Features

  • Get Itaiji Family: Retrieve a list of kanji characters that are equivalent to a given kanji.
  • Check Kanji Equivalence: Determine whether two kanji characters are equivalent itaiji.
  • Check Word Equivalence: Check if two words are equivalent within itaiji.
  • Generate Similar Words: Generate a list of words by replacing each kanji with its equivalent itaiji.

Installation

To install the package, use pip:

pip install ja-itaiji

Usage

Importing the Package

from ja_itaiji import Itaiji

Get Itaiji Family

Retrieve a list of kanji characters that are equivalent to a given kanji.

family = Itaiji.get_family('漢')
print(family)  # Output: ['漢', '㵄', '漢', '汉']

Check Kanji Equivalence

Determine whether two kanji characters are equivalent itaiji.

is_equivalent = Itaiji.is_family('漢', '㵄')
print(is_equivalent)  # Output: True

Check Word Equivalence

Check if two words are equivalent within itaiji.

is_similar = Itaiji.is_similar('漢字', '汉字')
print(is_similar)  # Output: True

Generate Similar Words

Generate a list of words by replacing each kanji with its equivalent itaiji.

similar_words = Itaiji.get_similar('漢字')
print(similar_words)  # Output: ['漢字', '㵄字', '漢字', '汉字']

You can also specify the number of replacing.

similar_words = Itaiji.get_similar("低頭思故郷", n=1)
print(similar_words)  # Output: ['低頭思故郷', '低頭思故鄕', '低頭思故乡', '低頭楒故郷', '低頭䰄故郷', '低頭恖故郷', '低头思故郷', '氐頭思故郷', '仾頭思故郷']

Data

The package uses a JSON file (ja-itaiji.json) that contains mappings of kanji to their itaiji. Ensure that this file is located in the correct directory as specified by ITAIJI_PATH.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for ja-itaiji 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ja-itaiji 1.0.2
File Size Uploaded
ja_itaiji-1.0.2.tar.gz 171.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ja-itaiji 1.0.2
File Interpreter ABI Platform
ja_itaiji-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 341.5 kB

Release files / ja_itaiji-1.0.2.tar.gz

Download URL ja_itaiji-1.0.2.tar.gz
Size 171.8 kB
Tags Source
SHA-256 checksum
How to use checksums
91c766e0cf64fbc0126ab2e548da6147427f089469980412eb6482b049aa6acd
BLAKE2b-256 checksum
How to use checksums
f7d05a405dddade3da42d4e69437f5918c84f98d8555eefbf60900f6ced70b85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / ja_itaiji-1.0.2-py3-none-any.whl

Download URL ja_itaiji-1.0.2-py3-none-any.whl
Size 169.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e8237ee9762c789c124ca29c1e7790367dc11e998f965c5c43de2517d715b62
BLAKE2b-256 checksum
How to use checksums
56bfacabc232a779bbe11af9f465c946a45ee4821d7edda7f8cf9dc6db135a05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page