class_docstr: String with various indexes.
docstr: Segment a string around the tokens created by a passed-in tokenizer
code: def _segment_with_tokens(text, tokens):
      """Segment a string around the tokens created by a passed-in tokenizer"""
      list_form = []
      text_ptr = 0
      for token in tokens:
          inter_token_string = []
          while not text[text_ptr:].startswith(token):
              inter_token_string.append(text[text_ptr])
              text_ptr += 1
              if text_ptr >= len(text):
                  raise ValueError(
                      "Tokenization produced tokens that do not belong in string!"
                  )
          text_ptr += len(token)
          if inter_token_string:
              list_form.append("".join(inter_token_string))
          list_form.append(token)
      if text_ptr < len(text):
          list_form.append(text[text_ptr:])
      return list_form
  
imports: from functools import partial
  import itertools
  import json
  import re
  import numpy
  import scipy
  import sklearn
  from sklearn.utils import check_random_state
  from .None import explanation
  from .None import lime_base
label_desc: Use image node_id 7 for calling the IndexedString obj's underlying member method code with example usage: obj._segment_with_tokens(text, tokens) and returns: list_form