ICS 582Lecture 05المحاضرة 05Part 04الجزء 04
The prior and the channel modelالاحتمال المسبق (Prior) ونموذج القناة
Estimating the two factors: P(w) from corpus counts, and P(x|w) from the Kernighan, Church and Gale confusion matrices for deletion, insertion, substitution and transposition.تقدير العاملين: P(w) من عدّ المدونة، وP(x|w) من مصفوفات الالتباس لـ Kernighan وChurch وGale للحذف والإدراج والاستبدال والتبديل (transposition).
- Conceptsالمفاهيم
- 3
- Slidesالشرائح
- 17-24
- Readingمدة القراءة
- 18 min18 دقيقة
Why this part mattersلماذا يهمّ هذا الجزء
By the end you canفي نهاية هذا الجزء ستستطيع
- Compute a unigram prior P(w) = C(w)/N from corpus counts and explain why any n-gram model can supply the prior.تحسب الاحتمال المسبق أحادي الكلمة P(w) = C(w)/N من عدّات المدوّنة، وتشرح لماذا يمكن لأي نموذج n-gram أن يوفّر هذا الاحتمال المسبق.
- State what each of the four confusion matrices del, ins, sub and trans counts, and read a cell of the substitution matrix in the right direction.تذكر ما تعدّه كل مصفوفة من مصفوفات الالتباس الأربع del وins وsub وtrans، وتقرأ خلية في مصفوفة الاستبدال بالاتجاه الصحيح.
- Write the Kernighan, Church and Gale formula for P(x|w) from memory, with the correct numerator and denominator for each edit type.تكتب صيغة Kernighan وChurch وGale للاحتمال P(x|w) من الذاكرة، مع البسط والمقام الصحيحين لكل نوع من أنواع التعديل.
- Map every acress candidate to its matrix cell and denominator, and explain why a zero count still gives a nonzero probability.تربط كل مرشح من مرشحي acress بخليته في المصفوفة وبمقامه، وتشرح لماذا يعطي العدّ الصفري مع ذلك احتمالًا غير صفري.
Before looking at how acress could have been mistyped, ask a simpler question: if you pick a random word from a large body of English, how likely is it to be actress? In the COCA sample of 404,253,213 words, actress appears 9,321 times, so about 23 words in every million are actress. Across appears 120,844 times, about 299 per million. Without knowing anything about the typo, across is roughly 13 times more likely to be the word the writer meant.
قبل أن ننظر في الطريقة التي ربما كُتبت بها acress خطأً، اطرح سؤالًا أبسط: لو اخترت كلمة عشوائية من نص إنجليزي ضخم، فما احتمال أن تكون actress؟ في عيّنة COCA المكوّنة من 404,253,213 كلمة، تظهر actress عدد 9,321 مرة، أي قرابة 23 كلمة من كل مليون. وتظهر across عدد 120,844 مرة، أي قرابة 299 في المليون. فمن دون معرفة أي شيء عن الخطأ الإملائي، تكون across أرجح بنحو 13 مرة لأن تكون الكلمة التي قصدها الكاتب.
That number is the Prior probability, P(w): how plausible a candidate is as a piece of text before the typed string is taken into account. The noisy channel does not care where it comes from. Any language model from lecture 03 can provide it: a unigram, a Bigram language model that looks at the previous word, or a trigram that looks at two. The simplest choice, used on this slide, is the Unigram prior: the relative frequency of the word in a corpus.
هذا العدد هو prior probability أي الاحتمال المسبق P(w): مدى معقولية المرشح بوصفه قطعة من نص قبل أخذ السلسلة المكتوبة في الحسبان. ولا تهتم القناة الصاخبة بمصدره. فأي نموذج لغوي من المحاضرة 03 يمكنه توفيره: نموذج unigram، أو bigram language model الذي ينظر إلى الكلمة السابقة، أو نموذج trigram الذي ينظر إلى كلمتين. وأبسط خيار، وهو المستخدم في هذه الشريحة، هو unigram prior: التكرار النسبي للكلمة في مدوّنة.
Worked exampleمثال محلول
Verify P(actress) from the COCA countsتحقّق من P(actress) باستخدام عدّات COCA
Read the countsاقرأ العدّات
C(actress) = 9,321 and N = 404,253,213 word tokens.C(actress) = 9,321 وN = 404,253,213 وحدة كلمة (word tokens).Divideاقسم
9,321 / 404,253,213 = 0.0000230573, which is 2.31 × 10⁻⁵.9,321 / 404,253,213 = 0.0000230573، أي 2.31 × 10⁻⁵.Sanity check against a neighborتحقّق منطقي بالمقارنة مع مرشح مجاور
120,844 / 404,253,213 = 0.000298931 for across, and the ratio 120,844 / 9,321 ≈ 12.96 matches the ratio of the two probabilities, as it must, because they share N.120,844 / 404,253,213 = 0.000298931 للكلمة across، والنسبة 120,844 / 9,321 ≈ 12.96 تطابق النسبة بين الاحتمالين، وهذا لا بد منه لأنهما يشتركان في N.Resultالنتيجة
P(actress) = 2.31 × 10⁻⁵, the first row of the table below.P(actress) = 2.31 × 10⁻⁵، وهو الصف الأول في الجدول أدناه.
The full table of priors for the six candidates of acress:
الجدول الكامل للاحتمالات المسبقة لمرشحي acress الستة:
| Candidate wالمرشح w | C(w)C(w) | P(w)P(w) |
|---|---|---|
| actressactress | 9,3219,321 | .0000230573.0000230573 |
| cresscress | 220220 | .0000005442.0000005442 |
| caresscaress | 686686 | .0000016969.0000016969 |
| accessaccess | 37,03837,038 | .0000916207.0000916207 |
| acrossacross | 120,844120,844 | .0002989314.0002989314 |
| acresacres | 12,87412,874 | .0000318463.0000318463 |
Notice what this table cannot know. The original sentence was about a stellar and versatile acress, and any human reads actress at once. A unigram prior has no access to that sentence, so it ranks the candidates purely by how common they are in general. That is the weakness part 05 fixes by swapping in a bigram prior, which is exactly the flexibility slide 17 promises: the channel stays the same and only the language model changes.
لاحظ ما لا يستطيع هذا الجدول معرفته. كانت الجملة الأصلية عن acress «متألقة ومتعددة المواهب»، وأي إنسان يقرؤها actress فورًا. أما الاحتمال المسبق أحادي الكلمة فلا يصل إلى تلك الجملة، لذا يرتّب المرشحين فقط بحسب مدى شيوعهم عمومًا. وهذا هو الضعف الذي يعالجه الجزء 05 باستبدال احتمال مسبق من نوع bigram به، وهي بالضبط المرونة التي تعد بها الشريحة 17: تبقى القناة كما هي ويتغير النموذج اللغوي وحده.
Priors at web scaleالاحتمالات المسبقة على نطاق الويب
A search engine correcting queries has n-gram counts over hundreds of billions of words. Properly smoothed models such as Kneser-Ney are expensive to estimate at that size, so the slide points to Stupid backoff: use the relative frequency of the longest n-gram that was seen, and multiply by a fixed 0.4 each time you back off to a shorter one. The result is a score rather than a true probability, but the decoder only compares candidates, so a consistent score is enough. The full recipe and a worked example are in lecture 03, backoff and stupid backoff.
محرك البحث الذي يصحّح الاستعلامات يملك عدّات n-gram على مئات المليارات من الكلمات. والنماذج المنعّمة تنعيمًا سليمًا مثل Kneser-Ney مكلفة التقدير عند هذا الحجم، لذلك تشير الشريحة إلى stupid backoff: استخدم التكرار النسبي لأطول n-gram شوهد، واضرب في قيمة ثابتة 0.4 في كل مرة تتراجع فيها إلى n-gram أقصر. والنتيجة درجة وليست احتمالًا حقيقيًا، لكن المفكّك (decoder) يقارن المرشحين فقط، فتكفي درجة متّسقة. والوصفة الكاملة مع مثال محلول موجودة في المحاضرة 03، backoff وstupid backoff.
Recall
Why can the noisy channel corrector use a unigram, bigram or trigram prior without any other change?لماذا يستطيع مصحّح القناة الصاخبة استخدام احتمال مسبق من نوع unigram أو bigram أو trigram دون أي تغيير آخر؟
Take the candidate across. To get acress from it, the writer must have typed e where o was intended. How often does that happen? Kernighan, Church and Gale counted it over a large set of real typos from newswire text: e was typed for o 93 times. That single number, divided by how often o occurs at all, is the probability of the edit. This is the whole idea of the Channel model, also called the error model or edit probability.
خذ المرشح across. لكي نحصل منه على acress، لا بد أن الكاتب كتب e حيث كان يقصد o. فكم مرة يحدث ذلك؟ عدّه Kernighan وChurch وGale على مجموعة كبيرة من الأخطاء الإملائية الحقيقية في نصوص الأخبار: كُتب e بدلًا من o عدد 93 مرة. هذا العدد الواحد، مقسومًا على عدد مرات ظهور o أصلًا، هو احتمال التعديل. وهذه هي الفكرة الكاملة لـ channel model، ويُسمّى أيضًا نموذج الخطأ (error model) أو احتمال التعديل (edit probability).
Fix the notation from slide 19. The typed, misspelled word is x = x₁ x₂ … xₘ and the intended, correct word is w = w₁ w₂ … wₙ, both as sequences of letters. Every candidate from part 03 differs from the typo by a single edit, so P(x|w) is just the probability of that one edit: a Deletion, an Insertion, a Substitution or a Transposition. A perfect error model would condition on the typist, the keyboard and the time of day. This one conditions only on the letters involved and, for insertion and deletion, the letter just before, which is local enough to estimate from data.
ثبّت الرموز من الشريحة 19. الكلمة المكتوبة الخاطئة هي x = x₁ x₂ … xₘ والكلمة المقصودة الصحيحة هي w = w₁ w₂ … wₙ، وكلتاهما متتالية من الحروف. كل مرشح من الجزء 03 يختلف عن الخطأ الإملائي بتعديل واحد، لذا فإن P(x|w) هو ببساطة احتمال ذلك التعديل الواحد: حذف deletion، أو إدراج insertion، أو استبدال substitution، أو تبديل transposition. نموذج الخطأ المثالي كان سيشترط على الكاتب ولوحة المفاتيح ووقت اليوم. أما هذا النموذج فيشترط فقط على الحروف المعنية، وفي حالتي الإدراج والحذف على الحرف السابق مباشرة، وهذا محلي بما يكفي لتقديره من البيانات.
The four tablesالجداول الأربعة
A Confusion matrix is a table of counts of how often one thing was mistaken for another. The Kernighan, Church and Gale channel model uses four of them, one per edit type, each indexed by a pair of letters.
confusion matrix أو مصفوفة الالتباس هي جدول عدّات لعدد المرات التي أُخذ فيها شيء على أنه شيء آخر. ويستخدم Kernighan, Church and Gale channel model أربعًا منها، واحدة لكل نوع تعديل، وكل منها مفهرسة بزوج من الحروف.
The four confusion matrices (slide 20, read consistently with slides 21 and 23)مصفوفات الالتباس الأربع (الشريحة 20، مقروءة بما يتّسق مع الشريحتين 21 و23)
- del[x,y]
- count(xy typed as x): the y after an x was left outcount(xy كُتبت x): سقط الحرف y الذي يأتي بعد x
- ins[x,y]
- count(x typed as xy): an extra y was typed after an xcount(x كُتبت xy): كُتب حرف y زائد بعد x
- sub[x,y]
- count(y typed as x): x was typed where y was intended (see the errata below)count(y كُتبت x): كُتب x حيث كان المقصود y (انظر التصويب أدناه)
- trans[x,y]
- count(xy typed as yx): two adjacent letters were swappedcount(xy كُتبت yx): تبادل حرفان متجاوران موقعيهما
Insertion and deletion are conditioned on the previous character. Dropping the t in actress is recorded as del[c,t], a t lost after a c, not as a bare t lost anywhere. That matters, because some letters vanish far more easily in certain neighborhoods, such as one letter of a doubled pair. The same choice gives insertion its first index: the extra s in acress, read as acres plus an s, is ins[e,s] or ins[s,s] depending on which s you call the extra one, and both readings appear on slide 24.
الإدراج والحذف مشروطان بالحرف السابق. فإسقاط t من actress يُسجَّل على أنه del[c,t]، أي t ضاع بعد c، لا مجرد t ضاع في أي مكان. وهذا مهم، لأن بعض الحروف تختفي بسهولة أكبر بكثير في جوار معيّن، مثل أحد حرفي زوج مكرر. والاختيار نفسه يعطي الإدراج فهرسه الأول: فالحرف s الزائد في acress، إذا قرأناها acres مضافًا إليها s، يكون ins[e,s] أو ins[s,s] بحسب أي s تعدّه الزائد، والقراءتان كلتاهما تظهران في الشريحة 24.
Reading the substitution matrixقراءة مصفوفة الاستبدال
Slide 21 prints the substitution table from the original paper. Rows are X, the letter typed; columns are Y, the letter intended. So the cell in row e, column o is sub[e,o] = 93: e typed for o. The big numbers cluster among the vowels: sub[e,a] = 388, sub[a,e] = 342, sub[i,e] = 146, sub[o,e] = 116. Vowels sound alike in unstressed syllables, so writers who spell by ear confuse them constantly. Among consonants the standout is sub[m,n] = 180, two letters that are both similar in sound and adjacent on the keyboard.
تطبع الشريحة 21 جدول الاستبدال من الورقة الأصلية. الصفوف هي X، الحرف المكتوب؛ والأعمدة هي Y، الحرف المقصود. لذا فالخلية في الصف e والعمود o هي sub[e,o] = 93: كُتب e بدلًا من o. وتتجمع الأعداد الكبيرة بين حروف العلة: sub[e,a] = 388، sub[a,e] = 342، sub[i,e] = 146، sub[o,e] = 116. فحروف العلة تتشابه في النطق داخل المقاطع غير المنبورة، ولذلك يخلط بينها باستمرار من يكتبون بحسب السمع. ومن بين الحروف الساكنة يبرز sub[m,n] = 180، وهما حرفان متشابهان في الصوت ومتجاوران على لوحة المفاتيح معًا.
Where the counts come fromمن أين تأتي العدّات
You need a list of real misspellings paired with their corrections, such as the Wikipedia list of common misspellings, Roger Mitton's Birkbeck corpus, or Peter Norvig's collection. Align each pair, find the single edit, and add one to the matching cell. Slide 22 points to Norvig's file of counts of single-edit errors, which already does this: it lists edits such as e|i with a count, ready to drop into the four tables. Kernighan, Church and Gale had no such list, so they bootstrapped: start with uniform matrices, correct a corpus of rejected words with the current model, recount the edits the corrections imply, and repeat. That loop is an instance of the EM algorithm.
تحتاج إلى قائمة بأخطاء إملائية حقيقية مقرونة بتصحيحاتها، مثل قائمة ويكيبيديا للأخطاء الإملائية الشائعة، أو مدوّنة Birkbeck الخاصة بـ Roger Mitton، أو مجموعة Peter Norvig. حاذِ كل زوج، وجد التعديل الواحد، وأضف واحدًا إلى الخلية المطابقة. وتشير الشريحة 22 إلى ملف Norvig لعدّات أخطاء التعديل الواحد، الذي يقوم بهذا مسبقًا: فهو يسرد تعديلات مثل e|i مع عدّها، جاهزة للإدخال في الجداول الأربعة. لم يكن لدى Kernighan وChurch وGale قائمة كهذه، فبدؤوا من الصفر بطريقة تمهيدية (bootstrapping): ابدأ بمصفوفات منتظمة، وصحّح مدوّنة من الكلمات المرفوضة بالنموذج الحالي، وأعد عدّ التعديلات التي تقتضيها التصحيحات، ثم كرّر. وهذه الحلقة مثال على خوارزمية EM.
Quick checkاختبار سريع
Which statement correctly reads the cell sub[e,o] = 93 on slide 21?أي عبارة تقرأ الخلية sub[e,o] = 93 في الشريحة 21 قراءة صحيحة؟
Recall
State what del[x,y], ins[x,y] and trans[x,y] count, and say what insertion and deletion are conditioned on.اذكر ما تعدّه del[x,y] وins[x,y] وtrans[x,y]، وقل على أي شيء يُشترط الإدراج والحذف.
Back to across. The count sub[e,o] = 93 on its own is not a probability: it would be large simply because o is a common letter. The fair question is: of all the times a writer meant to type o, how often did e come out? In the training text of Kernighan, Church and Gale, the letter o occurred roughly 10,000,000 times, so P(e|o) = 93 / 10,000,000 = .0000093, the across row of slide 24.
لنعد إلى across. العدّ sub[e,o] = 93 وحده ليس احتمالًا: فقد يكون كبيرًا لمجرد أن o حرف شائع. والسؤال المنصف هو: من بين كل المرات التي قصد فيها الكاتب كتابة o، كم مرة خرج e؟ في نص التدريب الخاص بـ Kernighan وChurch وGale، ظهر الحرف o قرابة 10,000,000 مرة، لذا P(e|o) = 93 / 10,000,000 = .0000093، وهو صف across في الشريحة 24.
The general rule repeats that move for each edit: divide the confusion count by the number of times the intended context occurred. The context is whatever the matrix was indexed on in the correct word, so the denominator always counts letters of w, never of x.
القاعدة العامة تكرر هذه الخطوة لكل تعديل: اقسم عدّ الالتباس على عدد مرات ظهور السياق المقصود. والسياق هو ما فُهرست عليه المصفوفة في الكلمة الصحيحة، لذا فإن المقام يعدّ دائمًا حروف w، ولا يعدّ أبدًا حروف x.
- Deletion divides by count[wᵢ₋₁ wᵢ], the number of times the pair that was supposed to appear actually appears, because each occurrence was a chance to drop its second letter.الحذف يقسم على count[wᵢ₋₁ wᵢ]، أي عدد مرات ظهور الزوج الذي كان يُفترض أن يظهر، لأن كل ظهور له كان فرصة لإسقاط حرفه الثاني.
- Insertion divides by count[wᵢ₋₁], a single letter, because each occurrence of it was a chance to type something extra afterwards. The numerator ins[wᵢ₋₁, xᵢ] names the extra typed letter xᵢ.الإدراج يقسم على count[wᵢ₋₁]، أي حرف واحد، لأن كل ظهور له كان فرصة لكتابة شيء زائد بعده. والبسط ins[wᵢ₋₁, xᵢ] يسمّي الحرف الزائد المكتوب xᵢ.
- Substitution divides by count[wᵢ], the intended letter that got replaced.الاستبدال يقسم على count[wᵢ]، أي الحرف المقصود الذي استُبدل.
- Transposition divides by count[wᵢ wᵢ₊₁], the intended pair that got swapped.التبديل يقسم على count[wᵢ wᵢ₊₁]، أي الزوج المقصود الذي تبادل حرفاه موقعيهما.
Mapping the acress table to the formulaربط جدول acress بالصيغة
| Candidateالمرشح | x|wx|w | Editالتعديل | Cell / denominatorالخلية / المقام | P(x|w)P(x|w) |
|---|---|---|---|---|
| actressactress | c|ctc|ct | deletionحذف | del[c,t] / count[ct]del[c,t] / count[ct] | .000117.000117 |
| cresscress | a|#a|# | insertionإدراج | ins[#,a] / count[#]ins[#,a] / count[#] | .00000144.00000144 |
| caresscaress | ac|caac|ca | transpositionتبديل | trans[c,a] / count[ca]trans[c,a] / count[ca] | .00000164.00000164 |
| accessaccess | r|cr|c | substitutionاستبدال | sub[r,c] / count[c]sub[r,c] / count[c] | .000000209.000000209 |
| acrossacross | e|oe|o | substitutionاستبدال | sub[e,o] / count[o]sub[e,o] / count[o] | .0000093.0000093 |
| acresacres | es|ees|e | insertionإدراج | ins[e,s] / count[e]ins[e,s] / count[e] | .0000321.0000321 |
| acresacres | ss|sss|s | insertionإدراج | ins[s,s] / count[s]ins[s,s] / count[s] | .0000342.0000342 |
Two rows need a closer look. For cress, the a at the start of acress is the extra letter, and there is no previous letter to condition on. The model uses a word-boundary symbol #, so the entry is a|#, priced as ins[#,a] / count[#], where count[#] is the number of word starts. Acres appears twice because there are two ways to read the extra s: inserted after e (es|e) or after the existing s (ss|s). Both are valid single edits, and in the original paper each row is scored as its own transformation; the two scores for acres are kept separate rather than merged.
صفّان يحتاجان إلى نظرة أدق. في cress، يكون الحرف a في بداية acress هو الحرف الزائد، ولا يوجد حرف سابق يُشترط عليه. فيستخدم النموذج رمز حدّ الكلمة #، فيصبح المدخل a|#، ويُحسب احتماله بـ ins[#,a] / count[#]، حيث count[#] هو عدد بدايات الكلمات. وتظهر acres مرتين لأن هناك طريقتين لقراءة s الزائد: مُدرج بعد e (es|e) أو بعد s الموجود أصلًا (ss|s). كلاهما تعديل واحد صالح، وفي الورقة الأصلية يُقيَّم كل صف بوصفه تحويلًا مستقلًا؛ فتبقى درجتا acres منفصلتين ولا تُدمجان.
Worked exampleمثال محلول
Compute P(x|w) for actress and acres from the paper's countsاحسب P(x|w) للكلمتين actress وacres من عدّات الورقة
actress, deletion c|ctactress، حذف c|ct
The t after c was dropped, so look up del[c,t] = 55. The pair ct occurred about 470,000 times. P(c|ct) = 55 / 470,000 = 1.17 × 10⁻⁴ = .000117.سقط الحرف t بعد c، فابحث عن del[c,t] = 55. ظهر الزوج ct قرابة 470,000 مرة. P(c|ct) = 55 / 470,000 = 1.17 × 10⁻⁴ = .000117.acres, insertion es|eacres، إدراج es|e
An s was typed after e, so look up ins[e,s] = 417. The letter e occurred about 13,000,000 times. P(es|e) = 417 / 13,000,000 = 3.21 × 10⁻⁵ = .0000321.كُتب s بعد e، فابحث عن ins[e,s] = 417. ظهر الحرف e قرابة 13,000,000 مرة. P(es|e) = 417 / 13,000,000 = 3.21 × 10⁻⁵ = .0000321.acres, insertion ss|sacres، إدراج ss|s
An s was typed after s: ins[s,s] = 205 over count[s] ≈ 6,000,000 gives 3.42 × 10⁻⁵ = .0000342.كُتب s بعد s: ins[s,s] = 205 مقسومًا على count[s] ≈ 6,000,000 يعطي 3.42 × 10⁻⁵ = .0000342.Resultالنتيجة
The deletion for actress is about 3.4 to 3.6 times more probable than the acres insertions, and about 12.6 times more probable than the substitution for across.الحذف في actress أرجح بنحو 3.4 إلى 3.6 مرة من إدراجَي acres، وأرجح بنحو 12.6 مرة من الاستبدال في across.
P(c|ct) = del[c,t] / count[ct] = 55 / 470,000
actress: del[c,t] over count[ct] gives 1.17e-4
Counts are as printed by Kernighan, Church and Gale (1990). The letter counts are rounded in the paper, yet every quotient still reproduces the value on slide 24.الأعداد كما نشرها Kernighan وChurch وGale (1990). أعداد الحروف مقرّبة في الورقة، ومع ذلك يعيد كل ناتج قسمة القيمةَ نفسها الموجودة في الشريحة 24.
Zero counts are smoothedالعدّات الصفرية تُنعَّم
Look up sub[r,c] in slide 21: row r, column c is 0. Nobody in the training data typed r for c. Yet slide 24 gives access a channel probability of .000000209, not zero. The reason is that the matrices are smoothed before use; the paper uses Good-Turing, which turns the zero into a small fractional count, about .98, over count[c] ≈ 4,700,000. Caress shows the same pattern, with a fractional count of about .95 over count[ca] ≈ 580,000. Without smoothing, one unseen confusion would veto a candidate no matter how strong its prior, which is the same zero problem n-gram models had in lecture 03.
ابحث عن sub[r,c] في الشريحة 21: الصف r والعمود c قيمته 0. لم يكتب أحد في بيانات التدريب r بدلًا من c. ومع ذلك تعطي الشريحة 24 الكلمة access احتمال قناة قدره .000000209، لا صفرًا. والسبب أن المصفوفات تُنعَّم قبل استخدامها؛ إذ تستخدم الورقة Good-Turing، الذي يحوّل الصفر إلى عدّ كسري صغير، قرابة .98، مقسومًا على count[c] ≈ 4,700,000. وتُظهر caress النمط نفسه، بعدّ كسري يقارب .95 مقسومًا على count[ca] ≈ 580,000. ومن دون تنعيم، فإن التباسًا واحدًا لم يُشاهَد سيُسقط المرشح مهما كان احتماله المسبق قويًا، وهي مشكلة الصفر نفسها التي واجهتها نماذج n-gram في المحاضرة 03.
Quick checkاختبار سريع
For the candidate acres with x|w = ss|s, which denominator does the channel formula use?للمرشح acres حيث x|w = ss|s، ما المقام الذي تستخدمه صيغة القناة؟
Quick checkاختبار سريع
Why does slide 24 give access a nonzero P(r|c) when sub[r,c] is printed as 0?لماذا تعطي الشريحة 24 الكلمة access احتمالًا P(r|c) غير صفري مع أن sub[r,c] مطبوعة 0؟
Recall
Write the denominator for each of the four edit types in the Kernighan, Church and Gale formula.اكتب المقام لكل نوع من أنواع التعديل الأربعة في صيغة Kernighan وChurch وGale.
Recall
For cress, why is the entry written a|# and what is its denominator?في cress، لماذا يُكتب المدخل a|# وما مقامه؟
Recapالخلاصة
If you remember nothing elseإن لم تتذكر شيئاً آخر فتذكّر هذا
- The prior P(w) comes from any language model; the unigram version is C(w)/N, for example P(actress) = 9,321 / 404,253,213 = .0000231.يأتي الاحتمال المسبق P(w) من أي نموذج لغوي؛ ونسخته أحادية الكلمة هي C(w)/N، فمثلًا P(actress) = 9,321 / 404,253,213 = .0000231.
- Unigram priors ignore context, so across (120,844) beats actress (9,321) by a factor of about 13 before the typo is even considered.الاحتمالات المسبقة أحادية الكلمة تتجاهل السياق، لذلك تتفوق across (120,844) على actress (9,321) بعامل يقارب 13 قبل أن يُنظر إلى الخطأ الإملائي أصلًا.
- The channel model P(x|w) is the probability of the single edit that turns the intended word w into the typed string x.نموذج القناة P(x|w) هو احتمال التعديل الواحد الذي يحوّل الكلمة المقصودة w إلى السلسلة المكتوبة x.
- del[x,y] = count(xy typed as x), ins[x,y] = count(x typed as xy), trans[x,y] = count(xy typed as yx); insertion and deletion are conditioned on the previous character.del[x,y] = count(xy كُتبت x)، وins[x,y] = count(x كُتبت xy)، وtrans[x,y] = count(xy كُتبت yx)؛ والإدراج والحذف مشروطان بالحرف السابق.
- sub[x,y] is indexed typed letter first, intended letter second: sub[e,o] = 93 means e was typed where o was meant.تُفهرس sub[x,y] بالحرف المكتوب أولًا ثم الحرف المقصود ثانيًا: sub[e,o] = 93 تعني أن e كُتب حيث كان المقصود o.
- P(x|w) = confusion count / count of the intended context: count[w_{i-1} w_i] for deletion, count[w_{i-1}] for insertion, count[w_i] for substitution, count[w_i w_{i+1}] for transposition.P(x|w) = عدّ الالتباس / عدّ السياق المقصود: count[w_{i-1} w_i] للحذف، وcount[w_{i-1}] للإدراج، وcount[w_i] للاستبدال، وcount[w_i w_{i+1}] للتبديل.
- Word start is the symbol #, so cress gives a|# = ins[#,a] / count[#].بداية الكلمة هي الرمز #، لذلك تعطي cress القيمة a|# = ins[#,a] / count[#].
- Confusion counts are smoothed before use, which is why sub[r,c] = 0 in the matrix still yields P(r|c) = .000000209.تُنعَّم عدّات الالتباس قبل استخدامها، ولهذا فإن sub[r,c] = 0 في المصفوفة تعطي مع ذلك P(r|c) = .000000209.
Sourcesالمصادر
- A Spelling Correction Program Based on a Noisy Channel ModelPaperKernighan, Church and Gale, COLING 1990Origin of the four confusion matrices, the channel formula, the acress counts behind slide 24, and the Good-Turing smoothing of the matrices. Defines sub[x,y] as the number of times y was typed as x.مصدر مصفوفات الالتباس الأربع، وصيغة القناة، وعدّات acress التي تقف خلف الشريحة 24، وتنعيم المصفوفات بطريقة Good-Turing. وتعرّف sub[x,y] بأنها عدد مرات كتابة y على أنه x.(opens in a new tab)(يفتح في تبويب جديد)
- Speech and Language Processing, Appendix B: Spelling Correction and the Noisy Channel (Oct 2019 draft)BookJurafsky and MartinThe textbook treatment the slides follow: the COCA unigram priors, the confusion-matrix definitions, equation B.6 and figure B.4. The current draft no longer includes this appendix.معالجة الكتاب المقرر التي تتبعها الشرائح: الاحتمالات المسبقة أحادية الكلمة من COCA، وتعريفات مصفوفات الالتباس، والمعادلة B.6 والشكل B.4. والمسودة الحالية لم تعد تتضمن هذا الملحق.(opens in a new tab)(يفتح في تبويب جديد)
- Natural Language Corpus Data: Beautiful DataDocsPeter NorvigHosts count_1edit.txt, the single-edit error counts slide 22 links to, derived from spell-errors.txt.يستضيف الملف count_1edit.txt، أي عدّات أخطاء التعديل الواحد التي تشير إليها الشريحة 22، وهي مشتقة من spell-errors.txt.(opens in a new tab)(يفتح في تبويب جديد)
- Large Language Models in Machine TranslationPaperBrants, Popat, Xu, Och and Dean, EMNLP-CoNLL 2007Introduces stupid backoff, the web-scale prior slide 17 recommends.تقدّم stupid backoff، وهو الاحتمال المسبق على نطاق الويب الذي توصي به الشريحة 17.(opens in a new tab)(يفتح في تبويب جديد)
- Corpus of Contemporary American EnglishArticleWikipediaFull name, creator and growth of COCA, the corpus behind the slide 18 counts.الاسم الكامل لـ COCA ومنشئها ونموها، وهي المدوّنة التي تقف خلف عدّات الشريحة 18.(opens in a new tab)(يفتح في تبويب جديد)