Using Python for a demonstration in historical linguistics

Chris Rebert clp2 at rebertia.com
Fri Nov 5 22:36:49 EDT 2010


On Fri, Nov 5, 2010 at 7:17 PM, Dax Bloom <bloom.dax at gmail.com> wrote:
> Hello,
>
> In the framework of a project on evolutionary linguistics I wish to
> have a program to process words and simulate the effect of sound
> shift, for instance following the Rask's-Grimm's rule. I look to have
> python take a dictionary file or a string input and replace the
> consonants in it with the Grimm rule equivalent. For example:
> bʰ → b → p → f
> dʰ → d → t → θ
> gʰ → g → k → x
> gʷʰ → gʷ → kʷ → xʷ
> If the dictionary file has the word "Abe" I want the program to
> replace the letter b with f forming the word "Afe" and write the
> result in a tabular file. How easy is it to find the python functions
> to do that?

Tabular files:
http://docs.python.org/library/csv.html

Character substitution:
(a) http://docs.python.org/library/string.html#string.maketrans and
http://docs.python.org/library/stdtypes.html#str.translate
(b) http://docs.python.org/library/stdtypes.html#str.replace
In either case, learn about dicts:
http://docs.python.org/library/stdtypes.html#dict

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list