code: def init_vocab(
      nlp: "Language",
      *,
      data: Optional[Path] = None,
      lookups: Optional[Lookups] = None,
      vectors: Optional[str] = None,
  ) -> None:
      if lookups:
          nlp.vocab.lookups = lookups
          logger.info(
              "Added vocab lookups: %s", ", ".join(lookups.tables)
          )
      data_path = ensure_path(data)
      if data_path is not None:
          lex_attrs = srsly.read_jsonl(data_path)
          for lexeme in nlp.vocab:
              lexeme.rank = OOV_RANK
          for attrs in lex_attrs:
              if "settings" in attrs:
                  continue
              lexeme = nlp.vocab[attrs["orth"]]
              lexeme.set_attrs(**attrs)
          if len(nlp.vocab):
              oov_prob = min(lex.prob for lex in nlp.vocab) - 1
          else:
              oov_prob = DEFAULT_OOV_PROB
          nlp.vocab.cfg.update({"oov_prob": oov_prob})
          logger.info(
              "Added %d lexical entries to the vocab", len(nlp.vocab)
          )
      logger.info("Created vocabulary")
      if vectors is not None:
          load_vectors_into_model(nlp, vectors)
          logger.info("Added vectors: %s", vectors)
      # warn if source model vectors are not identical
      sourced_vectors_hashes = nlp.meta.pop(
          "_sourced_vectors_hashes", {}
      )
      if len(sourced_vectors_hashes) > 0:
          vectors_hash = hash(
              nlp.vocab.vectors.to_bytes(exclude=["strings"])
          )
          for (
              sourced_component,
              sourced_vectors_hash,
          ) in sourced_vectors_hashes.items():
              if vectors_hash != sourced_vectors_hash:
                  warnings.warn(
                      Warnings.W113.format(name=sourced_component)
                  )
      logger.info("Finished initializing nlp object")
  
imports: import gzip
  import tarfile
  import warnings
  import zipfile
  from itertools import islice
  from pathlib import Path
  from typing import IO, TYPE_CHECKING, Any, Dict, Optional, Union
  import numpy
  import srsly
  import tqdm
  from thinc.api import Config, ConfigValidationError, fix_random_seed, set_gpu_allocator
  from ..errors import Errors, Warnings
  from ..lookups import Lookups
  from ..schemas import ConfigSchemaTraining
  from ..util import DEFAULT_OOV_PROB, OOV_RANK, ensure_path, get_sourced_components, load_model, load_model_from_config, logger, registry, resolve_dot_names
  from ..vectors import Mode
  from ..vectors import Vectors
  from .pretrain import get_tok2vec_ref
label_desc: Use image node_id 2 for calling a global function with example usage: init_vocab(nlp) without return types