skip to navigation
skip to content

jaconv 0.2.1

Pure-Python Japanese character interconverter for Hiragana, Katakana, Hankaku and Zenkaku

jaconv

jaconv (Japanese Converter) is interconverter for Hiragana, Katakana, Hankaku (half-width character) and Zenkaku (full-width character)

INSTALLATION

$ pip install jaconv

USAGE

import jaconv

# Hiragana to Katakana
jaconv.hira2kata(u'ともえまみ')
# => u'トモエマミ'

# Hiragana to half-width Katakana
jaconv.hira2hkata(u'ともえまみ')
# => u'トモエマミ'

# Katakana to Hiragana
jaconv.kata2hira(u'巴マミ')
# => u'巴まみ'

# half-width character to full-width character
jaconv.h2z(u'ティロ・フィナーレ')
# => u'ティロ・フィナーレ'

# half-width character to full-width character
# but only ascii characters
jaconv.h2z(u'abc', ascii=True)
# => u'abc'

# half-width character to full-width character
# but only digit characters
jaconv.h2z(u'123', digit=True)
# => u'123'

# half-width character to full-width character
# except half-width Katakana
jaconv.h2z(u'アabc123', kana=False, digit=True, ascii=True)
# => u'アabc123'

# full-width character to half-width character
jaconv.z2h(u'ティロ・フィナーレ')
# => u'ティロ・フィナーレ'

# full-width character to half-width character
# but only ascii characters
jaconv.z2h(u'abc', ascii=True)
# => u'abc'

# full-width character to half-width character
# but only digit characters
jaconv.z2h(u'123', digit=True)
# => u'123'

# full-width character to half-width character
# except full-width Katakana
jaconv.z2h(u'アabc123', kana=False, digit=True, ascii=True)
# => u'アabc123'

# normalize
jaconv.normalize(u'ティロ・フィナ〜レ', 'NFKC')
# => u'ティロ・フィナーレ'

# Hiragana to alphabet
jaconv.kana2alphabet(u'じゃぱん')
# => japan

# Alphabet to Hiragana
jaconv.alphabet2kana(u'japan')
# => じゃぱん

NOTE

jaconv.normalize method expand unicodedata.normalize for Japanese language processing.

'〜' => 'ー'
'~' => 'ー'
"’" => "'"
'”'=> '"'
'“' => '``'
'―' => '-'
'‐' => '-'
'˗' => '-'
'֊' => '-'
'‐' => '-'
'‑' => '-'
'‒' => '-'
'–' => '-'
'⁃' => '-'
'⁻' => '-'
'₋' => '-'
'−' => '-'
'﹣' => 'ー'
'-' => 'ー'
'—' => 'ー'
'―' => 'ー'
'━' => 'ー'
'─' => 'ー'

CHANGES

0.2.1 (2017-09-14)

  • Fix bugs (alphabet2kana, kana2alphabet)

0.2 (2015-04-02)

  • Change module name jctconv -> jaconv
  • Add alphabet and hiragana interconvert (alphabet2kana, kana2alphabet)

0.1.1 (2015-03-12)

  • Support Windows
  • Support Python 3.5

0.1 (2014-11-24)

  • Add some Japanese characters to convert table (ゝゞ・「」。、)
  • Decresing memory usage
  • Some function names are deprecated (hankaku2zenkaku, zenkaku2hankaku, H2K, H2hK, K2H)

0.0.7 (2014-03-22)

z2h and h2z allow mojimoji-like target character type determination. Bug fix about Half Kana conversion.

 
File Type Py Version Uploaded on Size
jaconv-0.2.1.tar.gz (md5) Source 2017-09-13 9KB