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
""" Prints the probability of a successful shot given argv[1] attempts where | |
each has an argv[2] probability of success. | |
""" | |
from __future__ import division | |
import random | |
import sys | |
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 __future__ import division | |
import itertools | |
import math | |
import pprint | |
import random | |
import sys | |
INF = float('inf') |
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
"""Readability | |
[Wiki](http://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_test) | |
The Flesch Reading Ease Score (FRES) is | |
206.835 - 1.015 * (#words / #sentences) - 84.6 * (#syllables / #words) | |
Example: | |
"The Australian platypus is seemingly a hybrid of a mammal and reptilian | |
creature." |
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
# | |
# http://www.elasticsearch.org/guide/reference/modules/scripting/ | |
# | |
# Create the index | |
curl -XPOST 'http://localhost:9200/people/' -d '{ | |
"settings" : { | |
}, | |
"mappings" : { | |
"person" : { |
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
public static ClientConfig getClientConfig(String connectionUrl) { | |
ClientConfig clientConfig = new ClientConfig(); | |
LinkedHashSet<String> servers = new LinkedHashSet<String>(); | |
servers.add(connectionUrl); | |
clientConfig.getServerProperties().put(ClientConstants.SERVER_LIST, servers); | |
return clientConfig; | |
} | |
public static JestClient getClient(String connectionUrl) { | |
JestClientFactory factory = new JestClientFactory(); |
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
IT'S GO TIME | |
GIDDYUP "Hello, Newman" | |
YADA YADA YADA |
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
IT'S GO TIME | |
YO YO MA isLessThan20 | |
IT'S IN THE VAULT @IT'S NOT A LIE IF YOU BELIEVE IT | |
YO YO MA n | |
IT'S IN THE VAULT 0 | |
YO YO MA multiple | |
IT'S IN THE VAULT @IT'S NOT A LIE IF YOU BELIEVE IT | |
CRY CRY AGAIN isLessThan20 |
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 collections import defaultdict | |
import random | |
restaurants = [ | |
'za', 'jake', 'spoon', 'hacienda', 'bridgetender', 'river grill', 'rosie', 'sunnyside' | |
] | |
people = ['megan', 'jan', 'todd', 'colin', 'michelle'] | |
random.shuffle(people) |
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
"""Make initial clusters of categories to bootstrap top-level categories.""" | |
from collections import defaultdict | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.cluster import KMeans, MiniBatchKMeans | |
from j_util import get_rows | |
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 spacy | |
from spacy.pipeline import EntityRuler | |
nlp = spacy.load("en_core_web_sm") | |
ruler = EntityRuler(nlp, validate=True) | |
ruler.add_patterns[ | |
{ | |
"label": "PHRASE", | |
"pattern": [ |