-
Notifications
You must be signed in to change notification settings - Fork 225
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
Add trim_to_alignments()
method
#926
Conversation
All tests are passing on my side (although I have to use |
merged_alignments = [(alignments[0], [0])] | ||
for i, item in enumerate(alignments[1:]): | ||
prev_item, prev_indices = merged_alignments[-1] | ||
if item.start - prev_item.end <= max_pause: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A catch here is that if there are alignment items which are continuous (i.e. prev_end == cur_start
) then they will necessarily get merged. So in order to trim such that we get #cuts = num. of alignment items, a negative value of max_pause
will need to be passed.
Thanks for testing this. I will verify it on my end and then ask @pzelasko to merge if he doesn't see any immediate issues. |
I think I have convinced myself that this works as expected. @pzelasko could you please check when you have some time? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good to me, just left one comment.
Done. |
Based on discussion in #923