o
    »©ZhÙ  ã                   @  s<   d dl mZ d dlmZmZ d dlmZ G dd„ deƒZdS )é    )Úannotations)ÚAnyÚList)ÚTextSplitterc                      s0   e Zd ZdZ	dd‡ fd	d
„Zddd„Z‡  ZS )ÚKonlpyTextSplitterzTSplitting text using Konlpy package.

    It is good for splitting Korean text.
    ú

Ú	separatorÚstrÚkwargsr   ÚreturnÚNonec                   sL   t ƒ jdi |¤Ž || _zddlm} W n ty   tdƒ‚w |ƒ | _dS )z$Initialize the Konlpy text splitter.r   )ÚKkmazw
                Konlpy is not installed, please install it with 
                `pip install konlpy`
                N© )ÚsuperÚ__init__Ú
_separatorZ
konlpy.tagr   ÚImportErrorÚkkma)Úselfr   r
   r   ©Ú	__class__r   úV/var/www/html/lang_env/lib/python3.10/site-packages/langchain_text_splitters/konlpy.pyr      s   ÿÿzKonlpyTextSplitter.__init__Útextú	List[str]c                 C  s   | j  |¡}|  || j¡S )z&Split incoming text and return chunks.)r   Z	sentencesZ_merge_splitsr   )r   r   Zsplitsr   r   r   Ú
split_text!   s   zKonlpyTextSplitter.split_text)r   )r   r	   r
   r   r   r   )r   r	   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__classcell__r   r   r   r   r      s
    þr   N)Ú
__future__r   Útypingr   r   Zlangchain_text_splitters.baser   r   r   r   r   r   Ú<module>   s    