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
- ArabicReshaper
- Iterator for the ArabicReshaper, you can use this type to iterate over strings in a Iterator and reshape them
- Flags to enable some or all groups of ligatures
- The main Config struct for the ArabicReshaper
Enums
- Supported languages
Traits
- Wrap an iterator to reshape strings
Functions
- Reshape the given text with the default ArabicReshaper configuration.
Keep in mind that if you want to reshape a large amount of lines its better to first create a ArabicReshaper and use theArabicReshaper::reshapeinstead.