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

Improved sentence segmentation based on word timestamps #982

Closed
wants to merge 2 commits into from

Conversation

Rumeysakeskin
Copy link

This PR improves sentence segmentation by handling long sentences and enforcing time-based breaks. Previously, all words between punctuation marks were grouped into a single segment, regardless of duration. This could lead to extremely long segments (60-80 seconds) which is problematic for many applications.

This PR improves sentence segmentation by handling long sentences and enforcing time-based breaks. Previously, all words between punctuation marks were grouped into a single segment, regardless of duration. This could lead to extremely long segments (60-80 seconds) which is problematic for many applications.
gap_duration = current_word_start - prev_word_end

if gap_duration >= gap_threshold:
if current_segment: # Boş segment eklemeyi önle
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
if current_segment: # Boş segment eklemeyi önle
if current_segment: # Prevent adding empty segments

if current_segment: # Boş segment eklemeyi önle
segments.append(current_segment)
current_segment = [word]
els
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
els
else:

@m-bain
Copy link
Owner

m-bain commented Jan 11, 2025

I feel like these changes should be in the subtitle writer

@Rumeysakeskin Rumeysakeskin closed this by deleting the head repository Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants