\(N = 1{,}000{,}000\)。Evert 在這個例子沒有用視窗,而是數雙詞組(bigram):搭配詞 Y 就是緊鄰在目標詞 X 前面的那個詞。每個 X 前面只有 1 個位置,所以位置數就是 count(X)。N = 1,000,000. Evert does not use a window here but counts bigrams: the collocate Y is the word right before the target X. Each X has exactly one such slot, so the number of slots is just count(X).
the Iliad《伊利亞特》
搭配詞 Y = the:count = 100,000 目標詞 X = Iliad:count = 10 \(P(\text{the}) = \frac{100{,}000}{1{,}000{,}000} = 0.1\) \(E = 0.1 \times 10 = \mathbf{1}\) O = 10
must also「必須」「也」
搭配詞 Y = must:count = 1,000 目標詞 X = also:count = 1,000 \(P(\text{must}) = \frac{1{,}000}{1{,}000{,}000} = 0.001\) \(E = 0.001 \times 1000 = \mathbf{1}\) O = 10
兩個詞對的 O 和 E 完全一樣:O = 10,E = 1。Both pairs have exactly the same O and E.
簡單指標的問題(二):分數相同A problem with simple measures, part 2: identical scores
詞對pair
O
E
O / E
MI
the Iliad
10
1
10
3.32
must also
10
1
10
3.32
分數相同,但情況不同:Iliad 只出現 10 次,而且每一次前面都是 the(O = 10 已是最大可能值);must、also 各出現 1,000 次,本來可以共現多得多。Same score, different situations: Iliad occurs only 10 times and every one follows “the” (O = 10 is the maximum possible), while must and also occur 1,000 times each and could have co-occurred far more.
O 與 E 忽略了語料中其他的一切——我們還要看兩詞「沒有」共現的情況。O vs. E ignores everything else in the corpus. We also need to look at when the words do not co-occur.
列聯表Contingency table: two events, X and Y
Y 發生Y occurs
Y 不發生Y does not
X 發生X occurs
a
b
X 不發生X does not
c
d
每個個案恰好落入四格之一every case falls into exactly one cell
a = X 和 Y 都發生的個案數cases where both X and Y occur
b = 只有 X 發生(Y 沒有)X occurs, Y does not
c = 只有 Y 發生(X 沒有)Y occurs, X does not
d = 兩者都沒有發生neither X nor Y occurs
X、Y 可以是任何事件;表格也記錄了「都沒有」的情況。詞語只是其中一例(下一頁)。X and Y can be any events, and the table also records when neither happens. Words are just one example (next slide).
列聯表無處不在Contingency tables are everywhere
兩個「是/否」的性質,各自分成兩類,數一數各格有多少個案Two yes/no properties, cross-tabulated: how many cases fall in each cell?
吸煙 × 肺癌Smoking × lung cancer
吸煙者患肺癌的比例是否更高?Are smokers more likely to have cancer?
示意數字 illustrative
慣用手 × 性別Handedness × sex
左撇子的比例是否因性別而異?Does the share of left-handers differ by sex?
教科書例子 textbook example
好 × 天氣(句子)Two words × sentences
兩個詞是否傾向出現在同一個句子?Do the two words tend to share sentences?
本課的小語料 our toy corpus
結構完全相同:問題都是——兩個性質互相獨立嗎?搭配詞的判斷也是如此。Same structure every time: are the two properties independent? Collocations are no different.
n 選 k(一):放回 vs. 不放回Background “n choose k”, part 1: with vs. without replacement
ABCD
從這 4 個字母中,依序選出 4 個。順序算不同。Pick 4 letters one after another from these 4. The order counts.
放回(同一字母可再選):每次都有 4 種選擇With replacement (a letter may be chosen again): 4 choices every time
41st
×
42nd
×
43rd
×
44th
=
256\(4^4\)
不放回(每個字母只能用一次):每選一個,選擇就少一個Without replacement (each letter only once): one fewer choice after every pick
41st
×
32nd
×
23rd
×
14th
=
24\(4!\)
階乘:\(4! = 4 \times 3 \times 2 \times 1 = 24\),就是把 4 個字母全部排一遍的方法數。Factorial: \(4! = 4 \times 3 \times 2 \times 1 = 24\) is the number of ways to line up all 4 letters.
n 選 k(二):只選 2 個(不放回)Background “n choose k”, part 2: only pick 2, without replacement
ABCD
現在只選 2 個,不放回;順序仍然算不同(AB ≠ BA)。Now pick only 2, without replacement; the order still counts (AB ≠ BA).
第 1 個有 4 種選擇,第 2 個剩 3 種:4 choices for the 1st pick, 3 left for the 2nd:
41st
×
32nd
=
12AB, AC, AD, BA, …
用階乘寫:4! 除以 (4−2)!,去掉多餘的 ×2×1In factorial notation: divide 4! by (4−2)! to cut off the unneeded “×2×1”
下一頁的奶茶實驗:\(\binom{8}{4} = \dfrac{8!}{4!\,4!} = 70\) 種選法,只有 1 種全對 → \(p = 1/70\)。Tea experiment (next slide): \(\binom{8}{4} = 70\) ways to pick the 4 milk-first cups; only 1 is fully correct, so \(p = 1/70\).
Fisher 與「奶茶實驗」Fisher and the lady tasting tea (1935)
R. A. Fisher 1890–1962
Muriel Bristol 聲稱能分辨奶茶是「先倒牛奶」還是「先倒茶」。Ronald Fisher 設計了實驗來檢驗。A lady claims she can tell whether the milk or the tea was poured first. Fisher designs a test.
M
T
T
M
M
T
M
T
8 杯外觀相同:4 杯先牛奶 (M)、4 杯先茶 (T),隨機排列;她要指出哪 4 杯是先牛奶。8 identical-looking cups, 4 milk-first and 4 tea-first, in random order. She must pick the 4 milk-first cups.
全對時,靠猜的機率只有 1/70,這張表「太不可能」;答對 3 杯則可能只是運氣。這就是 Fisher 精確檢定。Guessing all 4 right has probability 1/70, so the table is very unlikely by chance. 3 of 4 could easily be luck. This is Fisher’s exact test.
一張表的機率怎麼算?How likely is one particular table? (hypergeometric distribution)
\(\textcolor{#7c3aed}{N} = a + b + c + d\):表中所有個案(項目)的總數。\(\textcolor{#7c3aed}{N}\) is the total number of items in the table.
分子 ①:「有 X」這一列有 \(\textcolor{#1f5fd6}{a+b}\) 個項目,其中 \(\textcolor{#e0570f}{a}\) 個有 Y —— 從 \(a+b\) 個中選出 \(a\) 個。Numerator ①: the “has X” row holds \(\textcolor{#1f5fd6}{a+b}\) items; choose the \(\textcolor{#e0570f}{a}\) of them that have Y.
分子 ②:「無 X」那一列有 \(\textcolor{#1f5fd6}{c+d}\) 個項目,其中 \(\textcolor{#e0570f}{c}\) 個有 Y。兩列的選法相乘。Numerator ②: the other row holds \(\textcolor{#1f5fd6}{c+d}\) items, \(\textcolor{#e0570f}{c}\) of which have Y. The two choices are independent, so we multiply.
分母:全部 \(\textcolor{#7c3aed}{N}\) 個項目中,任意挑 \(\textcolor{#e0570f}{a+c}\) 個當作「有 Y」的所有可能。Denominator: all ways to choose which \(\textcolor{#e0570f}{a+c}\) of the \(\textcolor{#7c3aed}{N}\) items have Y, ignoring the rows.
代入 \(a=8,\ b=2,\ c=2,\ d=8\)(\(N=20\)):Plug in the numbers:
這張表有多「不可能」?How unlikely is this table?
20 位學生:10 位女生、10 位男生;其中 10 位有在讀書,而讀書的人裡有 8 位是女生。性別與讀書有關嗎?20 students: 10 women, 10 men; 10 are studying, and 8 of those are women. Is studying related to sex? (illustrative numbers)
若兩者無關,純屬偶然,預期讀書的女生只有 5 位。If they were unrelated, we would expect only 5 studying women.
觀察到的表 observed table
更極端 more extreme
最極端 most extreme
Fisher 精確檢定:把觀察到的表與所有更極端的表的機率相加Fisher’s exact test sums the observed table and all more extreme ones
→ 顯著 significant
回到 the Iliad / must alsoBack to Evert’s example: what does Fisher’s test say?
兩者:O = 10,E = 1,O/E = 10,MI = 3.32 —— 簡單指標分不出來。Both have O = 10, E = 1, O/E = 10, MI = 3.32: the simple measures cannot separate them.
完整的列聯表:每一項是一個雙詞組(共 1,000,000 個);列 = 前一個詞是不是 the / must,欄 = 後一個詞是不是 Iliad / also。Full contingency tables: every item is a bigram (1,000,000 in total); row = is the first word the / must, column = is the second word Iliad / also.
the Iliad (count(the) = 100,000 · count(Iliad) = 10)
must also (count(must) = count(also) = 1,000)
the Iliad 的 c = 0:每個 Iliad 前面都是 the。must also 的 c = 990:also 大多沒有 must 在前。For the Iliad c = 0: every Iliad follows “the”. For must also c = 990: most alsos have no must before them.
兩者都「顯著」,但 the Iliad 的 p 小 1000 倍 → 用 p 值排序,the Iliad 排在前面。Both are significant, but the Iliad’s p is 1000 times smaller. Ranking by p-value puts the Iliad first, which O/E and MI cannot do.
兩個不同的問題Two different questions we can ask about a word pair
顯著性Statistical significance
「這會不會只是偶然?」“Could this be chance? How sure are we that the attraction is real?”
取決於:關聯的強度 + 證據的多寡(語料越大,越「顯著」)Depends on the strength of the pattern and on how much evidence we have: a bigger corpus gives more significant results.
Fisher plog-likelihood G²t-score
關聯強度(效應量)Strength of association (effect size)
「兩個詞綁得有多緊?」“How tightly are the two words tied together?”
取決於:比例本身;與語料大小無關Depends only on proportions, not on the size of the corpus.
O / EMIDice · logDice
Evert 把兩者都叫作「關聯測量」(association measures),但它們回答的是不同的問題:顯著不等於強。Evert calls both kinds “association measures”, but they answer different questions. A significant collocation is not necessarily a strong one.
類比:兩枚不公平的硬幣An analogy: two unfair coins
硬幣 ACoin A: few flips
擲 10 次,正面 9 次 · 10 flips, 9 heads
90%
強度 strength90% 正面 heads→ 非常偏 very biased
顯著性 significance\(p \approx 0.011\)→ 勉強 just about
顯著性 significance\(p \approx 10^{-10}\)→ 極其確定 near certain
B 更「顯著」(我們幾乎確定它不公平),但 A 偏得更「強」。p 值衡量的是把握,不是大小。Coin B is more significant: we are almost certain it is unfair. Coin A is more strongly biased. A p-value measures how sure we are, not how big the effect is.
搭配詞也一樣:高頻詞對像硬幣 B,罕見詞對像硬幣 A。Same with collocations: frequent pairs behave like coin B, rare pairs like coin A.
同樣的比例,更大的語料Same proportions, bigger corpus: what changes?
回到「喝 / 茶」(視窗 4 + 4)。把語料放大,但每個詞的比例保持不變。Back to (喝, 茶) with a 4 + 4 window. We make the corpus bigger while every proportion stays the same. Values computed from the full contingency table, as in qhchina.
強度 strength
顯著性 significance
N
O
E
O / E
MI
logDice
G²
Fisher p
5,000
3
0.40
7.46
2.90
8.87
7.7
0.006
10,000
6
0.80
7.46
2.90
8.87
15.4
0.0001
20,000
12
1.61
7.46
2.90
8.87
30.7
\(3 \times 10^{-8}\)
200,000
120
16.1
7.46
2.90
8.87
307
\(10^{-68}\)
2,000,000
1,200
161
7.46
2.90
8.87
3,070
\(10^{-669}\)
強度完全不變:詞對之間的關係沒有改變。Strength does not move: the relationship between the words is the same.
顯著性一直上升:證據越多,把握越大。Significance keeps growing: more evidence, more certainty.
在數百萬詞的語料裡,幾乎所有詞對都「顯著」。只看 p 值,無法知道哪些搭配真正重要。In a corpus of millions of words, almost every pair is “significant”. The p-value alone cannot tell you which collocations matter.
四格都比較:觀察值偏離期望值多少?Compare all four cells: how far is the observed table from the expected one?
\(G^2 = 2 \sum_{\text{4 cells}} O \cdot \ln \dfrac{O}{E}\)
\(G^2(\text{喝}, \text{茶}) \approx \mathbf{30.7}\)
\(O \cdot \ln(O/E)\):偏離越大、次數越多,分數越高。Each cell contributes O · ln(O/E): bigger when O is far from E and when the counts are large.
讀法:G² > 3.84 ≈ p < 0.05;G² > 10.83 ≈ p < 0.001。30.7 → 非常顯著。How to read it: G² above 3.84 corresponds to p < 0.05, above 10.83 to p < 0.001. So 30.7 is highly significant.
它是 Fisher 檢定的快速近似(Dunning 1993),回答的是同一個問題:有多確定,而不是有多強。It is a fast approximation to Fisher’s test (Dunning 1993) and answers the same question: how sure, not how strong.
強度測量:Dice 與 logDiceA strength measure: Dice and logDice
兩詞的出現機會中,有多少比例是「在一起」的?Of all the chances the two words had, what share did they spend together?
最高 14(兩詞總是一起出現);分數越高,關係越強。Maximum 14 (the words always occur together). The higher the score, the stronger the tie.
再看 the Iliad / must also:測量會「意見不一」the Iliad vs. must also, once more: the measures disagree
O
E
MI
logDice
G²
Fisher p
the Iliad
10
1
3.32
1.71
46.1
\(1 \times 10^{-10}\)
must also
10
1
3.32
7.36
28.2
\(1 \times 10^{-7}\)
顯著性選 the Iliad:每一個 Iliad 前面都是 the,證據非常一致。Significance prefers the Iliad: every single Iliad follows “the”, so the evidence is very consistent.
logDice 選 must also:the 出現 100,000 次,只有 10 次在 Iliad 前面;從 the 的角度看,這個關係很弱。logDice prefers must also: “the” occurs 100,000 times and only 10 of those are before Iliad. From the point of view of “the”, the tie is weak.
沒有「唯一正確」的測量;先想清楚你的研究問題要的是哪一種。There is no single correct measure. Decide which question your research needs answered.
實際操作:先篩選,再排序In practice: filter by significance, rank by strength