mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
Fix newly introduced bug in EntityLinker.predict().
This commit is contained in:
parent
96909f3203
commit
6a30df3039
|
@ -529,7 +529,7 @@ class EntityLinker(TrainablePipe):
|
||||||
# set all prior probabilities to 0 if incl_prior=False
|
# set all prior probabilities to 0 if incl_prior=False
|
||||||
scores = prior_probs = xp.asarray(
|
scores = prior_probs = xp.asarray(
|
||||||
[
|
[
|
||||||
0.0 if self.incl_prior else c.prior_prob
|
c.prior_prob if self.incl_prior else 0.0
|
||||||
for c in candidates
|
for c in candidates
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -496,7 +496,7 @@ def test_el_pipe_configuration(nlp):
|
||||||
doc = nlp(text)
|
doc = nlp(text)
|
||||||
assert doc[0].ent_kb_id_ == "NIL"
|
assert doc[0].ent_kb_id_ == "NIL"
|
||||||
assert doc[1].ent_kb_id_ == ""
|
assert doc[1].ent_kb_id_ == ""
|
||||||
assert doc[2].ent_kb_id_ in ("Q2", "Q3")
|
assert doc[2].ent_kb_id_ == "Q2"
|
||||||
|
|
||||||
# Replace the pipe with a new one with with a different candidate generator.
|
# Replace the pipe with a new one with with a different candidate generator.
|
||||||
|
|
||||||
|
@ -540,9 +540,9 @@ def test_el_pipe_configuration(nlp):
|
||||||
)
|
)
|
||||||
_entity_linker.set_kb(create_kb)
|
_entity_linker.set_kb(create_kb)
|
||||||
_doc = nlp(doc_text)
|
_doc = nlp(doc_text)
|
||||||
assert _doc[0].ent_kb_id_ in ("Q2", "Q3")
|
assert _doc[0].ent_kb_id_ == "Q2"
|
||||||
assert _doc[1].ent_kb_id_ == ""
|
assert _doc[1].ent_kb_id_ == ""
|
||||||
assert _doc[2].ent_kb_id_ in ("Q2", "Q3")
|
assert _doc[2].ent_kb_id_ == "Q2"
|
||||||
|
|
||||||
# Test individual and doc-wise candidate generation.
|
# Test individual and doc-wise candidate generation.
|
||||||
test_reconfigured_el(False, text)
|
test_reconfigured_el(False, text)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user