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

Textgrid validation #26

Closed timmahrt closed 2 years ago

timmahrt commented 3 years ago

A user might make certain assumptions about their data and praatio will silently break those expectations. It can make calculation errors go unnoticed.

Scenario A

Scenario B?

Solution?

timmahrt commented 3 years ago

Adding a parameter to addTier to enforce lengths could be prblematic because its used in a lot of places.

What about a "safety" mode set on the Textgrid. If turned on, some operations will throw errors if they encounter unexpected data? Although that sounds kindof vague and hard to understand for the user about when or when something is or is not being validated.

GalaxieT commented 3 years ago

How about just show warnings and info about it, instead of interrupting the process?

timmahrt commented 3 years ago

I could imagine all three scenarios would be useful in different cases: silence, warn, exit.

timmahrt commented 3 years ago

I'm getting closish to a release. Praatio 5.0 will feature Textgrid validation. Users will have a choice to to silently ignore errors, print to the screen (default behavior), or to stop execution on errors.

Wholistic validation is done on save but more narrow validation is done when automatic "unexpected" behavior might occur, such as when adding new entries to a tier or when adding a tier to a textgrid. PR to change this and a lot of other things is here: https://github.com/timmahrt/praatIO/pull/28

I still need to write lots of tests and update the documentation--I'm going to aim to have it done in a week or two.

GalaxieT commented 3 years ago

That's very nice!

timmahrt commented 2 years ago

Praatio 5.0 is now released. As with my previous comment functions that may result in automatic "unexpected" behavior take a flag to either silently change, change and print a warning, or throw an exception.

Sorry for the delay, I was too ambitious in all of the features that I added into this release!

GalaxieT commented 2 years ago

Nevermind, and the new release looks amazing!