Designed by Melanie Walsh // Powered by Jupyter Book
This repository hosts the course materials for "Introduction to Cultural Analytics: Data, Computation & Culture," an undergraduate course taught at Cornell in the spring of 2020 and 2021. It includes an online textbook designed for the class, Introduction to Cultural Analytics & Python, which demonstrates how Python can be used to study cultural materials such as song lyrics, short stories, newspaper articles, tweets, Reddit posts, and film screenplays.
Course website and textbook: https://melaniewalsh.github.io/Intro-Cultural-Analytics/
The Python package jupyter-book
processes the Jupyter notebook files from this repository and outputs them as the publication-quality HTML files that generate the corresponding website.
The HTML files are currently hidden in this branch of the GitHub repository, but you can find them in the gh-pages branch.
Below I will briefly explain the structure of this repository and some important Jupyter Book features.
/book
contains all the materials that generate the Jupyter Book/binder
contains materials that set up the virtual Binder environment for running Jupyter notebooks in the cloud
The configuration file /book/_config.yml
is where I establish key features of the book, such as the title, logo, and whether users can open the Jupyter notebook files in the cloud.
The table of contents file /book/_toc.yml
establishes the table of contents structure on the left-hand side of the web page.
To include a Markdown or Jupyter notebook file in the table of contents, you include the flag - file:
followed by the file path without the file extension, as shown below:
- file: welcome
- part: How To
chapters:
- file: How-To-Interact-With-This-Book
title: Interact With This Book
- part: The Course
chapters:
- file: course-schedule
title: Course Schedule
- file: syllabus
title: Course Syllabus
- part: The Book
chapters:
- file: Command-Line/The-Command-Line
- file: Python/Python
sections:
- file: Python/Installation
- file: Python/How-to-Use-Jupyter-Notebooks
If you want the title in the table of contents to be different from the title in the notebook, you can also specify a different title
below the - file:
flag. Finally, you can include section headers within the table of contents by using the - part
flag or designate nested chapters by including chapters:
.
The Jupyter notebook files can be found in directories named for chapters:
/book/Command-Line
/book/Python
/book/Data-Analysis
/book/Data-Collection
/book/Text-Analysis
/book/Network-Analysis
/book/Mapping
Data can be can be found in /book/data
Texts can be can be found in /book/texts
Custom CSS styling can be found in /book/_static/custom.css
(it's a bit messy at the moment, sorry)
- Run
jupyter-book build /book
orjb build /book
, where/book
is the directory with your Jupyter notebook files
A fully-rendered HTML version of the book will be built in /book/_build/html/
. You can push these HTML files to a GitHub pages website by pushing them to the gh-pages
branch of a GitHub repository.
One easy way to push to the gh-pages
branch is to install gh-import
.
- Run
ghp-import -n -p -f book/_build/html
You can learn more about Jupyter Book by exploring the documentation: https://jupyterbook.org/intro.html
This course was inspired by a range of excellent course materials, including those by Lauren Klein, David Mimno, and Allison Parrish.
This book is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) License. The code is licensed under a GNU General Public License v3.0.