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

kakasi = kakasi()
kakasi.setMode("H","a") # default: Hiragana no conversion
kakasi.setMode("K","a") # default: Katakana no conversion
kakasi.setMode("J","a") # default: Japanese 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)

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

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 or noconversion

H

Hiragana convertion

a,K,None

roman or noconversion

J

Kanji conversion

a,H,K,None

roman or Hiragana, Katakana

E

Eigou convesion

a,None

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.80.tar.gz (1.0 MB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for pykakasi-0.80.tar.gz
Algorithm Hash digest
SHA256 ec06a42f1081df19b6ae836a979eddb7e495b66eb3f2fe47514ed6f32e667b4f
MD5 a3e8f0391cfebfc3d84e1219de047344
BLAKE2b-256 62273f9a21bfad41a931d885fb88aa2f0102fd2a014d4a06e4166a53f1c15e18

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