All problems
Diarization Segment Count
Problem
Count the number of speaker segments by counting runs of equal labels.
An empty label sequence gives 0, and each change of speaker starts a new segment.
Hint
Compare each label with the previous one and count the changes.
Test cases
case 1
in: [["a","a","b","b","a"]]
expected: 3
case 2
in: [[]]
expected: 0
case 3
in: [["a"]]
expected: 1
case 4
in: [["a","b","c"]]
expected: 3
Starter codePython
def diarization_segment_count(labels):
# Your code here
pass4 test cases · run your code against them in the editor