Crate ar_reshaper

source ·
Expand description

ArabicReshaper

Reconstruct Arabic sentences to be used in applications that don’t support Arabic script.

Usage:

reshape a single string

use ar_reshaper::{ArabicReshaper, reshape_line};

let reshaper = ArabicReshaper::default();

// You can reshape just a single string using
println!("{}", reshaper.reshape("سلام دنیا"));
// or `reshape_line` method if you dont want to construct the [ArabicReshaper]
// and you just want to reshape a line with default settings
println!("{}", reshape_line("سلام دنیا"));
// Both will reconstruct the string and print `ﺳﻼﻡ ﺩﻧﯿﺎ`

reshape a slice of strings

use ar_reshaper::ArabicReshaper;

let reshaper = ArabicReshaper::default();

println!("{:#?}", reshaper.reshape_lines(&["سلام خوبی؟", "عالیم ممنون"]));
// this will reconstruct the string and print  ["ﺳﻼﻡ ﺧﻮﺑﯽ؟", "ﻋﺎﻟﯿﻢ ﻣﻤﻨﻮﻥ"]

You can also reshape strings on a iterator

use ar_reshaper::ArabicReshaperExt;

for line in ["یک", "دو"].iter().reshape_default() {
    println!("{line}");
}

A rusty rewrite of python-arabic-reshaper You can check the original repository for more information.

Modules

Structs

Enums

Traits

Functions