fix tests

This commit is contained in:
svlandeg 2019-06-28 08:59:23 +02:00
parent 68a0662019
commit 1c80b85241
3 changed files with 7 additions and 3 deletions

View File

@ -41,8 +41,12 @@ def create_kb(vocab):
def add_el(kb, nlp):
el_pipe = nlp.create_pipe(name='entity_linker', config={"kb": kb})
el_pipe = nlp.create_pipe(name='entity_linker', config={"context_width": 64})
el_pipe.set_kb(kb)
nlp.add_pipe(el_pipe, last=True)
nlp.begin_training()
el_pipe.context_weight = 0
el_pipe.prior_weight = 1
for alias in ["Douglas Adams", "Douglas"]:
candidates = nlp.linker.kb.get_candidates(alias)

View File

@ -666,7 +666,7 @@ def build_nel_encoder(embed_width, hidden_width, **cfg):
entity_width = cfg.get("entity_width")
with Model.define_operators({">>": chain, "**": clone}):
model = Affine(1, entity_width+context_width+1, drop_factor=0.0)\
model = Affine(1, entity_width+context_width, drop_factor=0.0)\
>> logistic
# context encoder

View File

@ -126,7 +126,7 @@ def test_preserving_links_asdoc(nlp):
ruler.add_patterns(patterns)
nlp.add_pipe(ruler)
el_pipe = nlp.create_pipe(name='entity_linker', config={})
el_pipe = nlp.create_pipe(name='entity_linker', config={"context_width": 64})
el_pipe.set_kb(mykb)
el_pipe.begin_training()
el_pipe.context_weight = 0