code: def test_lm_punctuation(text, min_num, lang_model):
      """
      Checks if the language model can identify punctuation correctly
      """
      head, tail, head_tokens, tail_tokens = lang_model.head_tail_split(
          text
      )
  
      # assert head
      assert len(head) > 0
      assert len(tail) == 0
      assert len(head_tokens) > 0
      assert len(tail_tokens) == 0
  
      # select tokens that are punctuation
      buff = []
  
      for token in head_tokens:
          if lang_model.is_punctuation(token, string.punctuation):
              buff.append(
                  token.replace(lang_model.SUBWORD_PREFIX, "").strip()
              )
  
      # make sure that it found something
      assert len(buff) >= min_num
  
      # check if all tokens selected contain only punctuation
      for token in buff:
          assert all([(c in string.punctuation) for c in token])
  
imports: import pytest
  from pytest_lazyfixture import lazy_fixture
  import string
  import numpy
  from typing import List
  from alibi.api.defaults import DEFAULT_META_ANCHOR, DEFAULT_DATA_ANCHOR
  from alibi.exceptions import PredictorCallError, PredictorReturnTypeError
  from alibi.explainers import AnchorText
  from alibi.explainers.anchors.text_samplers import Neighbors, load_spacy_lexeme_prob
  from alibi.explainers.anchors.language_model_text_sampler import LanguageModelSampler
  from alibi.explainers.tests.utils import predict_fcn
label_desc: Use image node_id 4 for calling a global function with example usage: test_lm_punctuation(text, min_num, lang_model) without return types