Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nightmachinery/rtl_reshaper_rs
A CLI tool to reshape and reorder bi-directional, Arabic/Persian text for display in apps that do not support them natively
https://github.com/nightmachinery/rtl_reshaper_rs
arabic arabic-language aranic-reshaper bidi bidirectional cli cli-app ligatures persian persian-language persian-reshaper persian-script right-to-left rtl rust text-shaping unicode
Last synced: 2 days ago
JSON representation
A CLI tool to reshape and reorder bi-directional, Arabic/Persian text for display in apps that do not support them natively
- Host: GitHub
- URL: https://github.com/nightmachinery/rtl_reshaper_rs
- Owner: NightMachinery
- License: mit
- Created: 2021-03-16T17:28:36.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T02:59:07.000Z (about 1 year ago)
- Last Synced: 2024-11-08T11:12:27.905Z (about 2 months ago)
- Topics: arabic, arabic-language, aranic-reshaper, bidi, bidirectional, cli, cli-app, ligatures, persian, persian-language, persian-reshaper, persian-script, right-to-left, rtl, rust, text-shaping, unicode
- Language: Rust
- Homepage:
- Size: 47.9 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.org
- License: license
Awesome Lists containing this project
README
#+TITLE: rtl_reshaper_rs
=rtl_reshaper_rs= is a CLI tool that uses rust libraries =arabic_reshaper= and =unic-bidi= to reshape and reorder bi-directional, Arabic/Persian text for display in apps that do not support them natively.
* Installation
#+begin_example zsh
cargo install --git https://github.com/NightMachinary/rtl_reshaper_rs --force
#+end_example
Or (not recommended):
#+begin_example zsh
cargo install rtl_reshaper_rs
#+end_example
* Usage
#+begin_src bsh.dash :results verbatim :exports both :wrap example
echo 'من غذا خوردم.' $'\n' 'خانه خالی و hollow است ... :)' | rtl_reshaper_rs
echo $'\n'
#+end_src#+RESULTS:
#+begin_example.ﻡﺩﺭﻮﺧ ﺍﺬﻏ ﻦﻣ
): ... ﺖﺳﺍ hollow ﻭ ﯽﻟﺎﺧ ﻪﻧﺎﺧ#+end_example
[[file:readme.org_imgs/20210316_211212_rq0bk5.png]]
* Alternatives
** http://fribidi.org/
*** https://github.com/NightMachinary/bicon
**** https://github.com/behdad/bicon
** [[https://github.com/NightMachinary/.shells/blob/master/scripts/python/RTL/rtl_reshaper.py][Python version]] (less buggy but much slower)
** Benchmarks
#+begin_src bsh.dash :results verbatim :exports both :wrap example
cd ~/code/data/sharif_course_list || return $?
hyperfine --warmup=6 'ls -l | rtl_reshaper_rs' 'ls -l | rtl_reshaper.py'
#+end_src#+RESULTS:
#+begin_example
Benchmark #1: ls -l | rtl_reshaper_rs
Time (mean ± σ): 24.2 ms ± 12.9 ms [User: 14.8 ms, System: 8.3 ms]
Range (min … max): 13.9 ms … 91.3 ms 91 runsWarning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Benchmark #2: ls -l | rtl_reshaper.py
Time (mean ± σ): 1.310 s ± 0.137 s [User: 751.1 ms, System: 317.7 ms]
Range (min … max): 1.051 s … 1.489 s 10 runsSummary
'ls -l | rtl_reshaper_rs' ran
54.07 ± 29.28 times faster than 'ls -l | rtl_reshaper.py'
#+end_example* Known issues
** Upstream
*** +[[https://github.com/sigmaSd/arabic-reshaper-rs/issues/2][Character 'e' is dropped · Issue #2 · sigmaSd/arabic-reshaper-rs]]+
*** Newlines are ordered weirdly:
#+begin_src bsh.dash :results verbatim :exports both :wrap example
echo A$'\n'B | rtl_reshaper_rs | cat -n
#+end_src#+RESULTS:
#+begin_example
1 A
2 B
#+end_example#+begin_src bsh.dash :results verbatim :exports both :wrap example
echo ب$'\n'ن | rtl_reshaper_rs | cat -n
#+end_src#+RESULTS:
#+begin_example
1
2 ﺏ
3 ﻥ
#+end_example#+begin_src bsh.dash :results verbatim :exports both :wrap example
echo ب$'\n'ن | rtl_reshaper.py | cat -n
#+end_src#+RESULTS:
#+begin_example
1 ﺏ
2 ﻥ
#+end_example*** Punctuation marks are ordered wrongly:
#+begin_src bsh.dash :results verbatim :exports both :wrap example
echo "بد :)" | rtl_reshaper_rs
#+end_src#+RESULTS:
#+begin_example): ﺪﺑ
#+end_example#+begin_src bsh.dash :results verbatim :exports both :wrap example
echo "بد :)" | rtl_reshaper.py
#+end_src#+RESULTS:
#+begin_example
(: ﺪﺑ
#+end_example* License
MIT