Linguist 278: Programming for Linguists
InstructorChristopher Potts
MeetingsMW 11:30-12:50 Pacific
LocationOnline with Zoom
Discussion and exercisesEd forum
Submitting workCanvas
Hacking sessionsWed 3:30-4:30 and Thu 10:00-11:00 Pacific


Covid-19 😷: Our course is fully online this year. I think this has substantial advantages for a course like this one: more pair programming, more online exercises, more chances for feedback on student progress and student goals, and more individualized paths to becoming expert programmers. —Chris

Plan Assignment Reading/Reference
Sep 14
  1. The basics of numerical types and strings
  2. The basics of lists, built-ins, for-loops, conditionals, and function definitions
  1. Assignment 1 [due Sep 28]
  2. Chris's solutions
  1. str
  2. list
  3. Using Python as a calculator
  4. Numeric types
  5. Built-in functions
  6. Control flow tools
  7. Defining functions
Sep 16
Sep 21
  1. The basics of executing files, homework formatting, dicts, and tuples
  2. Review exercises and miscellaneous items
  1. tuple
  2. dict
  3. set
  4. sorted
  5. collections.defaultdict
Sep 23
Sep 28
  1. Range, advanced assignments, logical statements, printing, and function definitions
  2. Basic file and CSV reading and writing; os.path basics
  1. Assignment 2 [due Oct 5]
  2. Chris's solutions
  1. range, enumerate, and others
  2. More on defining functions
  3. Reading and writing files
  4. glob
  5. os
  6. shutil
  7. csv
  8. json
  9. gzip
  10. pickle
  11. Optional: shelve, yaml
Sep 30
Oct 5
  1. In-class hackathon: Anagram finder [Chris's implementation]
  2. Iterators and generators
  1. Assignment 3 [due Oct 12]
  2. Chris's solutions
  1. Notes on yield
  2. iterators
  3. generators
Oct 7
Oct 12
  1. In-class hacking using the Ed platform
  1. Assignment 4 [due Oct 19]
  2. Chris's solutions
Oct 14
  1. No class; Chris in a workshop
Oct 19
  1. Introduction to regular expressions
  2. More on regular expressions
  1. Assignment 5 [due Oct 26]
  2. Chris's solutions
  1. re
  2. Dataquest regular expression cheat sheet
Oct 21
Oct 26
  1. Using Jupyter notebooks
  2. Introduction to Pandas
    [HTML version]
  3. Pandas exercises
    [HTML version]
  1. Assignment 6 [due Nov 2; HTML version]
  2. Chris's solutions [HTML version]
  1. Lucy Li's Jupyter notebook tutorial
  2. Pandas documentation
Oct 28
Nov 2
  1. Hackathon (== Assignment 7)
  1. Assignment 7 [due Nov 9; HTML version]
  1. Wonderful language resources from Victor Kuperman and colleagues
Nov 4
Nov 9
  1. Introduction to object-oriented programming in Python
    [HTML version; completed version; completed version HTML]
  2. Selected earlier homework problems as classes
  1. Assignment 8 [due Nov 16; HTML version]
  2. Chris's solutions [HTML version]
  1. Classes
Nov 11
Nov 16
  1. Document formats [HTML version]
  2. subprocess [HTML version]
  1. All coursework must be submitted by December 1, 11:59 pm Pacific
  1. glob
  2. csv
  3. gzip
  4. json
  5. pickle
  6. zipfile
  7. textract
  8. PyMuPDF
  9. Beautiful Soup
  10. requests
Nov 18
  1. Exception handling
  2. Unit testing with pytest
  3. Sorting
  4. Overview of visualization libraries
  1. pytest
  2. Background on unit testing
  3. sorted
  4. matplotlib
  5. Pandas visualization
  6. seaborn

[Stanford F20 academic calendar]