                  context_encoding = context_encodings[i]
                  for ent in doc.ents:
                      type_vector = [0 for i in range(len(type_to_int))]
                      if len(type_to_int) > 0:
                          type_vector[type_to_int[ent.label_]] = 1
  
                      candidates = self.kb.get_candidates(ent.text)
 
</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                     if candidates:
 </s> add                     if not candidates:
                        final_kb_ids.append(self.NIL)  # no prediction possible for this entity
                    else: </s> remove     def set_annotations(self, docs, entities, kb_ids=None):
        for entity, kb_id in zip(entities, kb_ids):
            for token in entity:
                token.ent_kb_id_ = kb_id
 </s> add         return final_kb_ids

    def set_annotations(self, docs, kb_ids, tensors=None):
        i=0
        for doc in docs:
            for ent in doc.ents:
                kb_id = kb_ids[i]
                i += 1
                for token in ent:
                    token.ent_kb_id_ = kb_id </s> remove                                 # add both pos and neg examples (in random order)
                                # this will exclude examples not in the KB
                                if kb:
                                    gold_entities = {}
                                    candidates = kb.get_candidates(alias)
                                    candidate_ids = [c.entity_ for c in candidates]
                                    random.shuffle(candidate_ids)
                                    for kb_id in candidate_ids:
                                        entry = (gold_start, gold_end, kb_id)
                                        if kb_id != wd_id:
                                            gold_entities[entry] = 0.0
 </s> add                                 gold_entities = {}
                                found_useful = False
                                for ent in sent.ents:
                                    if ent.start_char == gold_start and ent.end_char == gold_end:
                                        # add both pos and neg examples (in random order)
                                        # this will exclude examples not in the KB
                                        if kb:
                                            value_by_id = {}
                                            candidates = kb.get_candidates(alias)
                                            candidate_ids = [c.entity_ for c in candidates]
                                            random.shuffle(candidate_ids)
                                            for kb_id in candidate_ids:
                                                found_useful = True
                                                if kb_id != wd_id:
                                                    value_by_id[kb_id] = 0.0
                                                else:
                                                    value_by_id[kb_id] = 1.0
                                            gold_entities[(ent.start_char, ent.end_char)] = value_by_id
                                        # if no KB, keep all positive examples </s> remove                 if value:
                    start, end, gold_kb = entity
                    correct_entries_per_article[str(start) + "-" + str(end)] = gold_kb
 </s> add                 for gold_kb, value in kb_dict.items():
                    if value:
                        correct_entries_per_article[str(start) + "-" + str(end)] = gold_kb
                    entity_count += 1
                  context_encoding = context_encodings[i]
                  for ent in doc.ents:
                    entity_count += 1
                      type_vector = [0 for i in range(len(type_to_int))]
                      if len(type_to_int) > 0:
                          type_vector[type_to_int[ent.label_]] = 1
  
                      candidates = self.kb.get_candidates(ent.text)
keep add keep keep keep keep keep
 have gold.links correspond exactly to doc.ents 
spacy/pipeline/pipes.pyx