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

fix: adjust where g2p imports need to come from now #8

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion aligner/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def __init__(self, sentence_list, transducer):

def create_transducer(text, labels_dictionary, debug=False):
# deferred expensive imports
from g2p import CompositeTransducer, Mapping, Transducer, make_g2p
from g2p import make_g2p
Copy link
Member

Choose a reason for hiding this comment

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

We'll have to make sure this is in the migration guide!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah! Indeed. Making a note of this (the other bits are in some Studio commit messages I`ll have to dig up)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, when I made g2p -h fast, I removed a lot of imports from g2p/__init__.py, so anything expecting those imports to work will need to be changed.
You can see those changes in roedoejet/g2p@0b8d773
I could argue it was not great style to import just to expose, but that's irrelevant: if packages using g2p took advantage of that, we need to warn them!
And that makes me realize that commit really should have had a breaking change warning. I didn't think of those changes as breaking because we don't document anywhere that those imports were part of the API.

from g2p.mappings import Mapping
from g2p.transducer import CompositeTransducer, Transducer

text = text.lower()
allowable_chars = labels_dictionary.keys()
Expand Down