def convert_to_segmentation_schema(filename, segmentation): # Create a segmentation object to serialize seg_schema = Segmentation() seg_schema.media.filename = filename # For each segment returned by the ina_speech_segmenter, add # a corresponding segment formatted to json spec for segment in segmentation: seg_schema.addSegment(segment[0], segment[0], float(segment[1]), float(segment[2])) return seg_schema
def convert_to_segmentation_schema(filename, segmentation): media = SegmentationMedia() media.filename = filename # Create a segmentation object to serialize seg_schema = Segmentation(media=media) # For each segment returned by the ina_speech_segmenter, add # a corresponding segment formatted to json spec row = 0 for segment in segmentation: row += 1 if row == 1: continue seg_schema.addSegment(segment[0], segment[0], float(segment[1]), float(segment[2])) return seg_schema