Linguist 278: Programming for Linguists
InstructorChristopher Potts
MeetingsTue/Thu 3:15-4:45 pm Pacific
LocationOnline with Zoom
Discussion and exercisesEd forum
Submitting workCanvas
Hacking sessionsMon 4:00-5:00 pm and Tue 9:00-10:00 am Pacific


Plan Assignment Reading/Reference
Sep 21
  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 Oct 5]
  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 23
Sep 28
  1. The basics of executing files, homework formatting, dicts, and tuples
  2. Review exercises
  1. tuple
  2. dict
  3. set
  4. sorted
  5. collections.defaultdict
Sep 30
Oct 5
  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 12]
  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
Oct 7
Oct 12
  1. In-class hackathon: Anagram finder [solved version]
  1. Assignment 3 [due Oct 19]
  2. Chris's solutions
Oct 14
Oct 19
  1. Iterators and generators
  2. In-class hacking using the Ed platform
  1. Assignment 4 [due Oct 26]
  1. Notes on yield
  2. iterators
  3. generators
Oct 21
Oct 26
  1. Introduction to regular expressions
  2. More on regular expressions
  1. Assignment 5 [due Nov 9]
  1. re
  2. Dataquest regular expression cheat sheet
Oct 28
Nov 2 Democracy Day; no class
Nov 4
  1. Using Jupyter notebooks
  2. Introduction to Pandas
    [HTML version]
  1. Lucy Li's Jupyter notebook tutorial
  2. Pandas documentation
Nov 9
  1. Pandas exercises
    [HTML version]
  2. Hackathon (== Assignment 6)
  1. Assignment 6 [HTML version; due Nov 16]
  1. Wonderful language resources from Victor Kuperman and colleagues
Nov 11
Nov 16
  1. Document formats [HTML version]
  2. subprocess [HTML version]
  3. Basic Twitter API usage [HTML version]
  4. Overview of visualization libraries
  1. Final projects [due December 7, 11:59 pm Pacific]
  2. (All coursework must be submitted by December 7, 11:59 pm Pacific)
  1. csv
  2. gzip
  3. json
  4. pickle
  5. zipfile
  6. textract
  7. PyMuPDF
  8. Beautiful Soup
  9. requests
  10. matplotlib
  11. Pandas visualization
  12. seaborn
Nov 18
Nov 23 Thanksgiving week; no classes
Nov 25
Nov 30
  1. Exception handling
  2. Unit testing with pytest
  3. Sorting
  1. pytest
  2. Background on unit testing
  3. sorted
Dec 2
  1. Introduction to object-oriented programming in Python
    [HTML version; completed version in HTML]
  2. Selected homework problems as classses
  3. Tests for the class-based implementations
  1. Classes

[Stanford F21 academic calendar]