diff --git a/arkindex_worker/worker.py b/arkindex_worker/worker.py index 2882358cb43094c3364ed8d8f092f0d43a02ddb7..73da0d8651fbc4a9ee3021b0004ed1943a6a6aab 100644 --- a/arkindex_worker/worker.py +++ b/arkindex_worker/worker.py @@ -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")