Skip to content
Tutorials Center
My learning

Topics

Lesson 46 of 49 Β· Projects and Practice

Project: a sound-change simulator

Build a sound-change simulator in Python: write rules like voicing and final-vowel loss, apply them in order, see why order matters, and compare with Latin to Spanish.

Historical linguists describe sound change with rules, and a rule is something you can run. In this project you build a small simulator that takes an ancestor word and applies a series of changes in order, the way a language might have evolved over generations. You will see two things: regular rules produce regular results across many words, and the order of the rules decides the outcome.

Two rows of word cards: kapata to kabada to kabad to kabat, and sipita to sibida to sibid to sibit, with three numbered rules below
Three ordered rules turn an invented ancestor word into its descendant, step by step.

What you will learn

  • How to write a sound change as a rule with an environment
  • How to apply an ordered list of rules to many words
  • How rule order changes the result (feeding and bleeding)
  • How a simple rule set compares with real Latin-to-Spanish data

Key terms

Sound change rule: written A β†’ B / C _ D, meaning "A becomes B when it comes between C and D".

Environment: the sounds around the changing sound.

Lenition: weakening of a consonant, such as voicing between vowels.

Apocope: loss of a final sound or syllable.

Rule ordering: the sequence in which changes apply; some orders give different results.

Writing changes as rules

In the notation linguists use, p, t, k β†’ b, d, g / V _ V reads: "the voiceless stops p, t, k become the voiced b, d, g between vowels". Real languages show this pattern often. In the history of Spanish, Latin vita became vida and amicu became amigo, and the same weakening shows up in many other languages. Three rules make up our toy language history:

Rule Notation In words
1. Voicing p t k β†’ b d g / V _ V between vowels, voiceless stops are voiced
2. Apocope V β†’ βˆ… / _ # a final vowel is lost
3. Final devoicing b d g β†’ p t k / _ # at the end of a word, voiced stops become voiceless

Final devoicing is real: German pronounces Rad "wheel" with a final [t], and Russian and Turkish do similar things. The rules apply to an invented ancestor language written with asterisks, such as kapata. (An asterisk marks a reconstructed or hypothetical form.)

A programmer reads a rule as a pattern and a replacement. Regular expressions express the environment: a lookbehind (?<=[aeiou]) for "after a vowel" and a lookahead (?=[aeiou]) for "before a vowel".

Running the simulation

The first demo defines the three rules and traces each invented word through them. Read the output as a mini history: the ancestor, then the form after each change.

Python Apply ordered rules

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice what the rules did not do. Word-initial consonants stayed (k in kapata), because the environment requires a vowel on both sides. And a word that cannot meet the environment, such as tapu, simply passes through that rule unchanged. That is the regularity the Neogrammarians insisted on: the same environment, the same outcome, in every word.

Why order matters

If you shuffle the rules, the outcome can change. Suppose final devoicing happened before apocope. In kabada, the final sound is a vowel, not a voiced stop, so devoicing has nothing to do; only afterwards does apocope remove the vowel, leaving kabad with a voiced final stop. Linguists call such a case counterfeeding: one rule would have created the environment for another, but it applies too late. In the opposite order, the apocope feeds devoicing by exposing the d at the end.

Changes that remove the context for another rule are said to bleed it. Examples occur in the history of many languages, and one reason that historical reconstruction needs careful reasoning about order: only a particular sequence of changes may produce the forms we see.

The second demo tries all six possible orders of the three rules and groups them by the final result. This is a good use of a small program: checking every possibility is easy for a computer and tedious for a person.

Python Does order matter?

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Checking against real data

How close is a simple rule set to real history? Try Latin to Spanish with two rules: voicing between vowels, and a final u becoming o (a real Latin-to-Spanish change; Spanish -o comes from Latin -u). The third demo compares the prediction with the Spanish word. For three of the four words the simple rules are enough; for lupu (Spanish lobo) they are not, because the stressed u also became o, a separate change. A real reconstruction needs many such rules, and finding the full set is the historical linguist's work.

Python Latin to Spanish, two rules

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Extending the project

Add your own rules and test them on a word list:

  • Nasal assimilation (n β†’ m / _ p, b).
  • Palatalization (k β†’ tΚƒ / _ i, e), a widespread change that gave Latin cena its Italian pronunciation, [tΚƒena].
  • A rule that deletes a vowel between two identical consonants.
  • Record each word's history so you can print it as a tree.

An important lesson: the simulator makes predictions, and where it fails you learn that your rule set is incomplete. This is exactly how reconstructed rules are tested.

Common misconceptions

"Sound changes happen in one jump." Real changes spread gradually through a community; a simulator applies them instantly for simplicity.

"The rules apply because speakers decide to simplify." Speakers are not aware of the change. It emerges from the accumulated drift of articulation and perception across generations.

"If the rules predict a word, the history is proven." Different rule sets can predict the same words, which is why linguists ask for independent evidence and the simplest consistent explanation.

Check your understanding

Quick check Β· 5 questions

of 5 answered You scored / 5 Β· perfect!

  1. 1. What does the rule p t k β†’ b d g / V _ V mean?

    The environment V _ V means between two vowels.
  2. 2. Why did the initial k in kapata not change?

    The voicing rule needs a vowel on both sides.
  3. 3. What is apocope?

    It removes the end of a word.
  4. 4. Why can the order of rules change the result?

    Feeding and bleeding relations make order matter.
  5. 5. What does a mismatch such as lupu to lobo tell you?

    A mismatch is a prediction test: it points to a missing rule.

Summary

  • Sound changes are rules with environments, and a regular rule applies in every matching word.
  • Rule order matters because of feeding and bleeding.
  • A simulator turns historical hypotheses into testable predictions.
  • Mismatches with real data show which rules are still missing.

Next: Glossary