#! /usr/bin/env python3 ''' This script will download the dataset xezpeleta/ccmatrix_eng_eus_filtered from Hugging Face with the following structure: { 'id': 0, 'score': 1.2498578, 'translation': { 'en': "He stands to God's word, and God's worship.", 'eu': 'Jaungoikoa goratzera bideratuta egongo da eta Jaungoikoa bere borondatea betez goratzen da.' } } Then will create the following txt files: - ccmatrix_filtered.en-eu.en - ccmatrix_filtered.en-eu.eu ''' from datasets import load_dataset def main(): dataset = load_dataset('xezpeleta/ccmatrix_eng_eus_filtered') # Create the txt files with open('ccmatrix_filtered.en-eu.en', 'w') as en_file, open('ccmatrix_filtered.en-eu.eu', 'w') as eu_file: for data in dataset['train']: en_file.write(data['translation']['en'] + '\n') eu_file.write(data['translation']['eu'] + '\n') if __name__ == '__main__': main()