a
     gŽ  ã                   @   sô   d dl mZ d dlmZmZ d dlmZ d dlmZ i Z	e
eD ]dZedkrNq@e
eD ]<Zde e e	ee e < ed e e e	ee e e < qVde e	ee < q@ee	 Ą Zee
e	 Ą e
e ZeeddZee Zeed	d
dZdS )é    )ÚTrie)Úthai_consonantsÚthai_tonemarks)Ú	Tokenizer)Úthai_orst_wordsu   āļĢu   āļąÚmm)Zcustom_dictZengine)ÚwordÚreturnc                 C   sp   t | dk r| S | tv r t|  S | tv r,| S t | Ą}g }|D ]&}|tv rZ| t| Ą q>| |Ą q>d |ĄS )uã  
    Convert AksonHan words to current Thai words

    AksonHan (āļ­āļąāļāļĐāļĢāļŦāļąāļ) writes down two consonants for the     spelling of the /a/ vowels. (āļŠāļĢāļ° āļ­āļ°).

    Today, āļĢāļĢ is an aksonHan word that is still used in Thai.

    :param str word: Thai word
    :return: Thai AksonHan to be converted to current Thai word
    :rtype: str

    :Example:
    ::

        from pythainlp.ancient import aksonhan_to_current

        print(aksonhan_to_current("āļāļāļ"))
        # output: āļāļąāļ

        print(aksonhan_to_current("āļāļāļāļāļāļ"))
        # output: āļāļąāļāļāļąāļ

        print(aksonhan_to_current("āļŠāļĢāļĢāđāļāļāļ")) # āļĢāļĢ is still used.
        # output: āļŠāļĢāļĢāđāļāļāļ
    é   Ú )ÚlenÚ_set_aksonhanÚ_dict_aksonhanÚ
_dict_thaiÚ
_tokenizerZword_tokenizeÚappendÚjoin)r   Z_segÚ_wÚiĐ r   úD/usr/local/lib/python3.9/dist-packages/pythainlp/ancient/aksonhan.pyÚaksonhan_to_current   s    
r   N)Zpythainlp.utilr   Z	pythainlpr   r   Zpythainlp.tokenizer   Zpythainlp.corpusr   r   Úlistr   ÚjÚsetÚkeysr   Ú_trier   r   Ústrr   r   r   r   r   Ú<module>   s    "
