code: def test_neighbors(nlp):
      # test inputs
      w_prob = -15.0
      tag = "NN"
      top_n = 10
  
      neighbor = Neighbors(load_spacy_lexeme_prob(nlp), w_prob=w_prob)
      n = neighbor.neighbors("book", tag, top_n)
      # The word itself is excluded from the array with similar words
      assert "book" not in n["words"]
      assert len(n["words"]) == top_n
      assert len(n["words"]) == len(n["similarities"])
      # similarity score list needs to be descending
      similarity_score = n["similarities"]
      assert np.isclose(
          (np.sort(similarity_score)[::-1] - similarity_score).sum(),
          0.0,
      )
  
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 3 for calling a global function with example usage: test_neighbors(nlp) without return types