No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-17 16:25:48 +01:00
clean_casebook.py Add casebook cleaner script with README 2026-09-17 16:25:48 +01:00
README.md Add casebook cleaner script with README 2026-09-17 16:25:48 +01:00
requirements.txt Add casebook cleaner script with README 2026-09-17 16:25:48 +01:00

Casebook Cleaner

Extracts casebook notes from a PDF and converts imported email HTML within those notes into plain text.

How it works

  1. Reads a PDF generated by a Casebook tool (likely LexisNexis/CLE exports)
  2. Skips the cover page and extracts only the "Casebook notes" section
  3. Splits the content into individual notes
  4. For notes marked as Type: Imported email, converts embedded HTML into clean, readable plain text while preserving attachments
  5. Outputs a single .txt file with all cleaned notes

Prerequisites

  • Python 3.12+
  • A Casebook PDF export (with imported email content)

Setting up the environment on Windows

Step 1: Install Python (if not already installed)

  1. Go to https://www.python.org/downloads/
  2. Download the latest Python installer
  3. Run it and check "Add python.exe to PATH" before clicking Install

Verify the installation:

python --version

Step 2: Create a virtual environment

Open PowerShell or Command Prompt and navigate to the project folder, then create a virtual environment:

cd path\to\casebook_clean
py -3.14 -m venv venv

Step 3: Activate the virtual environment

.\venv\Scripts\activate

You should see (venv) appear at the start of your command prompt.

Step 4: Install the dependencies

pip install -r requirements.txt

Running the script

Activate the virtual environment (see step 3 above), then run:

python clean_casebook.py path\to\your\casebook.pdf

By default, the output text file will be saved as <same filename>.txt in the same directory. To specify a custom output path:

python clean_casebook.py path\to\casebook.pdf -o output\notes.txt