GithubHelp home page GithubHelp logo

jeopardy-scrape's Introduction

Jeopardy Archive Data

Scrape J! Archive for am extensive archive of Jeopardy!.

Collecting the Data

  1. Install Python 3.7 and the Psycopg2 and BeautifulSoup packages.

  2. Set up a credentials.json file in /credentials directory with PostgreSQL database information. Below is an example of a local database.

    {
      "host": "localhost",
      "database": "jeopardy",
      "user": "postgres",
      "password": "password"
    }
  3. To scrape the entire archive of the site, run the following command. This will create a collection in your database with all questions leading up to the most recent episode. It will take some time (between one and two hours).

    cd scrape
    python scrape.py -a
    
  4. You can also scrape only specific seasons by running the command below. The example shown is for seasons 1 through 10 (will include 10).

    cd scrape
    python scrape.py -s 1 10
    
  5. Set up a keys.json file in the /credentials directory with keys for Genderize.io and the Google Maps API

    {
      "gmaps_api_key": "key_here",
      "genderize_api_key": "key_here"
    }
  6. Run the commands below to send the first name for each contestant to Genderize.io, a third-party API for identifying gender by name, and update the database accordingly.

    cd addon
    python gender.py
    
  7. Run the commands below to update the database with the latitude and longitude for each contestant with a valid location.

    cd addon
    python geocode.py
    

Topic Modeling

This project uses the topic modeling software MALLET to build a topic model for clues.

  1. Run the command below to create a separate text file for each clue in the database from the first specified season to the last.

    cd topics
    python create_clues_data.py -s 1 35
    
  2. Move to the MALLET directory on your local machine and import these files (specifically, point to the directory they are kept in).

    bin\mallet import-dir --input {wherever the project lives}\jeopardy-scrape\topics\mallet_files\data\clues --output jeopardy_clues.mallet --keep-sequence --remove-stopwords
    
  3. Train the model and create the output files.

    bin\mallet train-topics --input jeopardy_prof.mallet --num-topics 25 --optimize-interval 20 --output-state jeopardy_prof_topic-state.gz --output-topic-keys jeopardy_prof_keys.txt --output-doc-topics jeopardy_prof_composition.txt
    
  4. Move jeopardy_prof_keys.txt and jeopardy_prof_composition.txt to topics/mallet_files/output/clues. These files contain the topic information and which topics each clue is part of. Run the two commands below to update the database with that data.

    cd topics
    python parse_clue_topic_keys.py
    python parse_clue_topic_composition.py
    

jeopardy-scrape's People

Contributors

hmltnbrn avatar jayrobwilliams avatar

Watchers

James Cloos avatar

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.