mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 00:02:19 +03:00
black
This commit is contained in:
parent
6f750d0da6
commit
af802257f2
|
@ -191,10 +191,7 @@ def test_set_annotations_span_lengths(min_length, max_length, span_count):
|
||||||
if min_length is None:
|
if min_length is None:
|
||||||
min_length = 1
|
min_length = 1
|
||||||
|
|
||||||
assert all(
|
assert all(min_length <= len(span) <= max_length for span in doc.spans[SPANS_KEY])
|
||||||
min_length <= len(span) <= max_length
|
|
||||||
for span in doc.spans[SPANS_KEY]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_span_finder_suggester():
|
def test_span_finder_suggester():
|
||||||
|
@ -240,7 +237,11 @@ def test_overfitting_IO():
|
||||||
doc = nlp(test_text)
|
doc = nlp(test_text)
|
||||||
spans = doc.spans[span_finder.spans_key]
|
spans = doc.spans[span_finder.spans_key]
|
||||||
assert len(spans) == 3
|
assert len(spans) == 3
|
||||||
assert set([span.text for span in spans]) == {"London", "Berlin", "London and Berlin"}
|
assert set([span.text for span in spans]) == {
|
||||||
|
"London",
|
||||||
|
"Berlin",
|
||||||
|
"London and Berlin",
|
||||||
|
}
|
||||||
|
|
||||||
# Also test the results are still the same after IO
|
# Also test the results are still the same after IO
|
||||||
with make_tempdir() as tmp_dir:
|
with make_tempdir() as tmp_dir:
|
||||||
|
@ -249,7 +250,11 @@ def test_overfitting_IO():
|
||||||
doc2 = nlp2(test_text)
|
doc2 = nlp2(test_text)
|
||||||
spans2 = doc2.spans[span_finder.spans_key]
|
spans2 = doc2.spans[span_finder.spans_key]
|
||||||
assert len(spans2) == 3
|
assert len(spans2) == 3
|
||||||
assert set([span.text for span in spans2]) == {"London", "Berlin", "London and Berlin"}
|
assert set([span.text for span in spans2]) == {
|
||||||
|
"London",
|
||||||
|
"Berlin",
|
||||||
|
"London and Berlin",
|
||||||
|
}
|
||||||
|
|
||||||
# Test scoring
|
# Test scoring
|
||||||
scores = nlp.evaluate(train_examples)
|
scores = nlp.evaluate(train_examples)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user