Skip to content
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

[Feature Request]: Refactor SequenceTier.__init__() for easier textgrid creation/splitting #168

Open
1 task done
chrisbrickhouse opened this issue Feb 26, 2024 · 0 comments · Fixed by #175
Open
1 task done
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@chrisbrickhouse
Copy link
Member

What feature would you like added?

The following lines should be moved to their own (internal) function similar to __set_precedence() for easier code reuse:

        self.entry_class = entry_class
        self.superset_class = self.entry_class.superset_class
        self.subset_class =  self.entry_class.subset_class
        entry_order = np.argsort([x.start for x in self.entry_list])
        self.entry_list = [self.entry_list[idx] for idx in entry_order]
        self.sequence_list = []
        for entry in self.entry_list:
            this_seq = self.entry_class(entry)
            this_seq.set_superset_class(self.superset_class)
            this_seq.set_subset_class(self.subset_class)
            self.sequence_list += [this_seq]

What would the use case be for this feature?

I'm working on splitting up some textgrids and the workflow is mostly pretty good, but these operations need to be set manually when building a textgrid from scratch. For example, you can create an empty SequenceTier and populate it with intervals and run ST.__set_precedence() since those init operations are their own function, but if you want to set super/subset attributes or make sure everything is properly ordered, that needs to be done manually. If these operations were their own function, then I could just call that function and make code reuse easier.

Would you like to help add this feature?

Yes, and I will submit a pull request soon.

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

2 participants