Created
February 10, 2022 18:53
-
-
Save MostafaRabia/59cce25e559b5af6cea3df30b297e1cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF8 -*- | |
# Tested on Python 3.6.1 | |
# install: pip3 install --upgrade arabic-reshaper | |
from arabic_reshaper import ArabicReshaper | |
# install: pip3 install python-bidi | |
from bidi.algorithm import get_display | |
import sys | |
text_to_be_reshaped = sys.argv[1] | |
configuration = { | |
'use_unshaped_instead_of_isolated': True, | |
# 'delete_harakat': True, # لحذف التشكيل من الكلام | |
# 'delete_tatweel': True, # لحذف ال ـــــ من الكلام | |
} | |
resharper = ArabicReshaper.reshape(configuration=configuration) | |
reshaped_text = ArabicReshaper.reshape(text_to_be_reshaped) | |
print(get_display(reshaped_text)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment