Skip to main content

Japanese Katakana-Phonemes Conversion

Project description

Japanese Katakana-Phonemes Conversion

Installation

pip install kana2p

Usage

from kana2p import katakana2phonemes

# Convert Katakana to Phonemes
katakana = "ハロー、ワールデョ!"
phonemes = katakana2phonemes(katakana)
print(phonemes)
# Output: ["h", "a", "r", "o", ":", "、", "w", "a", ":", "r", "u", "dy", "o", "!"]
print(katakana2phonemes(katakana, normalize=True))
# Output: ["h", "a", "r", "o", ":", "w", "a", ":", "r", "u", "dy", "o"]
from kana2p import phonemes2katakana

# Convert Phonemes to Katakana
phonemes = ["s", "i", ":", "kw", "a", ":", "s", "a", ":"]
katakana = phonemes2katakana(phonemes)
print(katakana)
# Output: "スィークァーサー"

Note

General Notes

  • Only full-width Katakana are processed.
  • If a character is not found in the mapping and normalize is False, the character is passed through unchanged.
  • If normalize is True, characters not present in the mapping (e.g., non-Katakana characters) are excluded.

Special Characters

  • The sokuon is converted to the phoneme q.
  • The prolonged sound mark is converted to the phoneme :.
  • The syllabic nasal is converted to the phoneme N.
  • is converted to ["o"] rather than ["w", "o"].
  • is converted to ["k", "a"] rather than ["k", "e"].

Rare Consonants

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

kana2p-0.1.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

kana2p-0.1.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file kana2p-0.1.2.tar.gz.

File metadata

  • Download URL: kana2p-0.1.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.10

File hashes

Hashes for kana2p-0.1.2.tar.gz
Algorithm Hash digest
SHA256 263cf2eeb14ffef32d2e48205f8ca27444f2bbb7b16b31de01254b75ac002e9f
MD5 187809c6dd5a541bdcf1543f65fdbc4f
BLAKE2b-256 6e76684e0bc19b0e710827025213b82ebdf1a16ccf12bef88ce0873edb6cf11f

See more details on using hashes here.

File details

Details for the file kana2p-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: kana2p-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.10

File hashes

Hashes for kana2p-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4ee265bf25e8fdc9b3d7423a7b57e78d5068bb618d44c25b8cf3a6aa1743b4e6
MD5 b0c6ced46b0a873090f80c7c3b5cdc68
BLAKE2b-256 5033f59accf714ad770166ae6cba7d88436dd512dcda408280182c7fd4b23dfc

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