Algorithm 3.
Algorithm that creates a .csv file, generates data into a file, and downloads the csv file.
Input:(root_ve), The list of distinct root word tokens Output:(generated_grammar.csv), a csv file that contains a grammar-based of the generated dataset steps: 1 import csv 2 import files 3 with open('generated_grammar.csv', 'w', newline='', encoding ='UTF-8′) as csvfile: 4 fieldnames ← fieldnames (Insert Field names) 5 writer ← csv.DictWriter(csvfile, fieldnames=fieldnames) 6 writer.writeheader() 7 for verb in root_ve: 8 if((condition meets required affixes): 9 continue 10 Move over a series of ‘if-elif-else’ conditions to trim root verbs into their corresponding stems 11 Concatenate the suitable affixes to the generated stems 12 writer.writerow(‘Write the synthesized phrases into a csv file) 13 files.download(generated_grammar.csv'), save the dataset file into ‘Downloads’ |