Skip to content

Commit

Permalink
ENH: Better handle Praat TextGrids, fix #241
Browse files Browse the repository at this point in the history
* Be able to parse both "normal" and short format TextGrid files,
  in both UTF-8 and UTF-16 encoding
* Remove empty intervals by default,
  provide option to not remove them
* Be able to load a TextGrid with multiple IntervalTiers
  and then convert to an Annotation with multiple sequences
* Use reprlib with the vendored TextGrid so it is readable

Squash commits:
- Remove _vendor/textgrid
- Move textgrid module into sub-package
- Move test_textgrid into its own subpackage
- Change example TextGrid to a file with more than one tier, for demo purposes
- Add textgrid sub-package in formats/seq/
- Add tests/data_for_tests/textgrid/
- Add test fixtures:
  - a_parse_textgrid_path to fixtures/textgrid.py
  - add textgrid with empty interval fixtures
- Add test_textgrid sub-package in test_formats/test_seq
- Rewrite doc/formats/seq/textgrid.md
  • Loading branch information
NickleDave committed Mar 28, 2023
1 parent d17737f commit 54ee3c9
Show file tree
Hide file tree
Showing 46 changed files with 3,237 additions and 1,771 deletions.
7 changes: 1 addition & 6 deletions doc/formats/seq/textgrid.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ Annotation format saved by the [Praat](https://www.fon.hum.uva.nl/praat/) applic
More details about annotating with Praat can be found here:
<https://www.fon.hum.uva.nl/praat/manual/Intro_7__Annotation.html>
The specification for TextGrid objects is here:
<https://www.fon.hum.uva.nl/praat/manual/TextGrid.html>

Internally, crowsetta uses the Python tool `textgrid`
(<https://github.com/kylebgorman/textgrid>) to load .TextGrid files.
A version is distributed with crowsetta
under [MIT license](https://github.com/kylebgorman/textgrid/blob/master/LICENSE).
<https://www.fon.hum.uva.nl/praat/manual/TextGrid_file_formats.html>

The annotations can be loaded with the following class:
{py:class}`crowsetta.formats.seq.textgrid.TextGrid`.
5 changes: 0 additions & 5 deletions src/crowsetta/_vendor/textgrid/AUTHORS

This file was deleted.

7 changes: 0 additions & 7 deletions src/crowsetta/_vendor/textgrid/LICENSE

This file was deleted.

27 changes: 0 additions & 27 deletions src/crowsetta/_vendor/textgrid/README.md

This file was deleted.

1 change: 0 additions & 1 deletion src/crowsetta/_vendor/textgrid/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/crowsetta/_vendor/textgrid/exceptions.py

This file was deleted.

Loading

0 comments on commit 54ee3c9

Please sign in to comment.