Multilingual text/IPA to ARPAbet G2P for text2speech generation.
Project description
arpapy
Multilingual text/IPA to ARPAbet G2P for text2speech generation.
Installation
sudo apt install espeak-ng
pip install arpapy
Quick Start
Getting pronunciation
from arpapy import get_arpa
s: str = '"Marron glacé is in my DNA." adiós'
print(get_arpa(s))
# ['M', 'AA1', 'R', 'AX0', 'N', '/', 'G', 'L', 'AA0', 'S', 'EY1', '/', 'IH0', 'Z', '/', 'IH0', 'N', '/', 'M', 'AY0', '/', 'D', 'IY2', 'EH2', 'N', 'EY1', '-', 'EY1', 'D', 'IH0', 'AX2', 'UH0', 'Z']
s: str = 'あわてんのおつかい'
print(get_arpa(s, lang=CharacterCategory.JAPANESE)) # ['AA2', 'W', 'AA0', 'T', 'EY2', 'N', 'N', 'OW0', 'OW0', 'T', 'S', 'UW0', 'V', 'K', 'AA1', 'IY0']
Segmenting Languages
from arpapy import segment_string, CharacterCategory
test_string = "😊yo ♠你好hello, 人😊♠ 出自日本童谣'あわてん坊のおつかい'"
result = segment_string(test_string, [CharacterCategory.LATIN, CharacterCategory.CHINESE, CharacterCategory.JAPANESE])
print(result)
# [('yo ♠', <CharacterCategory.LATIN: 5>), ('你好', <CharacterCategory.CHINESE: 2>), ('hello, ', <CharacterCategory.LATIN: 5>), ("人😊♠ 出自日本童谣'", <CharacterCategory.CHINESE: 2>), ('あわてん', <CharacterCategory.JAPANESE: 3>), ('坊', <CharacterCategory.CHINESE: 2>), ("のおつかい'", <CharacterCategory.JAPANESE: 3>)]
Limitation
Some of the convertion from IPA to ARPA might be inaccurate or out of scope, which might result in arpapy.excepts.PhonemeError: Unable to recognize the phoneme. If this is the case, please submit a PR according to IPA consonant chart with audio.
Language scope: (If there is any error within the scope, I'll fix it.)
- All standard English
- All Chinese
- All Japanese Hiragana, Katakana
- Some western languages (Spanish, German, etc...)
- Some korean (not tested)
Future:
- Support Japanese Kanji
Citation
See CREADITS.md for all credits.
@misc{arpapy,
title={arpapy: Multilingual text/IPA to ARPAbet G2P for text2speech generation.},
author={Koke_Cacao},
year={2025},
howpublished={\url{https://github.com/KokeCacao/arpapy}},
note={Open-source software}
}
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
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 arpapy-0.0.3.tar.gz.
File metadata
- Download URL: arpapy-0.0.3.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86422ebdf16489ea7ee5bb83480d3d00afb33d8a5891b5e7788c65cb563505aa
|
|
| MD5 |
bd26a77e503ab636f0d892cad611518f
|
|
| BLAKE2b-256 |
ceff6918020bfd26e3a67629f48f7798e4064e720a0ff58f7baae63ed1c0bdba
|
Provenance
The following attestation bundles were made for arpapy-0.0.3.tar.gz:
Publisher:
workflow.yml on KokeCacao/arpapy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arpapy-0.0.3.tar.gz -
Subject digest:
86422ebdf16489ea7ee5bb83480d3d00afb33d8a5891b5e7788c65cb563505aa - Sigstore transparency entry: 362535575
- Sigstore integration time:
-
Permalink:
KokeCacao/arpapy@08bd0acca971fc5f11d422949a72ee1aa276463f -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/KokeCacao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@08bd0acca971fc5f11d422949a72ee1aa276463f -
Trigger Event:
release
-
Statement type:
File details
Details for the file arpapy-0.0.3-py3-none-any.whl.
File metadata
- Download URL: arpapy-0.0.3-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
066fb32c01aa9a4e7a2532822c629e5fa67929f4c26a81db60e58638445dbea5
|
|
| MD5 |
beaae03b651cd889916a8449d739bc68
|
|
| BLAKE2b-256 |
af402b3454da89a8c7bb81ac9fc607e10fed77de801420dff632f914183262a2
|
Provenance
The following attestation bundles were made for arpapy-0.0.3-py3-none-any.whl:
Publisher:
workflow.yml on KokeCacao/arpapy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arpapy-0.0.3-py3-none-any.whl -
Subject digest:
066fb32c01aa9a4e7a2532822c629e5fa67929f4c26a81db60e58638445dbea5 - Sigstore transparency entry: 362535587
- Sigstore integration time:
-
Permalink:
KokeCacao/arpapy@08bd0acca971fc5f11d422949a72ee1aa276463f -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/KokeCacao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@08bd0acca971fc5f11d422949a72ee1aa276463f -
Trigger Event:
release
-
Statement type: