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 bash | |
set -e | |
set -o pipefail | |
myDir=$(dirname $0) | |
if [[ $# != 4 && $# != 5 ]]; then | |
echo >&2 "Usage: $0 myfine.fst inText outToks tempDir [--text]" | |
echo >&2 " --text is for use with recitation lowercaser" | |
exit 1 | |
fi |
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
opzip = lambda *operators: (lambda *args: tuple(op(*arg) for (op, arg) in zip(operators, zip(*args)))) |
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 contextlib import contextmanager | |
from tempfile import NamedTemporaryFile | |
import logging | |
import re | |
import requests | |
EVAL = "http://boston.lti.cs.cmu.edu/classes/11-741/HW/HW3/upload.cgi" | |
def html2txt(html): | |
txt = re.sub("<[^>]+>", "\n", html) |
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
l = [(1, 2), (3, 4), (5, 6)] | |
d = {} | |
for d['a'], d['b'] in l: | |
print d |
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 sys | |
import argparse | |
import logging | |
import multiprocessing as mp | |
import cdec | |
decoder = None | |
def make_decoder(config, weights): | |
global decoder |
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 scipy.stats as ss | |
import math | |
import numpy as np | |
from timeit import timeit | |
np_log_poisson = lambda k, l: -l + k * np.log(l) - math.lgamma(k+1) | |
log_poisson = lambda k, l: -l + k * math.log(l) - math.lgamma(k+1) | |
%timeit -n 10000 ss.poisson.logpmf(5, 4) # 164.0 us | |
%timeit -n 10000 ss.poisson._logpmf(5, 4) # 23.1 us |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer