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
# Z_r (or "averaging") transform functions, based on: | |
# | |
# Kenneth W. Church and William A. Gale. 1991. A comparison of the enhanced | |
# Good-Turing and deleted estimation methods for estimating probabilities of | |
# English bigrams. Computer Speech and Language 5(1):19--54 | |
# | |
# Kyle Gorman <kgorman@ling.upenn.edu> | |
# | |
# Church and Gale do not say what is to be done about points at the edges. I | |
# have chosen to average them with respect to only the inward facing frequency, |
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
#!/usr/bin/env python | |
# difflib_demo.py | |
# Kyle Gorman <kgorman@ling.upenn.edu> | |
from difflib import SequenceMatcher | |
if __name__ == '__main__': | |
from sys import argv | |
for file in argv[1:]: |
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
#!/usr/bin/env python | |
# ProbDist.py: Two classes for probability distributions and sampling. | |
# Kyle Gorman <kgorman@ling.upenn.edu> | |
from math import fsum | |
from bisect import bisect | |
from random import random | |
from collections import defaultdict | |
class MLProbDist(object): |
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
File type = "ooTextFile" | |
Object class = "TextGrid" | |
xmin = 0 | |
xmax = 3 | |
tiers? <exists> | |
size = 1 | |
item []: | |
item [1]: | |
class = "IntervalTier" |
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
#!/usr/bin/env python | |
# point_bisect.py | |
# Kyle Gorman | |
# | |
# I continually use these two patterns in Python for iterables that contain | |
# continuous values, sorted. Here they are in their full glory. | |
from bisect import bisect_left |
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
/* Copyright (c) 2012 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 the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be included in |
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
#!/usr/bin/env python | |
# | |
# TIMIT+.py: make TIMIT bearable to use | |
# Kyle Gorman <kgorman@ling.upenn.edu | |
# | |
# To use this: | |
# 1. place in the same directory as a copy of TIMIT | |
# 2. install SoX and textgrid.py | |
# 3. run ./TIMIT+.py | |
# |
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
/* Copyright (c) 2012 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 the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be included in |
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
/** | |
* Copyright (C) 2012 Kyle Gorman | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* | |
* 1. Redistributions of source code must retain the above copyright notice, | |
* this list of conditions and the following disclaimer. | |
* 2. Redistributions in binary form must reproduce the above copyright |
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
#!/usr/bin/env Rscript | |
# lda-match.R: Perform group matching via backward selection using a heuristic based on Fisher's | |
# linear discriminant | |
# Kyle Gorman <gormanky@ohsu.edu> | |
require(MASS) | |
lda.match <- function(x, grouping, term.fnc=univariate.all) { | |
# Create a matched group via backward selection using a heuristic | |
# based on Fisher's linear discriminant. Observations are removed |
OlderNewer