You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorporate app-text-slicer functionality into text_document_helper as the app is discontinued #417
The core text slicing functionality is straightforward to absorb into the helper utility. Slicing text is primarily useful during internal app development rather than serving as an end-user pipeline step, making a standalone CLAMS app unnecessary.
#418 covers the core feature of app-text-slicer (the transcript text of each TimeFrame) with the existing Mmif.get_annotations_between_time, so the SDK needs no new function. Calling it with at_types=[AnnotationTypes.Token] gives the Tokens of a time range. Selecting TimeFrames by label, which the app did with containLabel, is already Mmif.get_annotations_of_labels. text_document_helper.slice_text, which joins the Tokens of every transcript into one string, is deprecated and will be removed in 2.0.0.
While doing so, I fixed these bugs in get_annotations_between_time:
Annotations that start or end exactly on the range boundary were left out, so slicing a segment dropped its first and last words (and a short segment could come back empty).
The time unit was read from each view's TimeFrame entry in contains, which fails on a view of TimePoints only, and a view holding both TimeFrames and TimePoints was searched twice, so its matches came back twice.
A Token aligned to more than one anchor in the range (for example, a word TimeFrame plus a forced aligner's TimeFrame) was returned once per anchor.
I also clarified the behavior:
The range includes its start and excludes its end, and any overlap counts. A zero-length anchor (a TimePoint, or a TimeFrame with equal start and end) belongs to the range it falls in. Ranges that meet end to end share no annotation.
Every time anchor in the MMIF must be in integer milliseconds. One that declares another timeUnit, or has a non-integer time, raises ValueError instead of being converted (the app passed times on as milliseconds whatever the unit).
Query times in units other than milliseconds (the time_unit argument) still work with a DeprecationWarning until 2.0.0; frames raise.
Activity
keighrim commentedon Nov 5, 2026
#418 covers the core feature of
app-text-slicer(the transcript text of eachTimeFrame) with the existingMmif.get_annotations_between_time, so the SDK needs no new function. Calling it withat_types=[AnnotationTypes.Token]gives the Tokens of a time range. Selecting TimeFrames by label, which the app did withcontainLabel, is alreadyMmif.get_annotations_of_labels.text_document_helper.slice_text, which joins the Tokens of every transcript into one string, is deprecated and will be removed in 2.0.0.While doing so, I fixed these bugs in
get_annotations_between_time:TimeFrameentry incontains, which fails on a view of TimePoints only, and a view holding both TimeFrames and TimePoints was searched twice, so its matches came back twice.I also clarified the behavior:
timeUnit, or has a non-integer time, raisesValueErrorinstead of being converted (the app passed times on as milliseconds whatever the unit).time_unitargument) still work with aDeprecationWarninguntil 2.0.0; frames raise.