Skip to content

Repository files navigation

IPA Engine

A lightweight package to convert text to IPA (International Phonetic Alphabet) symbols.

Command-line usage

Run a query without installing the package:

uvx ipa-engine "Ça va bien?" --lang fr_FR

Load more than one language dictionary by repeating --lang:

uvx ipa-engine "hello 世界" --lang en_US --lang zh_hans

Use --preserve-unknown (or -p) to keep characters that are not present in the selected dictionaries:

uvx ipa-engine "hello, Codex!" --lang en_US --preserve-unknown

Run uvx ipa-engine --help to see all options. The legacy ipa-translate command remains available when the package is installed.

Demo usage

importloggingfromipa_engineimportIPAEnginelogging.basicConfig(level=logging.DEBUG)
logger=logging.getLogger(__name__)
# Create an instance of IPASession# ipa_session = IPASession(languages=["zh_hans"])logger.debug("Initializing IPA session...")
ipa_session=IPAEngine(languages=["fr_FR"])
logger.debug("IPA session initialized.")
# Translate a sentencesentence="Ça va bien?"ipa_result=ipa_session.translate_ipa(sentence)
logger.debug(
"IPA translation: %s",
"".join(ipa_result)) # Output will be a list of IPA transcriptions

About

A lightweight package to convert text to IPA (International Phonetic Alphabet) symbols.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages