View Simple-linear-models-for-NLP.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View McFarlaneEtAl_MazeData-Deidentified.csv
Study.ID CA VIQ DX Activity Content Filler REP REV FS Cued Not.Cued
CSLU-001 5.6667 124 TD Conversation 24 31 2 5 17 36 50
CSLU-001 5.6667 124 TD Picture Description 1 2 0 0 1 2 3
CSLU-001 5.6667 124 TD Play 21 6 3 8 10 6 27
CSLU-001 5.6667 124 TD Wordless Picture Book 8 2 0 4 4 2 10
CSLU-002 6.5 124 TD Conversation 3 10 3 0 0 10 13
CSLU-002 6.5 124 TD Picture Description 5 3 2 1 2 3 8
CSLU-002 6.5 124 TD Play 8 8 3 2 3 9 15
CSLU-002 6.5 124 TD Wordless Picture Book 2 2 0 0 2 2 4
CSLU-007 7.5 108 TD Conversation 25 21 4 4 17 29 38
View ratio.pyx
"""Functions for computing log-likelihood ratio statistics."""
from libc.math cimport log
from scipy.stats import binom
from scipy.stats import chi2
cpdef double LLR(int c_a, int c_b, int c_ab, int n):
View wcm.py
#!/usr/bin/env python
#
# Copyright (c) 2014 Kyle Gorman
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
View bktree.py
# Copyright (c) 2014-2015 Kyle Gorman <gormanky@ohsu.edu>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
View dense-search.py
#!/usr/bin/env python
# Python 3.5 or greater, but probably backportable with minimal effort.
"""Creates dense crossword puzzle fills.
This module provides code to fill dense cross-word puzzles. It is a work
in progress.
We represent words in a puzzle as a square matrix of bytes.
View midp.R
mcnemar.midp <- function(b, c) {
# Compute McNemar's test using the "mid-p" variant suggested by:
#
# M.W. Fagerland, S. Lydersen, P. Laake. 2013. The McNemar test for
# binary matched-pairs data: Mid-p and asymptotic are better than
# exact conditional. BMC Medical Research Methodology 13: 91.
#
# `b` is the number of observations correctly labeled by the first,
# but not not the second, system and `c` is the number of observations
# correctly labeled by the second, but not the first, system.
View midp.py
from scipy.stats import binom
def mcnemar_midp(b, c):
"""
Compute McNemar's test using the "mid-p" variant suggested by:
M.W. Fagerland, S. Lydersen, P. Laake. 2013. The McNemar test for
binary matched-pairs data: Mid-p and asymptotic are better than exact
conditional. BMC Medical Research Methodology 13: 91.
View treeify.py
#!/usr/bin/env python
# treeify.py: convert PTB parse to LaTeX's `qtree`/`tikz-qtree` format
#
# NB: this only works for documents with a single tree, due to a limitation
# with `nltk.tree`.
import fileinput
from nltk import Tree
View shingles.py
#!/usr/bin/env python
from operator import xor
from functools import reduce
from mmh3 import hash as hash32
# `hash` would collide with built-in
def hashed_shingles(tokens, order):
hashes = [hash32(token) for token in tokens]
cumhash = reduce(xor, hashes[:order])