Giter Club home page Giter Club logo

jeopardy-parser's Introduction

Jeopardy parser

Quick note: this project does not use semantic versioning (python parser.py --version outputs the last updated date of the script).

What is this?

This is a Python script to extract Jeopardy! clues from the J! Archive website and dump them into a SQLite database for use elsewhere (no particular application is intended). Python 2.7.* and SQLite 3.7.* on *nix have been tested and confirmed to work (requires BeautifulSoup 4 and the lxml parser).

This fork includes updating the database based on date without having to re-create the database, game ID matches archive game number, and a flashcard-like HTML/CSS/JavaScript output for reading final jeopardy categories, clues and answers.

Quick start

git clone git://github.com/whymarrh/jeopardy-parser.git
cd jeopardy-parser
pip install -r requirements.txt
python download.py
python parser.py

Updating the database after initial download and parsing

python update.py

Outputting the final rounds

python final.py

Updating the database and outputting the final rounds

python final.py -u

How long will all this take?

There are two important steps:

  1. Downloading the game files from the J! Archive website
  2. Parsing and inserting them into the database

The first step, downloading, will depend on the machine: the download script will use twice the number of available cores to download game files in parallel and will take around an hour to complete. The second step, parsing, should take ~30 minutes (on a 1.7 GHz Core i5 w/ 4 GB RAM). In total, you're looking at around 2 hours (probably less).

The complete download of the game files is ~350MB, and the resulting database file is ~50MB (although these numbers are qucikly outdated as the number of games increases).

Updating the database for new games is relatively quick.

Querying the database

The database is split into 5 tables:

Table name What it holds
airdates Airdates for the shows, indexed by game number
documents Mappings from clue IDs to clue text and answers
categories The categories
clues Clue IDs with metadata (game number, round, and value)
classifications Mappings from clue IDs to category IDs

To get all the clues along with their metadata:

SELECT clues.id, game, round, value, clue, answer
FROM clues
JOIN documents ON clues.id = documents.id
-- WHERE <expression>
;

To get the category that a clue is in, given a clue id:

SELECT clue_id, category
FROM classifications
JOIN categories ON category_id = categories.id
-- WHERE <expression>
;

To get everything (although it is better to pick and choose what you're looking for):

SELECT clues.id, clues.game, airdate, round, value, category, clue, answer
FROM clues
JOIN airdates ON clues.game = airdates.game
JOIN documents ON clues.id = documents.id
JOIN classifications ON clues.id = classifications.clue_id
JOIN categories ON classifications.category_id = categories.id
-- WHERE <expression>
;

License

This software is released under the MIT License. See the LICENSE.md file for more information.

jeopardy-parser's People

Contributors

whymarrh avatar stucky avatar dangoldin avatar tshddx avatar

Stargazers

Abbas Ally avatar Jason Steinhauser avatar

Watchers

James Cloos avatar  avatar

Forkers

gregorstocks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.