#4544·tesseract

Arabic words are sometimes reversed in OCR output

Author: ryanhossain9797Created Apr 27, 2026Updated Jun 19, 2026
LabelsRTL

arabic_reversed_numbers.zip

Current Behavior

Searching for "١٩٩٦" doesn't hit all three instances.

traineddata used: ara, ara-Amiri (included in attachment)

When running OCR on Arabic text, usually with numbers, Some words are reversed while others are not. Could not figure out any deterministic pattern for this behavior.

tesseract ./input.png output -l ara+ara-Amiri  --oem 3 --dpi 150 --psm 3 tsv txt pdf
بيان بالشيكات /الحوالات التي لم تقدم للصرف حتى ١٣/٢١/٦٩٩١م.‏

رقم مستند الصرف رقم الشيك/الحوالة المبلغ بالدولار التاريخ
‎٩ ٤٢٢٢ر٣٤ ١١٤٨/ليوحت ٩٢٦‏ ا٧/٦٩٩١م‏

م١٩٩٦/‎ ٧١ ٤٧٨٥٠ ١٢٩١/ليوحت‎ ٩٦٥
^ generated pdf

Expected Behavior

Searching for "١٩٩٦" should hit all three lines.

Suggested Fix

No response

tesseract -v

tesseract 5.5.2
 leptonica-1.82.0
  libgif 5.2.1 : libjpeg 8d (libjpeg-turbo 2.1.5) : libpng 1.6.43 : libtiff 4.5.1 : zlib 1.3 : libwebp 1.3.2 : libopenjp2 2.5.0
 Found AVX2
 Found AVX
 Found FMA
 Found SSE4.1
 Found OpenMP 201511
 Found libarchive 3.7.2 zlib/1.3 liblzma/5.4.5 bz2lib/1.0.8 liblz4/1.9.4 libzstd/1.5.5
 Found libcurl/8.5.0 OpenSSL/3.0.13 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 (+libidn2/2.3.7) libssh/0.10.6/openssl/zlib nghttp2/1.59.0 librtmp/2.3 OpenLDAP/2.6.10

Operating System

Ubuntu 24.04 via WSL in Windows 11

Other Operating System

No response

uname -a

Linux DESKTOP-9PN56V1 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Compiler

gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0

CPU

AMD Ryzen 9 5900HX with Radeon Graphics (3.30 GHz)

Virtualization / Containers

N/A

Other Information

Could not derive any consistent pattern to reverse the behavior. There are many more examples, the attached input is a minimal reproduction.