ldc_bpcsad.segment
.Segment
- class ldc_bpcsad.segment.Segment(onset: float, offset: float)[source]
Speech segment.
- Parameters:
- static allclose(lsegs, rsegs, atol=1e-07)[source]
Return True if two lists of segments are element-wise equal within a tolerance.
Two segments are considered equal if their onsets/offsets are within atol of each other.
- property duration
Segment duration in seconds.
- gap(other)[source]
Return gap between segment and another segment.
If the two segments overlap, the gap will have duration <= 0.
- isclose(other, atol=1e-07)[source]
Return True if onsets/offsets of segments are equal within a tolerance.
- static merge_segs(segs, thresh=0.0, is_sorted=False, copy=True)[source]
Merge segments.
Produces a new segmentation from segs by:
merging overlapping segments
merging segments separated by <= thresh seconds.
- Parameters:
segs (Iterable[Segment]) – Segments to be merged.
thresh (float, optional) – Tolerance for merging. Segments separated by <= thresh seconds will be merged. (Default: 0.0)
is_sorted (bool, optional) – If True, treat segs as already sorted. Otherwise, sort before performing mergers. (Default: False)
copy (bool, optional) – If True, create copy of segs and perform merger on this copy. (Default: True)
- Returns:
Merged segments.
- Return type:
List[Segment]