Skip to main content

Python implementation of kakasi - kana kanji simple inversion library

Project description

Overview

Travis-CI PyPI version Coverage status Build status

pykakasi is re-implementation of kakasi library (original is written in C) in Python.

How To Use pykakasi

How to Install:

pip install six semidbm
pip install pykakasi

Building library, setup script build dictionary db file and generate pickled db files. Without dictionary files, a library fails to run.

Dependencies:

six and semidbm

Sample source code:

from pykakasi import kakasi,wakati

text = u"かな漢字交じり文"
kakasi = kakasi()
kakasi.setMode("H","a") # Hiragana to ascii, default: no conversion
kakasi.setMode("K","a") # Katakana to ascii, default: no conversion
kakasi.setMode("J","a") # Japanese to ascii, default: no conversion
kakasi.setMode("r","Hepburn") # default: use Hepburn Roman table
kakasi.setMode("s", True) # add space, default: no separator
kakasi.setMode("C", True) # capitalize, default: no capitalize
conv = kakasi.getConverter()
result = conv.do(text)
print(result)

wakati = wakati()
conv = wakati.getConverter()
result = conv.do(text)
print(result)

You can use output Mode values from “H”, “K”, “a” which is each means “Hiragana”, “Katakana” and “Alphabet”. For input, you can use “J” that means “Japanese” that is mixture of Kanji, Katakana and Hiragana. Also there is values of “H”, “K” that means “Hiragana”, and “Katakana”. You can use “Hepburn” , “Kunrei” or “Passport” as mode “r”, Roman table switch. Also “s” used for separator switch, “C” for capitalize switch. “S” for separator storing option.

wakati is an implementation of kakasi’s wakati gaki option.

Options

These switch alphabets are derived from original Kakasi. Now it support following options:

Option

Description

Values

Note

K

Katakana convertion

a,H,None

roman, Hiragana or noconversion

H

Hiragana convertion

a,K,None

roman, Katakana or noconversion

J

Kanji conversion

a,H,K,None

roman or Hiragana, Katakana or noconv

a

Roman conversion

E,None

JIS ROMAN or noconversion

E

JIS ROMAN conversion

a,None

ascii roman or noconversion

Each character means character sets as follows:

Character Sets
   a: ascii  j: jisroman  g: graphic  k: kana
   (j,k     defined in jisx0201)
   E: kigou  K: katakana  H: hiragana J: kanji
   (E,K,H,J defined in jisx0208)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pykakasi-0.94.tar.gz (1.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pykakasi-0.94-py35-none-any.whl (2.7 MB view details)

Uploaded Python 3.5

pykakasi-0.94-py34-none-any.whl (2.7 MB view details)

Uploaded Python 3.4

pykakasi-0.94-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

pykakasi-0.94-py2-none-any.whl (2.7 MB view details)

Uploaded Python 2

File details

Details for the file pykakasi-0.94.tar.gz.

File metadata

  • Download URL: pykakasi-0.94.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

File hashes

Hashes for pykakasi-0.94.tar.gz
Algorithm Hash digest
SHA256 1d2374d4ee90ecaf765aa5b51ebf94055aff081564c274773a0e1ad525c658ba
MD5 a5a4831c8998547c07d276e3c1e50694
BLAKE2b-256 d8e69dcd33d42dbda08900d66671f387c48d7ce5a0d35415c842c599bd0efef2

See more details on using hashes here.

File details

Details for the file pykakasi-0.94-py35-none-any.whl.

File metadata

  • Download URL: pykakasi-0.94-py35-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3.5
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.6

File hashes

Hashes for pykakasi-0.94-py35-none-any.whl
Algorithm Hash digest
SHA256 2f15ecbe5245b0fd85c1990f169f443e67956bb8a172c09b7641f09f53db45f1
MD5 a197fd2d9377bd0800a0a4be7d006f04
BLAKE2b-256 316e191fed3087cc65a47a0110785e42ffb1fa48a9ebd0335e673c6da065f1fa

See more details on using hashes here.

File details

Details for the file pykakasi-0.94-py34-none-any.whl.

File metadata

  • Download URL: pykakasi-0.94-py34-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3.4
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.4.6

File hashes

Hashes for pykakasi-0.94-py34-none-any.whl
Algorithm Hash digest
SHA256 5e86aab25d87e94bfaf177093db7df9ea3ba354358e0f81499d57b276fa04099
MD5 b089023fa1b61b02b5cf12e782ec9a61
BLAKE2b-256 e0735615f398549a773ebada41468945318e4ff6304001beb51988966575670c

See more details on using hashes here.

File details

Details for the file pykakasi-0.94-py3-none-any.whl.

File metadata

  • Download URL: pykakasi-0.94-py3-none-any.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for pykakasi-0.94-py3-none-any.whl
Algorithm Hash digest
SHA256 f72845395d65b6394247bcc4bad116b0ae726cd5223e448385cf6a49178269d6
MD5 7ff2f54c21e70e2b1a5979480bab8e17
BLAKE2b-256 eb0224d5b9ae9d1f3ea0242cdcc9e95c06954f9d98c7d0b4c4dd0f6ca5e73907

See more details on using hashes here.

File details

Details for the file pykakasi-0.94-py2-none-any.whl.

File metadata

  • Download URL: pykakasi-0.94-py2-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.14

File hashes

Hashes for pykakasi-0.94-py2-none-any.whl
Algorithm Hash digest
SHA256 8cffc0ad49760f5d897cc460841d1d8f25cf6b12a09f3e4d59c8fc74810a7500
MD5 7e0c06fda12914047bac6400b2f9a834
BLAKE2b-256 68022fafe11d54b28d7ff953ff5584525783037216c6fad3d1640fcfa446cef6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page