This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib import urlencode | |
from datetime import date, datetime | |
from httplib import HTTPSConnection, HTTPException | |
try: | |
from django.utils import simplejson as json | |
except ImportError: | |
import json | |
def capitalize(word): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from datetime import datetime | |
from urllib import urlencode | |
from httplib import HTTPConnection | |
from xml.dom.minidom import parse | |
import hmac, hashlib, base64 | |
ACCESS_ID = getattr(settings, 'AWS')['ID'] | |
ACCESS_SECRET = getattr(settings, 'AWS')['SECRET'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# summarize | |
# Uses TFIDF to extract relevent sentences from text. | |
# | |
# Author: Benjamin Bengfort <[email protected]> | |
# Created: Sun Oct 26 16:06:36 2014 -0400 | |
# | |
# ID: summarize.py [] [email protected] $ | |
""" | |
Uses TFIDF to extract relevent sentences from text. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nltk | |
import string | |
def tokenize(text): | |
stopwords = set(nltk.corpus.stopwords.words('english')) | |
for token in nltk.word_tokenize(text): | |
if token in stopwords or token in string.punctuation: | |
continue | |
yield token.lower() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"fields": { | |
"dc_source": 7, | |
"media_credit": 71, | |
"updated_parsed": 277, | |
"links": 2130, | |
"twitter": 20, | |
"media_text": 31, | |
"summary_detail": 1993, | |
"href": 386, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nba | |
# Analyzes the NBA Salary to PER data set | |
# | |
# Author: Benjamin Bengfort <[email protected]> | |
# Created: Sat Sep 20 09:35:11 2014 -0400 | |
# | |
# Copyright (C) 2014 Bengfort.com | |
# For license information, see LICENSE.txt | |
# | |
# ID: nba.py [] [email protected] $ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# big_tweet_import | |
# Imports the tweet-dump into MongoDB | |
# | |
# Author: Benjamin Bengfort <[email protected]> | |
# Created: Thu Aug 28 07:37:41 2014 -0400 | |
# | |
# Copyright (C) 2014 Bengfort.com | |
# For license information, see LICENSE.txt | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import division | |
import sys | |
import time | |
import random | |
class Averager(object): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
########################################################################## | |
## Imports | |
########################################################################## | |
import sys | |
import argparse | |
import traceback | |
import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.dates as mdates | |
from datetime import datetime | |
PATH = os.path.abspath(os.path.dirname(__file__)) |