a
    •˜ëj×  ã                   @  s8   d dl mZ d dlmZ d dlmZ G dd„ deƒZdS )é    )Úannotations)ÚAny)ÚTextSplitterc                      s<   e Zd ZdZdddddœ‡ fdd„Zdd	d
œdd„Z‡  ZS )ÚKonlpyTextSplitterzTSplitting text using Konlpy package.

    It is good for splitting Korean text.
    ú

Ústrr   ÚNone)Ú	separatorÚkwargsÚreturnc              
     sh   t ƒ jf i |¤Ž || _zddl}W n2 tyV } zd}t|ƒ|‚W Y d}~n
d}~0 0 |j ¡ | _dS )z$Initialize the Konlpy text splitter.r   Nzv
                Konlpy is not installed, please install it with
                `pip install konlpy`
                )ÚsuperÚ__init__Ú
_separatorÚkonlpyÚImportErrorÚtagZKkmaÚkkma)Úselfr	   r
   r   ÚerrÚmsg©Ú	__class__© ú^/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/langchain_text_splitters/konlpy.pyr      s     zKonlpyTextSplitter.__init__z	list[str])Útextr   c                 C  s   | j  |¡}|  || j¡S )z&Split incoming text and return chunks.)r   Ú	sentencesZ_merge_splitsr   )r   r   Úsplitsr   r   r   Ú
split_text    s    zKonlpyTextSplitter.split_text)r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__classcell__r   r   r   r   r      s    þr   N)Ú
__future__r   Útypingr   Zlangchain_text_splitters.baser   r   r   r   r   r   Ú<module>   s   