code: def load_spacy_lexeme_prob(
      nlp: "spacy.language.Language",
  ) -> "spacy.language.Language":
      """
      This utility function loads the `lexeme_prob` table for a spacy model if it is not present.
      This is required to enable support for different spacy versions.
      """
      import spacy
  
      SPACY_VERSION = spacy.__version__.split(".")
      MAJOR, MINOR = int(SPACY_VERSION[0]), int(SPACY_VERSION[1])
  
      if MAJOR == 2:
          if MINOR < 3:
              return nlp
          elif MINOR == 3:
              # spacy 2.3.0 moved lexeme_prob into a different package `spacy_lookups_data`
              # https://github.com/explosion/spaCy/issues/5638
              try:
                  table = nlp.vocab.lookups_extra.get_table("lexeme_prob")  # type: ignore[attr-defined]
                  # remove the default empty table
                  if table == dict():
                      nlp.vocab.lookups_extra.remove_table("lexeme_prob")  # type: ignore[attr-defined]
              except KeyError:
                  pass
              finally:
                  # access the `prob` of any word to load the full table
                  assert (
                      nlp.vocab["a"].prob != -20.0
                  ), f"Failed to load the `lexeme_prob` table for model {nlp}"
      elif MAJOR >= 3:
          # in spacy 3.x we need to manually add the tables
          # https://github.com/explosion/spaCy/discussions/6388#discussioncomment-331096
          if "lexeme_prob" not in nlp.vocab.lookups.tables:
              from spacy.lookups import load_lookups
  
              lookups = load_lookups(nlp.lang, ["lexeme_prob"])  # type: ignore[arg-type]
              nlp.vocab.lookups.add_table(
                  "lexeme_prob", lookups.get_table("lexeme_prob")
              )
  
      return nlp
  
imports: import logging
  from abc import abstractmethod
  from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
  import numpy
  import spacy
label_desc: Use image node_id 1 for calling a global function with example usage: load_spacy_lexeme_prob(nlp) and returns: nlp, nlp