cyrla

Crates.iocyrla
lib.rscyrla
version0.1.0
sourcesrc
created_at2023-01-29 11:46:07.978598
updated_at2023-01-29 11:46:07.978598
descriptionLibrary for two-way conversion between latin and cyrillic script
homepagehttps://github.com/panther99/cyrla
repositoryhttps://github.com/panther99/cyrla
max_upload_size
id770867
size24,928
Nikola Stojaković (panther99)

documentation

README

cyrla

Library for two-way conversion between latin and cyrillic script, written in Rust.

Getting started

To use cyrla, add following to your Cargo.toml file:

[dependencies]
cyrla = "0.1"

Usage

use cyrla::ConverterBuilder;

let converter = ConverterBuilder::new().build();

// conversion from latin to cyrillic script
let cyrillic_text = converter.lat_to_cyr("Konjugacija u genetici je sparivanje homolognih hromozoma u mejozi.");
assert_eq!(cyrillic_text, "Конјугација у генетици је спаривање хомологних хромозома у мејози.");

// conversion from cyrillic to latin script
let latin_text = converter.cyr_to_lat("Ђурђевак је њена омиљена биљка.");
assert_eq!(latin_text, "Đurđevak je njena omiljena biljka.");

You can also configure builder for your needs:

use cyrla::ConverterBuilder;

let mut builder = ConverterBuilder::new();
let mut prefixes = vec!["kunjar", "abanjar", "sanjar"];
let converter = builder
    .extend_dictionary(&mut prefixes)
    .build();

let cyrillic_text = converter.lat_to_cyr("Kunjar, Abanjar i Sanjar sudjelovali su u zadatku.");
assert_eq!(cyrillic_text, "Кунјар, Абанјар и Санјар судјеловали су у задатку.");

You can find all available options in the ConverterBuilder documentation.

License

This project is licensed under the terms of MIT license.

Commit count: 20

cargo fmt