Python
demonstration code and text files
These files were prepared
by Robert Staubs for use in the UMass Linguistics Python summer group, 2009.
Example of text
processing using regular expressions:
Program to search for
a pattern in the glosses of a child phonology datafile and put the matches in a
new file:
File referred to in
script (see Pater 1997
on source):
Some background on
collection types we haven't touched on much (tuples, dictionaries, sets):
Word frequency example
for dictionaries (makes a dictionary of word counts, gives a list of words
sorted by frequency):
Text we could use with
the above (Through the Looking Glass and What Alice Found There):
Basic function
example, Sanskrit meter generation, Fibonacci in 3 different ways (closed form,
recursive by way of Sanskrit meters, and the memoization one--should be doable
after word frequency):
Some information about
dynamic programming, Fibonacci, and its relation to Sanskrit meter, in the
context of a discussion of TesarŐs (1995) Gen:
Random text generation
based on a bigram language model built from a corpus (incomplete)
Random text generation
based on a bigram language model built from a corpus (complete)
Syllabify a word based
on onset and nuclei rules
Build nonce words
based on bigram language model of phones (incomplete--requires NLTK corpora)
Build nonce words
based on bigram language model of phones (complete--requires NLTK corpora)
Skeleton version of an
object-oriented approach to segmental phonology to illustrate OO concepts
Generate all possible
patterns permissible under a set of set definitions and a template utilizing
them
Simple set definition
file usable with patterngen