code: 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 LongestMatchTokenizer(custom_dict).tokenize(text)
docs: ตัดคำภาษาไทยด้วยวิธี longest matching