Skip to content

Commit

Permalink
correct argument for textgrid tier extractor
Browse files Browse the repository at this point in the history
when extracting a tier from .textfile, tg.getFirst() requires a tiername argument, and it should be one of the tier names from the original .textgrid file. Previously, PCT instead passed a name that user defines in PCT dialog. If user chooses a name other than the original tiername, the tg.getFirst() function cannot refer to the right tier, thus raised error.
  • Loading branch information
stannam committed Feb 9, 2022
1 parent 02bcf7f commit 60ca8ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions corpustools/corpus/io/pct_textgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def textgrid_to_data(corpus_name, path, annotation_types, stop_check=None, call_
cur += 1
call_back(cur)

spelling_tier = tg.getFirst(word_name)
spelling_tier = tg.getFirst(data.data[word_name].output_name)

for si in spelling_tier:
if not si.mark:# is None:
Expand All @@ -214,7 +214,7 @@ def textgrid_to_data(corpus_name, path, annotation_types, stop_check=None, call_
#compare with data.word_levels a few lines back in the nesting loop
if data[word_name].speaker != data[n].speaker and data[n].speaker is not None:
continue
t = tg.getFirst(n)
t = tg.getFirst(data[n].output_name)
# t is a list of Intervals
tier_elements = list()
for ti in t:
Expand Down Expand Up @@ -292,7 +292,7 @@ def textgrid_to_data(corpus_name, path, annotation_types, stop_check=None, call_
#same after the function call
#the annotations dictionary seems to contain useful information about words, but none of it is ever used
transcription_flag = {trans: False for trans, flag in transcription_flag.items()}
if len(annotation_types[0]) == 0:
if all([len(at) == 0 for at in annotation_types]):
raise(TextGridIOError('Empty corpus',
'Currently PCT is not able to import a TextGrid corpus with only a Transcription tier. '
'You must select another tier to be Orthography. If your TextGrid file only has one tier, '
Expand Down

1 comment on commit 60ca8ac

@stannam
Copy link
Member Author

@stannam stannam commented on 60ca8ac Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed issue #798

Please sign in to comment.