      entries_per_article = read_training_entities(training_output=training_dir)
  
      data = []
  
      cnt = 0
      files = listdir(training_dir)
      for f in files:
          if not limit or cnt < limit:
              if dev == run_el.is_dev(f):
                  article_id = f.replace(".txt", "")
                  if cnt % 500 == 0 and to_print:
                      print(datetime.datetime.now(), "processed", cnt, "files in the training dataset")
  
                  try:
                      # parse the article text
                      with open(os.path.join(training_dir, f), mode="r", encoding='utf8') as file:
                          text = file.read()
                          article_doc = nlp(text)
  
                      entries_by_offset = entries_per_article.get(article_id, dict())
  
                      gold_entities = list()
                      for ent in article_doc.ents:
 
</s> remove                     entries_by_offset = entries_per_article.get(article_id, dict())
 </s> add         except Exception as e:
            print("Problem parsing article", article_id)
            print(e)
            raise e </s> remove                     gold_entities = list()
                    for ent in article_doc.ents:
                        start = ent.start_char
                        end = ent.end_char

                        entity_tuple = entries_by_offset.get(str(start) + "-" + str(end), None)
                        if entity_tuple:
                            alias, wp_title = entity_tuple
                            if ent.text != alias:
                                print("Non-matching entity in", article_id, start, end)
                            else:
                                gold_entities.append((start, end, wp_title))

                    if gold_entities:
                        gold = GoldParse(doc=article_doc, links=gold_entities)
                        data.append((article_doc, gold))

                    cnt += 1
                except Exception as e:
                    print("Problem parsing article", article_id)
                    print(e)
                    raise e

    if to_print:
        print()
        print("Processed", cnt, "training articles, dev=" + str(dev))
        print()
 </s> add  </s> remove def read_training(nlp, training_dir, dev, limit, to_print):
    # This method will provide training examples that correspond to the entity annotations found by the nlp object
    entries_per_article = read_training_entities(training_output=training_dir)
 </s> add def read_training(nlp, training_dir, dev, limit):
    # This method provides training examples that correspond to the entity annotations found by the nlp object

    print("reading training entities")
    entries_per_article = read_training_entities(training_output=training_dir, dev=dev, limit=limit)
    print("done reading training entities") </s> remove                                                         limit=train_limit,
                                                        to_print=False)
 </s> add                                                         limit=train_limit)

        print("Training on", len(train_data), "articles")
        print()

        if not train_data:
            print("Did not find any training data")

        else:
            for itn in range(EPOCHS):
                random.shuffle(train_data)
                losses = {}
                batches = minibatch(train_data, size=compounding(4.0, 128.0, 1.001))
                batchnr = 0

                with nlp_2.disable_pipes(*other_pipes):
                    for batch in batches:
                        try:
                            docs, golds = zip(*batch)
                            nlp_2.update(
                                docs,
                                golds,
                                drop=DROPOUT,
                                losses=losses,
                            )
                            batchnr += 1
                        except Exception as e:
                            print("Error updating batch", e)

                losses['entity_linker'] = losses['entity_linker'] / batchnr
                print("Epoch, train loss", itn, round(losses['entity_linker'], 2)) </s> remove                                             print("alias (" + lang + "):", item["value"])
 </s> add                                              print("alias (" + lang + "):", item["value"])
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
      entries_per_article = read_training_entities(training_output=training_dir)
  
      data = []
  
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
            if gold_entities:
                gold = GoldParse(doc=article_doc, links=gold_entities)
                data.append((article_doc, gold))
  
                      entries_by_offset = entries_per_article.get(article_id, dict())
  
                      gold_entities = list()
                      for ent in article_doc.ents:
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 reprocessing all of wikipedia for training data 
examples/pipeline/wiki_entity_linking/training_set_creator.py