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: Learn from a batch of documents and gold-standard information,
  updating the pipe's model. Delegates to predict and get_loss.
  
  examples (Iterable[Example]): A batch of Example objects.
  drop (float): The dropout rate.
  sgd (thinc.api.Optimizer): The optimizer.
  losses (Dict[str, float]): Optional record of the loss during training.
      Updated using the component name as the key.
  RETURNS (Dict[str, float]): The updated losses dictionary.
  
  DOCS: https://spacy.io/api/entitylinker#update
docstr_tok: ["Learn","from","a","batch","of","documents","and","gold-standard","information",",","updating","the","pipe","'s","model",".","Delegates","to","predict","and","get_loss",".","examples","(","Iterable","[","Example","]",")",":","A","batch","of","Example","objects",".","drop","(","float",")",":","The","dropout","rate",".","sgd","(","thinc.api.Optimizer",")",":","The","optimizer",".","losses","(","Dict","[","str",",","float","]",")",":","Optional","record","of","the","loss","during","training",".","Updated","using","the","component","name","as","the","key",".","RETURNS","(","Dict","[","str",",","float","]",")",":","The","updated","losses","dictionary",".","DOCS",":","https",":","\/\/spacy.io\/api\/entitylinker","#","update"]
code: def update(
      self,
      examples: Iterable[Example],
      *,
      drop: float = 0.0,
      sgd: Optional[Optimizer] = None,
      losses: Optional[Dict[str, float]] = None,
  ) -> Dict[str, float]:
      """Learn from a batch of documents and gold-standard information,
      updating the pipe's model. Delegates to predict and get_loss.
  
      examples (Iterable[Example]): A batch of Example objects.
      drop (float): The dropout rate.
      sgd (thinc.api.Optimizer): The optimizer.
      losses (Dict[str, float]): Optional record of the loss during training.
          Updated using the component name as the key.
      RETURNS (Dict[str, float]): The updated losses dictionary.
  
      DOCS: https://spacy.io/api/entitylinker#update
      """
      self.validate_kb()
      if losses is None:
          losses = {}
      losses.setdefault(self.name, 0.0)
      if not examples:
          return losses
      validate_examples(examples, "EntityLinker.update")
  
      set_dropout_rate(self.model, drop)
      docs = [eg.predicted for eg in examples]
      # save to restore later
      old_ents = [doc.ents for doc in docs]
  
      for doc, ex in zip(docs, examples):
          if self.use_gold_ents:
              ents, _ = ex.get_aligned_ents_and_ner()
              doc.ents = ents
          else:
              # only keep matching ents
              doc.ents = ex.get_matching_ents()
  
      # make sure we have something to learn from, if not, short-circuit
      if not self.batch_has_learnable_example(examples):
          return losses
  
      sentence_encodings, bp_context = self.model.begin_update(docs)
  
      # now restore the ents
      for doc, old in zip(docs, old_ents):
          doc.ents = old
  
      loss, d_scores = self.get_loss(
          sentence_encodings=sentence_encodings, examples=examples
      )
      bp_context(d_scores)
      if sgd is not None:
          self.finish_update(sgd)
      losses[self.name] += loss
      return losses
  
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 6 for calling the EntityLinker obj's underlying member method code with example usage: obj.update(examples) and returns: losses, losses, losses