a
     †‹g¤  ã                   @   sx   d Z ddlmZmZ zddlmZ W n ey>   edƒ‚Y n0 ddlmZ g fe	eeee	 e	f ee	 dœdd„Z
d	S )
a  
Wrapper for deepcut Thai word segmentation. deepcut is a
Thai word segmentation library using 1D Convolution Neural Network.

User need to install deepcut (and its dependency: tensorflow) by themselves.

:See Also:
    * `GitHub repository <https://github.com/rkcosmos/deepcut>`_
é    )ÚListÚUnion)Útokenizez-Please install deepcut by pip install deepcut)ÚTrie)ÚtextÚcustom_dictÚreturnc                 C   s:   | rt | tƒsg S |r2t |tƒr(t|ƒ}t| |ƒS t| ƒS )N)Ú
isinstanceÚstrr   Úlistr   )r   r   © r   úD/usr/local/lib/python3.9/dist-packages/pythainlp/tokenize/deepcut.pyÚsegment   s    

r   N)Ú__doc__Útypingr   r   Zdeepcutr   ÚImportErrorZpythainlp.utilr   r
   r   r   r   r   r   Ú<module>   s   
ÿþ