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

Modify output for sentences info #395

Merged
merged 1 commit into from
Jul 20, 2023
Merged
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
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
Loading