Skip to content

Conversation

@hbredin
Copy link
Member

@hbredin hbredin commented Sep 16, 2025

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds an iterator method to the Annotation class, allowing users to iterate over annotation segments and their labels in chronological order. The iterator provides a convenient way to access (segment, label) pairs without needing to call the existing itertracks method explicitly.

  • Added __iter__ method to Annotation class that yields (segment, label) tuples
  • Updated changelog to document the new feature

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/pyannote/core/annotation.py Implements the __iter__ method that wraps itertracks to yield (segment, label) pairs
CHANGELOG.md Documents the new iterator feature in version 6.0.1

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

"""
return len(self._tracks) > 0

def __iter__(self) -> Iterator[Tuple[Segment, Label]]:
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

The return type annotation references Label but this type is not imported. Either import Label from the appropriate module or use a more generic type annotation like Any or str.

Copilot uses AI. Check for mistakes.

## Version 6.0.1 (wip)

- feat: add `Annotation.__iter__` (turn: Segment, speaker: str) iterator
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

The changelog description mentions '(turn: Segment, speaker: str)' but the actual implementation yields (Segment, Label) pairs. The description should be updated to match the implementation or clarify what Label represents.

Suggested change
- feat: add `Annotation.__iter__` (turn: Segment, speaker: str) iterator
- feat: add `Annotation.__iter__` iterator yielding (Segment, Label) pairs, where Label is typically a speaker name or class

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@juanmc2005 juanmc2005 left a comment

Choose a reason for hiding this comment

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

Been waiting for this my entire life 😄

@hbredin hbredin merged commit 7e698cb into develop Sep 16, 2025
6 checks passed
@hbredin hbredin deleted the feat/Annotation.__iter__ branch September 16, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants