Skip to content

Add Word-Level Alignment#215

Merged
fabiocat93 merged 74 commits into
mainfrom
214-task-word-level-alignment
Jun 11, 2025
Merged

Add Word-Level Alignment#215
fabiocat93 merged 74 commits into
mainfrom
214-task-word-level-alignment

Conversation

@ibevers

@ibevers ibevers commented Dec 5, 2024

Copy link
Copy Markdown
Collaborator

Description

  • Fixes a bug that was leading to incorrect alignments.
  • Updates the output to give transcription, sentence, word, and character timestamps.
  • Adds a recursive evaluation function for ensuring the differences in timestamps between two alignments are under a certain threshold.
  • Adds a test that validates that the generated alignments match a publicly available alignment with a tolerance of .1 second for every start and end timestamp for every aligned level present in both alignments.
  • Uses SenseLab native data types more (can be fully converted to SenseLab types in the future).
  • Adds optional levels so the user can include or exclude utterance, word, and character-level alignments.
  • Adds a tutorial for forced alignment.
  • Adds a docs.md for forced alignment.

Related Issue(s)

#14

Motivation and Context

Corrects buggy forced alignment and adds more granular alignment (word and character), which is useful for various purposes. This is a character-based approach. I plan to add a phoneme-based approach in the future to compare to this.

How Has This Been Tested?

Added test to compare with publicly available alignment. Plan to do more comprehensive evaluation on TIMIT as soon as possible.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My code follows the code style of this project.

@ibevers ibevers linked an issue Dec 5, 2024 that may be closed by this pull request
3 tasks
@ibevers

ibevers commented Dec 5, 2024

Copy link
Copy Markdown
Collaborator Author
  • Identify where the timestamps are calculated for indices
  • Ensure indices for words are present at that point
  • Update to calculate timestamps for words
  • Ensure word timestamps are stored in final result

@ibevers

ibevers commented Dec 17, 2024

Copy link
Copy Markdown
Collaborator Author

Update 12/09:
Reviewed code and identified what needs to be changed. Still figuring out how exactly it should be changed.

Update 12/17:
The code works and returns an aligned ScriptLine for sentences, words, and characters. I am now fixing discrepancies with the previous tests. I also plan to add a correctness test for at least one labeled example.

@ibevers
ibevers marked this pull request as ready for review December 19, 2024 17:49
@ibevers

ibevers commented Dec 19, 2024

Copy link
Copy Markdown
Collaborator Author

@fabiocat93 Would you kindly allow the workflow to run tests on this? All the forced alignment-relevant tests pass. I haven't run all the tests locally because I still have to address the squim issue.

@ibevers

ibevers commented Apr 18, 2025

Copy link
Copy Markdown
Collaborator Author

@fabiocat93 I addressed all your feedback:) Mergable?

@ibevers

ibevers commented Apr 18, 2025

Copy link
Copy Markdown
Collaborator Author
  • Add links in docs.md

@fabiocat93
fabiocat93 self-requested a review April 29, 2025 14:14

@fabiocat93 fabiocat93 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ibevers , it looks good to me. You only need unit tests to pass

@ibevers

ibevers commented Apr 30, 2025

Copy link
Copy Markdown
Collaborator Author

Hi @ibevers , it looks good to me. You only need unit tests to pass

Thanks! I think there might be an issue with the CI configuration since the error here is common to another unrelated PR--see here: #321

@ibevers
ibevers requested a review from 900miles June 10, 2025 20:38

@900miles 900miles left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I unfortunately didn't have time for a thorough review but the notebook uses an outdated form of loading audio from file so it gives an error. A couple of other comments but it seems to run okay otherwise.

Comment thread tutorials/audio/forced_alignment.ipynb Outdated
Comment thread src/senselab/audio/tasks/forced_alignment/forced_alignment.py Outdated
Comment thread src/senselab/audio/tasks/forced_alignment/forced_alignment.py
Comment thread src/senselab/audio/tasks/forced_alignment/forced_alignment.py
Comment thread src/senselab/audio/tasks/forced_alignment/forced_alignment.py Outdated
@ibevers
ibevers requested a review from 900miles June 10, 2025 21:28

@900miles 900miles left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@ibevers

ibevers commented Jun 11, 2025

Copy link
Copy Markdown
Collaborator Author

@fabiocat93 mergable ("Merging is blocked.")?

@fabiocat93

Copy link
Copy Markdown
Collaborator

@fabiocat93 mergable ("Merging is blocked.")?

image

@fabiocat93
fabiocat93 merged commit d92f523 into main Jun 11, 2025
15 checks passed
@fabiocat93
fabiocat93 deleted the 214-task-word-level-alignment branch October 28, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task: Word-Level Alignment

4 participants