Metadata-Version: 2.4
Name: ipa-engine
Version: 0.1.2
Author-email: Sheng Fan <fredtools999@gmail.com>
License: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# IPA Engine

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

## Command-line usage

Run a query without installing the package:

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

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

```console
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:

```console
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

```python
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

```
