mirror of
https://github.com/explosion/spaCy.git
synced 2025-05-29 10:13:19 +03:00
fix tests
This commit is contained in:
parent
68a0662019
commit
1c80b85241
|
@ -41,8 +41,12 @@ def create_kb(vocab):
|
||||||
|
|
||||||
|
|
||||||
def add_el(kb, nlp):
|
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.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"]:
|
for alias in ["Douglas Adams", "Douglas"]:
|
||||||
candidates = nlp.linker.kb.get_candidates(alias)
|
candidates = nlp.linker.kb.get_candidates(alias)
|
||||||
|
|
|
@ -666,7 +666,7 @@ def build_nel_encoder(embed_width, hidden_width, **cfg):
|
||||||
entity_width = cfg.get("entity_width")
|
entity_width = cfg.get("entity_width")
|
||||||
|
|
||||||
with Model.define_operators({">>": chain, "**": clone}):
|
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
|
>> logistic
|
||||||
|
|
||||||
# context encoder
|
# context encoder
|
||||||
|
|
|
@ -126,7 +126,7 @@ def test_preserving_links_asdoc(nlp):
|
||||||
ruler.add_patterns(patterns)
|
ruler.add_patterns(patterns)
|
||||||
nlp.add_pipe(ruler)
|
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.set_kb(mykb)
|
||||||
el_pipe.begin_training()
|
el_pipe.begin_training()
|
||||||
el_pipe.context_weight = 0
|
el_pipe.context_weight = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user