def segment(text: str, custom_dict: Trie = None) -> List[str]:
    """
    Dictionary-based word segmentation, using maximal matching algorithm and Thai Character Cluster
    :param str text: text to be tokenized to words
    :return: list of words, tokenized from the text
    """
    if not text or not isinstance(text, str):
        return []

    if not custom_dict:
        custom_dict = DEFAULT_DICT_TRIE

    return list(_onecut(text, custom_dict))
def segment ( text : str , custom_dict : Trie = None ) -> List [ str ] : if not text or not isinstance ( text , str ) : return [ ] if not custom_dict : custom_dict = DEFAULT_DICT_TRIE return list ( _onecut ( text , custom_dict ) )
Dictionary-based word segmentation, using maximal matching algorithm and Thai Character Cluster
    :param str text: text to be tokenized to words
    :return: list of words, tokenized from the text