Skip to content

[WIP] Tiered annotations #81

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 37 commits into
base: develop
Choose a base branch
from

Conversation

hadware
Copy link
Contributor

@hadware hadware commented Aug 26, 2022

Old idea, finally took some time to implement it.

This is more or less an implementation of the Praat/Elan tiered structure. Here are a couple of key points for this

  • There are two data structures TieredAnnotation and Tier. A TieredAnnotation is made out of Tiers
  • The structure is basically and schematically a dict of dict : TieredAnnotation[str, Tier[Segment,Label]]
  • A Tier is a thin wrapper over a timeline, used to keep store segments and take care of the cropping/support/etc-related operations
  • The TieredAnnotation shouldn't have that many available methods other than:
    • accessing tiers and tiers information
    • cropping/extruding/etc (all just done by the underlying Tiers)
    • Iterating over segment
  • Support for textigrid files parsing is optional, and added by running pip install pyannote.core[textgrid]. This installs textgrid-parser, my sly-based parser.

I'll follow up with a couple of questions to tune my implem to your preferences

hadware and others added 26 commits December 9, 2019 04:03
…ype hints should be good for the API objects.
# Conflicts:
#	pyannote/core/annotation.py
#	pyannote/core/segment.py
#	pyannote/core/timeline.py
…ailing in timeline.py. Added a type for LabelGenerator modes.
# Conflicts:
#	pyannote/core/segment.py
@hadware
Copy link
Contributor Author

hadware commented Aug 26, 2022

Alright, questions now:

  • Since Tier is such a thin wrapper above Timeline, I'm wondering if I shouldn't just inherit from it. This would still require some methods to be overridden to make sure the returned type is right, but you get the point
  • I've added the allow_overlap option to tiers to (optionally) more closely mimic TextGrid/Eaf's behavior. What do you think about that?
  • I kind of modeled TieredAnnotation on Annotation, and thus, (for now) left the self._timeline attribute that is a "lazy" cache of the TieredAnnotation's timeline. I don't think this has any use anymore, but I wanted your opinion on this.

@hbredin
Copy link
Member

hbredin commented Aug 31, 2022

Thanks @hadware. Will look into this at some point...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants