From 6a1a8377b9b75651d19efbbf7f9afd98396609a5 Mon Sep 17 00:00:00 2001
From: Sting <loic.allegre@ensiie.fr>
Date: Fri, 10 Nov 2023 13:56:56 +0100
Subject: [PATCH] Remove unnecessarily nested loop

---
 autokara/__init__.py                      |  2 +-
 autokara/autosyl/LyricsAlignment/utils.py | 30 +++++++++++------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/autokara/__init__.py b/autokara/__init__.py
index 90276fd..32f115e 100644
--- a/autokara/__init__.py
+++ b/autokara/__init__.py
@@ -1,2 +1,2 @@
 
-__version__ = "0.2.0"
\ No newline at end of file
+__version__ = "0.2.1"
\ No newline at end of file
diff --git a/autokara/autosyl/LyricsAlignment/utils.py b/autokara/autosyl/LyricsAlignment/utils.py
index 09f4703..7c6389e 100644
--- a/autokara/autosyl/LyricsAlignment/utils.py
+++ b/autokara/autosyl/LyricsAlignment/utils.py
@@ -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
 
-- 
GitLab