Skip to content

Commit

Permalink
fix: words may not be aligned (e.g. do-not-align)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhdaines committed Jan 31, 2023
1 parent 19fc2f1 commit 586154d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion readalongs/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,9 @@ def add_alignments(
}
# FIXME: Should propagate durations to higher-level elements, ideally
for el in results["tokenized"].xpath("//w"):
el.attrib["time"], el.attrib["dur"] = words_dict[el.attrib["id"]]
# It may not be aligned
if el.attrib["id"] in words_dict:
el.attrib["time"], el.attrib["dur"] = words_dict[el.attrib["id"]]


def align_audio(
Expand Down

0 comments on commit 586154d

Please sign in to comment.