mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-20 09:01:58 +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.
|
||||
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(
|
||||
|
|
|
@ -453,10 +453,13 @@ def test_candidate_generation(nlp):
|
|||
mykb.add_alias(alias="adam", entities=["Q2"], probabilities=[0.9])
|
||||
|
||||
# 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(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 (
|
||||
len(next(get_candidates_v2(mykb, SpanGroup(doc=doc, spans=[Adam_ent])))[0]) == 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user