Skip to content

Commit 1957518

Browse files
committed
Bugfix: Annotations without text caused problems in read_eaf.
1 parent c475c49 commit 1957518

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tgt/io.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,11 @@ def read_eaf(filename):
201201

202202
for intr in eaf_tr.iterfind('ANNOTATION/'):
203203
if intr.tag == 'ALIGNABLE_ANNOTATION':
204+
text = intr.find('ANNOTATION_VALUE').text
204205
tgt_tier.add_interval(Interval(
205206
start_time=time_slots[intr.attrib['TIME_SLOT_REF1']],
206207
end_time=time_slots[intr.attrib['TIME_SLOT_REF2']],
207-
text=intr.find('ANNOTATION_VALUE').text))
208+
text=text if text is not None else ''))
208209
else:
209210
raise Exception('Only ALIGNABLE_ANNOTATIONs are supported at the moment')
210211
tg.add_tier(tgt_tier)

tgt/io3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,11 @@ def read_eaf(filename):
195195

196196
for intr in eaf_tr.iterfind('ANNOTATION/'):
197197
if intr.tag == 'ALIGNABLE_ANNOTATION':
198+
text = intr.find('ANNOTATION_VALUE').text
198199
tgt_tier.add_interval(Interval(
199200
start_time=time_slots[intr.attrib['TIME_SLOT_REF1']],
200201
end_time=time_slots[intr.attrib['TIME_SLOT_REF2']],
201-
text=intr.find('ANNOTATION_VALUE').text))
202+
text=text if text is not None else ''))
202203
else:
203204
raise Exception('Only ALIGNABLE_ANNOTATIONs are supported at the moment')
204205
tg.add_tier(tgt_tier)

0 commit comments

Comments
 (0)