Commit ca5d8d16 authored by Sulfyderz's avatar Sulfyderz
Browse files

[New]:Adding the method write_rttm in Diar file.

parent bc53b545
......@@ -78,7 +78,8 @@ How to
* Write a diarization:
diarization = Diar.write_seg('foo.seg', diarization) //LIUM format
Diar.write_seg('foo.seg', diarization) //LIUM format
Diar.write_rttm('foo.rttm', "Last Action Hero", diarization) //RTTM format
* Add or remove an attribut:
......@@ -1017,6 +1018,24 @@ class Diar():
def write_rttm(cls, filename, showname, diarization):
Write diarization to a rttm file
:param filename: the str output filename
:param showname: the str showname of the diarization
:param diarization: the diarization to write
diarization.sort(['show', 'start'])
fic = open(filename, 'w', encoding="utf8")
line="SPEAKER "+showname.replace(' ','_')+" 1 "
for i in diarization:
fic.write(line+'{:.3f}'.format(start)+" "+'{:.3f}'.format(dur)+" <NA> <NA> "+i['cluster'].replace(' ','_')+" <NA>\n")
def write_lbl(cls, diarization, label_dir='', label_file_extension='.lbl'):
Markdown is supported
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