  
  from spacy.kb import KnowledgeBase
  from .functions import merge_subtokens
  from ..tokens.doc cimport Doc
  from ..syntax.nn_parser cimport Parser
  from ..syntax.ner cimport BiluoPushDown
  from ..syntax.arc_eager cimport ArcEager
 
</s> remove from .train_descriptions import EntityEncoder
from . import wikidata_processor as wd, wikipedia_processor as wp
 </s> add from bin.wiki_entity_linking.train_descriptions import EntityEncoder
from bin.wiki_entity_linking import wikidata_processor as wd, wikipedia_processor as wp </s> remove 
INPUT_DIM = 300  # dimension of pre-trained input vectors
DESC_WIDTH = 64  # dimension of output entity vectors
 </s> add from spacy import Errors </s> remove     kb = KnowledgeBase(vocab=nlp.vocab, entity_vector_length=DESC_WIDTH)
 </s> add     kb = KnowledgeBase(vocab=nlp.vocab, entity_vector_length=entity_vector_length) </s> remove     # disable this part of the pipeline when rerunning the KB generation from preprocessed files
    read_raw_data = True
 </s> add     # check the length of the nlp vectors
    if "vectors" in nlp.meta and nlp.vocab.vectors.size:
        input_dim = nlp.vocab.vectors_length
        print("Loaded pre-trained vectors of size %s" % input_dim)
    else:
        raise ValueError(Errors.E155)
from spacy.cli.pretrain import get_cossim_loss
  
  from spacy.kb import KnowledgeBase
from spacy.cli.pretrain import get_cossim_loss
  from .functions import merge_subtokens
  from ..tokens.doc cimport Doc
  from ..syntax.nn_parser cimport Parser
  from ..syntax.ner cimport BiluoPushDown
  from ..syntax.arc_eager cimport ArcEager
keep add keep keep keep keep keep
 CLI scripts for entity linking (wikipedia & generic) (#4091)

* document token ent_kb_id

* document span kb_id

* update pipeline documentation

* prior and context weights as bool's instead

* entitylinker api documentation

* drop for both models

* finish entitylinker documentation

* small fixes

* documentation for KB

* candidate documentation

* links to api pages in code

* small fix

* frequency examples as counts for consistency

* consistent documentation about tensors returned by predict

* add entity linking to usage 101

* add entity linking infobox and KB section to 101

* entity-linking in linguistic features

* small typo corrections

* training example and docs for entity_linker

* predefined nlp and kb

* revert back to similarity encodings for simplicity (for now)

* set prior probabilities to 0 when excluded

* code clean up

* bugfix: deleting kb ID from tokens when entities were removed

* refactor train el example to use either model or vocab

* pretrain_kb example for example kb generation

* add to training docs for KB + EL example scripts

* small fixes

* error numbering

* ensure the language of vocab and nlp stay consistent across serialization

* equality with =

* avoid conflict in errors file

* add error 151

* final adjustements to the train scripts - consistency

* update of goldparse documentation

* small corrections

* push commit

* turn kb_creator into CLI script (wip)

* proper parameters for training entity vectors

* wikidata pipeline split up into two executable scripts

* remove context_width

* move wikidata scripts in bin directory, remove old dummy script

* refine KB script with logs and preprocessing options

* small edits

* small improvements to logging of EL CLI script 
spacy/pipeline/pipes.pyx