Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SN-826: enable standardised_transcription #833

Merged
merged 4 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/projects/annotation_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def convert_prediction_json_to_annotation_result(
"original_length": audio_duration,
"type": "textarea",
"value": {
"text": "",
"text": [],
},
}
)
Expand Down
7 changes: 1 addition & 6 deletions backend/tasks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,9 @@ def annotations(self, request, pk):
# modifications for integrations of chitralekha UI
if "enable_chitralekha_UI" in dict(request.query_params):
for ann in annotations:
(
subtitles,
standardised_transcription,
) = convert_result_to_chitralekha_format(
ann.result = convert_result_to_chitralekha_format(
ann.result, ann.id, project.project_type
)
# ann.result = {"subtitles": subtitles, "standardised_transcription": standardised_transcription}
ann.result = subtitles

serializer = AnnotationSerializer(annotations, many=True)
return Response(serializer.data)
Expand Down
15 changes: 9 additions & 6 deletions backend/utils/convert_result_to_chitralekha_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def create_memory(result):

def convert_result_to_chitralekha_format(result, ann_id, project_type):
if (len(result) == 1 and result[0] == {}) or len(result) == 0:
return [], None
return []
memory = create_memory(result)
modified_result = []
count = 1
Expand Down Expand Up @@ -101,15 +101,18 @@ def convert_result_to_chitralekha_format(result, ann_id, project_type):
modified_result = (
sort_result_by_start_time(modified_result) if len(modified_result) > 0 else []
)
standardised_transcription = None
""" if project_type == "AcousticNormalisedTranscription":
if project_type == "AcousticNormalisedTranscription":
standardised_transcription = (
result[memory["standardised_transcription"]]["value"]["text"][0]
if result[memory["standardised_transcription"]]["value"]["text"]
if "standardised_transcription" in memory.keys()
and result[memory["standardised_transcription"]]["value"]["text"]
else ""
)
"""
return (modified_result, standardised_transcription)
modified_result.append(
{"standardised_transcription": standardised_transcription}
)

return modified_result


def convert_fractional_time_to_formatted(decimal_time, ann_id, data_id):
Expand Down