A lightweight package to convert text to IPA (International Phonetic Alphabet) symbols.
Run a query without installing the package:
uvx ipa-engine "Ça va bien?" --lang fr_FRLoad more than one language dictionary by repeating --lang:
uvx ipa-engine "hello 世界" --lang en_US --lang zh_hansUse --preserve-unknown (or -p) to keep characters that are not present in
the selected dictionaries:
uvx ipa-engine "hello, Codex!" --lang en_US --preserve-unknownRun uvx ipa-engine --help to see all options. The legacy ipa-translate
command remains available when the package is installed.
import logging
from ipa_engine import IPAEngine
logging.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 sentence
sentence = "Ç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