Notes for Lecture 16 on November 24, 2020
Expand Abbreviations and Numbers
Basic design of program
Version 1: read in a file
Version 2: split line into 2 parts separated by a tab character
Version 3: create a dictionary with abbreviations as keys and expansions as values
Version 4: read in input line and split it into words
Version 5: substitute the expressions for the abbreviations and print the line
Version 6: make loading the dictionary a function
Version 7: add to the dictionary numbers as keys and their words as values
Version 8: have the function return a dictionary (so there are two dictionaries)
abbrev.py
Input file and dictionaries
abbreviations.txt, file of abbreviations
abbreviations-num.txt, file of numbers
abbrev-input.txt, sample input file
Matt Bishop
Office: 2209 Watershed Science
Phone: +1 (530) 752-8060
Email:
mabishop@ucdavis.edu