mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-07 21:54:54 +03:00
Clean up vals reference
This commit is contained in:
parent
5d12e98550
commit
49baa1bffc
|
@ -401,8 +401,9 @@ class TextCategorizer(TrainablePipe):
|
||||||
def _validate_categories(self, examples: Iterable[Example]):
|
def _validate_categories(self, examples: Iterable[Example]):
|
||||||
"""Check whether the provided examples all have single-label cats annotations."""
|
"""Check whether the provided examples all have single-label cats annotations."""
|
||||||
for ex in examples:
|
for ex in examples:
|
||||||
if list(ex.reference.cats.values()).count(1.0) > 1:
|
vals = list(ex.reference.cats.values())
|
||||||
|
if vals.count(1.0) > 1:
|
||||||
raise ValueError(Errors.E895.format(value=ex.reference.cats))
|
raise ValueError(Errors.E895.format(value=ex.reference.cats))
|
||||||
for val in ex.reference.cats.values():
|
for val in vals:
|
||||||
if not (val == 1.0 or val == 0.0):
|
if not (val == 1.0 or val == 0.0):
|
||||||
raise ValueError(Errors.E851.format(val=val))
|
raise ValueError(Errors.E851.format(val=val))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user