mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-14 18:22:27 +03:00
Format.
This commit is contained in:
parent
ca1f86ebb9
commit
79798c0181
|
@ -138,7 +138,9 @@ def get_candidates(kb: KnowledgeBase, mention: Span) -> Iterable[Candidate]:
|
||||||
mention (Span): Entity mention.
|
mention (Span): Entity mention.
|
||||||
RETURNS (Iterable[Candidate]): Identified candidates for specified mention.
|
RETURNS (Iterable[Candidate]): Identified candidates for specified mention.
|
||||||
"""
|
"""
|
||||||
return next(next(get_candidates_v2(kb, iter([SpanGroup(mention.doc, spans=[mention])])))[0])
|
return next(
|
||||||
|
next(get_candidates_v2(kb, iter([SpanGroup(mention.doc, spans=[mention])])))[0]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_candidates_v2(
|
def get_candidates_v2(
|
||||||
|
|
|
@ -453,10 +453,13 @@ def test_candidate_generation(nlp):
|
||||||
mykb.add_alias(alias="adam", entities=["Q2"], probabilities=[0.9])
|
mykb.add_alias(alias="adam", entities=["Q2"], probabilities=[0.9])
|
||||||
|
|
||||||
# test the size of the relevant candidates
|
# test the size of the relevant candidates
|
||||||
adam_ent_cands = next(get_candidates_v2(mykb, SpanGroup(doc=doc, spans=[adam_ent])))[0]
|
adam_ent_cands = next(
|
||||||
|
get_candidates_v2(mykb, SpanGroup(doc=doc, spans=[adam_ent]))
|
||||||
|
)[0]
|
||||||
assert len(adam_ent_cands) == 1
|
assert len(adam_ent_cands) == 1
|
||||||
assert (
|
assert (
|
||||||
len(next(get_candidates_v2(mykb, SpanGroup(doc=doc, spans=[douglas_ent])))[0]) == 2
|
len(next(get_candidates_v2(mykb, SpanGroup(doc=doc, spans=[douglas_ent])))[0])
|
||||||
|
== 2
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
len(next(get_candidates_v2(mykb, SpanGroup(doc=doc, spans=[Adam_ent])))[0]) == 0
|
len(next(get_candidates_v2(mykb, SpanGroup(doc=doc, spans=[Adam_ent])))[0]) == 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user