| | |
| | | parts = line.strip().split() |
| | | if len(parts) < 2: |
| | | continue |
| | | text_dict[parts[0]] = " ".join(parts[1:]).lower() |
| | | text_dict[parts[0]] = " ".join(parts[1:]) |
| | | filter_count = 0 |
| | | with open(wav_file, "w") as f_wav, open(text_file, "w") as f_text: |
| | | for sample_name, wav_path in wav_dict.items(): |
| | |
| | | f.flush() |
| | | |
| | | |
| | | def calc_shape(args, dataset, nj=32): |
| | | def calc_shape(args, dataset, nj=64): |
| | | shape_path = os.path.join(args.data_dir, dataset, "speech_shape") |
| | | if os.path.exists(shape_path): |
| | | logging.info('Shape file for small dataset already exists.') |
| | |
| | | start = 0 |
| | | for i in range(nj): |
| | | end = start + num_job_lines |
| | | file = os.path.join(shape_path, "wav.scp.{}".format(str(i + 1))) |
| | | file = os.path.join(split_shape_path, "wav.scp.{}".format(str(i + 1))) |
| | | with open(file, "w") as f: |
| | | if i == nj - 1: |
| | | f.writelines(lines[start:]) |
| | |
| | | logging.info('Generating shape files done.') |
| | | |
| | | |
| | | def generate_data_list(data_dir, dataset, nj=100): |
| | | def generate_data_list(data_dir, dataset, nj=64): |
| | | list_file = os.path.join(data_dir, dataset, "data.list") |
| | | if os.path.exists(list_file): |
| | | logging.info('Data list for large dataset already exists.') |
| | |
| | | filter_wav_text(args.data_dir, args.train_set) |
| | | filter_wav_text(args.data_dir, args.valid_set) |
| | | |
| | | if args.dataset_type == "small" and args.train_shape_file is None: |
| | | if args.dataset_type == "small": |
| | | calc_shape(args, args.train_set) |
| | | calc_shape(args, args.valid_set) |
| | | |
| | | if args.dataset_type == "large" and args.train_data_file is None: |
| | | if args.dataset_type == "large": |
| | | generate_data_list(args.data_dir, args.train_set) |
| | | generate_data_list(args.data_dir, args.valid_set) |
| | | |