- Notifications
You must be signed in to change notification settings - Fork1
Utsuho is a Python module that facilitates bidirectional conversion between half-width katakana and full-width katakana in Japanese.
License
juno-rmks/utsuho
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
Install and update using pip:
pip install Utsuho
To convert from half-width katakana to full-width katakana, code as follows.
fromutsuhoimportHalfToFullConverterhalfwidth='キョウトシ サキョウク ギンカクジチョウ 2'cnv=HalfToFullConverter()fullwidth=cnv.convert(halfwidth)
The conversion result of the above example is "キョウトシ サキョウク ギンカクジチョウ 2
".
To convert from full-width katakana to half-width katakana, code as follows.
fromutsuhoimportFullToHalfConverterfullwidth='キョウトシ サキョウク ギンカクジチョウ 2'cnv=FullToHalfConverter()halfwidth=cnv.convert(fullwidth)
The conversion result of the above example is "キョウトシ サキョウク ギンカクジチョウ 2
".
To convert from hiragana to katakana, code as follows.
fromutsuhoimportHiraganaToKatakanaConverterhiragana='きょうとし さきょうく ぎんかくじちょう 2'cnv=HiraganaToKatakanaConverter()katakana=cnv.convert(hiragana)
The conversion result of the above example is "キョウトシ サキョウク ギンカクジチョウ 2
".
To convert from katakana to hiragana, code as follows.
fromutsuhoimportKatakanaToHiraganaConverterkatakana='キョウトシ サキョウク ギンカクジチョウ 2'cnv=KatakanaToHiraganaConverter()hiragana=cnv.convert(katakana)
The conversion result of the above example is "きょうとし さきょうく ぎんかくじちょう 2
".
This project is licensed under the terms of the Apache license 2.0.
See the"LICENSE" file for license rights and limitations.
About
Utsuho is a Python module that facilitates bidirectional conversion between half-width katakana and full-width katakana in Japanese.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.