Support relative paths in CSVs

This commit is contained in:
Reuben Morais 2018-09-14 11:14:49 -03:00
parent 44e502e236
commit 25a9e76afc

View File

@ -53,6 +53,9 @@ def preprocess(csv_files, batch_size, numcep, numcontext, alphabet, hdf5_cache_p
source_data = None
for csv in csv_files:
file = pandas.read_csv(csv, encoding='utf-8', na_filter=False)
#FIXME: not cross-platform
csv_dir = os.path.dirname(os.path.abspath(csv))
file['wav_filename'] = file['wav_filename'].str.replace(r'(^[^/])', lambda m: os.path.join(csv_dir, m.group(1)))
if source_data is None:
source_data = file
else: