arabic_ext.py 531 B

12345678910111213141516171819202122
  1. import logging
  2. # This requires ArabicTransliterator to be installed as a package.
  3. from arabic.ArabicTransliterator import ALA_LC_Transliterator as Trans
  4. from mishkal.tashkeel.tashkeel import TashkeelClass
  5. from scriptshifter.exceptions import BREAK
  6. __doc__ = """ Integrate external ArabicTransliterator library. """
  7. logger = logging.getLogger(__name__)
  8. def s2r_post_config(ctx):
  9. trans = Trans()
  10. vocalizer = TashkeelClass()
  11. voc = vocalizer.tashkeel(ctx.src)
  12. ctx.dest = trans.do(voc.strip())
  13. return BREAK