Giter VIP home page Giter VIP logo

ainconv-rs's Introduction

ainconv - Ainu language script converter

Crates.io GitHub issues GitHub

Overview

This cargo crate 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 cargo

cargo add ainconv

or add the following line to your Cargo.toml file

[dependencies]
ainconv = "0.1.0"

Usage

Word Conversion

use ainconv::{
    convert_kana_to_latn,
    convert_latn_to_kana,
    convert_cyrl_to_latn,
    convert_latn_to_cyrl,
    convert_kana_to_cyrl,
    convert_cyrl_to_kana,
    // ...
}

println!("{}", convert_kana_to_latn("イランカラㇷ゚テ")); // "irankarapte"
println!("{}", convert_latn_to_kana("irankarapte")); // "イランカラㇷ゚テ"
println!("{}", convert_cyrl_to_latn("иранкараптэ")); // "irankarapte"
println!("{}", convert_latn_to_cyrl("irankarapte")); // "иранкараптэ"
println!("{}", convert_cyrl_to_kana("иранкараптэ")); // "イランカラㇷ゚テ"
println!("{}", convert_kana_to_cyrl("イランカラㇷ゚テ")); // "иранкараптэ"

Extra Functionality

Script Detection

Detect the script of a given string.

use ainconv::detect;

println!("{}", detect("aynu")); // "Latn"
println!("{}", detect("アイヌ")); // "Kana"
println!("{}", detect("айну")); // "Cyrl"

Syllable Splitting

use ainconv::separate;

println!("{:?}", separate("eyaykosiramsuypa")); // ["e", "yay", "ko", "si", "ram", "suy", "pa"]

License

MIT License (c) 2024 mkpoli

See also

ainconv-rs's People

Contributors

mkpoli avatar nickoveracker avatar

Stargazers

 avatar Koichi Yasuoka avatar kp avatar

Watchers

 avatar

Forkers

nickoveracker

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.