diff --git a/backend/organizations/tasks.py b/backend/organizations/tasks.py index d4440e0cd..1a8754cf9 100644 --- a/backend/organizations/tasks.py +++ b/backend/organizations/tasks.py @@ -35,7 +35,11 @@ un_pack_annotation_tasks, ) from django.db.models import Q -from tasks.utils import calculateWordCount, calculateAudioDuration, calculateSentenceCount +from tasks.utils import ( + calculateWordCount, + calculateAudioDuration, + calculateSentenceCount, +) def get_all_annotation_reports( @@ -209,13 +213,19 @@ def get_all_annotation_reports( meta_stats = [] if project_type == "AllAudioProjects": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -246,13 +256,19 @@ def get_all_annotation_reports( transcribed_word_count.append(calculateAudioDuration(r)) elif project_type == "AcousticNormalisedTranscriptionEditing": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -283,9 +299,7 @@ def get_all_annotation_reports( if r["from_name"] == "transcribed_json": transcribed_word_count.append(calculateAudioDuration(r)) try: - total_raw_audio_duration_list.append( - anno.task.data["audio_duration"] - ) + total_raw_audio_duration_list.append(anno.task.data["audio_duration"]) except: pass if "total_segment_duration" in meta_stats: @@ -301,18 +315,20 @@ def get_all_annotation_reports( only_tasks = True total_raw_audio_duration, total_word_count = 0, 0 if project_type in get_audio_project_types() or project_type == "AllAudioProjects": - acoustic_normalised_duration = convert_seconds_to_hours(sum(acoustic_normalised_duration)) + acoustic_normalised_duration = convert_seconds_to_hours( + sum(acoustic_normalised_duration) + ) verbatim_duration = convert_seconds_to_hours(sum(verbatim_duration)) transcribed_duration = convert_seconds_to_hours(sum(transcribed_duration)) - acoustic_normalised_word_count = convert_seconds_to_hours(sum(acoustic_normalised_word_count)) + acoustic_normalised_word_count = convert_seconds_to_hours( + sum(acoustic_normalised_word_count) + ) verbatim_word_count = convert_seconds_to_hours(sum(verbatim_word_count)) transcribed_word_count = convert_seconds_to_hours(sum(transcribed_word_count)) total_raw_audio_duration = convert_seconds_to_hours( sum(total_raw_audio_duration_list) ) - total_segment_duration = convert_seconds_to_hours( - sum(total_segment_duration) - ) + total_segment_duration = convert_seconds_to_hours(sum(total_segment_duration)) else: total_word_count = sum(total_word_count_list) cumulative_rejection_score_ar = 0 @@ -559,19 +575,25 @@ def get_all_review_reports( else: total_word_count_list.append(ocr_word_count(anno.result)) elif ( - project_type in get_audio_project_types() or project_type == "AllAudioProjects" + project_type in get_audio_project_types() or project_type == "AllAudioProjects" ): for anno in submitted_tasks: meta_stats = anno.meta_stats if project_type == "AllAudioProjects": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -602,13 +624,19 @@ def get_all_review_reports( transcribed_word_count.append(calculateAudioDuration(r)) elif project_type == "AcousticNormalisedTranscriptionEditing": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -648,9 +676,7 @@ def get_all_review_reports( except: pass try: - total_raw_audio_duration_list.append( - anno.task.data["audio_duration"] - ) + total_raw_audio_duration_list.append(anno.task.data["audio_duration"]) except: pass else: @@ -658,18 +684,20 @@ def get_all_review_reports( total_raw_audio_duration, total_word_count = 0, 0 if project_type in get_audio_project_types() or project_type == "AllAudioProjects": - acoustic_normalised_duration = convert_seconds_to_hours(sum(acoustic_normalised_duration)) + acoustic_normalised_duration = convert_seconds_to_hours( + sum(acoustic_normalised_duration) + ) verbatim_duration = convert_seconds_to_hours(sum(verbatim_duration)) transcribed_duration = convert_seconds_to_hours(sum(transcribed_duration)) - acoustic_normalised_word_count = convert_seconds_to_hours(sum(acoustic_normalised_word_count)) + acoustic_normalised_word_count = convert_seconds_to_hours( + sum(acoustic_normalised_word_count) + ) verbatim_word_count = convert_seconds_to_hours(sum(verbatim_word_count)) transcribed_word_count = convert_seconds_to_hours(sum(transcribed_word_count)) total_raw_audio_duration = convert_seconds_to_hours( sum(total_raw_audio_duration_list) ) - total_segment_duration = convert_seconds_to_hours( - sum(total_segment_duration) - ) + total_segment_duration = convert_seconds_to_hours(sum(total_segment_duration)) else: total_word_count = sum(total_word_count_list) cumulative_rejection_score_ar = 0 @@ -845,19 +873,25 @@ def get_all_supercheck_reports( else: validated_word_count_list.append(ocr_word_count(anno.result)) elif ( - project_type in get_audio_project_types() or project_type == "AllAudioProjects" + project_type in get_audio_project_types() or project_type == "AllAudioProjects" ): for anno in submitted_tasks: meta_stats = anno.meta_stats if project_type == "AllAudioProjects": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -888,13 +922,19 @@ def get_all_supercheck_reports( transcribed_word_count.append(calculateAudioDuration(r)) elif project_type == "AcousticNormalisedTranscriptionEditing": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -944,18 +984,20 @@ def get_all_supercheck_reports( validated_raw_audio_duration, validated_word_count = 0, 0 if project_type in get_audio_project_types() or project_type == "AllAudioProjects": - acoustic_normalised_duration = convert_seconds_to_hours(sum(acoustic_normalised_duration)) + acoustic_normalised_duration = convert_seconds_to_hours( + sum(acoustic_normalised_duration) + ) verbatim_duration = convert_seconds_to_hours(sum(verbatim_duration)) transcribed_duration = convert_seconds_to_hours(sum(transcribed_duration)) - acoustic_normalised_word_count = convert_seconds_to_hours(sum(acoustic_normalised_word_count)) + acoustic_normalised_word_count = convert_seconds_to_hours( + sum(acoustic_normalised_word_count) + ) verbatim_word_count = convert_seconds_to_hours(sum(verbatim_word_count)) transcribed_word_count = convert_seconds_to_hours(sum(transcribed_word_count)) validated_raw_audio_duration = convert_seconds_to_hours( sum(validated_raw_audio_duration_list) ) - total_segment_duration = convert_seconds_to_hours( - sum(total_segment_duration) - ) + total_segment_duration = convert_seconds_to_hours(sum(total_segment_duration)) else: validated_word_count = sum(validated_word_count_list) cumulative_rejection_score_rs = 0 diff --git a/backend/tasks/migrations/0049_annotation_meta_stats.py b/backend/tasks/migrations/0049_annotation_meta_stats.py index bc235ca03..a9413e0f4 100644 --- a/backend/tasks/migrations/0049_annotation_meta_stats.py +++ b/backend/tasks/migrations/0049_annotation_meta_stats.py @@ -4,15 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('tasks', '0048_alter_annotation_unique_together'), + ("tasks", "0048_alter_annotation_unique_together"), ] operations = [ migrations.AddField( - model_name='annotation', - name='meta_stats', - field=models.JSONField(blank=True, help_text='Meta statistics for the annotation result', null=True, verbose_name='meta_stats'), + model_name="annotation", + name="meta_stats", + field=models.JSONField( + blank=True, + help_text="Meta statistics for the annotation result", + null=True, + verbose_name="meta_stats", + ), ), ] diff --git a/backend/tasks/utils.py b/backend/tasks/utils.py index 71c8209c2..da19d59d2 100644 --- a/backend/tasks/utils.py +++ b/backend/tasks/utils.py @@ -10,7 +10,17 @@ get_not_null_audio_transcription_duration, calculate_word_error_rate_between_two_audio_transcription_annotation, ) -from tasks.models import Annotation, REVIEWER_ANNOTATION, ANNOTATOR_ANNOTATION, SUPER_CHECKER_ANNOTATION, ACCEPTED, ACCEPTED_WITH_MINOR_CHANGES, ACCEPTED_WITH_MAJOR_CHANGES, VALIDATED, VALIDATED_WITH_CHANGES +from tasks.models import ( + Annotation, + REVIEWER_ANNOTATION, + ANNOTATOR_ANNOTATION, + SUPER_CHECKER_ANNOTATION, + ACCEPTED, + ACCEPTED_WITH_MINOR_CHANGES, + ACCEPTED_WITH_MAJOR_CHANGES, + VALIDATED, + VALIDATED_WITH_CHANGES, +) Queued_Task_name = { @@ -74,6 +84,7 @@ def query_flower(filters=None): def compute_meta_stats_for_annotation(ann_obj, project_type): from tasks.views import SentenceOperationViewSet + task_obj = ann_obj.task task_data = task_obj.data ced_project_type_choices = ["ContextualTranslationEditing"] @@ -93,10 +104,10 @@ def compute_meta_stats_for_annotation(ann_obj, project_type): ACCEPTED_WITH_MAJOR_CHANGES, ]: rev_ann = a - elif ( - a.annotation_type == SUPER_CHECKER_ANNOTATION - and a.annotation_status in [VALIDATED, VALIDATED_WITH_CHANGES] - ): + elif a.annotation_type == SUPER_CHECKER_ANNOTATION and a.annotation_status in [ + VALIDATED, + VALIDATED_WITH_CHANGES, + ]: sup_ann = a elif a.annotation_type == ANNOTATOR_ANNOTATION: ann_ann = a @@ -178,7 +189,7 @@ def compute_meta_stats_for_annotation(ann_obj, project_type): "as_wer_score": as_wer_score, "rs_wer_score": rs_wer_score, "ar_bleu_score": ar_bleu_score, - "rs_bleu_score": rs_bleu_score + "rs_bleu_score": rs_bleu_score, } elif project_type in ["AudioTranscription", "AudioTranscriptionEditing"]: transcribed_word_count, transcribed_duration = 0, 0 @@ -188,16 +199,17 @@ def compute_meta_stats_for_annotation(ann_obj, project_type): transcribed_duration += calculateAudioDuration(ann_obj.result) segment_duration = get_audio_transcription_duration(result) not_null_segment_duration = get_not_null_audio_transcription_duration(result) - return {"audio_word_count": transcribed_word_count, - "transcribed_duration": transcribed_duration, - "total_segment_duration": segment_duration, - "not_null_segment_duration": not_null_segment_duration, - "ar_wer_score": ar_wer_score, - "as_wer_score": as_wer_score, - "rs_wer_score": rs_wer_score, - "ar_bleu_score": ar_bleu_score, - "rs_bleu_score": rs_bleu_score - } + return { + "audio_word_count": transcribed_word_count, + "transcribed_duration": transcribed_duration, + "total_segment_duration": segment_duration, + "not_null_segment_duration": not_null_segment_duration, + "ar_wer_score": ar_wer_score, + "as_wer_score": as_wer_score, + "rs_wer_score": rs_wer_score, + "ar_bleu_score": ar_bleu_score, + "rs_bleu_score": rs_bleu_score, + } elif project_type in [ "ContextualSentenceVerification", "ContextualSentenceVerificationAndDomainClassification", @@ -208,13 +220,14 @@ def compute_meta_stats_for_annotation(ann_obj, project_type): for r in result: if r["type"] == "textarea": word_count += calculateWordCount(ann_obj.result) - return {"word_count": word_count, - "ar_wer_score": ar_wer_score, - "as_wer_score": as_wer_score, - "rs_wer_score": rs_wer_score, - "ar_bleu_score": ar_bleu_score, - "rs_bleu_score": rs_bleu_score - } + return { + "word_count": word_count, + "ar_wer_score": ar_wer_score, + "as_wer_score": as_wer_score, + "rs_wer_score": rs_wer_score, + "ar_bleu_score": ar_bleu_score, + "rs_bleu_score": rs_bleu_score, + } elif project_type in [ "ConversationTranslation", "ConversationTranslationEditing", @@ -228,14 +241,15 @@ def compute_meta_stats_for_annotation(ann_obj, project_type): ann_obj.result["value"]["text"][0] ) - return {"word_count": word_count, - "sentence_count": sentence_count, - "ar_wer_score": ar_wer_score, - "as_wer_score": as_wer_score, - "rs_wer_score": rs_wer_score, - "ar_bleu_score": ar_bleu_score, - "rs_bleu_score": rs_bleu_score - } + return { + "word_count": word_count, + "sentence_count": sentence_count, + "ar_wer_score": ar_wer_score, + "as_wer_score": as_wer_score, + "rs_wer_score": rs_wer_score, + "ar_bleu_score": ar_bleu_score, + "rs_bleu_score": rs_bleu_score, + } elif project_type in [ "OCRTranscription", "OCRTranscriptionEditing", @@ -245,13 +259,14 @@ def compute_meta_stats_for_annotation(ann_obj, project_type): for r in result: if r["from_name"] == "ocr_transcribed_json": word_count += calculateWordCount(ann_obj.result) - return {"word_count": word_count, - "ar_wer_score": ar_wer_score, - "as_wer_score": as_wer_score, - "rs_wer_score": rs_wer_score, - "ar_bleu_score": ar_bleu_score, - "rs_bleu_score": rs_bleu_score - } + return { + "word_count": word_count, + "ar_wer_score": ar_wer_score, + "as_wer_score": as_wer_score, + "rs_wer_score": rs_wer_score, + "ar_bleu_score": ar_bleu_score, + "rs_bleu_score": rs_bleu_score, + } def calculateWordCount(annotation_result): diff --git a/backend/workspaces/tasks.py b/backend/workspaces/tasks.py index cda293bf4..440d8392e 100644 --- a/backend/workspaces/tasks.py +++ b/backend/workspaces/tasks.py @@ -32,7 +32,11 @@ ocr_word_count, ) from tasks.views import SentenceOperationViewSet -from tasks.utils import calculateWordCount, calculateAudioDuration, calculateSentenceCount +from tasks.utils import ( + calculateWordCount, + calculateAudioDuration, + calculateSentenceCount, +) def get_all_annotation_reports( @@ -198,7 +202,7 @@ def get_all_annotation_reports( else: total_word_count_list.append(ocr_word_count(anno.result)) elif ( - project_type in get_audio_project_types() or project_type == "AllAudioProjects" + project_type in get_audio_project_types() or project_type == "AllAudioProjects" ): for anno in submitted_tasks: meta_stats = anno.meta_stats @@ -206,13 +210,19 @@ def get_all_annotation_reports( meta_stats = [] if project_type == "AllAudioProjects": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -243,13 +253,19 @@ def get_all_annotation_reports( transcribed_word_count.append(calculateAudioDuration(r)) elif project_type == "AcousticNormalisedTranscriptionEditing": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -280,9 +296,7 @@ def get_all_annotation_reports( if r["from_name"] == "transcribed_json": transcribed_word_count.append(calculateAudioDuration(r)) try: - total_raw_audio_duration_list.append( - anno.task.data["audio_duration"] - ) + total_raw_audio_duration_list.append(anno.task.data["audio_duration"]) except: pass if "total_segment_duration" in meta_stats: @@ -298,18 +312,20 @@ def get_all_annotation_reports( only_tasks = True total_raw_audio_duration, total_word_count = 0, 0 if project_type in get_audio_project_types() or project_type == "AllAudioProjects": - acoustic_normalised_duration = convert_seconds_to_hours(sum(acoustic_normalised_duration)) + acoustic_normalised_duration = convert_seconds_to_hours( + sum(acoustic_normalised_duration) + ) verbatim_duration = convert_seconds_to_hours(sum(verbatim_duration)) transcribed_duration = convert_seconds_to_hours(sum(transcribed_duration)) - acoustic_normalised_word_count = convert_seconds_to_hours(sum(acoustic_normalised_word_count)) + acoustic_normalised_word_count = convert_seconds_to_hours( + sum(acoustic_normalised_word_count) + ) verbatim_word_count = convert_seconds_to_hours(sum(verbatim_word_count)) transcribed_word_count = convert_seconds_to_hours(sum(transcribed_word_count)) total_raw_audio_duration = convert_seconds_to_hours( sum(total_raw_audio_duration_list) ) - total_segment_duration = convert_seconds_to_hours( - sum(total_segment_duration) - ) + total_segment_duration = convert_seconds_to_hours(sum(total_segment_duration)) else: total_word_count = sum(total_word_count_list) cumulative_rejection_score_ar = 0 @@ -563,13 +579,19 @@ def get_all_review_reports( meta_stats = anno.meta_stats if project_type == "AllAudioProjects": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -600,13 +622,19 @@ def get_all_review_reports( transcribed_word_count.append(calculateAudioDuration(r)) elif project_type == "AcousticNormalisedTranscriptionEditing": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -646,27 +674,27 @@ def get_all_review_reports( except: pass try: - total_raw_audio_duration_list.append( - anno.task.data["audio_duration"] - ) + total_raw_audio_duration_list.append(anno.task.data["audio_duration"]) except: pass else: only_tasks = True total_raw_audio_duration, total_word_count = 0, 0 if project_type in get_audio_project_types() or project_type == "AllAudioProjects": - acoustic_normalised_duration = convert_seconds_to_hours(sum(acoustic_normalised_duration)) + acoustic_normalised_duration = convert_seconds_to_hours( + sum(acoustic_normalised_duration) + ) verbatim_duration = convert_seconds_to_hours(sum(verbatim_duration)) transcribed_duration = convert_seconds_to_hours(sum(transcribed_duration)) - acoustic_normalised_word_count = convert_seconds_to_hours(sum(acoustic_normalised_word_count)) + acoustic_normalised_word_count = convert_seconds_to_hours( + sum(acoustic_normalised_word_count) + ) verbatim_word_count = convert_seconds_to_hours(sum(verbatim_word_count)) transcribed_word_count = convert_seconds_to_hours(sum(transcribed_word_count)) total_raw_audio_duration = convert_seconds_to_hours( sum(total_raw_audio_duration_list) ) - total_segment_duration = convert_seconds_to_hours( - sum(total_segment_duration) - ) + total_segment_duration = convert_seconds_to_hours(sum(total_segment_duration)) else: total_word_count = sum(total_word_count_list) cumulative_rejection_score_ar = 0 @@ -849,13 +877,19 @@ def get_all_supercheck_reports( meta_stats = anno.meta_stats if project_type == "AllAudioProjects": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -886,13 +920,19 @@ def get_all_supercheck_reports( transcribed_word_count.append(calculateAudioDuration(r)) elif project_type == "AcousticNormalisedTranscriptionEditing": if "acoustic_normalised_duration" in meta_stats: - acoustic_normalised_duration.append(meta_stats["acoustic_normalised_duration"]) + acoustic_normalised_duration.append( + meta_stats["acoustic_normalised_duration"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": - acoustic_normalised_duration.append(calculateAudioDuration(r)) + acoustic_normalised_duration.append( + calculateAudioDuration(r) + ) if "acoustic_normalised_word_count" in meta_stats: - acoustic_normalised_word_count.append(meta_stats["acoustic_normalised_word_count"]) + acoustic_normalised_word_count.append( + meta_stats["acoustic_normalised_word_count"] + ) else: for r in anno.result: if r["from_name"] == "acoustic_normalised_transcribed_json": @@ -942,18 +982,20 @@ def get_all_supercheck_reports( validated_raw_audio_duration, validated_word_count = 0, 0 if project_type in get_audio_project_types() or project_type == "AllAudioProjects": - acoustic_normalised_duration = convert_seconds_to_hours(sum(acoustic_normalised_duration)) + acoustic_normalised_duration = convert_seconds_to_hours( + sum(acoustic_normalised_duration) + ) verbatim_duration = convert_seconds_to_hours(sum(verbatim_duration)) transcribed_duration = convert_seconds_to_hours(sum(transcribed_duration)) - acoustic_normalised_word_count = convert_seconds_to_hours(sum(acoustic_normalised_word_count)) + acoustic_normalised_word_count = convert_seconds_to_hours( + sum(acoustic_normalised_word_count) + ) verbatim_word_count = convert_seconds_to_hours(sum(verbatim_word_count)) transcribed_word_count = convert_seconds_to_hours(sum(transcribed_word_count)) validated_raw_audio_duration = convert_seconds_to_hours( sum(validated_raw_audio_duration_list) ) - total_segment_duration = convert_seconds_to_hours( - sum(total_segment_duration) - ) + total_segment_duration = convert_seconds_to_hours(sum(total_segment_duration)) else: validated_word_count = sum(validated_word_count_list) cumulative_rejection_score_rs = 0