czyoung commited on
Commit
b1c27b9
·
verified ·
1 Parent(s): 04dd473

Update sonogram_utility.py

Browse files
Files changed (1) hide show
  1. sonogram_utility.py +11 -3
sonogram_utility.py CHANGED
@@ -374,7 +374,10 @@ def calcSpeakingTypes(myAnnotation,maxTime):
374
  continue
375
  # Add to one voice
376
  oneVoice.append((currID,currSegment))
377
- for _,timeSlot in multiVoice:
 
 
 
378
  copyOfNo = copy.deepcopy(noVoice)
379
  for emptySlot in noVoice:
380
  if checkForOverlap(timeSlot,emptySlot) is None:
@@ -383,7 +386,8 @@ def calcSpeakingTypes(myAnnotation,maxTime):
383
  copyOfNo.remove(emptySlot)
384
  copyOfNo += removeOverlap(emptySlot,timeSlot)
385
  noVoice = copyOfNo
386
- for _,timeSlot in oneVoice:
 
387
  copyOfNo = copy.deepcopy(noVoice)
388
  for emptySlot in noVoice:
389
  if checkForOverlap(timeSlot,emptySlot) is None:
@@ -392,7 +396,11 @@ def calcSpeakingTypes(myAnnotation,maxTime):
392
  copyOfNo.remove(emptySlot)
393
  copyOfNo += removeOverlap(emptySlot,timeSlot)
394
  noVoice = copyOfNo
395
- return noVoice, oneVoice, multiVoice
 
 
 
 
396
 
397
  def timeToString(timeInSeconds):
398
  if isinstance(timeInSeconds,list):
 
374
  continue
375
  # Add to one voice
376
  oneVoice.append((currID,currSegment))
377
+ ovAnnotation = Annotation()
378
+ mvAnnotation = Annotation()
379
+ for currID,timeSlot in multiVoice:
380
+ mvAnnotation[timeSlot] = currID
381
  copyOfNo = copy.deepcopy(noVoice)
382
  for emptySlot in noVoice:
383
  if checkForOverlap(timeSlot,emptySlot) is None:
 
386
  copyOfNo.remove(emptySlot)
387
  copyOfNo += removeOverlap(emptySlot,timeSlot)
388
  noVoice = copyOfNo
389
+ for currID,timeSlot in oneVoice:
390
+ ovAnnotation[timeSlot] = currID
391
  copyOfNo = copy.deepcopy(noVoice)
392
  for emptySlot in noVoice:
393
  if checkForOverlap(timeSlot,emptySlot) is None:
 
396
  copyOfNo.remove(emptySlot)
397
  copyOfNo += removeOverlap(emptySlot,timeSlot)
398
  noVoice = copyOfNo
399
+ nvAnnotation = Annotation()
400
+ for emptySlot in noVoice:
401
+ nvAnnotation[emptySlot] = "None"
402
+
403
+ return nvAnnotation, ovAnnotation, mvAnnotation
404
 
405
  def timeToString(timeInSeconds):
406
  if isinstance(timeInSeconds,list):