      incorrect_by_label = dict()
  
      docs = [d for d, g in data if len(d) > 0]
      if el_pipe is not None:
          docs = el_pipe.pipe(docs)
      golds = [g for d, g in data if len(d) > 0]
  
      for doc, gold in zip(docs, golds):
          try:
              correct_entries_per_article = dict()
 
</s> remove             entity_encodings = np.asarray(entity_encodings, dtype=np.float32)
 </s> add             entity_encodings = self.model.ops.asarray(entity_encodings, dtype="float32") </s> remove                 context_encoding = self.model([doc])
                context_enc_t = np.transpose(context_encoding)
 </s> add                 context_encoding = context_encodings[i]
                context_enc_t = context_encoding.T
                norm_1 = xp.linalg.norm(context_enc_t) </s> remove             print("Dev testing from file on", len(dev_data), "articles")
            print()
 </s> add     # testing performance with an NLP model from file
    if test_from_file:
        nlp_2 = spacy.load(NLP_1_DIR)
        nlp_3 = spacy.load(NLP_2_DIR)
        el_pipe = nlp_3.get_pipe("entity_linker") </s> remove                         scores = []
                        for c in candidates:
                            prior_prob = c.prior_prob * self.prior_weight
                            kb_id = c.entity_
                            entity_encoding = c.entity_vector
                            sim = float(cosine(np.asarray([entity_encoding]), context_enc_t)) * self.context_weight
                            score = prior_prob + sim - (prior_prob*sim)
                            scores.append(score)
 </s> add                         prior_probs = xp.asarray([c.prior_prob for c in candidates])
                        prior_probs *= self.prior_weight

                        entity_encodings = xp.asarray([c.entity_vector for c in candidates])
                        norm_2 = xp.linalg.norm(entity_encodings, axis=1)

                        # cosine similarity
                        sims = xp.dot(entity_encodings, context_enc_t) / (norm_1 * norm_2)
                        sims *= self.context_weight
                        scores = prior_probs + sims - (prior_probs*sims)
                        best_index = scores.argmax()
        print("applying el_pipe", datetime.datetime.now())
        docs = list(el_pipe.pipe(docs, batch_size=10000000000))
        print("done applying el_pipe", datetime.datetime.now())
      incorrect_by_label = dict()
  
      docs = [d for d, g in data if len(d) > 0]
      if el_pipe is not None:
        print("applying el_pipe", datetime.datetime.now())
        docs = list(el_pipe.pipe(docs, batch_size=10000000000))
        print("done applying el_pipe", datetime.datetime.now())
      golds = [g for d, g in data if len(d) > 0]
  
      for doc, gold in zip(docs, golds):
          try:
              correct_entries_per_article = dict()
keep keep keep keep replace keep keep keep keep keep
 improve speed of prediction loop 
examples/pipeline/wikidata_entity_linking.py