code: def nltk_tokenzier_factory(nltk_tokenizer):
      """
      Parameters
      ----------
      nltk_tokenizer : nltk.tokenize.* instance (e.g., nltk.TreebankWordTokenizer())
  
      Returns
      -------
      Doc of tweets
  
      Notes
      -------
      Requires NLTK to be installed
      """
  
      def tokenize(text):
          toks = []
          for tok in nltk_tokenizer.tokenize(text):
              if len(tok) > 0:
                  toks.append(
                      Tok(
                          _get_pos_tag(tok),
                          tok.lower(),
                          tok.lower(),
                          ent_type="",
                          tag="",
                      )
                  )
          return Doc([toks], text)
  
      return tokenize
  
file_path: scattertext/scattertext/WhitespaceNLP.py
imports: import re
  from scattertext.emojis.ProcessedEmojiStructure import VALID_EMOJIS
label_desc: Use image node_id 4 for calling a global function with example usage: nltk_tokenzier_factory(nltk_tokenizer) and returns: tokenize, Doc