This file contains 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 java.util.concurrent.BlockingQueue; | |
public class ConsumerTask implements Runnable { | |
private static final int H1 = 0; | |
private static final int H2 = 1; | |
private static final int H3 = 2; | |
private static final int H4 = 3; | |
final static int LIMIT = 100; |
This file contains 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 time | |
import random | |
import threading | |
class HitCounter(): | |
"""A thread-safe website hit counter using circular array | |
N: last N seconds we want to keep the number of hits | |
Assumption: number of hit per second < sys.maxsize of Python | |
""" | |
def __init__(self, N=300): # default 5 minutes (300 seconds) |
This file contains 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 this paper: http://acl.ldc.upenn.edu/acl2004/emnlp/pdf/Mihalcea.pdf | |
I used python with nltk, and pygraph to do an implmentation of of textrank. | |
for questions: http://twitter.com/voidfiles | |
""" | |
import nltk | |
import itertools |