Skip to main content

Sonority Distance Calculator

Example Input Files & Output

It wasn't more than a week ago that I found myself staring at a homework assignment with the thought of, "I bet I could solve this a lot faster with some help from a computer." What ensued very shortly thereafter was about forty-five minutes of code being written followed by another fifteen minutes spent making sure that everything worked as intended. Half an hour later I was submitting the final, polished version of my completed homework assignment. While I may not have arrived at the same conclusion as might have been desired by my professor- such an outcome is always a possibility- the fact remained that I'd built a little program that was undeniably useful. And it's something that I'd like to share with the rest of the web. But first things first. Let me explain why such a program should need to exist at all.


Sonority, which is rather vaguely translated by Google as being "the quality of being sonorous," can be more or less described as being a classification assigned to sounds based upon their relative volume or body. A vowel, for example, would be classified as being more sonorous than a voiceless obstruent. (If you don't know what that latter sound is, an example of such would be the the /t/ in the word "time.") There exists sonority hierarchies which distinctly classify and assign values to these and other different sounds, and these vary from language to language in their categorization of sounds.

Where sonority hierarchies are frequently applied is in determining the distance in sonority that exists between two segments. (For those unacquainted with linguistic terminology, a segment is analogous to a specific sound.) It has been observed that certain phonological processes only occur when a word exhibits a particular sonority distance between two of its segments. The triggering distance for the process is called the minimal sonority distance; this is the minimal distance in sonority before which (or after which) the phonological process does (or does not) occur.

In the case of my homework assignment, the two segments to be investigated were the initial two consonants of the word. I was given two sets of words: one for which a particular process was observed in a certain form of that word, and the other in which no such process occurred. My job was to figure out if there existed a minimal sonority distance (MSD) trigger, what value that MSD might be, and lastly to propose a sonority hierarchy. The first of my inquiries was already answered as a given by my professor; it was a homework assignment specifically dealing with MSD, after all.

This is the point where I realized just how tedious it would be to test different hierarchies against each other in order to realize a clean MSD amongst the data set. A computer program made to test the same two word-initial consonants against an easily modifiable hierarchy seemed like a much better option. So that's what I wrote. And it performed exactly as expected. Whether or not my homework receives the grade I expect... that still remains to be seen.

Now that it's time to share this with the world, it's probably best I describe how to use this program. For a start, one needs to have a plain text (no rich formatting) file labeled "hierarchy.txt" containing the hierarchy they wish to utilize. (This can obviously be modified prior to running the program additional iterations.) Each line should then be populated with the segments of the sonority corresponding to the line number. That means that any segment to be assigned a sonority value of one be located on the first line, anything to be assigned two be found on the second line, and so on. In a separate plain text file named "data.txt" there should be two lists of words, one word per line. The lists need to be separated by a blank line, which the program will identify as marking the end of the first word set and the beginning of the second.

After that, it's time to run the program. Assuming you already have Python installed on your computer and all three necessary files are located in the same directory, navigate to them from a command line / terminal window. Then simply execute the program with the command, "python sd-calculator.py" and wait a moment for the program to finish. Your output should look somewhat similar to the screenshot above, except that your values will match the data and hierarchy you provided. (Unless of course you use the dummy data included with the program, in which case you should get the exact same result.)

Armed with the results, it becomes a lot easier to identify minimal sonority distances that exist amongst data sets. More specifically, minimum and maximum sonority distances that occur in a set of words can be compared to the minimum and maximum distances of a second set of words. This is useful for quickly positing and then modifying a sonority hierarchy until it results in a distinct MSD separating two lists of words.

Without further ado, here it is! ---> Sonority Distance Calculator v1.0 by Christopher Kuzma

Of note are the following constraints:
  • This program is only capable of processing ASCII-formatted characters. Any "special" characters need to be assigned an ASCII stand-in that correlates between the hierarchy file and the data file.
  • Two word lists are necessary. If I had more time I would rewrite my program to be able to process one, two or even more groups of words. But given my time constraints, this is how the program was initially written and this is how I'm sharing it.
  • Keen eyed users will notice that this program compares the first-two letters of a word, as opposed to the first two segments or sounds. While that is true, I'm also assuming that you are using the phonetic spellings of your words, in which case my method of comparison should still work.
  • If there appears a letter in the first two letters of a word that does not also occur in the hierarchy, this program will crash. If the program is crashing for you, this is probably why.
  • Sonority distance values are only calculated for the first two characters found on each line of the data file. For the time being, should you wish to test segment distances that do not occur in the first two positions of the word, such as the /pu/ in the word /computer/, simply delete all characters preceding the first segment that makes up the comparison.
Use of this program is free for personal, non-commercial use. Any other use (including but not limited to: academic research, commercial processing, etc.) requires permission and proper attribution. Comments and suggestions for improvements are welcomed and encouraged. Modification of this program is allowed, assuming that the prior conditions are not violated and the original copyright remains within the program. Copyright 2013, Christopher Kuzma.

Comments