moved tokenizer loading inside of g2p function for code integrity.
This commit is contained in:
@@ -17,7 +17,6 @@ ARPA = {
|
|||||||
}
|
}
|
||||||
_g2p = G2p()
|
_g2p = G2p()
|
||||||
eng_dict = get_dict()
|
eng_dict = get_dict()
|
||||||
tokenizer = bert_models.load_tokenizer(Languages.EN)
|
|
||||||
|
|
||||||
def g2p(text: str) -> tuple[list[str], list[int], list[int]]:
|
def g2p(text: str) -> tuple[list[str], list[int], list[int]]:
|
||||||
phones = []
|
phones = []
|
||||||
@@ -115,6 +114,7 @@ def __distribute_phone(n_phone: int, n_word: int) -> list[int]:
|
|||||||
|
|
||||||
|
|
||||||
def __text_to_words(text: str) -> list[list[str]]:
|
def __text_to_words(text: str) -> list[list[str]]:
|
||||||
|
tokenizer = bert_models.load_tokenizer(Languages.EN)
|
||||||
tokens = tokenizer.tokenize(text)
|
tokens = tokenizer.tokenize(text)
|
||||||
words = []
|
words = []
|
||||||
for idx, t in enumerate(tokens):
|
for idx, t in enumerate(tokens):
|
||||||
|
|||||||
Reference in New Issue
Block a user