a
     gE                     @   s   d dl mZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ dZeee
eZeeedd	d
Zeddfeeeeee dddZdS )    )stderr)List)segment)	load_dict)_THAI_WORDS_FILENAME)path_pythainlp_corpusZ	_67a47bf9)	file_path	dict_namereturnc                 C   s(   t | |d\}}tdu r$t|td |S )a  Load a dictionary file into an in-memory dictionary collection.

    The loaded dictionary will be accessible through the assigned dict_name.
    *** This function does not override an existing dict name. ***

    :param file_path: Path to a dictionary file
    :type file_path: str
    :param dict_name: A unique dictionary name, used for reference.
    :type dict_name: str
    :return bool

    :See Also:
        *             https://github.com/PyThaiNLP/nlpo3
    )r   r	   F)file)nlpo3_load_dictboolprintr   )r   r	   msgsuccess r   B/usr/local/lib/python3.9/dist-packages/pythainlp/tokenize/nlpo3.pyr      s    r   F)textcustom_dict	safe_modeparallel_moder
   c                 C   s   t | |||dS )aV  Break text into tokens.

    Python binding for nlpO3. It is newmm engine in Rust.

    :param str text: text to be tokenized
    :param str custom_dict: dictionary name, as assigned with load_dict(),        defaults to pythainlp/corpus/common/words_th.txt
    :param bool safe_mode: reduce chance for long processing time for long text        with many ambiguous breaking points, defaults to False
    :param bool parallel_mode: Use multithread mode, defaults to False

    :return: list of tokens
    :rtype: List[str]

    :See Also:
        *             https://github.com/PyThaiNLP/nlpo3
    )r   r	   safeparallel)nlpo3_segment)r   r   r   r   r   r   r   r   (   s    r   N)sysr   typingr   Znlpo3r   r   r   r   Zpythainlp.corpus.commonr   Zpythainlp.corpusr   Z_NLPO3_DEFAULT_DICT_NAMEZ_NLPO3_DEFAULT_DICTstrr   r   r   r   r   <module>   s(   