Giter Site home page Giter Site logo

jaconv's Introduction

jaconv

travis-ci.org coveralls.io pyversion latest version license

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

Japanese README is available.

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.

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

jaconv's People

Contributors

ikegami-yukino avatar kokimame avatar ksato9700 avatar kyamada-exwzd-xware avatar letuananh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.