Skip to main content

Utsuho is a Python module that facilitates bidirectional conversion between half-width katakana and full-width katakana in Japanese, as well as between hiragana and katakana.

Project description

Utsuho

Utsuho is a Python module that facilitates bidirectional conversion between half-width katakana and full-width katakana in Japanese, as well as between hiragana and katakana.

The name "Utsuho" originates from the narrative "Utsuho Monogatari," believed to have been composed during the mid-Heian period. This narrative contains descriptions related to katakana.

Although the Python standard library allows for the normalization of Unicode strings, enabling the conversion of half-width katakana to full-width katakana, this process may involve unnecessary transformations such as decomposing composite characters and converting full-width alphanumeric symbols to half-width. Additionally, direct conversion from full-width katakana to half-width katakana is not supported.

Utsuho provides bidirectional conversion for half-width katakana and full-width katakana, as well as between hiragana and katakana.

[!NOTE] Starting from version 2.0.0, the functionality for bidirectional conversion between hiragana and katakana has been added.

Installing

Install and update using pip:

pip install Utsuho

Usage

Conversion from half-width katakana to full-width katakana

To convert from half-width katakana to full-width katakana, code as follows.

from utsuho import HalfToFullConverter

halfwidth = 'キョウトシ サキョウク ギンカクジチョウ 2'
cnv = HalfToFullConverter()
fullwidth = cnv.convert(halfwidth)

The conversion result of the above example is "キョウトシ サキョウク ギンカクジチョウ 2".

Conversion from full-width katakana to half-width katakana

To convert from full-width katakana to half-width katakana, code as follows.

from utsuho import FullToHalfConverter

fullwidth = 'キョウトシ サキョウク ギンカクジチョウ 2'
cnv = FullToHalfConverter()
halfwidth = cnv.convert(fullwidth)

The conversion result of the above example is "キョウトシ サキョウク ギンカクジチョウ 2".

Conversion from hiragana to katakana

To convert from hiragana to katakana, code as follows.

from utsuho import HiraganaToKatakanaConverter

hiragana = 'きょうとし さきょうく ぎんかくじちょう 2'
cnv = HiraganaToKatakanaConverter()
katakana = cnv.convert(hiragana)

The conversion result of the above example is "キョウトシ サキョウク ギンカクジチョウ 2".

Conversion from katakana to hiragana

To convert from katakana to hiragana, code as follows.

from utsuho import KatakanaToHiraganaConverter

katakana = 'キョウトシ サキョウク ギンカクジチョウ 2'
cnv = KatakanaToHiraganaConverter()
hiragana = cnv.convert(katakana)

The conversion result of the above example is "きょうとし さきょうく ぎんかくじちょう 2".

License

This project is licensed under the terms of the Apache license 2.0.

See the "LICENSE" file for license rights and limitations.

Links

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

Utsuho-2.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

Utsuho-2.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file Utsuho-2.1.0.tar.gz.

File metadata

  • Download URL: Utsuho-2.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for Utsuho-2.1.0.tar.gz
Algorithm Hash digest
SHA256 b1602a0bd5b6d77281ef84a37a1dfb396d65887f4bf3a6d192c8baf22e94e465
MD5 836258e655bd12cd450bd5d093110ee3
BLAKE2b-256 4d93f632a03633d8b833dc3e82ec47642cbc4cfb4f4efd3a53f3ac3619a7e7d9

See more details on using hashes here.

File details

Details for the file Utsuho-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: Utsuho-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for Utsuho-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2a52d428be2dbf9acb186fff3ec67d4136339a590d00a928354fbdc69422b22
MD5 2fdf4353ab9ed1f41db34233dbaf0987
BLAKE2b-256 919f31b7ade137f724d3f56f8b2cf8d0d5db9acc75e224fdf66c1e58f48dbb17

See more details on using hashes here.

Supported by

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