-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixing alignments #914
fixing alignments #914
Conversation
lhotse/supervision.py
Outdated
@@ -671,7 +671,8 @@ def with_alignment_from_ctm( | |||
num_overspanned += len(alignment) | |||
segments.append(fastcopy(seg, alignment={type: alignment})) | |||
else: | |||
segments.append([s for s in self.find(recording_id=reco_id)]) | |||
for s in self.find(recording_id=reco_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use extend()
here.
for s in self.find(recording_id=reco_id): | |
segments.extend([s for s in self.find(recording_id=reco_id)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be possible to do even segments.extend(self.find(recording_id=reco_id))
.
Can we add a unit test to cover this case?
Thanks for your first contribution! Can you also help us with testing the code? |
ok, I will work on it |
I found another error, which happens when we try to write the ctm: When there is no recording_id found, we do not write any alignment, but when there is a recording id without an alignment we write {type: []}. |
Hello,
This was not working as it created a list of segments which was appended instead of appending each segment separately. Now it seems to work.
thanks