Module utils

Module utils 

Source
Available on crate feature analysis only.
Expand description

Utility functions for dialogue event analysis

Provides common operations for collections of dialogue events including sorting, duration calculations, and overlap detection. Optimized for performance with large event collections.

§Features

  • Efficient sorting by timing with stable ordering
  • Total duration calculation across event collections
  • Overlap detection delegation to efficient algorithms
  • Zero-allocation operations where possible

§Performance

  • Sorting: O(n log n) with optimized comparison
  • Duration: O(n) single pass with min/max tracking
  • Overlap detection: O(n log n) via sweep-line algorithm

Functions§

calculate_average_duration
Calculate average event duration
calculate_total_duration
Calculate total duration spanning all events
count_overlapping_dialogue_events
Count overlapping dialogue events efficiently
find_events_in_range
Find events within a specific time range
find_overlapping_dialogue_events
Find overlapping dialogue events using efficient timing analysis
sort_events_by_time
Sort events by timing with stable ordering