@@ -1232,7 +1232,9 @@ def _sync_onset(raw, onset, inverse=False):
12321232 return annot_start
12331233
12341234
1235- def _annotations_starts_stops (raw , kinds , name = "skip_by_annotation" , invert = False ):
1235+ def _annotations_starts_stops (
1236+ raw , kinds , name = "skip_by_annotation" , exact_match = False , invert = False
1237+ ):
12361238 """Get starts and stops from given kinds.
12371239
12381240 onsets and ends are inclusive.
@@ -1247,11 +1249,18 @@ def _annotations_starts_stops(raw, kinds, name="skip_by_annotation", invert=Fals
12471249 if len (raw .annotations ) == 0 :
12481250 onsets , ends = np .array ([], int ), np .array ([], int )
12491251 else :
1250- idxs = [
1251- idx
1252- for idx , desc in enumerate (raw .annotations .description )
1253- if any (desc .upper ().startswith (kind .upper ()) for kind in kinds )
1254- ]
1252+ if exact_match :
1253+ idxs = [
1254+ idx
1255+ for idx , desc in enumerate (raw .annotations .description )
1256+ if desc in kinds
1257+ ]
1258+ else :
1259+ idxs = [
1260+ idx
1261+ for idx , desc in enumerate (raw .annotations .description )
1262+ if any (desc .upper ().startswith (kind .upper ()) for kind in kinds )
1263+ ]
12551264 # onsets are already sorted
12561265 onsets = raw .annotations .onset [idxs ]
12571266 onsets = _sync_onset (raw , onsets )
0 commit comments