from datasets import load_dataset from tqdm import tqdm subsets = [('bg', 'lv'),('cs', 'lv'),('da', 'lv'),('de', 'lv'),('el', 'lv'),('en', 'lv'),('es', 'lv'), ('et', 'lv'),('fi', 'lv'),('fr', 'lv'),('hu', 'lv'),('it', 'lv'),('lt', 'lv'),('lv', 'nl'), ('lv', 'pl'),('lv', 'pt'),('lv', 'ro'),('lv', 'sk'), ('lv', 'sl'),('lv', 'sv')] with open('europarl_lv.txt', 'w') as file: for subset in tqdm(subsets): print(f'Downloading subset: {subset[0]} - {subset[1]}') dataset = load_dataset('europarl_bilingual', lang1=subset[0], lang2=subset[1], split='train') for entry in tqdm(dataset): file.write(f'{entry["translation"]["lv"]}\n') file.close() print('Done')