timmahrt / praatIO

A python library for working with praat, textgrids, time aligned audio transcripts, and audio files. It is primarily used for extracting features from and making manipulations on audio files given hierarchical time-aligned transcriptions (utterance > word > syllable > phone, etc).
MIT License
299 stars 32 forks source link

Textgrids with non-unique tier names cannot be opened #32

Closed timmahrt closed 2 years ago

timmahrt commented 2 years ago

I received an email request for this feature, so I'm documenting it here as an issue.

Praat will allow tiers in the same textgrid to have the same name. Praatio references tiers by name using a dictionary, so the tier names must be unique. If an affected textgrid is opened in Praatio, an exception is thrown.

It would be nice if somehow, these textgrids could be opened in Praatio.

timmahrt commented 2 years ago

A fix for this was added in praatio 5 -- textgrid.openTextgrid() has a new argument 'duplicateNamesMode'. By default it will raise an exception--but if the user is ok with it, they can set it to rename. In this case, praatio will rename tiers by appending numbers to them so that all tiers have unique names.

It's not ideal, but I wasn't sure of a better solution.

timmahrt commented 2 years ago

I'll close this after Praatio 5.0 is released (preferably if I can get feedback from the original issue reporter first).

timmahrt commented 2 years ago

This is now supported in Praatio 5.0.0.