Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arpapy-0.0.3.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

arpapy-0.0.3-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

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

Hashes for arpapy-0.0.3.tar.gz
Algorithm Hash digest
SHA256 86422ebdf16489ea7ee5bb83480d3d00afb33d8a5891b5e7788c65cb563505aa
MD5 bd26a77e503ab636f0d892cad611518f
BLAKE2b-256 ceff6918020bfd26e3a67629f48f7798e4064e720a0ff58f7baae63ed1c0bdba

See more details on using hashes here.

Provenance

The following attestation bundles were made for arpapy-0.0.3.tar.gz:

Publisher: workflow.yml on KokeCacao/arpapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for arpapy-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 066fb32c01aa9a4e7a2532822c629e5fa67929f4c26a81db60e58638445dbea5
MD5 beaae03b651cd889916a8449d739bc68
BLAKE2b-256 af402b3454da89a8c7bb81ac9fc607e10fed77de801420dff632f914183262a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for arpapy-0.0.3-py3-none-any.whl:

Publisher: workflow.yml on KokeCacao/arpapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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