-
Notifications
You must be signed in to change notification settings - Fork 377
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
Improve SegmentSeeker word alignment #305
Conversation
Co-authored-by: Andrew Wooster <[email protected]>
- This will allow wrapper to handle newer versions of the tokenizer protocol without requiring strict conformance
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.
lgtm
} | ||
|
||
public init( | ||
id: Int = 0, |
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.
since we set defaults here, we should remove redundancy above
return updatedSegments | ||
} | ||
|
||
public func calculateWordDurationConstraints(alignment: [WordTiming]) -> (Float, Float) { |
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.
let's add names to Floats in the return tuple, i.e. (median: Float, max: Float)
let end = (timeOffset + timing.end).rounded(2) | ||
|
||
// Handle short duration words by moving their start time back if there's space | ||
if end - start < constrainedMedianDuration / 4 { |
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.
nit: it would be nice to add example in comments for each of these if/else cases
These changes primarily focus on enhancing the
SegmentSeeker
class to fix some edge cases and make it more testable. It also adds public initializers to various structs and uses more flexible dependency versioning to allow usage of newer versions of swift-transformers if desired.