ตัดคำภาษาไทยด้วยวิธี longest matching

def segment(text: str, custom_dict: Trie = None) -> List[str]:
    """ตัดคำภาษาไทยด้วยวิธี longest matching"""
    if not text or not isinstance(text, str):
        return []

    if not custom_dict:
        custom_dict = DEFAULT_DICT_TRIE

    return LongestMatchTokenizer(custom_dict).tokenize(text)