jaconv package

jaconv.alphabet2kana(text)[source]

Convert alphabets to Hiragana

Parameters

text (str) – Alphabets string.

Returns

Hiragana string.

Return type

str

Examples

>>> print(jaconv.alphabet2kana('mamisan'))
まみさん
jaconv.alphabet2kata(text)
jaconv.h2z(text, ignore='', kana=True, ascii=False, digit=False)[source]

Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana

Parameters
  • text (str) – Half-width Katakana string.

  • ignore (str) – Characters to be ignored in converting.

  • kana (bool) – Either converting Kana or not.

  • ascii (bool) – Either converting ascii or not.

  • digit (bool) – Either converting digit or not.

Returns

Full-width Katakana string.

Return type

str

Examples

>>> print(jaconv.h2z('ティロフィナーレ'))
ティロフィナーレ
>>> print(jaconv.h2z('ティロフィナーレ', ignore='ィ'))
ティロフィナーレ
>>> print(jaconv.h2z('abcd', ascii=True))
ABCD
>>> print(jaconv.h2z('1234', digit=True))
1234
jaconv.hankaku2zenkaku(text, ignore='', kana=True, ascii=False, digit=False)

Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana

Parameters
  • text (str) – Half-width Katakana string.

  • ignore (str) – Characters to be ignored in converting.

  • kana (bool) – Either converting Kana or not.

  • ascii (bool) – Either converting ascii or not.

  • digit (bool) – Either converting digit or not.

Returns

Full-width Katakana string.

Return type

str

Examples

>>> print(jaconv.h2z('ティロフィナーレ'))
ティロフィナーレ
>>> print(jaconv.h2z('ティロフィナーレ', ignore='ィ'))
ティロフィナーレ
>>> print(jaconv.h2z('abcd', ascii=True))
ABCD
>>> print(jaconv.h2z('1234', digit=True))
1234
jaconv.hira2hkata(text, ignore='')[source]

Convert Hiragana to Half-width (Hankaku) Katakana

Parameters
  • text (str) – Hiragana string.

  • ignore (str) – Characters to be ignored in converting.

Returns

Half-width Katakana string.

Return type

str

Examples

>>> print(jaconv.hira2hkata('ともえまみ'))
トモエマミ
>>> print(jaconv.hira2hkata('ともえまみ', ignore='み'))
トモエマみ
jaconv.hira2kata(text, ignore='')[source]

Convert Hiragana to Full-width (Zenkaku) Katakana.

Parameters
  • text (str) – Hiragana string.

  • ignore (str) – Characters to be ignored in converting.

Returns

Katakana string.

Return type

str

Examples

>>> print(jaconv.hira2kata('ともえまみ'))
トモエマミ
>>> print(jaconv.hira2kata('まどまぎ', ignore='ど'))
マどマギ
jaconv.hiragana2julius(text)[source]

Convert Hiragana to Julius’s phoneme format.

Parameters

text (str) – Hiragana string.

Returns

Alphabet string.

Return type

str

Examples

>>> print(jaconv.hiragana2julius('てんきすごくいいいいいい'))
t e N k i s u g o k u i:
jaconv.kana2alphabet(text)[source]

Convert Hiragana to hepburn-style alphabets

Parameters

text (str) – Hiragana string.

Returns

Hepburn-style alphabets string.

Return type

str

Examples

>>> print(jaconv.kana2alphabet('まみさん'))
mamisan
jaconv.kata2alphabet(text)
jaconv.kata2hira(text, ignore='')[source]

Convert Full-width Katakana to Hiragana

Parameters
  • text (str) – Full-width Katakana string.

  • ignore (str) – Characters to be ignored in converting.

Returns

Hiragana string.

Return type

str

Examples

>>> print(jaconv.kata2hira('巴マミ'))
巴まみ
>>> print(jaconv.kata2hira('マミサン', ignore='ン'))
まみさン
jaconv.normalize(text, mode='NFKC')[source]

Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana, Full-width (Zenkaku) ASCII and DIGIT to Half-width (Hankaku) ASCII and DIGIT. Additionally, Full-width wave dash (〜) etc. are normalized

Parameters
  • text (str) – Source string.

  • mode (str) – Unicode normalization mode.

Returns

Normalized string.

Return type

str

Examples

>>> print(jaconv.normalize('ティロ・フィナ〜レ', 'NFKC'))
ティロ・フィナーレ
jaconv.z2h(text, ignore='', kana=True, ascii=False, digit=False)[source]

Convert Full-width (Zenkaku) Katakana to Half-width (Hankaku) Katakana

Parameters
  • text (str) – Full-width Katakana string.

  • ignore (str) – Characters to be ignored in converting.

  • kana (bool) – Either converting Kana or not.

  • ascii (bool) – Either converting ascii or not.

  • digit (bool) – Either converting digit or not.

Returns

Half-width Katakana string.

Return type

str

Examples

>>> print(jaconv.z2h('ティロフィナーレ'))
ティロフィナーレ
>>> print(jaconv.z2h('ティロフィナーレ', ignore='ィ'))
ティロフィナーレ
>>> print(jaconv.z2h('ABCD', ascii=True))
abcd
>>> print(jaconv.z2h('1234', digit=True))
1234
jaconv.zenkaku2hankaku(text, ignore='', kana=True, ascii=False, digit=False)

Convert Full-width (Zenkaku) Katakana to Half-width (Hankaku) Katakana

Parameters
  • text (str) – Full-width Katakana string.

  • ignore (str) – Characters to be ignored in converting.

  • kana (bool) – Either converting Kana or not.

  • ascii (bool) – Either converting ascii or not.

  • digit (bool) – Either converting digit or not.

Returns

Half-width Katakana string.

Return type

str

Examples

>>> print(jaconv.z2h('ティロフィナーレ'))
ティロフィナーレ
>>> print(jaconv.z2h('ティロフィナーレ', ignore='ィ'))
ティロフィナーレ
>>> print(jaconv.z2h('ABCD', ascii=True))
abcd
>>> print(jaconv.z2h('1234', digit=True))
1234