
    )ie!                     B   S r SSKJr  SSKJr  SSKJr  SSKJr   SSKJr  \R                  r\R                  r\R                  r\R                  r\R                  r\R                   r\R"                  r\R$                  r\R&                  r\R(                  r\R*                  r\R,                  r\R.                  r\R0                  r\R2                  r\R4                  r\R6                  r\R8                  r\R:                  r\R:                  r\R>                  r\R@                  r \RB                  r!0 r"\"RG                  \RD                  5        \"RG                  \RD                  5         " S S\$5      r%\" S	S
9S 5       r&SS jr'S r(g! \	 a
    SSK
Jr   GN{f = f)a  
Transliteration functions for Sanskrit. The most important function is
:func:`transliterate`, which is very easy to use::

    output = transliterate(data, IAST, DEVANAGARI)

A full list of supported scripts and romanizations can be viewed at the sanscript/schemes/data path.

For example, the module supports the following scripts:

- Bengali
- Devanagari
- Gunjala Gondi
- Gujarati
- Kannada
- Malayalam
- Telugu
- Tamil
- Oriya
- Gurmukhi/ Punjabi/ Panjabi

and the following romanizations:

- HK = 'hk'
- IAST = 'iast'
- ITRANS = 'itrans'
- OPTITRANS = 'optitrans'
- KOLKATA_v2 = 'kolkata_v2'
- SLP1 = 'slp1'
- VELTHUIS = 'velthuis'
- WX = 'wx'

Many of these **schemes** is defined in a global dictionary `SCHEMES`, whose
keys are strings::

    devanagari_scheme = SCHEMES['devanagari']

For convenience, we also define a variable for each scheme::

    devanagari_scheme = SCHEMES[DEVANAGARI]

Some of these variables are documented below.

:license: MIT and BSD

.. _Bengali: http://en.wikipedia.org/wiki/Bengali_alphabet
.. _Devanagari: http://en.wikipedia.org/wiki/Devanagari
.. _Gujarati: http://en.wikipedia.org/wiki/Gujarati_alphabet
.. _Kannada: http://en.wikipedia.org/wiki/Kannada_alphabet
.. _Malayalam: http://en.wikipedia.org/wiki/Malayalam_alphabet
.. _Telugu: http://en.wikipedia.org/wiki/Telugu_alphabet

.. _Harvard-Kyoto: http://en.wikipedia.org/wiki/Harvard-Kyoto
.. _IAST: http://en.wikipedia.org/wiki/IAST
    )unicode_literals)Scheme)roman)brahmic)	lru_cachec                   $    \ rS rSrSrS rS rSrg)	SchemeMaph   zMaps one :class:`Scheme` to another. This class grabs the metadata and
character data required for :func:`transliterate`.

:param from_scheme: the source scheme
:param to_scheme: the destination scheme
c                 |  ^ 0 U l         0 U l        0 U l        0 U l        0 U l        0 U l        TU l        X l        [        U4S jT 5       5      U l	        TR                  5        GH  nUS;   a  M  X2R                  5       ;  a  M!  0 nTU   R                  5        H  u  pVTR                  [        R                  ;   a  US;   a  M+  XRU   ;   d  M5  TU   U   nX#   U   nUS:X  a  US;  a  UnXU'   UTR                  S0 5      ;   d  Mn  TS   U    H  n	XU	'   M	     M     UR!                  S5      (       a  U R                   R#                  U5        M  US:X  a  X@l        M  U R                  R#                  U5        UR!                  S	5      (       a  U R                  R#                  U5        GMK  UR!                  S
5      (       a  U R                  R#                  U5        GM  US:X  d  GM  X@l        GM     TR                  S0 5      R                  5        H  u  pU H  nU
SS nU
S   nU R
                  R                  X5      nU R                   R                  US5      U-   U R                   U'   U R                  U   U-   U R                  U'   U R                  R#                  U R                  5        M     M     g)z3Create a mapping from `from_scheme` to `to_scheme`.c              3   T   >#    U  H  nTU     H  n[        U5      v   M     M     g 7f)N)len).0gxfrom_schemes      h/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/indic_transliteration/sanscript/__init__.py	<genexpr>%SchemeMap.__init__.<locals>.<genexpr>{   s.      *C+Q3>q>a +.a&&3A +1+s   %()
alternatesaccented_vowel_alternates)u   ॐ )viramazwjskipr   vowel_marksr   
consonantsvowelsaccentsr   N)r   r   r   r   non_marks_viraamar   r   	to_schememaxmax_key_length_from_schemekeysitemsnamer   CAPITALIZABLE_SCHEME_IDSgetendswithupdate)selfr   r!   groupconjunct_mapkeyvaluefrom_scheme_symbolto_scheme_symbolk_synbase_accented_vowelsynonymsaccented_vowel
base_vowelsource_accenttarget_accents    `              r   __init__SchemeMap.__init__p   s   DDKDKDODDL"DN&) *C+ *C 'CD# !!#	=	=	nn&	&l#E*002*#u===G^E""*51#6
&-c2
"$58Q+Q1-=)
*;??<#DD$\23EF$45! G 3 
	&	&-H"%%l3>>,''
//
 
 
.^^H%%
++

\
*i%,= $@ *59TVX)Y)_)_)a%$.("-
+B/((F+/+;+;+?+?
B+OR_+_(&*kk*&=&MN#%%dkk2 % *b    c                     SS K nUR                  U R                  U R                  U R                  U R
                  S.5      $ )Nr   )r   r   r   r   )pprintpformatr   r   r   r   )r+   r=   s     r   __str__SchemeMap.__str__   s8    >>T[[+/+;+;&*kk)-: ; ;r;   )	r   r   r   r#   r    r!   r   r   r   N)__name__
__module____qualname____firstlineno____doc__r9   r?   __static_attributes__ r;   r   r	   r	   h   s    63r;r;   r	      )maxsizec                 6    [        [        U    [        U   5      $ )a  Provides a caching layer on top of `SchemeMap` objects to allow faster
access to scheme maps we've instantiated once.

:param input_encoding: Input encoding. Must be defined in `SCHEMES`.
:param output_encoding: Input encoding. Must be defined in `SCHEMES`.
)r	   SCHEMES)input_encodingoutput_encodings     r   _get_scheme_maprN      s     W^,go.FGGr;   Nc                 N   0 [        5       [        5       S.nUR                  U5        Uc  Uc  SSKJn  UR                  U 5      nUR	                  SS5      nUS:X  a2  US;   a   US-   nU[
        R                  5       ;   a  UnO1US	;   a  US-   nO%US
:X  a  US-   nU[
        R                  5       ;   a  Un[        X5      nSSKJ	n	  SSK
Jn
  UR                  R                  (       a  U
OU	nUR                  R                  U S9n U" X40 UD6nUR                  R!                  US9nU$ )a  Transliterate `data` with the given parameters::

    output = transliterate('idam adbhutam', HK, DEVANAGARI)

Common options: togglers= {'##'}, suspend_on= set('<'), suspend_off = set('>')
Note: length of togglers, suspend_on and suspend_off parameters is limited by max token length of the source-scheme.

Each time the function is called, a new :class:`SchemeMap` is created
to map the input scheme to the output scheme. This operation is fast
enough for most use cases. But for higher performance, you can pass a
pre-computed :class:`SchemeMap` instead::

    scheme_map = SchemeMap(SCHEMES[HK], SCHEMES[DEVANAGARI])
    output = transliterate('idam adbhutam', scheme_map=scheme_map)

:param data: the data to transliterate
:param scheme_map: the :class:`SchemeMap` to use. If specified, ignore
                   `_from` and `_to`. If unspecified, create a
                   :class:`SchemeMap` from `_from` to `_to`.
)togglers
suspend_onsuspend_offNr   )detectmaybe_use_dravidian_variantyes)kannadatamiltelugu	malayalam
_dravidian)	optitransitranshkforce)_brahmic)_roman)data_in)setr*   indic_transliterationrS   r(   rK   r$   rN   .indic_transliteration.sanscript.brahmic_mapperr_   ,indic_transliteration.sanscript.roman_mapperr`   r   is_romanunapply_shortcutsr!   apply_shortcuts)data_from_to
scheme_mapkwoptionsrS   rT   dravidian_schemer_   r`   funcresults                r   transliteraterr      s)   , %5'
 
..}.mmD!e")++.KT"R"e+	=	=-w||~- #11$	$	/|+	W\\^	+ ,JEA))22$				1	1$	1	?$,G,&///?&	-r;   c                 8    [        [        X[        S9[        US9$ )N)ri   rj   rk   )rr   
DEVANAGARI)ri   scheme_names     r   get_standard_formrv      s    	MtJW_ioz	{{r;   )NNN))rE   
__future__r   'indic_transliteration.sanscript.schemesr   r   r   	functoolsr   ImportErrorbackports.functools_lru_cacheBENGALIrt   GUNJALA_GONDIGUJARATIGURMUKHIKANNADA	MALAYALAMORIYATAMILGRANTHATELUGUTITUSHKIASTISO	ISO_VEDICITRANS	OPTITRANS
KOLKATA_v2KOLKATASLP1VELTHUISWXrK   r*   objectr	   rN   rr   rv   rG   r;   r   <module>r      sw  6p ( ; 9 ;8# //
%%
//	
//	
XXzziiOO		OO	



zz>>
XX  u}}  w F; F;R 1H H4n|[  8778s   F FF