Skip to content

Commit

Permalink
Merge pull request #395 from AI4Bharat/translation_bugs
Browse files Browse the repository at this point in the history
Modify output for sentences info
  • Loading branch information
Shruti1229 authored Jul 20, 2023
2 parents 6fe41f2 + d5e4299 commit c156e2f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions backend/voiceover/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,16 +352,31 @@ def get_bad_sentences(translation_obj, target_language):
translation["payload"].pop(index)
for ind, text in enumerate(translation["payload"]):
if not compare_time(text["end_time"], text["start_time"])[0]:
problem_sentences.append({"index": ind, "segment": text})
problem_sentences.append(
{
"index": ind,
"start_time": text["start_time"],
"end_time": text["end_time"],
"text": text["text"],
"target_text": text["target_text"],
}
)
if (
ind != 0
and ind < len(translation["payload"])
and compare_time(
translation["payload"][ind - 1]["end_time"], text["start_time"]
)[0]
):
problem_sentences.append({"index": ind, "segment": text})

problem_sentences.append(
{
"index": ind,
"start_time": text["start_time"],
"end_time": text["end_time"],
"text": text["text"],
"target_text": text["target_text"],
}
)
return problem_sentences


Expand Down

0 comments on commit c156e2f

Please sign in to comment.