  # cython: profile=True
  # coding: utf8
  from __future__ import unicode_literals
  
  import numpy as np
  
  import numpy
  import srsly
  from collections import OrderedDict
  from thinc.api import chain
  from thinc.v2v import Affine, Maxout, Softmax
 
</s> remove     to_read_nlp = True
 </s> add     to_read_nlp = False </s> remove                         best_index = scores.index(max(scores))
 </s> add  </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() </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")
  # cython: profile=True
  # coding: utf8
  from __future__ import unicode_literals
  


  import numpy
  import srsly
  from collections import OrderedDict
  from thinc.api import chain
  from thinc.v2v import Affine, Maxout, Softmax
keep keep keep keep replace replace keep keep keep keep keep
 improve speed of prediction loop 
spacy/pipeline/pipes.pyx