Using Python for a demonstration in historical linguistics

MRAB python at
Sat Nov 6 03:37:06 CET 2010

On 06/11/2010 02:17, Dax Bloom 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?
Very. :-)

I'd build a dict of each rule:

     bʰ → b
     b → p

etc, and then use the re module to perform the replacements in one
pass, looking up the new sound for each match.

More information about the Python-list mailing list