Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare timit manifests #324

Merged
merged 13 commits into from
Jul 19, 2021
16 changes: 8 additions & 8 deletions lhotse/recipes/timit.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ def prepare_timit(
wav_files = []
file_name = ''

if part == 'TRAIN':
file_name = os.path.join(splits_dir, 'train_samples.txt')
if part == 'TRAIN':
file_name = splits_dir/'train_samples.txt'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to add a space before and after opterator "/".

-file_name = splits_dir/'train_samples.txt'
+ file_name = splits_dir / 'train_samples.txt'

elif part == 'DEV':
file_name = os.path.join(splits_dir, 'dev_samples.txt')
file_name = splits_dir/'dev_samples.txt'
else:
file_name = os.path.join(splits_dir, 'tst_samples.txt')

file_name = splits_dir/'tst_samples.txt'
wav_files = []
with open(file_name, 'r') as f:
lines = f.readlines()
lines = f.readlines()
for line in lines:
items = line.strip().split(' ')
wav = os.path.join(corpus_dir, items[-1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wav = os.path.join(corpus_dir, items[-1])
wav = corpus_dir / items[-1]

Expand All @@ -98,8 +98,8 @@ def prepare_timit(
for wav_file in tqdm(wav_files):
items = wav_file.split('/')
idx = items[-2] + '-' + items[-1][:-4]
speaker = items[-2]
transcript_file = wav_file[:-3] + 'PHN' ###the phone file
speaker = items[-2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove ALL leading and trailing spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do it.

transcript_file = Path(wav_file).with_suffix('.PHN')
if not Path(wav_file).is_file():
logging.warning(f'No such file: {wav_file}')
continue
Expand Down