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 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. - See also: https://ja.wikipedia.org/wiki/%E6%8D%A8%E3%81%A6%E4%BB%AE%E5%90%8D
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.2.tar.gz
(6.4 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.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
263cf2eeb14ffef32d2e48205f8ca27444f2bbb7b16b31de01254b75ac002e9f
|
|
| MD5 |
187809c6dd5a541bdcf1543f65fdbc4f
|
|
| BLAKE2b-256 |
6e76684e0bc19b0e710827025213b82ebdf1a16ccf12bef88ce0873edb6cf11f
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ee265bf25e8fdc9b3d7423a7b57e78d5068bb618d44c25b8cf3a6aa1743b4e6
|
|
| MD5 |
b0c6ced46b0a873090f80c7c3b5cdc68
|
|
| BLAKE2b-256 |
5033f59accf714ad770166ae6cba7d88436dd512dcda408280182c7fd4b23dfc
|