This npm package provides a comprehensive set of functions for converting text between different writing systems of the Ainu language.
Currently, Latin (Romanization), Katakana, Cyrillic and Hangul 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. The converted string are always in lower case.
Conversion between Latin, Cyrillic and Hangul 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.
Install the package using npm (or bun, yarn, pnpm, etc.)
npm install ainconv
import { convert } from 'ainconv';
console.log(convert('イランカラㇷ゚テ', 'Kana', 'Latn')); // 'irankarapte'
console.log(convert('irankarapte', 'Latn', 'Kana')); // 'イランカラㇷ゚テ'
console.log(convert('иранкараптэ', 'Cyrl', 'Latn')); // 'irankarapte'
console.log(convert('irankarapte', 'Latn', 'Cyrl')); // 'иранкараптэ'
console.log(convert('이란가랍더', 'Hang', 'Latn')); // 'irankarapte'
console.log(convert('irankarapte', 'Latn', 'Hang')); // '이란가랍더'
// or use the alternative api
import {
convertLatnToKana,
convertKanaToCyrl,
// ...
} from 'ainconv';
convertLatnToKana('aynukotan'); // 'アイヌコタン'
convertKanaToCyrl('アイヌコタン'); // аинукотан
Detect the script of a given string.
import { detect } from 'ainconv';
console.log(detect('aynu')); // 'Latn'
console.log(detect('アイヌ')); // 'Kana'
console.log(detect('айну')); // 'Cyrl'
console.log(detect('애누')); // 'Hang'
import { separate } from 'ainconv';
console.log(separate('eyaykosiramsuypa')); // [ 'e', 'yay', 'ko', 'si', 'ram', 'suy', 'pa' ]
We use bun as the build tool.
bun run build
bun test
MIT License (c) 2023 mkpoli
- ainconv - crates.io: The Rust implementation of this package
- Module:ain-kana-conv - ウィクショナリー日本語版: The original Lua Scribunto module in the Japanese Wiktionary