Commit 53df6051 authored by Sulfyderz's avatar Sulfyderz
Browse files

[Error Update]:Correcting some methods in diar_tools.py.

parent 53b7b9ec
......@@ -1867,16 +1867,12 @@ def matchingSegmentsFromSegment(segment,diar):
break
return dictMatch
# Returns a diar object corresponding to the merging of two diar objects
def mergeDiar(diar1,diar2,sort=False):
assert isinstance(diar1,Diar) and isinstance(diar2,Diar) and isinstance(sort,bool)
if len(diar1)>=len(diar2):
out_diar=copy.deepcopy(diar1)
add_diar=copy.deepcopy(diar2)
else:
out_diar=copy.deepcopy(diar2)
add_diar=copy.deepcopy(diar1)
out_diar.append_diar(add_diar)
# Returns a new diar object corresponding to the merging of two diar objects
def mergeDiar(diarBase,diarAdd,sort=False):
assert isinstance(diarBase,Diar) and isinstance(diarAdd,Diar) and isinstance(sort,bool)
out_diar=copy.deepcopy(diarBase)
add_diar=copy.deepcopy(diarAdd)
out_diar.append_diar(diarAdd)
if sort:
out_diar.sort()
return out_diar
......@@ -2172,13 +2168,11 @@ def rmOvlpSegments(diar, epsilon):
def safeAnnotationDiar(diar,diarUem=None,addNoise=True,segmentFollowed=None,withoutSpeechTurn=100):
assert isinstance(withoutSpeechTurn,numbers.Number) and isinstance(diar,Diar) and (isinstance(diarUem,Diar) or diarUem is None) and (isinstance(segmentFollowed,numbers.Number) or segmentFollowed is None) and isinstance(addNoise,bool)
diar=copy.deepcopy(diar)
diar.del_attribut('gender')
if diarUem is None:
diarUem=Diar()
diarUem.append(show=diar[0]["show"], cluster='nonspeech', start=min(diar.unique('start')), stop=max(diar.unique('stop')))
else:
diarUem=copy.deepcopy(diarUem)
diarUem.del_attribut('gender')
diarNoise=copy.deepcopy(diarUem)
for i in diar:
diarNoise=releaseFramesFromSegment(i,diarNoise)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment