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.92.tar.gz (2.7 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.92-py35-none-any.whl (2.7 MB view details)

Uploaded Python 3.5

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

Uploaded Python 3.4

pykakasi-0.92-py33-none-any.whl (2.7 MB view details)

Uploaded Python 3.3

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

Uploaded Python 3

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

Uploaded Python 2

File details

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

File metadata

  • Download URL: pykakasi-0.92.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pykakasi-0.92.tar.gz
Algorithm Hash digest
SHA256 d06c142aabd6754ba6709d01a29472038f1912cc8c6d2938c67e2ef32fbab2a2
MD5 a363292116c26c690ba865a58355156a
BLAKE2b-256 1038d3ca5d116df6861a71002b050cc9808d488fc47ca084604594aad81d2cc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pykakasi-0.92-py35-none-any.whl
Algorithm Hash digest
SHA256 ad180ac664c519f2f3adcede961bd3c63e7222f5691ca26bb6be8c54a477edd1
MD5 a467b4db09c6e8d7ce13440954d41f66
BLAKE2b-256 0f43c6bff38294e8590d38ffe0d7a02b6cc04ad6d675b561a3ed1fed314f0808

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pykakasi-0.92-py34-none-any.whl
Algorithm Hash digest
SHA256 1f1c7b26afce8df5faf48cb7e17b4f980f2deb080d2759e50b5acbd157ea6324
MD5 8f9ba99c4e5c2edbebd0f0c14e98d0ac
BLAKE2b-256 70d2dec445aa6bc4bbba4151a6db472570a2d249e487cf12ce7e0d608fddfc79

See more details on using hashes here.

File details

Details for the file pykakasi-0.92-py33-none-any.whl.

File metadata

File hashes

Hashes for pykakasi-0.92-py33-none-any.whl
Algorithm Hash digest
SHA256 c51e0970f545e19634445c8aa8c032934dcbb6982a8aab7a342a1aad0eccfc5c
MD5 39277f613f6ff00c533e9cef2a538b49
BLAKE2b-256 bd959210d05a0853f665f70a7d4491f230038c175841fc78c125b9409da4c0f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pykakasi-0.92-py3-none-any.whl
Algorithm Hash digest
SHA256 7baec0a55e3cfce0956dabd8e41a2ed50562b1a1ee1e909ec48dc071e1ada0b7
MD5 e9a13be1226ce884a7b7738f9dc74d77
BLAKE2b-256 3f0f351d7ea78fd1e2928b0d95046915e31a80efba851d5d29d61ba3dc680ec0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pykakasi-0.92-py2-none-any.whl
Algorithm Hash digest
SHA256 90984b23833b65c94e5b48668de4c8be6f09d72dbf49e5a557349d71bcaa8124
MD5 fcd856d8842ce8b5b0d77022b64d786f
BLAKE2b-256 cb352e6a3eb4fd4242fb56858d44ffb273d89432ebe7fbc1141659bde49f258d

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