Skip to content

Instantly share code, notes, and snippets.

@bobobo1618
bobobo1618 / Collocations.py
Created October 5, 2011 07:59
Gets collocations given a list of words.
def lexical_diversity(wordlist):
"""Returns the ration of the number of unique words to the number of words overall as a floating point number
(unique/normal)."""
normal = []
for word in wordlist:
normal.append(word.lower())
# Conversion to a set finds unique words.
return float(len(wordlist))/float(len(set(wordlist)))
def getbigrams(words):
@jtimberman
jtimberman / nginx.conf
Created March 5, 2010 21:01 — forked from johnthethird/nginx.conf
nginx front end for Riak
# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
# Config is in /etc/nginx/sites-available/default or somewhere like that
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;