Skip to content
Snippets Groups Projects
Commit c85e5a32 authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Check score & confidence type

parent d58750ae
No related branches found
No related tags found
No related merge requests found
Pipeline #77964 passed
......@@ -299,7 +299,7 @@ class ElementsWorker(BaseWorker):
text, str
), "text shouldn't be null and should be of type str"
assert (
score and isinstance(score, float) and 0 <= score <= 1
isinstance(score, float) and 0 <= score <= 1
), "score shouldn't be null and should be a float in [0..1] range"
if self.is_read_only:
logger.warning(
......@@ -374,7 +374,7 @@ class ElementsWorker(BaseWorker):
), "corpus shouldn't be null and should be of type str"
if metas:
assert isinstance(metas, dict), "metas should be of type dict"
if validated:
if validated is not None:
assert isinstance(validated, bool), "validated should be of type bool"
if self.is_read_only:
logger.warning("Cannot create entity as this worker is in read-only mode")
......@@ -422,7 +422,7 @@ class ElementsWorker(BaseWorker):
score = transcription.get("score")
assert (
score and isinstance(score, float) and 0 <= score <= 1
score is not None and isinstance(score, float) and 0 <= score <= 1
), f"Transcription at index {index} in transcriptions: score shouldn't be null and should be a float in [0..1] range"
polygon = transcription.get("polygon")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment