Skip to main content
ワナカナ <--> WanaKana <--> わなかな
Python utility library for detecting and transliterating Hiragana, Katakana, and Romaji

This library uses Semantic Versioning

See what this means here

Demo

Visit the website to see WanaKana in action.

Usage

Install

pip install wanakana-python
import wanakana
# or
from wanakana import to_kana, is_romaji

Documentation

Extended API reference (Note that function names are converted to snake_case)

Quick Reference

### TEXT CHECKING UTILITIES ###
wanakana.is_japanese('泣き虫。!〜2¥zenkaku')
# => True

wanakana.is_kana('あーア')
# => True

wanakana.is_hiragana('すげー')
# => True

wanakana.is_katakana('ゲーム')
# => True

wanakana.is_kanji('切腹')
# => True
wanakana.is_kanji('勢い')
# => False

wanakana.is_romaji('Tōkyō and Ōsaka')
# => True

wanakana.to_kana('ONAJI buttsuuji')
# => 'オナジ ぶっつうじ'
wanakana.to_kana('座禅‘zazen’スタイル')
# => '座禅「ざぜん」スタイル'
wanakana.to_kana('batsuge-mu')
# => 'ばつげーむ'
wanakana.to_kana('wanakana', custom_kana_mapping={'na': 'に', 'ka': 'bana'})
# => 'わにbanaに'

wanakana.to_hiragana('toukyou, オオサカ')
# => 'とうきょう、 おおさか'
wanakana.to_hiragana('only カナ', ignore_romaji=True)
# => 'only かな'
wanakana.to_hiragana('wi', use_obsolete_kana=True)
# => 'ゐ'

wanakana.to_katakana('toukyou, おおさか')
# => 'トウキョウ、 オオサカ'
wanakana.to_katakana('only かな', ignore_romaji=True)
# => 'only カナ'
wanakana.to_katakana('wi', use_obsolete_kana=True)
# => 'ヰ'

wanakana.to_romaji('ひらがな カタカナ')
# => 'hiragana katakana'
wanakana.to_romaji('ひらがな カタカナ', uppercase_katakana=True)
# => 'hiragana KATAKANA'
wanakana.to_romaji('つじぎり', custom_romaji_mapping={'じ': 'zi', 'つ': 'tu', 'り': 'li' })
# => 'tuzigili'

### EXTRA UTILITIES ###
wanakana.strip_okurigana('お祝い')
# => 'お祝'
wanakana.strip_okurigana('踏み込む')
# => '踏み込'
wanakana.strip_okurigana('お腹', leading=True)
# => '腹'
wanakana.strip_okurigana('ふみこむ', match_kanji='踏み込む')
# => 'ふみこ'
wanakana.strip_okurigana('おみまい', match_kanji='お祝い', leading=True)
# => 'みまい'

wanakana.tokenise('ふふフフ')
# => ['ふふ', 'フフ']
wanakana.tokenise('hello 田中さん')
# => ['hello', ' ', '田中', 'さん']
wanakana.tokenise('I said 私はすごく悲しい', compact=True)
# => [ 'I said ', '私はすごく悲しい']

Contributors

Credits

Port of WanaKana

Metadata

Release files for wanakana-python 1.2.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 wanakana-python 1.2.2
File Size Uploaded Provenance Actions
wanakana-python-1.2.2.tar.gz 15.2 kB Without provenance Details for wanakana-python-1.2.2.tar.gz

Release files / wanakana-python-1.2.2.tar.gz

Download URL wanakana-python-1.2.2.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2168958ad2126eecddc3a86cfec5ba1f92eff42e85b309214513f5daaf64e08f
BLAKE2b-256 checksum
How to use checksums
7fe18894b11cfb4642e97f0d9df255665a027744b9c9debe6a1abacf2a53a462
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for wanakana-python 1.2.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.

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