code: def bad_whitespace_nlp(doc):
      toks = []
      for tok in doc.split():
          pos = "WORD"
          if tok.strip() == "":
              pos = "SPACE"
          elif re.match("^\W+$", tok):
              pos = "PUNCT"
          toks.append(
              Tok(
                  pos, tok[:2].lower(), tok.lower(), ent_type="", tag=""
              )
          )
      return Doc([toks])
  
imports: import re
  from collections import Counter
  from unittest import TestCase
  from scattertext import whitespace_nlp
  from scattertext.WhitespaceNLP import Tok, Doc, _regex_parse_sentence, whitespace_nlp_with_sentences
  from scattertext.features.FeatsFromSpacyDoc import FeatsFromSpacyDoc
  from scattertext.features.FeatsFromSpacyDocOnlyNounChunks import FeatsFromSpacyDocOnlyNounChunks
label_desc: Use image node_id 1 for calling a global function with example usage: bad_whitespace_nlp(doc) and returns: Doc