a
     g·  ã                	   @   sD   d Z ddlmZmZmZ deeeeeeedf f  dddZdS )	z
Thai abbreviation tools
é    )ÚListÚTupleÚUnioné   N)ÚtextÚtop_kÚreturnc                 C   s8   zddl m} W n ty*   tdY n0 || |dS )u>  
    This function converts Thai text (with abbreviation) to full text.

    This function uses KhamYo for handles abbreviations.
    See more `KhamYo <https://github.com/wannaphong/KhamYo>`_.

    :param str text: Thai text
    :param int top_k: Top K
    :return: Thai full text with abbreviations converted to full text and cos scores (original text - modified text).
    :rtype: List[Tuple[str, Union[float, None]]]

    :Example:
    ::

        from pythainlp.util import abbreviation_to_full_text

        text = "āļĢāļĢ.āļāļ­āļāđāļĢāļēāļāđāļēāļ­āļĒāļđāđ"

        abbreviation_to_full_text(text)
        # output: [
        # ('āđāļĢāļāđāļĢāļĩāļĒāļāļāļ­āļāđāļĢāļēāļāđāļēāļ­āļĒāļđāđ', tensor(0.3734)), 
        # ('āđāļĢāļāđāļĢāļĄāļāļ­āļāđāļĢāļēāļāđāļēāļ­āļĒāļđāđ', tensor(0.2438))
        # ]
    r   )ÚreplacezĢ
            This function needs to use khamyo.
            You can install by pip install khamyo or 
            pip install pythainlp[abbreviation].
            )r   )Zkhamyor	   ÚImportError)r   r   Ú_replaceĐ r   úE/usr/local/lib/python3.9/dist-packages/pythainlp/util/abbreviation.pyÚabbreviation_to_full_text
   s    ĸ
r   )r   )	Ú__doc__Útypingr   r   r   ÚstrÚintÚfloatr   r   r   r   r   Ú<module>   s   