GithubHelp home page GithubHelp logo

popstick / citizen-quotes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cjdd3b/citizen-quotes

0.0 2.0 0.0 1.17 MB

A project to demonstrate maximum entropy models for extracting quotes from news articles in Python.

Python 76.98% CSS 2.33% HTML 20.69%

citizen-quotes's Introduction

Citizen Quotes

A simple project to demonstrate the use of NLTK maximum entropy models for extracting quotes from news articles. Also includes a pretty quote browser that cycles through quotes from a random selection of Bay Citizen stories.

Includes

  • A workflow and class wrapper for training, evaluating and applying NLTK maximum entropy models to quote detection.
  • A demonstration of OpenCalais for coreference detection.
  • Basic Django admin interface for training a classifier.
  • A simple public-facing quote browser interface.
  • Sample data so you can see how everything ties together.

Getting started

The demo is designed to work out of the box with an included SQLite database. To get up and running, simply:

git clone [email protected]:cirlabs/citizen-quotes.git
cd citizen-quotes
pip install -r requirements.txt
python manage.py runserver

The quote browser will be running in your browser at 127.0.0.1:8000.

Training the system

Being supervised classifiers, maxent models require a set of training data to learn from before they can begin classifying.

In this case, the classification problem is a simply binary choice: Given a paragraph, is it a quote or isn’t it? But as with most classification problems, things aren’t quite so simple under the surface.

Luckily, training the system is easy. Simple log into the system’s admin interface at 127.0.0.1:8000/admin. The default username and password are both quotex.

Navigate to the paragraph interface. In the list view, you’ll see a dropdown that identifies an item as a quote and a checkbox indicating it should be in the training set. Simply set these values according to the each value according to its paragraph and hit save.

The more training data you have, the better the classifier will work. We’d recommend manually classifiying at least a few hundred before you set the classifier loose.

Running the classifier

The classifier is located at quotex/classify/maxent.py. Running it is easy:

python maxent.py

The first thing you’ll want to do is see how it performs. By default, the script uses your manually classified training set to test initial performance. It does this by splitting the set in half: the first half for training and the second half for testing. You can change that split in the code if you’d like.

When you’re ready to perform the actual classification, just uncomment the following line in the classifier code:

#me_classifier.classify(unlabeled)

Questions

This project brought to you by Chase Davis’ nights and weekends: [email protected].

citizen-quotes's People

Contributors

cjdd3b avatar joncotton avatar

Watchers

 avatar 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.