code: def test_lm_stopwords(text, stopwords, lang_model):
      """
      Checks if the language model can identify stopwords correctly
      """
      head, tail, head_tokens, tail_tokens = lang_model.head_tail_split(
          text
      )
  
      # head assertions
      assert len(head) > 0
      assert len(head_tokens) > 0
  
      # tail assertions
      assert len(tail) == 0
      assert len(tail_tokens) == 0
  
      # convert stopwords to lowercase
      stopwords = [s.strip().lower() for s in stopwords]
  
      # find all the subwords in the sentence
      found_stopwords = []
  
      for i in range(len(head_tokens)):
          if lang_model.is_stop_word(
              head_tokens, i, string.punctuation, stopwords
          ):
              word = lang_model.select_word(
                  head_tokens, i, string.punctuation
              )
              found_stopwords.append(word.strip())
  
      # transform found_stopwords to lowercase
      found_stopwords = set(
          [s.strip().lower() for s in found_stopwords]
      )
  
      # check if the found subwords and the expected one are the same
      assert set(found_stopwords) == set(stopwords)
  
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 5 for calling a global function with example usage: test_lm_stopwords(text, stopwords, lang_model) without return types