code: def test_sense2vec_best_sense():
      s2v = Sense2Vec(shape=(5, 4))
      s2v.cfg["senses"] = ["A", "B", "C"]
      for key, freq in [
          ("a|A", 100),
          ("a|B", 50),
          ("a|C", 10),
          ("b|A", 1),
          ("B|C", 2),
      ]:
          s2v.add(
              key,
              numpy.asarray([4, 2, 2, 2], dtype=numpy.float32),
              freq,
          )
      assert s2v.get_best_sense("a") == "a|A"
      assert s2v.get_best_sense("A") == "a|A"
      assert s2v.get_best_sense("b") == "B|C"
      assert s2v.get_best_sense("b", ignore_case=False) == "b|A"
      assert s2v.get_best_sense("c") is None
      s2v.cfg["senses"] = []
      assert s2v.get_best_sense("a") is None
      assert s2v.get_best_sense("b", ["A"]) == "b|A"
      assert s2v.get_best_sense("b", ["A", "C"]) == "B|C"
  
file_path: sense2vec/sense2vec/tests/test_sense2vec.py
imports: import pytest
  import numpy
  from sense2vec import Sense2Vec, registry
label_desc: Use image node_id 4 for calling a global function with example usage: test_sense2vec_best_sense() without return types