a
     g                     @   s   d Z ddddddddd	d
d
Zddddddddddd
Zdddddddddd d
Zddddddddddd!
ZeeZeeZeeZ	eed"d#d$Z
eed"d%d&Zeed"d'd(Zeed"d)d*Zeed"d+d,Zd-S ).z
Convert digits
   ๐   ๑   ๒   ๓   ๔   ๕   ๖   ๗   ๘   ๙)
0123456789r   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   r   r   )textreturnc                 C   s   | rt | tsdS | tS )u8  
    This function converts Thai digits (i.e. ๑, ๓, ๑๐) to Arabic digits
    (i.e. 1, 3, 10).

    :param str text: Text with Thai digits such as '๑', '๒', '๓'
    :return: Text with Thai digits converted to Arabic digits
             such as '1', '2', '3'
    :rtype: str

    :Example:
    ::

        from pythainlp.util import thai_digit_to_arabic_digit

        text = 'เป็นจำนวน ๑๒๓,๔๐๐.๒๕ บาท'

        thai_digit_to_arabic_digit(text)
        # output: เป็นจำนวน 123,400.25 บาท
     )
isinstancestr	translate_thai_arabic_translate_tabler    r'   B/usr/local/lib/python3.9/dist-packages/pythainlp/util/digitconv.pythai_digit_to_arabic_digitA   s    r)   c                 C   s   | rt | tsdS | tS )u:  
    This function converts Arabic digits (i.e. 1, 3, 10) to Thai digits
    (i.e. ๑, ๓, ๑๐).

    :param str text: Text with Arabic digits such as '1', '2', '3'
    :return: Text with Arabic digits converted to Thai digits
             such as '๑', '๒', '๓'
    :rtype: str

    :Example:
    ::

        from pythainlp.util import arabic_digit_to_thai_digit

        text = 'เป็นจำนวน 123,400.25 บาท'

        arabic_digit_to_thai_digit(text)
        # output: เป็นจำนวน ๑๒๓,๔๐๐.๒๕ บาท
    r!   )r"   r#   r$   _arabic_thai_translate_tabler&   r'   r'   r(   arabic_digit_to_thai_digit[   s    r+   c                 C   s*   | rt | tsdS | t} | t} | S )u|   
    :param str text: Text with digits such as '1', '2', '๓', '๔'
    :return: Text with digits spelled out in Thai
    r!   )r"   r#   r$   r%   _digit_spell_translate_tabler&   r'   r'   r(   digit_to_textv   s
    

r-   c                 C   s   | r| t vrdS t |  S )u  
    This function converts spelled out digits in Thai to Arabic digits.

    :param text: A digit spelled out in Thai
    :return: An Arabic digit such as '1', '2', '3' if the text is
             digit spelled out in Thai (ศูนย์, หนึ่ง, สอง, ..., เก้า).
             Otherwise, it returns an empty string.
    :rtype: str

    :Example:
    ::

        from pythainlp.util import text_to_arabic_digit

        text_to_arabic_digit("ศูนย์")
        # output: 0
        text_to_arabic_digit("หนึ่ง")
        # output: 1
        text_to_arabic_digit("แปด")
        # output: 8
        text_to_arabic_digit("เก้า")
        # output: 9

        # For text that is not digit spelled out in Thai
        text_to_arabic_digit("สิบ") == ""
        # output: True
        text_to_arabic_digit("เก้าร้อย") == ""
        # output: True
    r!   )_spell_digitr&   r'   r'   r(   text_to_arabic_digit   s    r/   c                 C   s   t t| S )u  
    This function converts spelled out digits in Thai to Thai digits.

    :param text: A digit spelled out in Thai
    :return: A Thai digit such as '๑', '๒', '๓' if the text is digit
             spelled out in Thai (ศูนย์, หนึ่ง, สอง, ..., เก้า).
             Otherwise, it returns an empty string.
    :rtype: str

    :Example:
    ::

        from pythainlp.util import text_to_thai_digit

        text_to_thai_digit("ศูนย์")
        # output: ๐
        text_to_thai_digit("หนึ่ง")
        # output: ๑
        text_to_thai_digit("แปด")
        # output: ๘
        text_to_thai_digit("เก้า")
        # output: ๙

        # For text that is not Thai digit spelled out
        text_to_thai_digit("สิบ") == ""
        # output: True
        text_to_thai_digit("เก้าร้อย") == ""
        # output: True
    )r+   r/   r&   r'   r'   r(   text_to_thai_digit   s    r0   N)__doc__Z_arabic_thaiZ_thai_arabicZ_digit_spellr.   r#   	maketransr*   r%   r,   r)   r+   r-   r/   r0   r'   r'   r'   r(   <module>   sh   


$