Metadata-Version: 2.4
Name: mn-translit
Version: 1.0.3
Summary: Mongolian Latin-Cyrillic transliteration library following MNS 5217:2012 standard
Author-email: Battseren Badral <bbattseren88@gmail.com>
License: MIT License
        
        Copyright (c) 2025 mn-translit contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/btseee/mn-translit
Project-URL: Bug Reports, https://github.com/btseee/mn-translit/issues
Project-URL: Source, https://github.com/btseee/mn-translit
Keywords: mongolian,transliteration,cyrillic,latin,mns-5217
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# mn-translit

Mongolian Latin-Cyrillic transliteration following MNS 5217:2012 standard with proper Mongolian number grammar.

## Python Version Support

- Python 3.8+

## Installation

```bash
pip install mn-translit
```

Or install from source:

```bash
git clone https://github.com/btseee/mn-translit.git
cd mn-translit
pip install -e .
```

## Usage

### Text Transliteration

```python
from mn_translit import latin_to_cyrillic, cyrillic_to_latin

# Latin to Cyrillic
print(latin_to_cyrillic("Sain baina uu?"))
# Output: Сайн байна уу?

# With automatic number conversion (digits → words)
print(latin_to_cyrillic("Bi 21 nom baina", trans_num=True))
# Output: Би хорин нэг ном байна

# Cyrillic to Latin
print(cyrillic_to_latin("Монгол"))
# Output: Mongol
```

### Command-line

Install and use the CLI directly:

```bash
echo "Sain baina uu?" | mn-translit --direction cyrillic
# → Сайн байна уу?

echo "Монгол" | mn-translit --direction latin
# → Mongol

echo "Bi 2024 ond" | mn-translit --direction cyrillic --trans-num
# → Би хоёр мянга хорин дөрвөн онд
```

### Number Conversion

```python
from mn_translit import number_to_words, words_to_number

# Number to words (proper Mongolian grammar)
print(number_to_words(21))
# Output: хорин нэг

print(number_to_words(111))
# Output: зуун арав нэг

print(number_to_words(230))
# Output: хоёр зуун гучин

print(number_to_words(2024))
# Output: хоёр мянга хорин дөрөв

# Words to number
print(words_to_number("мянга"))
# Output: 1000

print(words_to_number("хорин нэг"))
# Output: 21

print(words_to_number("хоёр зуун гучин"))
# Output: 230
```

## Character Mapping

### Basic Mapping

| Latin | Cyrillic | Latin | Cyrillic |
|-------|----------|-------|----------|
| a     | а        | n     | н        |
| e     | э        | o     | о        |
| i     | и        | u     | у        |
| ö     | ө        | ü     | ү        |

### Digraphs

| Latin | Cyrillic | Latin | Cyrillic |
|-------|----------|-------|----------|
| kh    | х        | ts    | ц        |
| ch    | ч        | sh    | ш        |
| zh    | ж        | ya    | я        |
| ye    | е        | yo    | ё        |
| yu    | ю        |       |          |

### Diphthongs

| Latin | Cyrillic | Example |
|-------|----------|---------|
| ai    | ай       | sainai → сайнай |
| ei    | эй       | erdei → эрдэй |
| ii    | ий       | kharii → харий |
| oi    | ой       | oilgokh → ойлгох |

## Number System

### Major Scales

- 100 → зуун
- 1,000 → мянга
- 10,000 → түм
- 100,000 → бум
- 1,000,000 → сая
- 1,000,000,000 → тэрбум
- 1,000,000,000,000 → их наяд

### Examples

- 21 → хорин нэг
- 31 → гучин нэг
- 41 → дөчин нэг
- 51 → тавин нэг
- 61 → жаран нэг
- 71 → далан нэг
- 81 → наян нэг
- 91 → ерэн нэг
- 111 → зуун арав нэг
- 230 → хоёр зуун гучин

## Testing

Run the test suite to verify all functionality:

```bash
python tests/test_translit.py
```

## Development

### Setting up for development

```bash
git clone https://github.com/btseee/mn-translit.git
cd mn-translit
pip install -e .
```

### Running tests

```bash
python tests/test_translit.py
```

### Publishing to PyPI

This package uses GitHub Actions for automated publishing. To publish a new version:

1. Update version in `mn_translit/__init__.py`
2. Create a new release on GitHub
3. The GitHub Action will automatically run tests and publish to PyPI

**Note:** You need to set up `PYPI_API_TOKEN` secret in your GitHub repository settings.

## License

MIT License
