[−][src]Function alass_core::align
pub fn align(
reference: &[TimeSpan],
list: &[TimeSpan],
split_penalty: f64,
speed_optimization: Option<f64>,
score_fn: impl Fn(TimeDelta, TimeDelta) -> f64 + Copy,
progress_handler: impl ProgressHandler
) -> (Vec<TimeDelta>, f64)
Matches an incorrect
subtitle list to a reference
subtitle list.
Returns the delta for every time span in list.
The split_penalty_normalized
is a value between
0 and 1000. Providing 0 will make the algorithm indifferent of splitting lines (resulting in MANY
different deltas), so this is not recommended. Providing 1000 will assure that no split will occur,
so only one/the best offset is applied to ALL lines. The most common useful values are in the
4 to 20 range (optimum 7+-1).
Especially for larger subtitles (e.g. 1 hour in millisecond resolution and 1000 subtitle lines) this
process might take some seconds. To provide user feedback one can pass a ProgressHandler
to
this function.
If you want to increase the speed of the alignment process, you can use the speed_optimization
parameter. This value can be between 0
and +inf
, altough after 10
the accuracy
will have greatly degraded. It is recommended to supply a value around 3
.
Use standard_scoring
as score function if no fine tuning is required.