Lecture 03 · N-grams

المحاضرة 03 · نماذج N-grams

Discounting

الخصم (Discounting)

Slides 74–79الشرائح 74–79 P2 SHOULDP2 مهم

Why d ≈ 0.75 is an experimental result and not a guess, and how absolute discounting turns that number into an equation.

لماذا يُعدّ d ≈ 0.75 نتيجة تجريبية مقيسة لا تخميناً، وكيف يحوّل absolute discounting هذا الرقم إلى معادلة.

Why add-1 and add-k are not enough

لماذا لا يكفي add-1 وadd-k

Slide 74 lists three complaints.

تسرد الشريحة 74 ثلاث مشكلات في add-1 وadd-k.

The problem is not that add-k takes mass. Taking mass is correct. The problem is that it takes a proportional amount, so reliable high counts get mauled along with the unreliable low ones.

المشكلة ليست أن add-k يأخذ كتلة احتمالية، فالأخذ نفسه صحيح ومطلوب. المشكلة أنه يأخذ مقداراً تناسبياً، فتتأذى العدّات المرتفعة الموثوقة بالقدر نفسه الذي تتأذى به العدّات المنخفضة غير الموثوقة.

The core idea of discounting

الفكرة الجوهرية للخصم

Definition, slide 75التعريف، الشريحة 75

Reduce (discount) the counts of observed n-grams to free probability mass for unseen ones.

خفّض (discount) عدّات الـn-grams التي رأيتها، لتحرّر كتلة احتمالية تمنحها للـn-grams غير المرئية.

Two design goals from the slide:

هدفان تصميميان من الشريحة:

A single fixed subtraction does both at once. Subtract 0.75 from a count of 500 and you removed 0.15 percent. Subtract 0.75 from a count of 1 and you removed 75 percent. Same absolute d, wildly different relative effect, and that is exactly the behaviour you wanted.

طرح ثابت واحد يحقق الهدفين في وقت واحد. اطرح 0.75 من عدّ 500 فتكون أزلت 0.15 بالمئة فقط. واطرح 0.75 من عدّ 1 فتكون أزلت 75 بالمئة. نفس الـd المطلق، لكن الأثر النسبي مختلف تماماً، وهذا بالضبط هو السلوك المطلوب.

The third bullet on the slide is the one that matters most: estimate how much to subtract using held-out data. That is the next section.

النقطة الثالثة في الشريحة هي الأهم: قدّر مقدار الطرح باستخدام held-out data، وهذا موضوع القسم التالي.

The Church and Gale experiment

تجربة Church and Gale

This is the heart of the page. Church and Gale (1991) did not theorize the discount, they measured it.

هذا قلب الصفحة. Church and Gale (1991) لم ينظّرا للـdiscount نظرياً، بل قاساه قياساً تجريبياً.

  1. Take 22 million words of AP newswire. Call it the training half. Count every bigram.

    خذ 22 مليون كلمة من أخبار AP newswire، وسمّها نصف التدريب، ثم عُدّ كل bigram فيها.

  2. Take a different 22 million words of AP newswire. Call it the held-out half. Same size, so counts are directly comparable.

    خذ 22 مليون كلمة مختلفة من AP newswire، وسمّها نصف الـheld-out. الحجم هو نفسه، فتصبح العدّات قابلة للمقارنة مباشرة.

  3. Group the bigrams by their training count c. All the bigrams with c = 4 form one bucket, all with c = 5 form another, and so on.

    جمّع الـbigrams حسب عدّها في التدريب c. كل الـbigrams التي عندها c = 4 تشكّل سلة واحدة، والتي عندها c = 5 تشكّل سلة أخرى، وهكذا.

  4. For each bucket, look up how often those same bigrams occur in the held-out half, and take the average.

    لكل سلة، انظر كم مرة تظهر تلك الـbigrams نفسها في نصف الـheld-out، ثم خذ المتوسط.

  5. Compare the held-out average against c. The gap is how much the training count overstated reality.

    قارن متوسط الـheld-out بالعدّ c. الفجوة بينهما هي مقدار مبالغة عدّ التدريب على الواقع.

Why this is the right experiment: the held-out average is an unbiased estimate of the bigram's true rate. If a bigram occurred 4 times in training but only 3.23 times on average in fresh text of the same size, then the training count of 4 was inflated by about 0.77. Discounting should remove exactly that inflation.

لماذا هذه هي التجربة الصحيحة: متوسط الـheld-out تقدير غير متحيّز للمعدل الحقيقي للـbigram. فإذا ظهر bigram 4 مرات في التدريب، لكنه ظهر 3.23 مرة في المتوسط في نص جديد بالحجم نفسه، فمعنى ذلك أن عدّ التدريب 4 كان منفوخاً بمقدار 0.77 تقريباً. ومهمة الـdiscounting أن يزيل هذا الانتفاخ بالضبط.

The held-out counts table

جدول العدّات على held-out

Slide 77, with a difference column added so the pattern cannot be missed.

الشريحة 77، مع إضافة عمود الفرق حتى لا يفوتك النمط.

Bigram count in training (c)عدّ الـ bigram في التدريب (c) Average count in held-outمتوسط العدّ في held-out Difference (c − held-out)الفرق (c − held-out)
00.0000270n/aلا ينطبق
10.4480.552
21.250.75
32.240.76
43.230.77
54.210.79
65.230.77
76.210.79
87.210.79
98.260.74

يعرض الجدول نتيجة تجربة Church and Gale: العمود الأول عدّ الـbigram في التدريب c، والثاني متوسط عدّ الـbigrams نفسها في نصف الـheld-out، والثالث الفرق بينهما. وما يجب أن تلاحظه: الفرق لا يكبر ولا يصغر مع c، بل يبقى قريباً من 0.75 في كل الصفوف من c = 2 إلى c = 9. أي أن متوسط الـheld-out يساوي c ناقص ثابت مقداره نحو 0.75، وهذه هي الحقيقة التجريبية التي تبرّر طرح مقدار ثابت d. والصفان الشاذان هما c = 0 وc = 1 فقط.

Read the third column top to bottom from c = 2. It is 0.75, 0.76, 0.77, 0.79, 0.77, 0.79, 0.79, 0.74. Eight different buckets, eight nearly identical gaps. The mean of those eight is 6.16 / 8 = 0.77, and the slide's takeaway states it plainly: a nearly constant subtraction of about 0.75 is a good discount for many small counts.

اقرأ العمود الثالث من أعلى إلى أسفل بدءاً من c = 2: 0.75 ثم 0.76 ثم 0.77 ثم 0.79 ثم 0.77 ثم 0.79 ثم 0.79 ثم 0.74. ثماني سلال مختلفة، وثمانية فروق متطابقة تقريباً. متوسط هذه الثمانية هو 6.16 / 8 = 0.77، وخلاصة الشريحة تقولها صريحة: طرح شبه ثابت بمقدار 0.75 تقريباً هو discount جيد لكثير من العدّات الصغيرة.

The insight to carry into the examالفكرة التي تأخذها معك إلى الامتحان

d ≈ 0.75 is not arbitrary. It is an empirical constant read off the Church and Gale table.

d ≈ 0.75 ليس رقماً اعتباطياً، بل ثابت تجريبي مقروء مباشرة من جدول Church and Gale.

The difference column does not grow with c, shrink with c, or scale with c. It is flat. A flat gap means the correction is additive, so subtract a fixed amount rather than multiplying by a factor. Add-k gets this wrong by scaling; absolute discounting gets it right by subtracting.

عمود الفرق لا يزيد مع c، ولا ينقص معه، ولا يتناسب معه. إنه مسطّح. والفجوة المسطّحة تعني أن التصحيح جمعي، فاطرح مقداراً ثابتاً بدلاً من الضرب في معامل. Add-k يخطئ هنا لأنه يعمل بالتناسب، وabsolute discounting يصيب لأنه يطرح.

If you remember one number from this lecture other than 0.4, remember 0.75, and remember that it came from an experiment on two 22-million-word halves of AP newswire.

إن حفظت رقماً واحداً من هذه المحاضرة غير 0.4، فاحفظ 0.75، واحفظ أنه جاء من تجربة على نصفين كل منهما 22 مليون كلمة من AP newswire.

The two rows that break the pattern

الصفّان اللذان يكسران النمط

Look at the top of the table instead.

انظر الآن إلى أعلى الجدول.

This is why many implementations keep a separate, smaller discount for counts of 1, typically d1 = 0.5. The textbook says it directly: set all the d values to 0.75, or keep a separate discount of 0.5 for the bigrams with counts of 1. Modified Kneser-Ney generalizes this to three discounts, d1, d2, and d3+.

لهذا تحتفظ كثير من التطبيقات بـdiscount منفصل وأصغر للعدّات التي تساوي 1، وعادة d1 = 0.5. والكتاب يقولها مباشرة: اجعل كل قيم d تساوي 0.75، أو احتفظ بـdiscount منفصل مقداره 0.5 للـbigrams ذات العدّ 1. وModified Kneser-Ney يعمّم هذه الفكرة إلى ثلاثة discounts: d1 وd2 وd3+.

What the subtraction looks like

كيف يبدو الطرح

shaved slice = d = 0.75 bar height = training count c 1 2 3 4 5 6 7 8 9 training count c freed mass pool λ(wᵢ₋₁) = d × N(wᵢ₋₁ •) / C(wᵢ₋₁) one slice per distinct type spread over the lower order λ(wᵢ₋₁) · P(wᵢ)
Every nonzero bar loses the same 0.75 strip off the top, so tall bars barely notice and the bar at c = 1 loses three quarters of itself. The strips pool into λ(wᵢ₋₁) and are handed to the lower-order model.
كل عمود غير صفري يخسر الشريحة نفسها بمقدار 0.75 من أعلاه، فالأعمدة الطويلة بالكاد تتأثر، والعمود عند c = 1 يخسر ثلاثة أرباعه. وتتجمع هذه الشرائح في λ(wᵢ₋₁) وتُعطى للنموذج ذي الرتبة الأدنى.

Absolute discounting, interpolated form

الخصم المطلق (Absolute discounting)، الصيغة الاستيفائية

Slide 78, the bigram equation.

الشريحة 78، معادلة الـbigram.

PAbsDiscount(wi | wi−1) = C(wi−1 wi) − dΣv C(wi−1 v) + λ(wi−1) · P(wi)

In practice you also guard against negative numerators, so implementations and the textbook write the first term with a max:

عملياً تحتاج أيضاً إلى حماية من البسط السالب، لذلك تكتب التطبيقات والكتاب الحدَّ الأول باستخدام max:

PAbsDiscount(wi | wi−1) = max( C(wi−1 wi) − d , 0 )C(wi−1) + λ(wi−1) · P(wi)

Note that Σv C(wi−1 v) and C(wi−1) are the same quantity: the total number of times anything followed wi−1.

لاحظ أن Σv C(wi−1 v) وC(wi−1) هما الكمية نفسها: العدد الكلي للمرات التي تلا فيها أي شيء الكلمة wi−1.

Every piece, one at a time

كل جزء على حدة

PieceالجزءWhat it doesماذا يفعلWhy it is thereلماذا هو موجود
C(wi−1 wi) The raw bigram count.عدّ الـ bigram الخام. The starting evidence, which the table told us is inflated.الدليل الابتدائي، والجدول أخبرنا أنه مضخَّم.
− d Subtracts a fixed amount, typically 0.75, with 0 ≤ d ≤ 1.يطرح مقداراً ثابتاً، عادة 0.75، مع 0 ≤ d ≤ 1. Removes the inflation measured by Church and Gale. Fixed, not proportional.يزيل التضخيم الذي قاسه Church and Gale. ثابت لا نسبي.
max( … , 0 ) Floors the discounted count at zero.يجعل العدّ المخصوم لا ينزل تحت الصفر. Stops counts going negative. Without it, a count of 0 would give −0.75 and the model would emit a negative probability.يمنع العدّات من أن تصبح سالبة. بدونه يعطي العدّ 0 القيمة −0.75 فيُخرج النموذج احتمالاً سالباً.
C(wi−1) Normalizes by the history's total count.يطبّع بالقسمة على العدّ الكلي للسياق (history). Turns the discounted count into a conditional probability.يحوّل العدّ المخصوم إلى احتمال شرطي.
λ(wi−1) The total mass freed by discounting this history, written as a function of the history.الكتلة الكلية التي حرّرها خصم هذا السياق، مكتوبة كدالة في السياق. Conservation. Whatever you took off the bars has to be given back somewhere, or the distribution stops summing to 1.الحفظ: ما أخذته من الأعمدة يجب أن يُعاد في مكان ما، وإلا لم يعد مجموع التوزيع 1.
P(wi) The lower-order (unigram) model.النموذج ذو الرتبة الأدنى (unigram). Decides how the freed mass is split across words. This is the part Kneser-Ney will replace.يقرر كيف تُوزَّع الكتلة المحرَّرة على الكلمات. وهذا هو الجزء الذي سيستبدله Kneser-Ney.

يفكّك الجدول معادلة absolute discounting قطعة قطعة: العدّ الخام C(wi−1 wi)، ثم طرح الثابت d، ثم حارس max( … , 0 )، ثم التطبيع على C(wi−1)، ثم λ(wi−1)، وأخيراً النموذج الأدنى رتبةً P(wi). وما يجب أن تلاحظه: الطرح ثابت لا تناسبي، وmax موجودة لمنع الاحتمال السالب، ووظيفة λ هي الحفاظ على مجموع الاحتمالات مساوياً 1، والسطر الأخير هو القطعة الوحيدة التي سيغيّرها Kneser-Ney.

How λ(wi−1) is computedكيف تُحسب λ(wi−1)

You take d away from each of the distinct word types that followed wi−1. Call that number of types N(wi−1 •). The total you removed is d · N(wi−1 •), so after normalizing:

أنت تطرح d من كل نوع كلمة مختلف تلا wi−1. سمِّ عدد هذه الأنواع N(wi−1 •). فيكون مجموع ما أزلته هو d · N(wi−1 •)، وبعد التطبيع:

λ(wi−1) = d · N(wi−1 •)C(wi−1)

So λ is bigger for histories followed by many different words, which are exactly the histories where you should expect to see something new next. It is the interpolation weight and the freed mass at the same time, which is what makes the equation sum to 1 automatically.

إذن λ تكون أكبر للسياقات التي تلاها عدد كبير من الكلمات المختلفة، وهي بالضبط السياقات التي يُتوقع أن يأتي بعدها شيء جديد. فهي وزن الـinterpolation والكتلة المحرَّرة في الوقت نفسه، وهذا ما يجعل المعادلة تجمع إلى 1 تلقائياً.

Worked: one absolute discounting probabilityمثال محلول: احتمال واحد بالخصم المطلق

History wi−1 = the. Target wi = gate. Set d = 0.75.

السياق wi−1 = the، والكلمة الهدف wi = gate، وليكن d = 0.75.

C(the gate)          = 4        the bigram we want
C(the)               = 1000     total count of anything after "the"
N(the •)             = 60       distinct word types seen after "the"
P(gate)              = 0.002    unigram

step 1  unsmoothed MLE
        4 / 1000                              = 0.004

step 2  discount the count
        max(4 - 0.75, 0) = 3.25

step 3  normalize the discounted count
        3.25 / 1000                           = 0.00325

step 4  how much mass did we free for this history?
        d x N(the .) = 0.75 x 60              = 45
        lambda(the)  = 45 / 1000              = 0.045

step 5  hand the freed mass to the unigram
        0.045 x 0.002                         = 0.00009

step 6  add the two terms
        0.00325 + 0.00009                     = 0.00334

Check the direction of travel: 0.004 became 0.00334. The estimate dropped, which is correct, because the table says a training count of 4 really behaves like 3.23.

تحقّق من اتجاه الحركة: 0.004 صارت 0.00334. التقدير انخفض، وهذا صحيح، لأن الجدول يقول إن عدّ التدريب 4 يتصرف في الحقيقة كأنه 3.23.

Now an unseen bigram with the same history. Step 3 gives max(0 − 0.75, 0) / 1000 = 0, so the whole estimate is the second term alone: 0.045 × P(w). The 45 counts' worth of mass we shaved off is precisely what pays for every unseen continuation of the. Nothing is created and nothing is lost.

الآن خُذ bigram غير مرئي بالسياق نفسه. الخطوة 3 تعطي max(0 − 0.75, 0) / 1000 = 0، فيصبح التقدير كله هو الحدّ الثاني وحده: 0.045 × P(w). والكتلة التي تساوي 45 عدّة والتي قشطناها من أعلى الأعمدة هي بالضبط ما يدفع ثمن كل استمرار غير مرئي للكلمة the. لا شيء يُخلق من العدم ولا شيء يُفقد.

Choosing d

اختيار d

Slide 79 gives two routes.

تعطي الشريحة 79 طريقين لاختيار d.

1. The heuristic

1. القاعدة التجريبية

d ≈ 0.75 works well for many counts. Straight off the Church and Gale table. Costs nothing and is what most exam questions expect.

d ≈ 0.75 يعمل جيداً مع كثير من العدّات، وهو مأخوذ مباشرة من جدول Church and Gale. لا يكلّف شيئاً، وهو ما تتوقعه معظم أسئلة الامتحان.

2. The principled estimate (Ney et al.)

2. التقدير المبدئي (Ney et al.)

d = n1n1 + 2n2

n1 and n2 are the numbers of n-gram types with count 1 and with count 2. Derived from your own corpus, so no held-out half needed.

n1 وn2 هما عددا أنواع الـn-gram التي عدّها 1 والتي عدّها 2. تُحسبان من الـcorpus نفسه، فلا تحتاج إلى نصف held-out منفصل.

Careful with n1 and n2: they are counts of counts, also called frequencies of frequencies. n1 is how many distinct n-grams occurred exactly once, not the count 1 itself.

احترس مع n1 وn2: هما count of counts، ويسمّيان أيضاً frequencies of frequencies. فـn1 هو عدد الـn-grams المختلفة التي ظهرت مرة واحدة بالضبط، وليس العدّ 1 نفسه.

Worked: the Ney estimateمثال محلول: تقدير Ney
n1 = 100000   bigram types seen exactly once
n2 =  30000   bigram types seen exactly twice

d = n1 / (n1 + 2 n2)
  = 100000 / (100000 + 2 x 30000)
  = 100000 / (100000 + 60000)
  = 100000 / 160000
  = 0.625

0.625 lands in the same neighbourhood as the 0.75 heuristic, which is the point: the formula and the experiment agree.

القيمة 0.625 تقع في الجوار نفسه لقيمة 0.75 التقريبية، وهذا هو المقصود: المعادلة والتجربة تتفقان.

Traps on this pageفخاخ هذه الصفحة

The bridge to Kneser-Ney

الجسر إلى Kneser-Ney

Split the equation in half and grade each half separately.

قسّم المعادلة إلى نصفين، وقيّم كل نصف على حدة.

How much to take: correct

كم نأخذ: صحيح

A fixed d ≈ 0.75, justified by a real held-out experiment. Church and Gale settled this. Kneser-Ney keeps it unchanged.

d ثابتة تساوي 0.75 تقريباً، ومبرَّرة بتجربة held-out حقيقية. Church and Gale حسما هذه المسألة، وKneser-Ney يبقيها كما هي بلا تغيير.

max(C − d, 0) / C(wᵢ₋₁)

Where to give it: naive

أين نعطيه: ساذج

The freed mass is spread by the plain unigram P(wi), which asks only "how frequent is this word?". That is the wrong question for a continuation.

الكتلة المحرَّرة تُوزَّع بواسطة الـunigram العادي P(wi)، وهو يسأل سؤالاً واحداً فقط: كم هذه الكلمة شائعة؟ وهذا سؤال خاطئ عندما يكون المطلوب استمراراً لسياق معيّن.

λ(wᵢ₋₁) · P(wᵢ)

The standard illustration: I can't see without my reading ___. The unigram prefers Kong over glasses, because Kong is frequent in the corpus. But Kong is frequent in exactly one context, after Hong, so it is a terrible guess for a novel context.

المثال المعتاد: I can't see without my reading ___. الـunigram يفضّل Kong على glasses، لأن Kong شائعة في الـcorpus. لكن Kong شائعة في سياق واحد بالضبط، أي بعد Hong، فهي تخمين سيء جداً لسياق جديد.

One sentence to memorizeجملة واحدة للحفظ

Absolute discounting is right about how much to take, but naive about where to give it. Kneser-Ney fixes the second half by replacing P(wi) with a continuation probability based on how many different contexts a word completes.

Absolute discounting مُحق في مقدار ما يأخذ، لكنه ساذج في مكان ما يعطي. وKneser-Ney يصلح النصف الثاني باستبدال P(wi) باحتمال استمرار مبني على عدد السياقات المختلفة التي تُكمِلها الكلمة.

Check yourself

اختبر نفسك

In the Church and Gale experiment, bigrams with a training count of 4 had what average count in the held-out half?

في تجربة Church and Gale، الـ bigrams التي عدّها في التدريب 4، كم كان متوسط عدّها في النصف المحجوز (held-out)؟

C. The table gives 3.23 for c = 4, a gap of 0.77. A is the intuitive but wrong answer: equal corpus sizes do not give equal counts, because a training count of 4 is itself an overestimate of the bigram's true rate. B is the discount, not the held-out count. D is the held-out value for c = 5, one row off.

الجواب C. الجدول يعطي 3.23 عند c = 4، أي فرق 0.77. والخيار A هو الجواب الحدسي الخاطئ: تساوي حجمي الـ corpus لا يعطي عدّات متساوية، لأن عدّ التدريب 4 هو نفسه تقدير مبالغ فيه لمعدل الـ bigram الحقيقي. والخيار B هو مقدار الخصم لا عدّ held-out. والخيار D هو قيمة held-out عند c = 5، أي صف واحد بعيداً.

Why is d ≈ 0.75 the discount of choice rather than, say, a fixed 10 percent of each count?

لماذا يُفضَّل الخصم d ≈ 0.75 بدلاً من، مثلاً، نسبة ثابتة 10 بالمئة من كل عدّ؟

B. The difference column is flat at 0.75, 0.76, 0.77, 0.79, 0.77, 0.79, 0.79, 0.74. A gap that does not scale with c means you should subtract a constant, not multiply by a factor. A is false: a count of 1 minus 0.75 is still positive, and the max() guard exists precisely because the subtraction can go negative. C is false and backwards, since any discounting lowers training likelihood. D invents a statistic.

الجواب B. عمود الفرق مستوٍ عند 0.75, 0.76, 0.77, 0.79, 0.77, 0.79, 0.79, 0.74. والفرق الذي لا يتغير مع c يعني أن عليك طرح ثابت لا الضرب في معامل. والخيار A خاطئ: العدّ 1 ناقص 0.75 ما زال موجباً، والحارس max() موجود تحديداً لأن الطرح قد يصبح سالباً. والخيار C خاطئ ومعكوس، لأن أي خصم يخفّض الأرجحية على التدريب. والخيار D يخترع إحصائية غير موجودة.

What is λ(wi−1) in PAbsDiscount(wi|wi−1) = max(C(wi−1wi) − d, 0)/C(wi−1) + λ(wi−1)·P(wi)?

ما هي λ(wi−1) في الصيغة PAbsDiscount(wi|wi−1) = max(C(wi−1wi) − d, 0)/C(wi−1) + λ(wi−1)·P(wi)؟

D. You removed d from each of the N(wi−1 •) distinct continuation types, so d · N(wi−1 •) is the mass taken, and dividing by C(wi−1) normalizes it. Because λ is pinned to exactly what was removed, the whole expression sums to 1 automatically. A is the trap: unlike the lambdas of linear interpolation, this λ is derived, not tuned. B is unrelated. C confuses this with the stupid backoff λ ≈ 0.4.

الجواب D. أزلت d من كل نوع من أنواع الاستمرار المختلفة وعددها N(wi−1 •)، فتكون d · N(wi−1 •) هي الكتلة المأخوذة، والقسمة على C(wi−1) تطبّعها. ولأن λ مثبتة على ما أُزيل بالضبط، يصبح مجموع التعبير كله 1 تلقائياً. والخيار A هو الفخ: بخلاف قيم lambda في الاستيفاء الخطي، هذه الـ λ مشتقة لا مضبوطة. والخيار B لا علاقة له. والخيار C يخلط بينها وبين λ ≈ 0.4 في stupid backoff.

d = 0.75, C(the gate) = 4, C(the) = 1000, N(the •) = 60 distinct continuations, P(gate) = 0.002. What is PAbsDiscount(gate | the)?

d = 0.75، وC(the gate) = 4، وC(the) = 1000، وN(the •) = 60 استمراراً مختلفاً، وP(gate) = 0.002. ما قيمة PAbsDiscount(gate | the)؟

A. Discounted term: (4 − 0.75)/1000 = 3.25/1000 = 0.00325. Freed mass: λ(the) = 0.75 × 60 / 1000 = 45/1000 = 0.045. Interpolated term: 0.045 × 0.002 = 0.00009. Total: 0.00325 + 0.00009 = 0.00334. B is the unsmoothed MLE, which ignores the discount entirely. C drops the interpolation term and keeps only the discounted bigram. D adds λ itself instead of λ · P(gate), the most common arithmetic slip here.

الجواب A. الحد المخصوم: (4 − 0.75)/1000 = 3.25/1000 = 0.00325. الكتلة المحرَّرة: λ(the) = 0.75 × 60 / 1000 = 45/1000 = 0.045. حد الاستيفاء: 0.045 × 0.002 = 0.00009. المجموع: 0.00325 + 0.00009 = 0.00334. والخيار B هو MLE بلا تنعيم، يتجاهل الخصم كلياً. والخيار C يحذف حد الاستيفاء ويُبقي الـ bigram المخصوم فقط. والخيار D يضيف λ نفسها بدل λ · P(gate)، وهي أشيع زلة حسابية هنا.

Why do some implementations use a separate, smaller discount for n-grams with count 1?

لماذا تستخدم بعض التطبيقات خصماً منفصلاً أصغر للـ n-grams ذات العدّ 1؟

B. The textbook notes the astute reader will see that every row except the held-out counts for 0 and 1 is well predicted by subtracting 0.75. For c = 1 the measured gap is 0.552, so a separate d of about 0.5 fits better. Modified Kneser-Ney extends this to d1, d2, d3+. A is unrelated to the table. C is arithmetically wrong, since 1 − 0.75 = 0.25. D is wrong: normalization is handled by λ, which adapts to whatever d you choose.

الجواب B. يذكر الكتاب أن القارئ المتنبّه سيلاحظ أن كل صف ما عدا عدّات held-out عند 0 و1 يُتنبأ به جيداً بطرح 0.75. وعند c = 1 الفرق المقيس 0.552، فيناسبه d منفصل قرابة 0.5. ويوسّع Modified Kneser-Ney هذا إلى d1 وd2 وd3+. والخيار A لا علاقة له بالجدول. والخيار C خاطئ حسابياً لأن 1 − 0.75 = 0.25. والخيار D خاطئ: التطبيع تتولاه λ التي تتكيف مع أي d تختاره.

What does Kneser-Ney change about absolute discounting?

ماذا يغيّر Kneser-Ney في الخصم المطلق؟

C. Absolute discounting is right about how much to take and naive about where to give it. Kneser-Ney keeps max(C − d, 0)/C(wi−1) untouched and fixes the redistribution, so that glasses beats Kong in a novel context because Kong appears in essentially one context only. A is the opposite of the Church and Gale finding. B would reintroduce the zero problem. D confuses interpolated Kneser-Ney with Katz backoff, and the λ term is exactly what KN improves rather than removes.

الجواب C. الخصم المطلق محق في مقدار ما يأخذ وساذج في أين يعطيه. يُبقي Kneser-Ney الحد max(C − d, 0)/C(wi−1) كما هو ويُصلح إعادة التوزيع، فتتفوق glasses على Kong في سياق جديد لأن Kong تظهر عملياً في سياق واحد فقط. والخيار A عكس ما وجده Church and Gale. والخيار B يعيد مشكلة الأصفار. والخيار D يخلط بين Kneser-Ney الاستيفائي وKatz backoff، والحد λ هو بالضبط ما يحسّنه KN لا ما يحذفه.