Skip to content
Extraits de code Groupes Projets
Valider 6a1a8377 rédigé par Sting's avatar Sting
Parcourir les fichiers

Remove unnecessarily nested loop

parent 98cfa51a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
__version__ = "0.2.0"
\ No newline at end of file
__version__ = "0.2.1"
\ No newline at end of file
......@@ -152,21 +152,21 @@ def gen_phone_gt(words, raw_lines, language="jp", uppercase_as_english=True):
idx_in_full_p.append([s1, s2])
s1 = s2 + 1
# beginning of a line
idx_line_p = []
last_end = 0
for i in range(len(raw_lines)):
line = []
line_phone = [(g2p_uppercase(word.lower()) if regex_uppercase.sub('', word) == '' else g2p(word.lower())) for word in raw_lines[i].split()]
for l in line_phone:
line += l + [' ']
line = line[:-1]
line = [phone if phone[-1] not in string.digits else phone[:-1] for phone in line]
offset = getsubidx(lyrics_p[last_end:], line)
assert (offset >= 0)
assert (line == lyrics_p[last_end + offset:last_end + offset + len(line)])
idx_line_p.append([last_end + offset, last_end + offset + len(line)])
last_end += offset + len(line)
# beginning of a line
idx_line_p = []
last_end = 0
for i in range(len(raw_lines)):
line = []
line_phone = [(g2p_uppercase(word.lower()) if regex_uppercase.sub('', word) == '' else g2p(word.lower())) for word in raw_lines[i].split()]
for l in line_phone:
line += l + [' ']
line = line[:-1]
line = [phone if phone[-1] not in string.digits else phone[:-1] for phone in line]
offset = getsubidx(lyrics_p[last_end:], line)
assert (offset >= 0)
assert (line == lyrics_p[last_end + offset:last_end + offset + len(line)])
idx_line_p.append([last_end + offset, last_end + offset + len(line)])
last_end += offset + len(line)
return lyrics_p, words_p, idx_in_full_p, idx_line_p
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter