romanizer.py 793 B

123456789101112131415161718192021222324252627282930
  1. # @package ext
  2. __doc__ = """
  3. Transliterate a number of Indian and other Asian scripts using Aksharamukha:
  4. https://github.com/virtualvinodh/aksharamukha-python """
  5. from logging import getLogger
  6. from aksharamukha.transliterate import process
  7. from scriptshifter.exceptions import BREAK
  8. logger = getLogger(__name__)
  9. def s2r_post_config(ctx, src_script):
  10. # options = detect_preoptions(ctx.src, src_script)
  11. options = [n for n, v in ctx.options.items() if v and n != "capitalize"]
  12. ctx.dest = process(src_script, "IAST", ctx.src, pre_options=options)
  13. return BREAK
  14. def r2s_post_config(ctx, dest_script):
  15. options = [n for n, v in ctx.options.items() if v and n != "capitalize"]
  16. ctx.dest = process("IAST", dest_script, ctx.src, post_options=options)
  17. return BREAK