Crates.io | arabic_reshaper |
lib.rs | arabic_reshaper |
version | 0.4.2 |
source | src |
created_at | 2018-08-06 21:22:44.2882 |
updated_at | 2023-08-16 19:29:01.605686 |
description | Reconstruct Arabic sentences to be used in applications that doesn't support Arabic script. |
homepage | |
repository | https://github.com/sigmaSd/arabic-reshaper-rs |
max_upload_size | |
id | 77811 |
size | 112,943 |
Reconstruct Arabic sentences to be used in applications that don't support Arabic.
This crate is python-arabic-reshaper ported to rust.
Like python-arabic-reshaper
it reshapes the letters, but it doesnt reverse the writing, the user is responsible for that: you can look at Unicode bidirectional algorithm or simply try reversing the characters orders and see if that works for you
arabic_reshape
:
Reshape letters
use arabic_reshaper::arabic_reshape;
let salam = "سلام";
println!("{}",arabic_reshape(salam));
// سلام is now correctly reshaped but the letters are not reversed yet
// For simple cases we can use chars().rev()
// For a more correct approach http://unicode.org/reports/tr9/ should be used (via https://docs.rs/unic_bidi crate for example)
Checkout the tests/bench directories for more examples.
Starting version 0.4.0
the msrv is 1.51
rtl_reshaper_rs
is a CLI frontend available that reshapes and reorders stdin
.
Credits/More info:
Check the awesome original python version.