code: def whitespace_nlp_with_sentences(
      doc,
      entity_type=None,
      tag_type=None,
      tok_splitter_re=DEFAULT_TOK_SPLITTER_RE,
  ):
      sentence_split_pat = re.compile(r"([^\.!?]*?[\.!?$])", re.M)
      sents = []
      raw_sents = sentence_split_pat.findall(doc)
      if len(raw_sents) == 0:
          raw_sents = [doc]
      sent_start_idx = 0
      for sentence in raw_sents:
          toks = []
          start_idx_in_sentence = 0
          for tok in tok_splitter_re.split(sentence):
              if len(tok.strip()) > 0:
                  toks.append(
                      Tok(
                          _get_pos_tag(tok),
                          tok[:2].lower(),
                          tok.lower(),
                          ent_type=""
                          if entity_type is None
                          else entity_type.get(tok, ""),
                          tag=""
                          if tag_type is None
                          else tag_type.get(tok, ""),
                          idx=sent_start_idx + start_idx_in_sentence,
                      )
                  )
              start_idx_in_sentence += len(tok)
          sents.append(toks)
          sent_start_idx += len(sentence)
      return Doc(sents, doc)
  
file_path: scattertext/scattertext/WhitespaceNLP.py
imports: import re
  from scattertext.emojis.ProcessedEmojiStructure import VALID_EMOJIS
label_desc: Use image node_id 7 for calling a global function with example usage: whitespace_nlp_with_sentences(doc, entity_type, tag_type, tok_splitter_re) and returns: Doc