HG4052 · Speech Synthesis & Recognition
ʃ
HG4052 · Speech Synthesis & Recognition / Week 2

The Listener's
Math.

Probability and Uncertainty.

Chenzi Xu · chenzi.xu@ntu.edu.sg

P
Today

Roadmap

t
The shape of the morning

Today, by the clock

09:40  Lecture I: guessing, counting, and Bayes at the noisy café
10:40  Break (10 min)
10:50  Lecture II: we measure your ears, then logs, surprisal, entropy
11:40  Break + Colab setup (10 min)
11:50  Practical: count a novel, build a bigram babbler
12:50  Wrap-up
Before new math · 3 minutes, tell your neighbour

Four echoes from Week 1

1. What is a vector?

a list of numbers; a point with a direction

2. What question does the dot product answer?

do two arrows point the same way?

3. In the recognizer pipeline, which two stages turn features into text?

the acoustic model, then the decoder with its language model

4. The course mantra?

one list of numbers into another

Today we build the mathematics inside those last two boxes: the arithmetic of guessing.

Before new math · loose ends from Week 1

Three questions Week 1 leaves behind

When do I use cosine, and when distance?

Cosine compares direction and forgives overall size: a child's /i/ and an adult's /i/ point the same way. Distance cares about the actual Hz gap. Neither is wrong; they answer different questions, which is why /u/ ranked differently under each in the practical.

Why is two samples per cycle the limit?

A 100 Hz wave goes up and down 100 times a second. The samples must come faster than the wiggles: at least one on the way up and one on the way down of every cycle, so more than 200 samples per second. Sample more slowly and whole wiggles fall between the samples; the dots that remain trace out a slower wave instead (Week 3 calls this aliasing). So a recording at rate R holds frequencies only up to R/2: the Nyquist frequency.

In the acoustic phonetics textbook's words: “The Nyquist frequency is always one-half the sampling rate.” Johnson, Acoustic and Auditory Phonetics, 2nd ed. (2003), p. 22. The full sampling theorem is Coleman (2005) §2.5, in the same chapter as Week 1's quantisation ladder.

Do I have to convert binary in my head?

No. Practise a couple of 4-bit conversions once, then own the idea: n bits give 2ⁿ levels, and every extra bit doubles the ladder. The table is a reference, not a memory task.

The problem

Same sound, two sentences

PARSE A

“recognize speech”

[ˌɹɛkəɡnaɪz ˈspiːtʃ]

PARSE B

“wreck a nice beach”

[ˌɹɛkə ˈnaɪs ˈbiːtʃ]

The acoustics barely differ. Word boundaries are not in the signal.
So a recognizer cannot know; it can only rank its guesses.

Your perceptual system does exactly the same thing, all day, effortlessly. This week is the arithmetic of guessing: recognition as inference under uncertainty.

Week 1's timeline, act two

The statistical turn

“Every time I fire a linguist, the performance
of the speech recognizer goes up.”

Attributed to Fred Jelinek (IBM), c. 1988: the folk version. His own telling was milder, and no linguist was actually fired; see the references.

What he meant: hand-written rules were losing to probabilities counted from data. That turn is paradigm 2 on last week's timeline, HTK to Kaldi, and every paradigm since has taken it further.

Then: linguists chose what to count

A probability is a count of some unit in some context. In that era linguists chose both: phones as the units, the previous phone or two as the context.

Now: models learn the units too

End-to-end and foundation models count letters, word pieces, even self-invented sound units. Your choices move outward: which speech is in the training data (today's Singlish demo), and whose errors get counted.

Its arithmetic is still today's arithmetic: every network is trained to minimise surprisal and graded by perplexity.

Commit before the chart

Which phone is the most frequent
in spoken English?

Write your guess down. Hands up: who picked a vowel? A consonant? Which one?
The chart on the next slide settles it.

Probability, the corpus linguist's way

Count phones, then believe the counts

≈ share of phone tokens, conversational English (approximate)

P(phone) ≈ count(phone) / N

Frequency is what you counted.
Probability is what you believe about the next one.
(Goldsmith's distinction; it is in your reading)

Schwa wins. The most frequent sound in English is the most reduced one. Hold that thought for the surprisal slide.

ŋ
Phonotactics as probabilities

Conditional probability

P( /ŋ/ begins an English word ) ≈ 0

Not zero in general: perfectly fine in Cantonese (ŋɔː⁵ 我 ‘I’), in Vietnamese (Nguyễn), and in the Singaporean surname Ng. Phonotactics is a probability distribution conditioned on the language.

Heard /t/: what comes next?

P(/ɹ/ | /t/): given a /t/, how often is the next phone /ɹ/? A different question from the joint P(/t/ then /ɹ/): “pick any adjacent pair at random; is it /tɹ/?”

The bridge between them:  P(A then B) = P(A) × P(B | A)
Read aloud: “the chance of the pair is the chance of the first, times the chance of the second given the first.”

One table, three questions

Joint, marginal, conditional probability

Toy counts: 200 word-initial pairs, first phone by row, second by column. Phonotactically honest: /tɹ/ thrives, /tl/ and /sɹ/ starve.

JOINT

Pick any pair at random: is it /tɹ/?

ɹlwΣ
t4021860
s1243560
k29361580
Σ706268200

P(t then ɹ) = 40 / 200 = .20

MARGINAL

Ignore the second phone: starts with /t/?

ɹlwΣ
t4021860
s1243560
k29361580
Σ706268200

P(t first) = 60 / 200 = .30

CONDITIONAL

Given it starts /t/: is /ɹ/ next?

ɹlwΣ
t4021860
s1243560
k29361580
Σ706268200

P(ɹ | t) = 40 / 60 ≈ .67

The bridge law, checked on the counts

P(t) × P(ɹ|t) = 60/200 × 40/60 = (60 × 40) / (200 × 60) = 40/200 = P(t then ɹ)

The chain rule, plus one honest shortcut

A word is built one phone at a time

The chain rule, exact: each phone conditioned on everything before it

P( stɹɛŋθs ) = P(s) · P(t|s) · P(ɹ|st) · P(ɛ|stɹ) · P(ŋ|stɹɛ) · P(θ|stɹɛŋ) · P(s|stɹɛŋθ)

The Markov assumption: keep only the previous phone as context

P( stɹɛŋθs ) ≈ P(s) · P(t|s) · P(ɹ|t) · P(ɛ|ɹ) · P(ŋ|ɛ) · P(θ|ŋ) · P(s|θ)

Why truncate? Each extra phone of context multiplies the number of probabilities to estimate, and most longer contexts never occur in a finite corpus at all: data sparsity. Two phones of context give a trigram; more in Week 6.

★ The hardest idea this week

P( word | sound ) P( sound | word )

“How would this word sound?” and “which word was that sound?” are different questions.
Bayes' rule is the machine for flipping one into the other.

Bayes' rule

The flip, labeled

P(word | sound)  ∝  P(sound | word)  ×  P(word)

Posterior

What we want: belief in each candidate word, after hearing the sound.

Likelihood: “the speaker model”

How well does each word explain the sound? In ASR this is the acoustic model (Weeks 5–8).

Prior: “the expectation”

How plausible was the word anyway? In ASR this is the language model (Week 6).

These are exactly the two boxes from last week's pipeline diagram. Bayes' rule is the referee that multiplies their opinions.

From definition to rule

Bayes’ rule in three lines

Step 1 · The definition of conditional probability, written twice

P(A|B) = P(A,B) / P(B)
P(B|A) = P(A,B) / P(A)

Step 2 · Both name the same joint

P(A|B) · P(B)  =  P(A,B)  =  P(B|A) · P(A)

Step 3 · Divide both sides by P(B)

P(A|B)  =  P(B|A) · P(A) / P(B)

Bayes’ rule. No new assumption anywhere: the definition of conditional probability, rearranged.

The same move on the count table: one cell, two roads
ɹlwΣ
t4021860
s1243560
k29361580
Σ706268200

by row:  P(t) · P(ɹ|t) = 60/200 × 40/60 = 40/200

by column:  P(ɹ) · P(t|ɹ) = 70/200 × 40/70 = 40/200

Two different conditionals reach the same cell. Setting them equal and dividing by one marginal is exactly step 3.

Commit before we compute

A noise-smeared fricative before [ɪp]:
sip or ship?

No context given. Hands up for sip; hands up for ship.
Hold your vote; the arithmetic is next, and it may change your mind twice.

Worked example · the noisy café

A smeared fricative: sip or ship?

The sound · fixed in both scenarios

The frication is ambiguous between [s] and [ʃ], leaning /s/:  P(sound|sip) = 0.6    P(sound|ship) = 0.4

SCENARIO 1 · NO CONTEXT

Corpus priors, “ship” about 9× more frequent:

P(ship) = 0.90    P(sip) = 0.10

a two-word universe: priors renormalized over the only candidates

ship: 0.4 × 0.90 = .360    sip: 0.6 × 0.10 = .060

ship 86%
sip 14%

Ship wins: the prior steamrolls the acoustics.

SCENARIO 2 · “TAKE A ___ OF TEA”

The context flips the priors:

P(sip) = 0.95    P(ship) = 0.05

same sound, same arithmetic, new expectations

sip: 0.6 × 0.95 = .570    ship: 0.4 × 0.05 = .020

sip 97%
ship 3%

Sip wins, 97%: the verdict flips back.

The sound never changed; only the prior did. Context decides what you hear.

The same arithmetic, drawn

Bayes' rule is a ratio of areas

ship · prior .90 sip .10 .4 .6 .360 area .360 area .060

No context:
P(ship|sound) = .360/(.360+.060) = 86%

ship .05 sip · prior .95 .4 .6 .570 .020 area .570

“Take a ___ of tea”:
P(sip|sound) = .570/(.570+.020) = 97%

Widths are priors: how much of the world each word owns before you listen.
Heights are likelihoods: how well each word explains this sound.

Shade is their product, the joint. The posterior is a share of shade: your word's patch, out of all the shade there is.

Context redraws the widths. The heights never move. The verdict flips.

This is the picture in this week's 3Blue1Brown reading; the numbers are the café's.

Pencil break · ~4 minutes, in pairs

Their or there?

EX 2.1

A garbled signal is equally consistent with “their” and “there”: P(signal | their) = P(signal | there) = 0.5. Corpus priors: P(their) = 0.3, P(there) = 0.7. Use Bayes' rule to find P(there | signal). What decided the outcome?

Same recipe as the café: likelihood × prior for each candidate, then compare. Check with your neighbour before the walkthrough; the worked answer is in the appendix.

ʔ
Live demo · the prior in the wild

The prior in your pocket

Predict first, word for word. Then we dictate this into the podium recognizer:

Dictated live (fallback: pre-recorded screen capture)

“He kena scolded by his boss lah.”

What you just watched

A US-English language model prior rewriting Singlish acoustics: kena becomes the nearest English word it expects, lah vanishes. The sip/ship arithmetic, happening in the wild.

The fix is a different prior

To hear Singlish you must count Singlish: the IMDA National Speech Corpus is exactly the corpus you would count. Week 9 audits this properly.

Break · 10 minutes · back at 10:50

Stretch. Refill.
Then: we measure your ears.

When we return, your own perception becomes the data set.

Activity · your ears as data · ~10 minutes

The Ganong effect, measured on us

1. You will hear a 9-step continuum from [ɡ] to [k] (VOT 0 to 80 ms; the two ends are reference tokens), spliced before “-ift”, then the same 9 steps before “-iss”
2. After each step, vote by hand: did you hear g or k?
3. We tally the votes per step on the board and draw the two category boundaries
THE PREDICTION

If perception were acoustics only, the two boundaries would land in the same place. If your lexicon is a prior, the boundary shifts: more “g” before -ift (gift is a word), more “k” before -iss (kiss is a word). Your vote curve is the posterior, drawn by a room of linguists.

ɡ
This is not just engineering

Your perception runs Bayes too

GANONG (1980)

The lexicon biases the ear

An ambiguous sound between /ɡ/ and /k/ is heard as /ɡ/ before “-ift” (gift is a word) but /k/ before “-iss” (kiss is a word). Same acoustics, different percept: the prior at work. You have just replicated this.

WARREN (1970)

Phoneme restoration

Replace the /s/ in “legi*lature” with a cough and listeners still hear the /s/, and cannot even locate the cough. Perception fills in what the prior expects.

The noisy-channel model is not a metaphor borrowed by engineers; it is a serious theory of human word recognition (see Norris & McQueen's Shortlist B, if you want the deep end).

Math primer, continued

You've been using logs all along

Decibels

Loudness: each +10 dB ≈ ×10 in power. A log axis for ears.

The mel scale

Pitch perception: roughly logarithmic in frequency above ~1 kHz. Returns in Week 4.

Semitones

Musical intervals: equal steps = equal frequency ratios. Logs again.

Logs do two jobs: they compress huge ranges into honest axes, and they turn multiplication into addition:

log(a × b) = log(a) + log(b)

Math primer, continued

log₂ x asks: 2 to what power makes x?

0 < x < 1 24816 43210−1−2−3 x log₂ x (1, 0)(2, 1)(4, 2)(8, 3)(16, 4) (½, −1)(¼, −2) → −∞ as x → 0

Doubling x adds 1 to log₂ x: the curve keeps climbing, ever more slowly.

Inverse of a power

2y = x  ⇔  y = log₂ x   log₂ 8 = 3

Landmarks

log 1 = 0.  Between 0 and 1 the log is negative; it never reaches x = 0.  Probabilities live in that strip, so log P ≤ 0.

Products become sums

log(a × b) = log a + log b
log(aⁿ) = n · log a

Which base? Three lines to change it

log₂ counts bits (this course); log₁₀ counts decades (decibels); ln is the calculus one. To get log₂ from a calculator's log₁₀:

y = log₂ x  means  x = 2y
log₁₀ x = log₁₀(2y) = y · log₁₀ 2  the power rule
y = log₂ x = log₁₀ x / log₁₀ 2  divide by 0.301

Why every probability lives on the log scale

Multiply twenty small numbers and you get zero

Multiplying raw probabilities

A 20-word sentence, each word P ≈ 0.01:

0.01 × 0.01 × … × 0.01  =  (10⁻²)²⁰  =  10⁻⁴⁰   → absurdly small, but still alive

A two-minute transcript (200 words):

0.01 × … × 0.01  =  10⁻⁴⁰⁰  =  exactly 0.0   → below the float floor, near 10⁻³⁰⁸ (float64)

Week 1's exponent bits, out of room; the next slide closes that loop.

Adding logs: the same computation

log₂P  =  (−6.6) + (−6.6) + …  =  −133 for 20 words,  −1329 for 200   → alive at any length

From Week 5 onward, every score in this course (acoustic, lexical, syntactic) is a log probability being added. When you see scores added in a decoder, you are watching probabilities being multiplied.

Live · watch a probability die

Type it with me

>>> 0.01 ** 20
1e-40  tiny, but alive

>>> 0.01 ** 200
0.0  a two-minute transcript, gone without an error message

>>> 200 * math.log2(0.01)
-1328.77…  the same number, alive and well, in logs

Week 1, closing the loop

Remember float32: 1 sign + 8 exponent + 23 fraction bits, floor near 10⁻³⁸. Python's float is float64: 11 exponent bits buy a floor near 10⁻³⁰⁸. But 0.01²⁰⁰ = 10⁻⁴⁰⁰ needs an exponent no float can hold, so the hardware rounds it to 0.0 and says nothing. log₂P sidesteps the whole machinery: it keeps only the exponent, as an ordinary mid-sized number; −1329 fits comfortably where 10⁻⁴⁰⁰ cannot.

No crash, no warning, just a wrong answer: the log scale is a survival rule, not a taste.

From probability to information

Surprisal: −log₂ P, measured in bits

surprisal(x) = −log₂ P(x)  (in bits)

“the”, out of the blue: P ≈ .05 → 4.3 bits

“the” right after “of”: P ≈ .6 → 0.7 bits

“sesquipedalian”: P ≈ 10⁻⁸ → ≈ 27 bits

A surprise meter: the rarer, the bigger. A certainty scores 0 bits; every halving of the probability adds exactly one bit.

THE PHONETICS PAYOFF

Probabilistic reduction

Predictable words and segments are produced shorter, more reduced, more often deleted, as measured across corpora (Aylett & Turk 2004; Bell et al. 2009).

“probably” → [pɹɒbli] exactly when it's expected. Surprisal is in the signal, not just in the model.

IN THE TEXTBOOK’S WORDS

MacKay defines the Shannon information content of an outcome x as h(x) = log₂ 1/P(x), measured in bits: the same number as −log₂ P(x). Psycholinguists call it the surprisal of a word in its context (Hale 2001; Levy 2008): the name is literal, it measures how surprised you should be by the outcome that actually happened.

MacKay (2003), Information Theory, Inference, and Learning Algorithms, §2.4 (free online). The name goes back to Tribus (1961).
Two kinds of data

Two kinds of data, two kinds of probability

DISCRETE · a choice among categories

Which phone? Which word? Which particle? The outcomes are separate options, and each gets a probability. Bar heights, and they sum to 1.

.50.20.15.10.05 lahlehlormehsia

P(x) ≥ 0    Σ P(x) = 1   a probability mass function

CONTINUOUS · a measurement

F1 in Hz, a vowel's duration in ms, pitch. Any value on the line is possible, so no single exact value can carry probability. Instead a density curve: probability is the area under it between two values; the whole area is 1.

200250300350400 Hz P(260 ≤ F1 ≤ 300) = the shaded area height = density, not probability

f(x) ≥ 0    total area = 1   a probability density function

Everything so far was discrete (phones, words). Acoustic measurements are continuous, and Week 6's recognizer scores them with densities: next slide.

One more tool, for Week 6's recognizers

Continuous values need densities

F1 of /i/ tokens, one speaker: histogram + fitted normal density

What's the probability your next /i/ has F1 of exactly 280.000000 Hz?  Zero.

For continuous measurements we use a density: a curve whose height says which regions are likely. Fit a bell curve to F1 and you have a model of a vowel.

In Week 6, each HMM state scores incoming acoustic frames with exactly this kind of curve. You now own every ingredient.

Σ
Entropy

Average surprisal = how guessable a language is

H(X) = −Σx P(x) · log₂ P(x)  (in bits)
NEXT SLIDE: SHANNON'S GUESSING GAME

I have a sentence. You guess it letter by letter; I only say yes or no. We count the guesses; those counts estimate the language's per-letter information.

Strict phonotactics → fewer real options → lower entropy per segment. After /st/, English allows very little. Structure = predictability.

IN THE TEXTBOOK’S WORDS

H(X) = −Σx p(x) log₂ p(x), in bits: Jurafsky & Martin introduce entropy as a measure of information and, intuitively, as “a lower bound on the number of bits it would take to encode a certain decision”. The definition is Shannon’s (1948).

Jurafsky & Martin, SLP 3rd ed., §3.7, eq. (3.32); Shannon (1948).
Letters, if all 26 were equally likely

4.70 bits

computed: log₂ 26

English letter frequencies (unigram)

≈ 4.1 bits

the formula, fed corpus letter counts; you compute it on a novel in the practical

A human using full context (Shannon's 1951 estimate)

≈ 1 bit / letter

measured with the guessing game, next slide; his bounds: 0.6 to 1.3 bits

Activity · Shannon's guessing game · ~8 minutes

Guess my sentence, letter by letter

1. I have a sentence you cannot see. Call out letters for position one until you hit it; I only say no or yes
2. A scorekeeper tallies the guesses needed for every position
3. Round two: a new sentence with a code-switch in the middle. Predict first: where will the guess counts spike?
WHAT THE TALLY MEANS

Mid-word, after strong context, one guess suffices: low surprisal. Right after the switch point, guesses pile up: surprisal made audible. (Strictly, guess counts give bounds on entropy, not the number itself; close enough to feel it.)

Perplexity

2entropy = the average branching factor

P(x)  → −log₂ →  surprisal  → average →  entropy H  → 2H →  back to a number of options

The 2H undoes the −log₂. For a single outcome the round trip returns 1/P(x): a one-in-32 event counts as 32 live options; perplexity averages those across outcomes. Check: k equally likely options → H = log₂ k → 2H = k exactly.

perplexity ≈ 17: seventeen live options perplexity = 2: a coin flip

Perplexity converts bits back into an intuition: “the model is as confused as if it were choosing among k equally likely options.”

Letter frequencies alone: 24.1 ≈ 17. Predicting with the preceding text (the guessing game): 21 = 2, nearly a coin flip per letter.

In Week 6 we grade language models by exactly this number, on text they have never seen.

One rule we keep for the rest of the term

The exam rule: held-out data

We always examine a model
on sentences it never saw.

Training set

The text the model counted. Its textbook.

Held-out test set

The exam: text it could not have memorized.

In the practical

Your bigram model's perplexity on a fresh paragraph vs the same paragraph shuffled. Commit now: which is higher, and why?

Acing your own textbook proves memory, not knowledge. From here to Week 13, every number we trust is measured on held-out data.

Break · 10 minutes · back at 11:50

Open your laptop.
The Week 2 Colab link is on NTULearn.

Same drill as last week: browser tab, no installs. Your notebook already knows pwd and ls.

The practical · 11:50–12:50

From counts to a babbling machine

  • Meet def: read the provided text-cleaning function aloud, f(x) made of code
  • Count a whole novel (NLTK's built-in Gutenberg corpus): does ETAOIN appear?
  • Letter bigrams as warm-up, then phone bigrams from a transcribed wordlist
  • Sample from the model: generate pseudo-words that babble in English phonotactics
  • Perplexity on held-out text: a fresh paragraph vs the same paragraph shuffled

Stretch (or take-home): trigrams (better babbling); or compare the entropy of English letters vs English phones. Which writing system is the corpus hiding?

You leave with this, made by you

your bigram heatmap: hunt for the bright q→u cell and the phonotactic dark zones

The practical · your first code reading

def is the f(x) machine

def clean_text(raw):
    text = raw.lower()
    text = remove_punctuation(text)
    return text

We read it aloud together, once: the name, the input, two steps, the output. That is the whole grammar of a function.

Why we read and do not write

This is Week 1's input → output machine, in code: clean_text(raw) is spectrogram(waveform)'s cousin. From Week 5 onward you must recognize functions on sight; you will never be asked to write one from scratch.

The practical · your second code reading

for means: do this once per item

The loop, three lines

counts = Counter()
for ch in text:
    counts[ch] += 1

Read aloud: for each character in the text (call it ch), add one to that character’s count. The indented body runs once per item; ch is a name you choose, fresh each round.

The same loop, packed into brackets

letters = [ch for ch in text
           if ch.isalpha()]

A list comprehension: collect ch, for each ch in text, keeping only the letters. The same loop in one line; the notebook uses both shapes.

As with def: you read these on sight; you are never asked to write one from scratch. Counting the novel is the left loop run 846,301 times, once per character of Emma.

The practical · the hour, mapped

By the end of the hour, you will have built this

1.  Read clean_text aloud together (10 min)
2.  Count a novel: letter frequencies, ETAOIN (10 min)
3.  Phone bigrams and your heatmap (20 min)
4.  Babble: sample pseudo-words (10 min)
5.  Perplexity: held-out vs shuffled (10 min)
DONE LOOKS LIKE

✓ a bigram heatmap with the q→u cell found
✓ five pseudo-words that look eerily English
✓ perplexity higher on the shuffled text, and you can say why

This bigram model returns in Week 6 as the language model inside a real recognizer. The stretch tasks are take-home if the hour runs out.

In the textbook's words

This week, formally

DEFINITION
Conditional probability

P(A | B) = P(A, B) / P(B): the probability of A once B is known. Read “the probability of A given B”.

Standard; see Goldsmith (2007), “Probability for linguists”.
DEFINITION
Bayes' rule

P(A | B) = P(B | A) · P(A) / P(B). It turns “how a word sounds” (likelihood) and “how expected the word is” (prior) into “which word, given the sound” (posterior).

Jurafsky & Martin, SLP 3rd ed. (noisy-channel framing).
DEFINITION
Surprisal & entropy

Surprisal of an event: I(x) = −log₂ P(x) bits. Entropy is its expected value: H(X) = −Σₓ P(x) log₂ P(x), the average surprisal.

Shannon (1948); Jurafsky & Martin, SLP 3rd ed., ch. 3.
DEFINITION
Perplexity & the n-gram

An n-gram model estimates P(word | n−1 previous words). Its perplexity on a test set W is PP(W) = P(w₁…w_N)−1/N; “the lower the perplexity… the better the model.”

Jurafsky & Martin, SLP 3rd ed., §3.1, §3.7 (quoted).
Exercises · pencils out · ~6 minutes, in pairs

Try it: the listener's arithmetic

EX 2.2

One word has probability ¼; another has probability 1/32. Give each one's surprisal in bits. Which is more surprising, and by how many bits?

EX 2.3

A toy language has 4 phonemes. (a) If all four are equally likely, what are its entropy and perplexity? (b) Now one phoneme has P = 0.7 and the other three share 0.1 each. Is the entropy higher or lower than (a)? Compute it.

EX 2.4

Utterance-final particles in a Singlish corpus: P(lah) = .5, P(leh) = .2, P(lor) = .15, P(meh) = .1, P(sia) = .05. Compute the entropy and the perplexity. Compared with EX 2.3(b): which system keeps its listeners guessing more?

EX 2.1 was the pencil break earlier. Worked answers for everything are in the appendix.

Before next week

This week’s readings

REQGoldsmith (2007), “Probability for linguists”

Written exactly for you: linguists with secondary-school math. At least the opening sections: probability vs frequency, distributions over words and phones. journals.openedition.org/msh/7933

REQJurafsky & Martin, SLP (3rd ed., free online): Ch 3 “N-gram Language Models”, §3.1–3.3 + the perplexity section

Skip smoothing for now; we return to it in Week 6. web.stanford.edu/~jurafsky/slp3 (chapter numbers refer to the Jan 2026 release)

REQ3Blue1Brown, “Bayes theorem, the geometry of changing beliefs” (15 min video)

Watch before the practical: the area-based picture is the one we draw on the board. 3blue1brown.com/lessons/bayes-theorem

OPTShannon (1951), “Prediction and Entropy of Printed English”

The original guessing-game paper: short and historically delightful. Free at archive.org/details/bstj30-1-50

OPTSeeing Theory (Brown University): interactive probability

Play with “Basic Probability” and “Compound Probability” if conditioning still feels slippery. seeing-theory.brown.edu

Looking one week ahead

Next week’s readings

REQHugging Face Audio Course, Unit 1 “Working with audio data”

Meet the course’s second free resource: short pages with runnable audio examples. Unit 1 is waveforms, sampling and spectrograms; the course follows us to Week 13. huggingface.co/learn/audio-course

REQSchaedler, Seeing Circles, Sines, and Signals (interactive)

The sine, sampling and aliasing pages: Week 1’s samples-per-cycle slides, animated and draggable. jackschaedler.github.io/circles-sines-signals

REQJurafsky & Martin, SLP Ch 14 “Phonetics and Speech Feature Extraction”: acoustics sections

Stop at feature extraction: that is Week 4’s whole story. (Chapter numbers refer to the Jan 2026 release.)

OPT3Blue1Brown, “But what is the Fourier Transform?” · first 10 minutes

The winding-machine picture behind next week’s spectrograms.

OPTStyler, Using Praat for Linguistic Research

The spectrogram-settings and formant sections: a lab manual you will keep using through Week 5. wstyler.ucsd.edu/praat

Next week: the sound itself becomes numbers: sampling in full (aliasing included), the Fourier idea, spectrograms, and the vocal tract as source and filter.

Wrap-up · quiz radar

Five things to walk out with

θ

Hear a sound, weigh every explanation,
pick the least surprising.

That's Bayes, and that's a recognizer.  Next week: the sound itself becomes numbers (sampling, spectrograms, source–filter), and you will hear what a 4 kHz telephone ceiling removes from /s/.

Sources

References

Goldsmith, J. (2007). “Probability for linguists.” Mathématiques et sciences humaines 180, 73–98. The probability-vs-frequency distinction, and this week’s required reading.

Jelinek, F. (2005). “Some of my best friends are linguists.” Language Resources and Evaluation 39(1), 25–34. His own account of the “fire a linguist” quote and of IBM’s statistical turn; the LREC 2004 talk slides are free at lrec-conf.org/lrec2004/doc/jelinek.pdf.

Shannon, C. E. (1951). “Prediction and Entropy of Printed English.” Bell System Technical Journal 30(1), 50–64. The guessing game and the ≈1 bit-per-letter estimate.

Ganong, W. F. (1980). “Phonetic categorization in auditory word perception.” JEP: Human Perception and Performance 6(1), 110–125.  Warren, R. M. (1970). “Perceptual restoration of missing speech sounds.” Science 167, 392–393.

Aylett, M. & Turk, A. (2004). Language and Speech 47(1), 31–56.  Bell, A. et al. (2009). Journal of Memory and Language 60(1), 92–111. Probabilistic reduction: predictability shortens words.

Norris, D. & McQueen, J. M. (2008). “Shortlist B: A Bayesian model of continuous speech recognition.” Psychological Review 115(2), 357–395.

Johnson, K. (2003). Acoustic and Auditory Phonetics, 2nd ed. Blackwell, p. 22 (the Nyquist sentence).  Coleman, J. (2005). Introducing Speech and Language Processing. CUP, §2.5.

Jurafsky, D. & Martin, J. H. Speech and Language Processing, 3rd ed. (Jan 2026 release), Ch 3. Definitions quoted on the formal slide.

3Blue1Brown, “Bayes theorem, the geometry of changing beliefs”: the area picture.  Seeing Theory (Kunin et al., Brown University): interactive probability.

Appendix · worked answers

Answers

EX 2.1

P(there | signal) = (0.5 × 0.7) / (0.5 × 0.7 + 0.5 × 0.3) = 0.35 / 0.50 = 0.70. The likelihoods tied, so the prior alone decided: context doing the work your ear does automatically.

EX 2.2

−log₂(¼) = 2 bits; −log₂(1/32) = 5 bits. The 1-in-32 word is more surprising by 3 bits, and 3 bits means 2³ = 8× less probable.

EX 2.3

(a) H = log₂4 = 2 bits; perplexity = 2² = 4 (“choosing among 4”). (b) H = −[0.7 log₂0.7 + 3(0.1 log₂0.1)] = −[−0.360 − 0.997] = 1.36 bits: lower. Skew makes a language more predictable; perplexity falls to 21.36 ≈ 2.6.

EX 2.4

H = −(.5 log₂.5 + .2 log₂.2 + .15 log₂.15 + .1 log₂.1 + .05 log₂.05) ≈ .500 + .464 + .411 + .332 + .216 = 1.92 bits; perplexity 21.923.8, as confused as choosing among about four equally likely particles. Higher than EX 2.3(b)'s 1.36 bits: despite the strong lah bias, the particle system keeps listeners guessing more.