RodrigoLimaRFL commited on
Commit
c13860d
·
verified ·
1 Parent(s): 5264ad1

Update NURC-SP_ENTOA_TTS.py

Browse files
Files changed (1) hide show
  1. NURC-SP_ENTOA_TTS.py +50 -0
NURC-SP_ENTOA_TTS.py CHANGED
@@ -108,7 +108,57 @@ class EntoaDataset(GeneratorBasedBuilder):
108
  ),
109
  ]
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  def _generate_examples(self, prompts_path, path_to_clips, audio_files):
 
112
  examples = {}
113
  with open(prompts_path, "r") as f:
114
  csv_reader = csv.DictReader(f)
 
108
  ),
109
  ]
110
 
111
+ def debug_path_matching(csv_path, archive_files):
112
+ """
113
+ Debug utility to compare paths between CSV and archive files
114
+ """
115
+ import csv
116
+ from collections import defaultdict
117
+
118
+ # Store CSV paths
119
+ csv_paths = set()
120
+ with open(csv_path, "r") as f:
121
+ reader = csv.DictReader(f)
122
+ for row in reader:
123
+ # Store both the full path and filename
124
+ path = row.get("path") or row.get("file_path")
125
+ csv_paths.add(path)
126
+ csv_paths.add(path.split("/")[-1])
127
+
128
+ # Compare with archive paths
129
+ archive_paths = set()
130
+ matches = defaultdict(list)
131
+
132
+ for path, _ in archive_files:
133
+ archive_paths.add(path)
134
+ archive_paths.add(path.split("/")[-1])
135
+
136
+ # Check for matches
137
+ for csv_path in csv_paths:
138
+ if path.endswith(csv_path) or csv_path.endswith(path):
139
+ matches[path].append(csv_path)
140
+
141
+ print("=== Debug Report ===")
142
+ print(f"CSV Paths: {len(csv_paths)}")
143
+ print(f"Archive Paths: {len(archive_paths)}")
144
+ print(f"Matched Paths: {len(matches)}")
145
+ print("\nSample CSV paths:")
146
+ for path in list(csv_paths)[:5]:
147
+ print(f" {path}")
148
+ print("\nSample Archive paths:")
149
+ for path in list(archive_paths)[:5]:
150
+ print(f" {path}")
151
+ print("\nSample Matches:")
152
+ for archive_path, csv_paths in list(matches.items())[:5]:
153
+ print(f" Archive: {archive_path}")
154
+ print(f" CSV: {csv_paths}")
155
+ print()
156
+
157
+ return csv_paths, archive_paths, matches
158
+
159
+
160
  def _generate_examples(self, prompts_path, path_to_clips, audio_files):
161
+ csv_paths, archive_paths, matches = debug_path_matching(prompts_path, audio_files)
162
  examples = {}
163
  with open(prompts_path, "r") as f:
164
  csv_reader = csv.DictReader(f)