Python BiDi是一种很棒的BiDi算法实现,但是它仅支持双向(As
Is),而没有修复阿拉伯脚本的上下文形式,要解决上下文形式问题,您应该将python-
bidi模块与一个名为python-的阿拉伯整形器库一起使用阿拉伯整形器。
示例:(来自=> http://mpcabd.igeex.biz/python-arabic-text-
reshaper/)
import arabic_reshaperfrom bidi.algorithm import get_display#...reshaped_text = arabic_reshaper.reshape(u'اللغة العربية رائعة')bidi_text = get_display(reshaped_text)pass_arabic_text_to_render(bidi_text)#...
它完美地解决了我的问题,并且两个软件包都是纯python实现。



