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", "d", "y", "o"]
from kana2p import phonemes2katakana
# Convert Phonemes to Katakana
phonemes = ["s", "i", ":", "kw", "a", ":", "s", "a", ":"]
katakana = phonemes2katakana(phonemes)
print(katakana)
# Output: "スィークァーサー"
Note
Special Characters
- The sokuon
ッis converted to the phonemeq. - The prolonged sound mark
ーis converted to the phoneme:. - The syllabic nasal
ンis converted to the phonemeN. ヲis converted to["o"]rather than["w", "o"].ヶis converted to["k", "a"]rather than["k", "e"].
Rare Consonants
- Some rare consonants like
shw,dy,tsy,bw, ... are included (e.g.シュェ->["shw", "e"],デョ->["dy", "o"]). - See
src/kana2p/const.pyfor the full list of phoneme mappings.
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.
Project details
Release history Release notifications | RSS feed
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.1.tar.gz
(6.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kana2p-0.1.1.tar.gz.
File metadata
- Download URL: kana2p-0.1.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d5d97fb8e374bc846efb76ed6edcd1d919b042a52fa0a8c3c63a98289765c22
|
|
| MD5 |
4061ff43fd3f63591c440eecba4b122c
|
|
| BLAKE2b-256 |
8d0ae51f805c5ee671d71b661b30a7517bbcd0045d563becd1a69f214fa033bd
|
File details
Details for the file kana2p-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kana2p-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edd8ce28a0179c1c92832884716c662868ac35617c67029bc3af397c26364608
|
|
| MD5 |
c788ab19403ae616b6d732382274cf93
|
|
| BLAKE2b-256 |
fb06d86851bddc5c4377947604dfb5d551fd2df06140ee8cad7930a1eb695cf8
|