From 94c3de9cae22d4df772f1566f85e87eb016af2cd Mon Sep 17 00:00:00 2001 From: Tahir Rafique Date: Thu, 3 Mar 2022 00:30:35 +0500 Subject: [PATCH] returning char form if needed. --- arabic_reshaper/arabic_reshaper.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arabic_reshaper/arabic_reshaper.py b/arabic_reshaper/arabic_reshaper.py index 4721a6a..84e80b6 100644 --- a/arabic_reshaper/arabic_reshaper.py +++ b/arabic_reshaper/arabic_reshaper.py @@ -97,7 +97,7 @@ def _get_ligature_forms_from_re_group_index(self, group_index): return self._ligatures_re return self._re_group_index_to_ligature_forms[group_index] - def reshape(self, text): + def reshape(self, text, return_char_forms=False): if not text: return '' @@ -236,7 +236,10 @@ def reshape(self, text): if i in positions_harakat: result.extend(positions_harakat[i]) - return ''.join(result) + if return_char_forms: + return ''.join(result), output + else: + return ''.join(result) default_reshaper = ArabicReshaper()