Skip to content

Instantly share code, notes, and snippets.

@JaimieMurdock
Last active May 14, 2018 21:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JaimieMurdock/20ca8d91038a592c3536b74176db2408 to your computer and use it in GitHub Desktop.
Save JaimieMurdock/20ca8d91038a592c3536b74176db2408 to your computer and use it in GitHub Desktop.
Vonnegut Topic Explorer

Vonnegut Topic Explorer Demo

This script should download and install the InPhO Topic Explorer and HTRC Workset Toolkit, then train a Topic Explorer instance on the Kurt Vonnegut collection at the HathiTrust Digital Library.

Many thanks to Tassie Gnaidy for presenting on "Vonnegut, Bradbury, and the HathiTrust, Oh My!" at the Granfalloon: A Kurt Vonnegut Convergence, which inspired me to look up a Vonnegut collection and train a demo.

Instructions

  1. Install Anaconda Python (either Python 2.7 or 3.6. 3.6 recommended and tested)
  2. Download vonengut.sh below.
  3. Open a terminal.
  4. Type bash, followed by a space.
  5. Drag and drop the vonnegut.sh file into the terminal.
  6. Hit enter.
  7. After a few moments the explorer should launch in your default browser after training a 25, 50 and 100 topic model.
  8. Press Ctrl + C to stop the explorer or close the terminal window.
#!/bin/bash
# install the tools
pip install topicexplorer htrc
# make a folder
mkdir -p /tmp/vonnegut
cd /tmp/vonnegut
# download the list of identifiers from IDAH's collection
htrc export "https://babel.hathitrust.org/cgi/mb?a=listis;c=1100976828" > vonnegut.txt
# train the models
topicexplorer init vonnegut.txt -q --htrc --name "Vonnegut's works (and criticism thereof)"
topicexplorer prep vonnegut.txt -q --high-percent 70 --low-percent 5 --lang en
topicexplorer train vonnegut.txt -q -k 25 50 100 --iter 200 -p 4
# launch the explorer
topicexplorer launch vonnegut.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment