  
      def get_loss(self, docs, golds, scores):
          cats = []
          for gold in golds:
              for entity, value in gold.links.items():
                  cats.append([value])
  
          cats = self.model.ops.asarray(cats, dtype="float32")
          assert len(scores) == len(cats)
  
          d_scores = (scores - cats)
 
</s> remove                 entity_encoding = self.kb.get_vector(kb_id)
                prior_prob = self.kb.get_prior_prob(kb_id, mention)

                gold_ent = ents_by_offset[str(ent.start_char) + "_" + str(ent.end_char)]
                assert gold_ent is not None
                type_vector = [0 for i in range(len(type_to_int))]
                if len(type_to_int) > 0:
                    type_vector[type_to_int[gold_ent.label_]] = 1

                # store data
                entity_encodings.append(entity_encoding)
                context_docs.append(doc)
                type_vectors.append(type_vector)

                if self.cfg.get("prior_weight", 1) > 0:
                    priors.append([prior_prob])
                else:
                    priors.append([0])
 </s> add                 for kb_id, value in kb_dict.items():
                    entity_encoding = self.kb.get_vector(kb_id)
                    prior_prob = self.kb.get_prior_prob(kb_id, mention)

                    gold_ent = ents_by_offset[str(ent.start_char) + "_" + str(ent.end_char)]
                    assert gold_ent is not None
                    type_vector = [0 for i in range(len(type_to_int))]
                    if len(type_to_int) > 0:
                        type_vector[type_to_int[gold_ent.label_]] = 1

                    # store data
                    entity_encodings.append(entity_encoding)
                    context_docs.append(doc)
                    type_vectors.append(type_vector)

                    if self.cfg.get("prior_weight", 1) > 0:
                        priors.append([prior_prob])
                    else:
                        priors.append([0]) </s> remove         return final_entities, final_kb_ids
 </s> add         assert len(final_kb_ids) == entity_count </s> remove         entities, kb_ids = self.predict([doc])
        self.set_annotations([doc], entities, kb_ids)
 </s> add         kb_ids = self.predict([doc])
        self.set_annotations([doc], kb_ids) </s> remove             for entity, value in gold.links.items():
                start, end, kb_id = entity
 </s> add             for entity, kb_dict in gold.links.items():
                start, end = entity </s> remove             for entity, value in gold.links.items():
 </s> add             for entity, kb_dict in gold.links.items():
                start, end = entity
            for entity, kb_dict in gold.links.items():
                for kb_id, value in kb_dict.items():
                    cats.append([value])
  
      def get_loss(self, docs, golds, scores):
          cats = []
          for gold in golds:
            for entity, kb_dict in gold.links.items():
                for kb_id, value in kb_dict.items():
                    cats.append([value])
            for entity, kb_dict in gold.links.items():
                for kb_id, value in kb_dict.items():
                    cats.append([value])
  
          cats = self.model.ops.asarray(cats, dtype="float32")
          assert len(scores) == len(cats)
  
          d_scores = (scores - cats)
keep keep keep keep replace replace keep keep keep keep keep
 have gold.links correspond exactly to doc.ents 
spacy/pipeline/pipes.pyx