class_docstr: Pipeline component for named entity linking.
  
  DOCS: https://spacy.io/api/entitylinker
class_docstr_tok: ["Pipeline","component","for","named","entity","linking",".","DOCS",":","https",":","\/\/spacy.io\/api\/entitylinker"]
docstr: Modify a batch of documents, using pre-computed scores.
  
  docs (Iterable[Doc]): The documents to modify.
  kb_ids (List[str]): The IDs to set, produced by EntityLinker.predict.
  
  DOCS: https://spacy.io/api/entitylinker#set_annotations
docstr_tok: ["Modify","a","batch","of","documents",",","using","pre-computed","scores",".","docs","(","Iterable","[","Doc","]",")",":","The","documents","to","modify",".","kb_ids","(","List","[","str","]",")",":","The","IDs","to","set",",","produced","by","EntityLinker.predict",".","DOCS",":","https",":","\/\/spacy.io\/api\/entitylinker","#","set_annotations"]
code: def set_annotations(
      self, docs: Iterable[Doc], kb_ids: List[str]
  ) -> None:
      """Modify a batch of documents, using pre-computed scores.
  
      docs (Iterable[Doc]): The documents to modify.
      kb_ids (List[str]): The IDs to set, produced by EntityLinker.predict.
  
      DOCS: https://spacy.io/api/entitylinker#set_annotations
      """
      count_ents = len([ent for doc in docs for ent in doc.ents])
      if count_ents != len(kb_ids):
          raise ValueError(
              Errors.E148.format(ents=count_ents, ids=len(kb_ids))
          )
      i = 0
      overwrite = self.cfg["overwrite"]
      for doc in docs:
          for ent in doc.ents:
              kb_id = kb_ids[i]
              i += 1
              for token in ent:
                  if token.ent_kb_id == 0 or overwrite:
                      token.ent_kb_id_ = kb_id
  
imports: import random
  from itertools import islice
  from pathlib import Path
  from typing import Any, Callable, Dict, Iterable, List, Optional, Union
  import srsly
  from thinc.api import Config, CosineDistance, Model, Optimizer, set_dropout_rate
  from thinc.types import Floats2d
  from ..None import util
  from ..errors import Errors
  from ..kb import Candidate, KnowledgeBase
  from ..language import Language
  from ..ml import empty_kb
  from ..scorer import Scorer
  from ..tokens import Doc, Span
  from ..training import Example, validate_examples, validate_get_examples
  from ..util import SimpleFrozenList, registry
  from ..vocab import Vocab
  from .legacy.entity_linker import EntityLinker_v1
  from .pipe import deserialize_config
  from .trainable_pipe import TrainablePipe
label_desc: Use image node_id 9 for calling the EntityLinker obj's underlying member method code with example usage: obj.set_annotations(docs, kb_ids) without return types