mpcabd / python-arabic-reshaper

Reconstruct Arabic sentences to be used in applications that don't support Arabic
MIT License
395 stars 81 forks source link

problem with english code #46

Closed YouKnow-sys closed 3 years ago

YouKnow-sys commented 4 years ago

hi thanks for your great work im using arabic reshaper and its work perefect in all of my text but wen i try to convert this text (i forgot to tell i yse bidi too) [0.1s] [2.6s] ماشین شماره 11کی، درگیر یه تیراندازی شدم. [2.5s] وضعیت کد 4 هست ولی مظنون از پا دراومده. [3.9s] تو خیابون 522 هیل جنوبی به یه آمبولانس نیاز هست،کافه برادران بوس.

its move [?.?s] from end of all line to start of line. [0.1s] [2.6s] [2.5s] .ﻡﺪﺷ ﯼﺯﺍﺪﻧﺍﺮﯿﺗ ﻪﯾ ﺮﯿﮔﺭﺩ ،ﯽﮐ11 ﻩﺭﺎﻤﺷ ﻦﯿﺷﺎﻣ [3.9s] .ﻩﺪﻣﻭﺍﺭﺩ ﺎﭘ ﺯﺍ ﻥﻮﻨﻈﻣ ﯽﻟﻭ ﺖﺴﻫ 4 ﺪﮐ ﺖﯿﻌﺿﻭ

what can i do with this?

YouKnow-sys commented 4 years ago

its reshape full line can i do something to make it only reshape arabic text and dont touch english?

mpcabd commented 4 years ago

The reshaper won't affect any non-Arabic characters, your problem is the bidi code, it's not something I can control actually.

However, I can't see the problem you're mentioning, as when the text is mixed with Arabic and non-Arabic characters, bidi is used, and then rendered it all looks good:

image

YouKnow-sys commented 4 years ago

The reshaper won't affect any non-Arabic characters, your problem is the bidi code, it's not something I can control actually.

However, I can't see the problem you're mentioning, as when the text is mixed with Arabic and non-Arabic characters, bidi is used, and then rendered it all looks good:

image

thanks for reply yes you right, my problem coming from bidi (when a english text is in start or end of line this happen (not middle)) But fortunately I managed to solve this problem with regex (i just move [?.?s] from start of all the line to end) but i find other problem i normally use fold for split my english long line to some smaller line but when i try to use it with arabic and persian its just make text wrong you have any idea about this? (i know it doesnt have any connection to this topic 😅)

YouKnow-sys commented 4 years ago

hi my last problem fully solved but i face new problem with reshaper i use reshaper on txt file but my problem is after saving reshaped file all carriage return of all line converted to CRLF What can i do about this