code: def test_method_token_segments_pretrained_tokenizer():
      """Check that the Text masker produces the same segments as its non-fast pretrained tokenizer."""
  
      AutoTokenizer = pytest.importorskip("transformers").AutoTokenizer
  
      tokenizer = AutoTokenizer.from_pretrained(
          "distilbert-base-cased", use_fast=False
      )
      masker = shap.maskers.Text(tokenizer)
  
      test_text = "I ate a Cannoli"
      output_token_segments, _ = masker.token_segments(test_text)
      correct_token_segments = [
          "",
          " I",
          " ate",
          " a",
          " Can",
          "no",
          "li",
          "",
      ]
  
      assert output_token_segments == correct_token_segments
  
file_path: shap/tests/maskers/test_text.py
imports: import tempfile
  import numpy
  import pytest
  import shap
label_desc: Use image node_id 1 for calling a global function with example usage: test_method_token_segments_pretrained_tokenizer() without return types