Converts Ainu text between different scripts (Katakana, Latin, Cyrillic and more)
Project description
ainconv - Ainu language script converter
Table of Contents
Overview
This package provides a comprehensive set of functions for converting text between different writing systems of the Ainu language.
Currently, Latin (Romanization), Katakana and Cyrillic scripts are supported. We are also planning to convert between different romanization systems and Katakana variants. Currently only the more adopted version of Latin script and lossy Katakana script are supported.
Sentence conversion is planned to be supported in the future. For now, only well-formed single word is accepted. The converted string are always in lower case.
Important Note
Conversion between Latin and Cyrillic script are lossless, however, conversion between Katakana and other scripts are lossy. This means that converting from Katakana to other scripts and then back to Katakana may not give the original string and the result may be ambiguous or even incorrect.
This is because the Katakana script used broadly for the Ainu language is intrinsically ambiguous. For example, it does not distinguish between tow and tu (both トゥ), iw and i.u (both イウ), ay and a.i (both アイ), etc. Some alternative Katakana scripts are proposed to solve this problem, but none of them are widely adopted. We are planning to support some of these alternative scripts in the future.
Installation
Install the package using pip
pip install ainconv
Usage
Word Conversion
from ainconv import (
kana2latn,
latn2kana,
cyrl2latn,
latn2cyrl,
kana2cyrl,
cyrl2kana,
# ...
)
print(kana2latn("イランカラㇷ゚テ")) # "irankarapte"
print(latn2kana("irankarapte")) # "イランカラㇷ゚テ"
print(cyrl2latn("иранкараптэ")) # "irankarapte"
print(latn2cyrl("irankarapte")) # "иранкараптэ"
print(cyrl2kana("иранкараптэ")) # "イランカラㇷ゚テ"
print(kana2cyrl("イランカラㇷ゚テ")) # "иранкараптэ"
Extra Functionality
Script Detection
Detect the script of a given string.
from ainconv import detect
print(detect("aynu")) # "Latn"
print(detect("アイヌ")) # "Kana"
print(detect("айну")) # "Cyrl"
Syllable Splitting
from ainconv import separate
print(separate("eyaykosiramsuypa")) # ["e", "yay", "ko", "si", "ram", "suy", "pa"]
Support
If you have a question or have found a bug or any other issue, feel free to open an issue to let me know. For instructions on how to contribute, see CONTRIBUTING.md.
You can also join our Discord for discussion. We have many projects going on about Ainu, so you may find something interesting there as well.
License
MIT License (c) 2024 mkpoli
See also
- ainconv - npm: The JavaScript version of this package
- ainconv - crates.io: The Rust version of this package
- Module:ain-kana-conv - ウィクショナリー日本語版: The original Lua Scribunto module in the Japanese Wiktionary
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.