
    {-jS"                        d Z ddlmZ ddlmZ ddlmZ ddlmZ 	 ddlmZ n# e	$ r	 ddl
mZ Y nw xY wej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej        Zej         Z!ej         Z ej"        Z"ej#        Z#ej$        Z$i Z%e%&                    ej%                   e%&                    ej%                    G d de'          Z( ed	
          d             Z)ddZ*d Z+d Z,dS )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                       e Zd ZdZd Zd ZdS )	SchemeMapzMaps 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                 h   i | _         i | _        i | _        i | _        i | _        i | _        | _        || _        t          fdD                       | _	        
                                D ]}|dv r||
                                vri }|                                         D ]\  }}j        t          j        v r|dv r|||         v r[|         |         }||         |         }|dk    r|dvr|}|||<   |                    di           v rd         |         D ]}	|||	<   |                    d          r| j                             |           |dk    r|| _        | j                            |           |                    d	          r| j                            |           G|                    d
          r| j                            |           x|dk    r|| _                            di                                           D ]\  }
}|D ]}|
dd         }|
d         }| j                            ||          }| j                             |d          |z   | j         |<   | j        |         |z   | j        |<   | j                            | j                   dS )z3Create a mapping from `from_scheme` to `to_scheme`.c              3   L   K   | ]}|         D ]}t          |          V  d S )N)len).0gxfrom_schemes      h/var/www/html/banglarbhumi/venv/lib/python3.11/site-packages/indic_transliteration/sanscript/__init__.py	<genexpr>z%SchemeMap.__init__.<locals>.<genexpr>~   s`       *C *CQ3>q>*C *C./ +.a&& *C *C *C *C *C *C *C    )
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__zSchemeMap.__init__s   s>   DDKDKDODDL"DDN&) *C *C *C *C+ *C *C *C 'C 'CD# !!## & &	=	=	=	inn&&	&	&l#E*0022 5 5*#uu===G^^)E"""*51#6
&u-c2
"$$58Q+Q+Q1-=,)
*;??<#D#DDD$\23EF 5 5$4l5!!		&	& &----H"%%l333>>,'' 	&
/
 
 
.
.
.
.^^H%% 	&
+

\
*
*
*
*i%$,)49TVX)Y)Y)_)_)a)a 3 3%X$ 3 3.("-
+B/((FF+/+;+?+?
B+O+OR_+_(&*k*&=&MN#%%dk222233 3r   c                 f    dd l }|                    | j        | j        | j        | j        d          S )Nr   )r   r   r   r   )pprintpformatr   r   r   r   )r*   r:   s     r   __str__zSchemeMap.__str__   s?    MMM>>T[+/+;&*k)-: : ; ; ;r   N)__name__
__module____qualname____doc__r8   r<    r   r   r	   r	   k   s=         63 63 63r; ; ; ; ;r   r	      )maxsizec                 N    t          t          |          t          |                   S )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_maprH      s     W^,go.FGGGr   Nc                 l   i t                      t                      d}|                    |           ||ddlm} |                    |           }|                    dd          }|dk    r1|dv r#|dz   }|t
                                          v r|}n2|d	v r|dz   }n(|d
k    r"|dz   }|t
                                          v r|}t          ||          }ddlm	}	 ddl
m}
 |j        j        r|
n|	}|j                            |           }  || |fi |}|j                            |          }|S )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_transliterationrM   r'   rE   r#   rH   .indic_transliteration.sanscript.brahmic_mapperrY   ,indic_transliteration.sanscript.roman_mapperrZ   r   is_romanunapply_shortcutsr    apply_shortcuts)data_from_to
scheme_mapkwoptionsrM   rN   dravidian_schemerY   rZ   funcresults                r   transliteraterl      s   , %%55 '
 
..}......mmD!!e")++.KT"R"R"e++	=	=	=-w||~~-- #111$	$	/	/|+	W\\^^	+	+ ,,JEEEEEEAAAAAA)2	@$			1	1$	1	?	?$4j,,G,,&///??&	-r   c                 Z    t          t          | |t                    t          |          S )N)rc   rd   re   )rl   
DEVANAGARI)rc   scheme_names     r   get_standard_formrp      s(    	Mt;JWWW_ioz	{	{	{{r   c                 `    ddl m} t          |                    | t                              S )Nr   )	sanscript)rc   re   )r]   rr   intrl   IAST)textrr   s     r   
get_numberrv      s5    ------	Y$$$D$99	:	::r   )NNN)-r@   
__future__r   'indic_transliteration.sanscript.schemesr   r   r   	functoolsr   ImportErrorbackports.functools_lru_cacheBENGALIrn   GUNJALA_GONDIGUJARATIGURMUKHIKANNADA	MALAYALAMORIYATAMIL	TAMIL_SUP	TAMIL_SUBGRANTHATELUGUTITUSHKrt   ISO	ISO_VEDICITRANS	OPTITRANSOPTITRANS_DRAVIDIAN
KOLKATA_v2KOLKATASLP1VELTHUISWXrE   r)   objectr	   rH   rl   rp   rv   rA   r   r   <module>r      s:  6 6p ( ' ' ' ' ' ; : : : : : 9 9 9 9 9 9 ; ; ; ; ; ;8####### 8 8 8777777778
 /
%
/			
/	
XziO		O	/ 


z>
X  u}    w   F; F; F; F; F; F; F; F;R 1H H H4 4 4 4n| | |; ; ; ; ;s   # 11