Skip to main content

jaconvV2

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

jaconvV2 (Japanese Converter) can detect whether a character is Zenkaku or Hankaku, and also support interconvertion for Hiragana, Katakana, Hankaku (half-width character) and Zenkaku (full-width character)

Japanese README is available.

INSTALLATION

$ pip install jaconvV2

USAGE

See also document

import jaconvV2


# Test if Zenkaku
jaconvV2.is_zen('D')
# => True

# Test if Hankaku
jaconvV2.is_han('D')
# => True


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

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

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

# half-width character to full-width character
# default parameters are followings: kana=True, ascii=False, digit=False
jaconvV2.h2z('ティロ・フィナーレ')
# => 'ティロ・フィナーレ'

# half-width character to full-width character
# but only ascii characters
jaconvV2.h2z('abc', kana=False, ascii=True, digit=False)
# => 'abc'

# half-width character to full-width character
# but only digit characters
jaconvV2.h2z('123', kana=False, ascii=False, digit=True)
# => '123'

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

# an alias of h2z
jaconvV2.hankaku2zenkaku('ティロ・フィナーレabc123')
# => 'ティロ・フィナーレabc123'

# full-width character to half-width character
# default parameters are followings: kana=True, ascii=False, digit=False
jaconvV2.z2h('ティロ・フィナーレ')
# => 'ティロ・フィナーレ'

# full-width character to half-width character
# but only ascii characters
jaconvV2.z2h('abc', kana=False, ascii=True, digit=False)
# => 'abc'

# full-width character to half-width character
# but only digit characters
jaconvV2.z2h('123', kana=False, ascii=False, digit=True)
# => '123'

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

# an alias of z2h
jaconvV2.zenkaku2hankaku('ティロ・フィナーレabc123')
# => 'ティロ・フィナーレabc123'

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

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

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

# Katakana to Alphabet
jaconvV2.kata2alphabet('ケツイ')
# => 'ketsui'

# Alphabet to Katakana
jaconvV2.alphabet2kata('namba')
# => 'ナンバ'

# Hiragana to Julius's phoneme format
jaconvV2.hiragana2julius('てんきすごくいいいいいい')
# => 't e N k i s u g o k u i:'

NOTE

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

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

CHANGES

0.4 (2021-08-24)

  • Add functions: is_han(char): Check if character is Hankaku

  • Add Function: is_zen(char): Check if character is Zenkaku

0.3 (2021-03-29)

  • Fix bug (alphabet2kana) thanks @Cuddlemuffin007

  • Support Python 3.8 and 3.9

  • Add handy functions: alphabet2kata and kata2alphabet. thanks @kokimame

  • Add function for julius: hiragana2julius

0.2.4 (2018-02-04)

  • Fix bug (kana2alphabet)

  • Support Python 3.7

  • No longer support Python 2.6

  • Add aliases of z2h -> zenkaku2hankaku and h2z -> hankaku2zenkaku

0.2.3 (2018-02-03)

  • Fix bugs (alphabet2kana, kana2alphabet) thanks @letuananh

0.2.2 (2018-01-22)

  • Fix bug (kana2alphabet) thanks @kokimame

  • Support Python 3.6

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.

Metadata

Release files for jaconvV2 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for jaconvV2 0.4
File Interpreter ABI Platform
jaconvV2-0.4-py3-none-any.whl Python 3 none any Details

Release files / jaconvV2-0.4-py3-none-any.whl

Download URL jaconvV2-0.4-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
015bcd37fb740e30f444d2c89df6219ce74ed8f1835af5ebd6c74b06de5e4d5c
BLAKE2b-256 checksum
How to use checksums
ff15d55b1df868a8a9ba5953c07be41f4742dca787652a28d5fe860d1b177a22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.4 This release

1 release file

0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page