Digital Methods

Syllabus

Printable syllabus (PDF)

Homework listed under a session is assigned that day and due before the next session, unless it says otherwise. All assignments are submitted on Canvas. For what class sessions, homework, and capstone coding assignments are like, see Course Format and Materials.

Each homework assignment is marked in one of three ways (see AI Policies for an AI Course):

  • (AI off): on your honor, no AI. These are short, and they exist so that you can do the AI-assisted work better.
  • (AI required): directing and checking an AI model is the assignment. Say what you did in the comments of what you hand in.
  • No mark: your call. If you use AI, say so in a comment (see Saying What You Did).

Your Worm Journal gets at least one short entry for every class session. Where a session lists a Journal prompt, that prompt is your entry.

Part One: What Does a Computer Know About a Text?

Core questions: What is a text, to a computer? What do we add to a text when we mark it up? What is an AI model doing when it “reads” one?

Tue, Jan 12 Session 1 A Text, a Tree, and a Machine

In class:

  • What is (computational) digital humanities? A look at a few past projects
  • How this course works: (Un)Grading, the Worm Journal, AI on and AI off
  • Introduction to XML: hierarchy, well-formedness, elements and attributes, using Lord of the Rings quotes

Homework:

Journal: Read Can humanities undergrads learn to code?, written in 2012 by two undergraduate instructors in this course’s ancestor. What in it is still true now that AI can write code? What is not?

Thu, Jan 14 Session 2 Human Markup, Machine Markup

In class:

  • Briefing: how large language models work (prediction, training, context), and the difference between deterministic and stochastic systems
  • Exercise: an AI model marks up the same letter you did. Compare the two, and ask why its markup looks the way it does
  • Types of markup: descriptive, presentational, procedural
  • A standing rule for the semester: the model’s own report of what it did is never verification
  • Introduction to the research project

Homework:

  • XML exercise 2 (AI required): have an AI model mark up a short text of your choice (any genre, any language; ideally something you might want for a project). Then correct its markup, and submit your corrected version with a punch list of what you changed and why.
  • Read You aren’t a beginning XML developer anymore, and use it as a checklist against the AI’s markup.
  • Read Research Projects and Copyright.
  • Complete the questionnaire on research interests (Canvas).

Journal: Choose one project from Past Projects. What was its research question? What did its makers have to mark up in order to ask it? Name one thing you would steal for a project of your own.

Recitation this week: Setup clinic. One past project, from first idea to finished site.

Part Two: Nuts and Bolts

Core questions: Where do files live, and how does a computer find them? What is a program doing when it runs? How is instructing a program different from instructing an AI?

Tue, Jan 19 Session 3 Files, Paths, and the Command Line

In class:

  • Paths: absolute and relative locations, the working directory, and why moving a file breaks everything that pointed to it
  • Coding without computers: path tracing (draw a project’s folder tree on paper and predict where relative paths lead)
  • The command line: a command is a program plus what you hand it, and an error message is information
  • Read the command: annotate commands supplied by an AI in plain English, asking what each acts on and whether it can be undone

Homework:

  • Command line practice (AI required): in the practice folder provided, ask an AI model how to carry out the listed file tasks. Before running anything, annotate each command in plain English and mark any that cannot be undone. Then run them and record what happened.

Thu, Jan 21 Session 4 Algorithms, Loops, and Functions

In class:

  • Coding without computers: the literal-minded research assistant. Instruct a “robot” to alphabetize a stack of cards, then instruct an “AI” that fills every gap with a plausible guess. How do the failures differ?
  • Loops and conditionals in plain language
  • Functions as contracts: what a function takes, what it returns, and when it fails. Function cards, chained into a pipeline

Homework:

  • Function cards (AI off): write three function cards for small tasks a project of yours might need (name, takes, returns, fails when).

Recitation this week: Forming project teams; team norms, meeting times, and communication.

Part Three: Modeling a Text

Core questions: What is this document made of? Which of its features matter for your question, and why? How do you turn that analysis into rules a computer can enforce?

Tue, Jan 26 Session 5 Document Analysis

In class:

  • Document analysis without angle brackets: Kubla Khan
  • Every document contains nearly infinite information. What you model depends on what you want to know
  • Coding without computers: conditional logic as editorial policy. Draft if/then rules for a fuzzy editorial decision, trade them, and apply another team’s rules literally

Homework:

  • Document analysis, stage 1 (AI off): choose a small text, ideally from your project’s corpus. In one to two pages of prose, with no code, describe its structures and features, say which you would model, and say why.

Project: Teams (or solo researchers) submit a one-paragraph sketch: your text or texts, your question, and who is on the team.

Thu, Jan 28 Session 6 Schemas: Rules for a Document

In class:

  • What is a schema? Relax NG by way of a pasta recipe
  • Coding without computers: the type sorting game. What is a string, a number, a date, a list? What are you allowed to do with each?
  • Reading a schema aloud

Homework:

  • Read Introduction to Relax NG.
  • Relax NG exercise 1 (AI off): write a Relax NG schema for the XML you produced in XML exercise 1 or 2 (you may modify your XML). Upload both files.

Journal: Explore one of these archives: the Blake Archive, the Rossetti Archive, Melville’s Marginalia, or the Perseus Digital Library. You cannot see its schema, but you can infer it. From what the site lets you do, name three things its makers must have decided to model, and one thing they evidently did not.

Recitation this week: Assembling a corpus; first document analysis of your project’s texts.

Tue, Feb 2 Session 7 Mixed Content and Harder Cases

In class:

  • The Dungeon Crawl: Relax NG patterns for harder cases (mixed content, empty elements, choice, order)
  • How much markup is enough? Two projects in one field with two philosophies: TEI and OpenITI mARkdown

Homework:

  • Read Relax NG content models.
  • Document analysis, stage 2: write a schema that formalizes your stage 1 analysis, mark up the text according to it, and validate. Upload the XML and the schema.

Thu, Feb 4 Session 8 The AI’s Schema, and Yours

In class:

  • An AI model can write a schema for your document in thirty seconds. Have it do so from the text alone, then set its schema beside your prose analysis. What did it skip? What did it get wrong?

Homework:

  • Capstone Coding Assignment 1 (AI off): XML, paths, and schemas. Handwritten and scanned, no notes, and longer than a weekly exercise: it pulls together the unit.
  • Schema critique (AI required): a written comparison of the AI’s schema and yours for the same document. Where they differ, say which is right for your research question and why.
  • Read the regular expressions quick start.
  • Scan and submit your Worm Journal so far (first check-in).

Recitation this week: The Text Encoding Initiative: what other people have considered worth modeling, and what to borrow. Project meetings.

Part Four: Pattern Matching

Core questions: How do you describe a pattern precisely enough for a machine to find it? How do you know that a pattern matches what you think it matches?

Tue, Feb 9 Session 9 Regular Expressions

In class:

  • Regex, the superpowered search-and-replace language; the difference between a language and a program
  • Walkthrough: Sonnet 60, and puzzles on a word list
  • Outside in: tag the largest structures first

Homework:

  • Regex exercise 1 (AI off): turn a plain-text edition of Shakespeare’s sonnets into XML with search and replace, and write up your process.
  • Read the first half of Regex tips (stop at “Using regex in XSLT”).

Journal: Read Stephen Ramsay, The Hermeneutics of Screwing Around. Ramsay distinguishes searching from browsing. Where does asking an AI fall? Does it change his argument?

Thu, Feb 11 Session 10 Almost Right: Regex with AI

In class:

  • Three candidate patterns for the same job, one yours and two from an AI: test them, rank them, and explain the ranking (The Scarlet Letter)
  • Adversarial testing: build an input designed to break a pattern
  • Autotagging a text toward your own schema

Homework:

  • Regex exercise 2 (AI required): autotag The Blithedale Romance. For each step, have an AI model propose the pattern, then test it against the text. Your write-up records every place the AI’s pattern failed, how you found out, and what you changed.

Recitation this week: Project meetings: autotagging your own corpus. Optional session on version control, for teams that want it.

Part Five: Asking Questions of a Document

Core questions: How do you ask a document a question? How do you know that the answer is right?

Tue, Feb 16 Session 11 Paths Through a Tree

In class:

  • Paths again: from folders to document trees
  • XPath: paths and axes, with fables.xml and Bad Hamlet
  • Coding without computers: draw the tree, and walk an expression through it with your finger

Homework:

Thu, Feb 18 Session 12 Predicates and Functions

In class:

  • Predicates and functions
  • Develop and test (!) path expressions one step at a time
  • How to look things up, and how to check what an AI tells you

Homework:

Recitation this week: XPath workshop: harder problems, worked together (XPath exercise 4).

Tue, Feb 23 Session 13 When the Expression Looks Right

In class:

  • Diagnose and fix: expressions that look right and are not (the . in a predicate; //stage[last()] versus (//stage)[last()]; a sibling axis that returns nothing)
  • Bad Hamlet as a trap: its markup is deliberately damaged, which is exactly what an AI model does not expect
  • For fun: string functions, and Hamlet rewritten

Homework:

  • XPath exercise 3 (AI required): put each task to an AI model before writing anything yourself. Then check every answer against the document. Report which answers were wrong, how you could tell, and the corrected expression.

Thu, Feb 25 Session 14 Rules That Catch Mistakes

In class:

  • Schematron: editorial rules written as XPath, which a computer can enforce (the Best Stooge Ever election, where percentages must add up to 100)
  • Checking an AI’s markup at scale

Homework:

  • Capstone Coding Assignment 2 (AI off): trace the tree by hand. Handwritten and scanned, no notes.
  • Read the Schematron tutorial.
  • Schematron exercise: write three rules for your project’s markup that your Relax NG schema cannot express, and show each one catching a mistake.

Recitation this week: Project meetings: teams trade schemas and review each other’s models.

Part Six: Directing the Machine

Core questions: What should a reader see? How do you say what you want precisely enough for an AI to build it? How do you know that what it built is right?

Tue, Mar 2 Session 15 Saying What You Want

In class:

  • How large language models work, revisited: now that you have used them for seven weeks
  • The context window field trip: give a model a document that is too long, and document what it does to the middle
  • Coding without computers: specification poker. Write a short plain-language specification, trade it, and watch another team satisfy it as unhelpfully as its wording allows

Homework (due Thursday, March 18):

  • Reading view specification (AI off): in plain language, with a hand-drawn sketch, specify what a reader of your project’s text should see. No code.
  • Read Thinking in algorithms.
  • Scan and submit your Worm Journal so far (second check-in).

Journal: Read the American Historical Association’s Guiding Principles for Artificial Intelligence in History Education. Where does this course follow them? Where does it not, and who is right?

Project: By the recess, your team should have its corpus assembled, a draft schema, and a sample of the text marked up.

Recitation this week: Project meetings: checkpoint before the recess.

No class Thursday, March 4 through Tuesday, March 16 (spring recess is March 7–14)

Thu, Mar 18 Session 16 The Target: HTML and CSS

In class:

  • XML and its relatives: HTML and TEI
  • A web page as a tree: structure in HTML, appearance in CSS
  • The do’s and don’ts of AI assistance for web design
  • Exercise: an AI model generates a page. Change it until it is yours

Homework:

  • HTML/CSS exercise (AI required): have an AI model generate a first page for your project’s site. Submit the page with a punch list of everything you changed and why.
  • Read XSLT basics.

Journal: Read the first chapter of Don Norman, The Design of Everyday Things (on Canvas), with attention to affordances and signifiers. How should those two ideas shape the interface of your project?

Recitation this week: Thinking about user experience.

Tue, Mar 23 Session 17 XSLT: Trees In, Trees Out

In class:

  • XPath refresher
  • Templates and push processing. Coding without computers: which template fires?
  • A first stylesheet, written together: an outline of Bad Hamlet

Homework:

Thu, Mar 25 Session 18 Specify, Generate, Diagnose

In class:

  • The workflow: your specification, an AI’s draft stylesheet, your diagnosis
  • Four ways an AI’s stylesheet goes wrong: pulling where it should push; templates that never fire; namespaces that fail silently; valid HTML that misrepresents the document
  • Coding without computers: the debugging autopsy. A stylesheet and its wrong output, on paper. Find the bug by reading
  • Specification poker, round two: this time the genie is an AI

Homework:

  • XSLT exercise 2 (AI required): write a specification for a reading view of skyrim.xml (tables of characters and factions, and a styled narrative). Have an AI model draft the stylesheet. Diagnose it against the four failure types, fix it, and annotate every template.

Recitation this week: Project meetings: a first reading view of your own XML.

Tue, Mar 30 Session 19 Reading Views as Arguments

In class:

  • One document, two treatments: modal XSLT and Shakespeare’s sonnets
  • Prompt archaeology: given a finished reading view, reconstruct the specification that would produce it
  • A provocation: do we need to transform at all? (CETEIcean)

Homework:

  • Capstone Coding Assignment 3 (AI off): reading a stylesheet. Handwritten and scanned, no notes.
  • XSLT exercise 3: build a reading view of your own project’s XML from the specification you wrote over the recess. Teammates may share XML, but each of you submits your own stylesheet. Be ready to explain it.

Part Seven: From Tree to Table

Core questions: What counts as an observation? What is a row? What does a text lose, and gain, when it becomes a table?

Thu, Apr 1 Session 20 Rows Are Arguments

In class:

  • The same skills, a different product: sometimes a transformation makes a dataset, not a page
  • Coding without computers: tidy data. Rows are observations and columns are variables. What is a row in Hamlet?
  • Markup stays the source of truth; the table is derived from it

Homework:

  • Tree to table exercise 1: produce a table of the speeches in Bad Hamlet, one row per speech, as a CSV file. In a paragraph, defend your decision about what counts as a row and which columns it needs.

Recitation this week: Walkthroughs: explain one template of your stylesheet to a TA. Python setup clinic.

Tue, Apr 6 Session 21 Tables at Work

In class:

  • Opening your table: first in a spreadsheet, then in Python
  • People and places as tables: a network is a table of connections, and a map is a table of coordinates
  • Checking a table against its source

Homework:

  • Tree to table exercise 2 (AI required): extract a dataset from your project’s XML. Submit the table, a definition of its rows and columns, and an independent check: counts from the table set beside counts from XPath.

Journal: Read Erin Davis, Sweet & slim, greasy & grim: the physical traits that define men & women in literature. What table sits underneath this essay? What was a row? What would you want to check before believing it?

Part Eight: Analysis and Visualization

Core questions: What can counting tell you about a text, and what can it not? What should a chart argue? How do you check a script that you could not have written yourself?

Thu, Apr 8 Session 22 Directing Python

In class:

  • Not learning Python, but directing it: reading a script by its function signatures, its loops, and its types
  • Frequency lists and concordances
  • Old friends in a new setting: XPath and regular expressions inside Python, now over a whole corpus

Homework:

  • Python exercise (AI required): the verification ladder. Have an AI model write a script that answers one counting question about your corpus. Verify it three ways: by reading it, by testing it on a case where you already know the answer, and by building an input designed to break it. Compare what each method caught.
  • Scan and submit your Worm Journal so far (third check-in).

Recitation this week: Project meetings: what will your project count, compare, or draw?

Tue, Apr 13 Session 23 A Menu of Methods

In class:

  • Short demonstrations, each starting from a table: counting and comparing; networks; maps; stylometry (whose voice is this?); topic models
  • At the scale of a library: detecting reused text across a corpus (KITAB)
  • Teams choose one method to try on their own data

Homework:

  • Menu exercise (AI required): try your team’s chosen method on your own table. Put the same task to two AI models, or to one model twice, and compare what comes back. State what your result shows and what it does not.

Journal: Read the item that matches your team’s method, and say what it suggests for your project: counting, Mining the Dispatch (the introduction); networks, the Background section of An introduction to network analysis and Cytoscape for XML coders; stylometry, José Binongo, Who wrote the 15th book of Oz?

Thu, Apr 15 Session 24 What Should a Chart Argue?

In class:

  • Coding without computers, then with one: the SVG coordinate space, and a bar chart drawn by hand (Best Stooge Ever)
  • From coordinates to a grammar of graphics: describing a chart by mapping data to position, color, and size
  • A chart is an argument: what does yours claim?

Homework:

  • Visualization exercise: make one chart from your project’s table. In a paragraph, say what it argues, and name one way it could mislead.

Journal: Watch Hans Rosling, The best stats you’ve ever seen. What does his presentation suggest that visualization can contribute to an argument? Are you persuaded?

Recitation this week: Project meetings: your site, and preparing for the showcase.

Part Nine: The Research Project

Core questions: What did you find out? How do you know? Can you explain how your project works?

Tue, Apr 20 Session 25 Project Studio

In class:

  • A working session for project teams, with the instructional team on hand
  • Be ready to explain your project’s code to a TA: what it does, why it is there, and how you know it works

Recitation this week: Project meetings: final checks.

Thu, Apr 22 Session 26 Project Showcase

In class:

  • Teams present their research projects

Project: Projects and final reports are due during finals week (April 24–30), on dates to be announced.