Majid Al-RaimiReal-word spelling errorsأخطاء الكلمات الحقيقية

ICS 582Lecture 05المحاضرة 05Part 06الجزء 06

Real-word spelling errorsأخطاء الكلمات الحقيقية

Errors that are themselves dictionary words, why they are common, and the candidate-set recipe that treats every word in the sentence as possibly wrong.أخطاء تكون هي نفسها كلمات موجودة في القاموس، ولماذا هي شائعة، وطريقة مجموعة المرشحين التي تعامل كل كلمة في الجملة على أنها قد تكون خاطئة.

Conceptsالمفاهيم
3
Slidesالشرائح
30-33
Readingمدة القراءة
18 min18 دقيقة
Understoodما فهمته
0/3 conceptsمفاهيم

Why this part mattersلماذا يهمّ هذا الجزء

Everything so far in this lecture assumed the typo was obvious: acress is not English, so we knew exactly which token to fix. This part removes that comfort. Some typos produce a different, perfectly valid word, and a large share of real errors are like that. A spell checker that only looks words up in a list will wave every one of them through.

The ideas build in three steps. First, what these errors look like and why lookup is blind to them. Second, how to build a candidate set when you do not know which word is wrong. Third, how the noisy channel scores whole sentences instead of single words. For the exam, expect to classify the edit behind a real-word error, to write a candidate set, and to explain why the original word must stay in it. For research, this is the point where spelling correction stops being a lookup problem and becomes a language modeling problem, the same move that grammar checkers and modern neural correctors make.

كل ما سبق في هذه المحاضرة افترض أن الخطأ المطبعي واضح: acress ليست كلمة إنجليزية، فكنا نعرف بالضبط أي token نصلحه. هذا الجزء يزيل تلك الراحة. بعض الأخطاء المطبعية تنتج كلمة مختلفة صحيحة تمامًا، ونسبة كبيرة من الأخطاء الحقيقية من هذا النوع. والمدقق الإملائي الذي يكتفي بالبحث عن الكلمات في قائمة سيُمرر كل واحد منها دون أن يلاحظه.

تُبنى الأفكار على ثلاث خطوات. أولًا، كيف تبدو هذه الأخطاء ولماذا يعجز البحث في القاموس عن رؤيتها. ثانيًا، كيف نبني مجموعة المرشحين (candidate set) حين لا نعرف أي كلمة هي الخاطئة. ثالثًا، كيف تُقيّم القناة المشوشة (noisy channel) جملًا كاملة بدل كلمات منفردة. في الاختبار، توقّع أن يُطلب منك تصنيف التعديل وراء خطأ كلمة حقيقية، وكتابة مجموعة مرشحين، وشرح لماذا يجب أن تبقى الكلمة الأصلية فيها. ومن جهة البحث العلمي، هذه هي النقطة التي يتوقف فيها التصحيح الإملائي عن كونه مسألة بحث في قاموس ويصبح مسألة نمذجة لغوية (language modeling)، وهي النقلة نفسها التي تقوم بها مدققات القواعد والمصححات العصبية الحديثة.

By the end you canفي نهاية هذا الجزء ستستطيع

  1. Define a real-word error and explain why dictionary lookup can never detect one.تعريف خطأ الكلمة الحقيقية (real-word error) وشرح لماذا لا يستطيع البحث في القاموس اكتشافه أبدًا.
  2. Name the single edit behind each of the four classic examples: minuets, an, lave and be.تسمية التعديل الواحد وراء كل مثال من الأمثلة الكلاسيكية الأربعة: minuets و an و lave و be.
  3. Build the candidate set for a word: the word itself, its one-edit dictionary neighbors, and its homophones.بناء مجموعة المرشحين (candidate set) لكلمة ما: الكلمة نفسها، وجيرانها في القاموس على بعد تعديل واحد، وكلماتها المتجانسة صوتيًا (homophones).
  4. Explain why the search moves from one word to the whole sentence, and why the typed word must stay a candidate.شرح لماذا ينتقل البحث من كلمة واحدة إلى الجملة كلها، ولماذا يجب أن تبقى الكلمة المكتوبة ضمن المرشحين.
  5. Write the sentence-level noisy channel objective and say what the slide's P(W) leaves out.كتابة هدف القناة المشوشة (noisy channel) على مستوى الجملة، وتوضيح ما يُغفله P(W) في الشريحة.

Read this sentence once at normal speed: “The study was conducted mainly be John Black.” Most readers stumble on be and silently read by. Now give the same sentence to a program that checks each token against an English word list. The, study, was, conducted, mainly, be, John, Black: every one is in the list. The program reports zero errors.

اقرأ هذه الجملة مرة واحدة بسرعتك العادية: «The study was conducted mainly be John Black.». معظم القراء يتعثرون عند be ويقرؤونها في أذهانهم by دون أن يشعروا. والآن أعطِ الجملة نفسها لبرنامج يتحقق من كل token في قائمة كلمات إنجليزية. The، study، was، conducted، mainly، be، John، Black: كلها موجودة في القائمة. فيُبلغ البرنامج عن صفر أخطاء.

What a real-word error isما هو خطأ الكلمة الحقيقية

That is a real-word error: the writer meant one word and produced another word that also exists. It is the opposite of a non-word error like graffe, which fails lookup and so announces itself. Real-word errors come from the same two sources you met at the start of the lecture. A typographical error is a slip of the fingers that happens to land on a valid word. A cognitive error is a writer who does not know which spelling is right, typically between two homophones such as piece and peace.

هذا هو خطأ الكلمة الحقيقية (real-word error): قصد الكاتب كلمة فأنتج كلمة أخرى موجودة هي أيضًا. وهو عكس خطأ الكلمة غير الموجودة (non-word error) مثل graffe، الذي يفشل في البحث في القاموس فيكشف نفسه بنفسه. تأتي أخطاء الكلمات الحقيقية من المصدرين نفسيهما اللذين رأيتهما في بداية المحاضرة. الخطأ الطباعي (typographical error) هو زلة أصابع تصادف أن تقع على كلمة صحيحة. والخطأ المعرفي (cognitive error) هو كاتب لا يعرف أي تهجئة هي الصحيحة، وغالبًا ما يكون ذلك بين كلمتين متجانستين صوتيًا (homophones) مثل piece وpeace.

Every word in “conducted mainly be John Black” passes dictionary lookup; only the context window around be shows that by was meantكل كلمة في «conducted mainly be John Black» تجتاز البحث في القاموس؛ ونافذة السياق حول be وحدها تُظهر أن المقصود كان by

Dissecting the four classic examplesتشريح الأمثلة الكلاسيكية الأربعة

The slide’s four sentences come from Kukich’s survey and are reused in Jurafsky and Martin. Each one is a single edit away from the intended word, which is why the same edit operations from the non-word case will generate the fix. What changed is only that the edited string happens to be in the dictionary.

جمل الشريحة الأربع مأخوذة من مسح Kukich ويعيد استخدامها Jurafsky وMartin. كل واحدة منها تبعد تعديلًا واحدًا عن الكلمة المقصودة، ولهذا فإن عمليات التعديل نفسها المستخدمة في حالة الكلمات غير الموجودة هي التي ستولّد التصحيح. الشيء الوحيد الذي تغيّر هو أن السلسلة بعد التعديل تصادف أنها موجودة في القاموس.

TypedالمكتوبةIntendedالمقصودةSingle edit (intended to typed)تعديل واحد (من المقصودة إلى المكتوبة)Why lookup passes itلماذا يجتازها البحث في القاموس
minuetsminuetsminutesminutesTransposition of the adjacent letters t and eتبديل (transposition) للحرفين المتجاورين t وeminuets is a dance, a perfectly good wordminuets رقصة، وهي كلمة صحيحة تمامًا
ananandandDeletion of dحذف (deletion) للحرف dan is one of the most common words in Englishan من أكثر الكلمات شيوعًا في الإنجليزية
lavelaveleaveleaveDeletion of the first eحذف أول elave is a rare but valid verb, to washlave فعل نادر لكنه صحيح، ومعناه يغسل
bebebybySubstitution of e for yاستبدال (substitution) الحرف y بالحرف ebe is a very common verb, so it never looks odd alonebe فعل شائع جدًا، لذا لا يبدو غريبًا وحده أبدًا
Each classic real-word error is exactly one edit from the intended wordكل خطأ كلاسيكي من أخطاء الكلمات الحقيقية يبعد تعديلًا واحدًا بالضبط عن الكلمة المقصودة

Read the edit direction carefully. In the noisy channel, the channel turns the intended word into the typed one, so and becoming an is a deletion of d, not an insertion. The transposition in minuets is the swap that Damerau-Levenshtein distance counts as one operation: minu-te-s becomes minu-et-s.

انتبه جيدًا لاتجاه التعديل. في القناة المشوشة، تحوّل القناةُ الكلمةَ المقصودة إلى الكلمة المكتوبة، لذا فإن تحوّل and إلى an هو حذف (deletion) للحرف d، وليس إدراجًا. والتبديل (transposition) في minuets هو تبادل الموقعين الذي تعدّه مسافة Damerau-Levenshtein عملية واحدة: minu-te-s تصبح minu-et-s.

How common, and why it mattersما مدى شيوعها، ولماذا يهم ذلك

Kukich’s 1992 survey summarizes studies that put real-word errors at 25 to 40% of all spelling errors. Take the conservative end: if a quarter to two fifths of your errors are real words, then a checker that only does lookup misses up to two errors in every five, however good its non-word correction is. That is the gap this part closes.

يلخّص مسح Kukich عام 1992 دراسات تقدّر أخطاء الكلمات الحقيقية بنسبة 25 إلى 40% من جميع الأخطاء الإملائية. خذ الطرف المتحفظ: إذا كان ما بين الربع والخُمسين من أخطائك كلمات حقيقية، فإن المدقق الذي يكتفي بالبحث في القاموس يفوّت ما يصل إلى خطأين من كل خمسة، مهما كانت جودة تصحيحه للكلمات غير الموجودة. هذه هي الفجوة التي يسدّها هذا الجزء.

Quick checkاختبار سريع

In “conducted mainly be John Black”, which single edit turns the intended by into be?في «conducted mainly be John Black»، ما التعديل الواحد الذي يحوّل الكلمة المقصودة by إلى be؟

Quick checkاختبار سريع

Which single edit turns the intended word minutes into the typed word minuets?ما التعديل الواحد الذي يحوّل الكلمة المقصودة minutes إلى الكلمة المكتوبة minuets؟

Recall

Why does a spell checker that only looks words up in a dictionary report zero errors for “Can they lave him my messages?”لماذا يُبلغ مدقق إملائي يكتفي بالبحث عن الكلمات في القاموس عن صفر أخطاء في الجملة «Can they lave him my messages?»

Because every token, including lave (a rare verb meaning to wash), is a valid English word. Lookup can only detect non-word errors. The real-word error lave for leave is only visible from context: “they lave him” makes no sense, while “they leave him” is a common phrase.
لأن كل token فيها، بما في ذلك lave (فعل نادر يعني «يغسل»)، كلمة إنجليزية صحيحة. البحث في القاموس لا يكتشف إلا أخطاء الكلمات غير الموجودة. وخطأ الكلمة الحقيقية lave بدل leave لا يظهر إلا من السياق: «they lave him» لا معنى لها، بينما «they leave him» عبارة شائعة.

Take the word lave from “Can they lave him my messages?” and ask what the writer might have meant. One edit away there are many real words: leave (insert e), live, love, have, lane, lava. And there is one more option that the non-word case never needed: the writer may really have meant lave.

خذ الكلمة lave من «Can they lave him my messages?» واسأل: ماذا كان الكاتب يقصد؟ على بعد تعديل واحد توجد كلمات حقيقية كثيرة: leave (إدراج e)، وlive، وlove، وhave، وlane، وlava. وهناك خيار إضافي لم تحتجه حالة الكلمات غير الموجودة قط: ربما كان الكاتب يقصد فعلًا lave.

The recipe: for every word, three kinds of candidatesالوصفة: لكل كلمة ثلاثة أنواع من المرشحين

Because we do not know which word is wrong, candidate generation now runs on every word in the sentence, not just a flagged one. For each word the candidate set contains:

لأننا لا نعرف أي كلمة هي الخاطئة، صار توليد المرشحين (candidate generation) يعمل الآن على كل كلمة في الجملة، لا على كلمة واحدة مُعلَّمة فقط. ولكل كلمة تحتوي مجموعة المرشحين (candidate set) على:

  1. The word itself. Most words in any text are typed correctly, so “no change” has to be an option that can win.الكلمة نفسها. معظم الكلمات في أي نص تُكتب بشكل صحيح، لذا يجب أن يكون «عدم التغيير» خيارًا قادرًا على الفوز.
  2. Every single-letter edit that is an English word. Insertions, deletions, substitutions and transpositions at edit distance 1, filtered to dictionary words. This is the typographical side, and it covers all four slide examples.كل تعديل بحرف واحد ينتج كلمة إنجليزية. الإدراج والحذف والاستبدال والتبديل على مسافة تحرير (edit distance) تساوي 1، مع تصفيتها لتبقى كلمات القاموس فقط. هذا هو الجانب الطباعي، وهو يغطي أمثلة الشريحة الأربعة كلها.
  3. Its homophones. Words that sound the same but are spelled differently. This is the cognitive side, and it reaches pairs that a single edit cannot.الكلمات المتجانسة صوتيًا معها. كلمات تُنطق بالطريقة نفسها لكنها تُكتب بشكل مختلف. هذا هو الجانب المعرفي، وهو يصل إلى أزواج لا يستطيع تعديل واحد الوصول إليها.
The candidate set for lave: the word itself in teal, kept as a real option, and its one-edit dictionary neighbors in the main accentمجموعة المرشحين للكلمة lave: الكلمة نفسها باللون الفيروزي، مُبقاة كخيار حقيقي، وجيرانها في القاموس على بعد تعديل واحد باللون الأساسي

Why the original word must stay in the setلماذا يجب أن تبقى الكلمة الأصلية في المجموعة

In non-word correction we threw the typed string away: acress is not a word, so it cannot be the answer. Doing the same here would be a disaster. If every word were replaced by its best neighbor, a correct sentence would come back full of “corrections”. Keeping the typed word in its own set lets the model say “this word is fine”, and since that is the right answer for the vast majority of words, it should usually win. Part 07 makes this precise with the probability of no error.

في تصحيح الكلمات غير الموجودة كنا نتخلص من السلسلة المكتوبة: acress ليست كلمة، فلا يمكن أن تكون هي الإجابة. أما فعل الشيء نفسه هنا فسيكون كارثة. لو استُبدلت كل كلمة بأفضل جار لها، لعادت الجملة الصحيحة مليئة بـ«تصحيحات». إبقاء الكلمة المكتوبة في مجموعتها يسمح للنموذج بأن يقول «هذه الكلمة سليمة»، وبما أن هذه هي الإجابة الصحيحة للغالبية العظمى من الكلمات، فيجب أن تفوز عادةً. يجعل الجزء 07 هذا الأمر دقيقًا عبر احتمال عدم وجود خطأ (probability of no error).

Why homophones get their own slotلماذا تحصل الكلمات المتجانسة صوتيًا على خانة خاصة بها

A cognitive error is not a slip, so it need not be a small edit. Compare the pairs below. The one-edit rule catches some homophones by luck, but the classic confusions like piece and peace sit two edits apart. Adding homophones explicitly, from a pronunciation dictionary or a sound-based key, brings them into the set without widening the edit radius to 2 for every word, which would multiply the candidates for everything else.

الخطأ المعرفي ليس زلة أصابع، لذا لا يلزم أن يكون تعديلًا صغيرًا. قارن الأزواج في الجدول أدناه. قاعدة التعديل الواحد تلتقط بعض الكلمات المتجانسة صوتيًا بالصدفة، لكن حالات الخلط الكلاسيكية مثل piece وpeace تبعد عن بعضها تعديلين. إضافة الكلمات المتجانسة صوتيًا صراحةً، من قاموس نطق أو من مفتاح مبني على الصوت، يُدخلها إلى المجموعة دون توسيع نصف قطر التعديل إلى 2 لكل كلمة، وهو ما كان سيضاعف عدد المرشحين لكل الكلمات الأخرى.

PairالزوجEdit distanceمسافة التعديلReached by the one-edit rule?هل تصل إليه قاعدة التعديل الواحد؟
piece / peacepiece / peace22Two substitutions, out of reach of one editاستبدالان، خارج نطاق التعديل الواحد
their / theretheir / there22Two substitutions, out of reach of one editاستبدالان، خارج نطاق التعديل الواحد
two / tootwo / too11One substitution, the edit rule already finds itاستبدال واحد، فقاعدة التعديل تجده أصلًا
desert / dessertdesert / dessert11One insertion, the edit rule already finds itإدراج واحد، فقاعدة التعديل تجده أصلًا
Edit distance between common homophone pairsمسافة التعديل بين أزواج شائعة من الكلمات المتجانسة صوتيًا

Two ways to chooseطريقتان للاختيار

Once every word has a candidate set, the slide offers two ways to pick. The general one is the noisy channel model, which scores every candidate sentence and is the subject of the next concept. The specialised one is a task-specific classifier, also called a confusion-set classifier: train a model for one confusable group, such as to/too/two or weather/whether, using features of the surrounding words. Golding and Roth’s WinSpell is a well-known example. Classifiers are very accurate for the pairs they were trained on and say nothing about any other word.

بعد أن تصبح لكل كلمة مجموعة مرشحين، تعرض الشريحة طريقتين للاختيار. الطريقة العامة هي نموذج القناة المشوشة (noisy channel model)، الذي يُقيّم كل جملة مرشحة، وهو موضوع المفهوم التالي. والطريقة المتخصصة هي مصنِّف خاص بمهمة محددة، ويُسمى أيضًا مصنِّف مجموعة الالتباس (confusion-set classifier): تدرّب نموذجًا لمجموعة واحدة من الكلمات المتشابهة، مثل to/too/two أو weather/whether، باستخدام خصائص الكلمات المحيطة. ويُعدّ WinSpell الذي طوّره Golding وRoth مثالًا معروفًا. المصنِّفات دقيقة جدًا في الأزواج التي دُرِّبت عليها، ولا تقول شيئًا عن أي كلمة أخرى.

Recall

Why does the candidate set include homophones as well as one-edit neighbors?لماذا تتضمن مجموعة المرشحين الكلمات المتجانسة صوتيًا إضافةً إلى الجيران على بعد تعديل واحد؟

Because cognitive errors come from not knowing the spelling, not from a finger slip, so the intended word can be more than one edit away. piece and peace, or their and there, are two edits apart and would be missed by a one-edit rule. Listing homophones explicitly catches them without widening the edit radius for every word.
لأن الأخطاء المعرفية تأتي من عدم معرفة التهجئة، لا من زلة أصابع، لذا قد تبعد الكلمة المقصودة أكثر من تعديل واحد.piece وpeace، أو their وthere، يفصل بينهما تعديلان، وستفوتهما قاعدة التعديل الواحد. إدراج الكلمات المتجانسة صوتيًا صراحةً يلتقطها دون توسيع نصف قطر التعديل لكل كلمة.

Recall

In non-word correction the typed string is dropped from the candidates. Why is it kept in real-word correction?في تصحيح الكلمات غير الموجودة تُستبعد السلسلة المكتوبة من المرشحين. فلماذا تُبقى في تصحيح الكلمات الحقيقية؟

A non-word cannot be the intended word, so it is useless as a candidate. A real word usually is the intended word, since most words are typed correctly. Keeping it lets the model choose “no change”; dropping it would force a correction at every position.
الكلمة غير الموجودة لا يمكن أن تكون الكلمة المقصودة، فلا فائدة منها كمرشح. أما الكلمة الحقيقية فهي في العادة الكلمة المقصودة فعلًا، لأن معظم الكلمات تُكتب بشكل صحيح. إبقاؤها يسمح للنموذج باختيار «عدم التغيير»؛ واستبعادها سيفرض تصحيحًا في كل موضع.

Put the candidate sets for “mainly be John Black” side by side: {mainly, manly}, {be, by, bee, he, we}, {John}, {Black, Back}. Any choice of one candidate per column is a possible corrected sentence. That gives 2 × 5 × 1 × 2 = 20 sentences from four words, and the right one, “mainly by John Black”, is just one path through them.

ضع مجموعات المرشحين لعبارة «mainly be John Black» جنبًا إلى جنب: {mainly, manly}، {be, by, bee, he, we}، {John}، {Black, Back}. أي اختيار لمرشح واحد من كل عمود هو جملة مصححة محتملة. وهذا يعطي 2 × 5 × 1 × 2 = 20 جملة من أربع كلمات فقط، والجملة الصحيحة «mainly by John Black» ليست إلا مسارًا واحدًا بينها.

The key shift: from one word to the whole sentenceالنقلة الأساسية: من كلمة واحدة إلى الجملة كلها

In non-word correction we knew where the error was, so the search was over one word’s candidates. Here we do not know, so the unit of search becomes the sentence. Given a typed sentence X=x1,x2,…,xnX = x_1, x_2, \dots, x_n, we build Candidate(xᵢ) for every position and search over every sequence W=w1,…,wnW = w_1, \dots, w_n that takes one candidate from each set. This is the method of Mays, Damerau and Mercer (1991), which Jurafsky and Martin present as the noisy channel for real-word errors.

في تصحيح الكلمات غير الموجودة كنا نعرف مكان الخطأ، فكان البحث يجري على مرشحي كلمة واحدة. أما هنا فلا نعرف، فتصبح وحدة البحث هي الجملة. بالنظر إلى جملة مكتوبة X=x1,x2,…,xnX = x_1, x_2, \dots, x_n، نبني Candidate(xᵢ) لكل موضع ونبحث في كل تسلسل W=w1,…,wnW = w_1, \dots, w_n يأخذ مرشحًا واحدًا من كل مجموعة. هذه هي طريقة Mays وDamerau وMercer (1991)، التي يقدّمها Jurafsky وMartin على أنها القناة المشوشة لأخطاء الكلمات الحقيقية.

The candidate columns for mainly be John Black form a lattice of 20 sentences; the typed path is teal and the argmax path through by is the main accentأعمدة المرشحين لعبارة mainly be John Black تشكّل شبكة (lattice) من 20 جملة؛ المسار المكتوب باللون الفيروزي، ومسار argmax المار عبر by باللون الأساسي

The objective: prior times channel, over sentencesالهدف: الاحتمال المسبق مضروبًا في القناة، على مستوى الجمل

W^=argmax⁡W∈C(X)  P(X∣W) P(W)\hat{W} = \underset{W \in C(X)}{\operatorname{argmax}}\; P(X \mid W)\, P(W)
Sentence-level noisy channel: C(X) is every sentence built from the candidate setsالقناة المشوشة على مستوى الجملة: C(X) هي كل جملة تُبنى من مجموعات المرشحين

This is the same argmax as before, lifted from words to sentences. P(W) is the prior probability of the whole sentence, supplied by a language model such as a bigram language model or a trigram model, so context finally enters the score. P(X|W) is the channel model: how likely the writer was to type X when they meant W. For an unchanged word it is the probability of typing it correctly; for a changed word it is the probability of that edit.

هذا هو argmax نفسه كما سبق، لكنه رُفع من مستوى الكلمات إلى مستوى الجمل. P(W) هو الاحتمال المسبق (prior probability) للجملة كلها، ويوفّره نموذج لغوي مثل النموذج اللغوي الثنائي (bigram language model) أو نموذج ثلاثي (trigram)، وبذلك يدخل السياق أخيرًا في الدرجة. وP(X|W) هو نموذج القناة (channel model): ما مدى احتمال أن يكتب الكاتب X وهو يقصد W. بالنسبة إلى كلمة لم تتغير، فهو احتمال كتابتها بشكل صحيح؛ وبالنسبة إلى كلمة تغيّرت، فهو احتمال ذلك التعديل.

Worked exampleمثال محلول

Does be become by? (illustrative numbers)هل تصبح be هي by؟ (أرقام توضيحية)

  1. Fix the channelتثبيت القناة

    Use the simple Mays et al. channel. A word is typed correctly with probability α=0.95\alpha = 0.95, and the remaining 0.05 is shared equally by the other candidates. If be has 10 other candidates, each gets 0.05 / 10 = 0.005.
    نستخدم قناة Mays et al. البسيطة. تُكتب الكلمة بشكل صحيح باحتمال α=0.95\alpha = 0.95، وتتقاسم المرشحات الأخرى الباقي 0.05 بالتساوي. إذا كان للكلمة be 10 مرشحات أخرى، فكل منها يحصل على 0.05 / 10 = 0.005.
  2. Score the typed sentenceتقييم الجملة المكتوبة

    Suppose a bigram model gives P(be | mainly) = 0.0001 and P(John | be) = 0.00002. The language model part is 2 × 10⁻⁹. Times the channel 0.95 gives 1.9 × 10⁻⁹.
    لنفترض أن نموذجًا ثنائيًا (bigram) يعطي P(be | mainly) = 0.0001 وP(John | be) = 0.00002. جزء النموذج اللغوي يساوي 2 × 10⁻⁹. وبضربه في القناة 0.95 نحصل على 1.9 × 10⁻⁹.
  3. Score the corrected sentenceتقييم الجملة المصححة

    Suppose P(by | mainly) = 0.002 and P(John | by) = 0.0005. The language model part is 1 × 10⁻⁶, which is 500 times higher. Times the channel 0.005 gives 5 × 10⁻⁹.
    لنفترض أن P(by | mainly) = 0.002 وP(John | by) = 0.0005. جزء النموذج اللغوي يساوي 1 × 10⁻⁶، أي أعلى بـ500 مرة. وبضربه في القناة 0.005 نحصل على 5 × 10⁻⁹.
  4. Compareالمقارنة

    5 × 10⁻⁹ > 1.9 × 10⁻⁹, so the correction wins, by a factor of about 2.6. The channel charged a toll of 0.95 / 0.005 = 190 for changing the word, and the language model gain of 500 paid it.
    5 × 10⁻⁹ > 1.9 × 10⁻⁹، إذن يفوز التصحيح، بفارق يقارب 2.6 ضعف. فرضت القناة رسم عبور مقداره 0.95 / 0.005 = 190 مقابل تغيير الكلمة، ومكسب النموذج اللغوي البالغ 500 دفع هذا الرسم.
  5. Resultالنتيجة

    A change is accepted only when the context makes the new sentence more likely by more than the channel’s toll. Here “mainly by John” clears the bar; a mild preference would not.
    لا يُقبل التغيير إلا حين يجعل السياقُ الجملةَ الجديدة أكثر احتمالًا بمقدار يتجاوز رسم القناة. هنا تتجاوز «mainly by John» العتبة؛ أما التفضيل الطفيف فلن يكفي.

Why the full search is too bigلماذا البحث الكامل أكبر من اللازم

The number of candidate sentences is the product of the set sizes. With 10 words and 11 candidates each (the word plus 10 alternatives), that is 11¹⁰, about 26 billion sentences. Mays et al. cut this down by assuming at most one error per sentence, which leaves 1 + 10 × 10 = 101 sentences to score. That one-error-per-sentence assumption and the candidate lattice it prunes are the subject of Part 07.

عدد الجمل المرشحة هو حاصل ضرب أحجام المجموعات. مع 10 كلمات و11 مرشحًا لكل منها (الكلمة نفسها زائد 10 بدائل)، يصبح العدد 11¹⁰، أي نحو 26 billion (26 مليار) جملة. قلّص Mays et al. هذا العدد بافتراض وجود خطأ واحد على الأكثر في كل جملة، مما يترك 1 + 10 × 10 = 101 جملة فقط للتقييم. افتراض one-error-per-sentence (خطأ واحد لكل جملة) وشبكة المرشحين (candidate lattice) التي يقلّمها هما موضوع الجزء 07.

Non-word correctionتصحيح الكلمات غير الموجودةReal-word correctionتصحيح الكلمات الحقيقية
Exampleمثالgraffe for giraffegraffe بدل giraffebe for bybe بدل by
DetectionالاكتشافDictionary lookup: the string is not a wordالبحث في القاموس: السلسلة ليست كلمةNeeds context: the string is a wordيحتاج إلى السياق: السلسلة كلمة صحيحة
Where is the error?أين الخطأ؟Known: the one token that failed lookupمعروف: الـ token الوحيد الذي فشل في البحثUnknown: any word could be wrongغير معروف: أي كلمة قد تكون خاطئة
Does the typed string join the candidates?هل تدخل السلسلة المكتوبة ضمن المرشحين؟No, it is not a word, so it cannot be the answerلا، فهي ليست كلمة، فلا يمكن أن تكون الإجابةYes, it is usually correct and must be allowed to winنعم، فهي صحيحة في العادة ويجب أن يُسمح لها بالفوز
Unit of searchوحدة البحثOne wordكلمة واحدةThe whole sentenceالجملة كلها
Model neededالنموذج المطلوبChannel model plus a prior (a unigram is enough to start)نموذج قناة مع احتمال مسبق (prior)، ويكفي unigram للبدايةChannel model plus a language model over context, or a confusion-set classifierنموذج قناة مع نموذج لغوي على السياق، أو مصنِّف مجموعة الالتباس (confusion-set classifier)
Non-word versus real-word correctionتصحيح الكلمات غير الموجودة مقابل تصحيح الكلمات الحقيقية

Recall

What does P(W) alone get wrong, and what does the channel term P(X|W) add?ما الخطأ الذي يقع فيه P(W) وحده، وما الذي يضيفه حد القناة P(X|W)؟

P(W) alone prefers whatever sentence the language model likes best, so it rewrites correct but less common words into more common neighbors. P(X|W) adds the cost of the change: with α = 0.95 a kept word scores far higher than an edited one, so a correction must win on context by more than that toll.
P(W) وحده يفضّل أي جملة يحبها النموذج اللغوي أكثر، فيعيد كتابة الكلمات الصحيحة الأقل شيوعًا إلى جيران أكثر شيوعًا. ويضيف P(X|W) تكلفة التغيير: مع α = 0.95 تحصل الكلمة المُبقاة على درجة أعلى بكثير من الكلمة المعدَّلة، لذا يجب أن يفوز التصحيح بالسياق بمقدار يتجاوز ذلك الرسم.

Recall

How many candidate sentences are there for a 4-word sentence whose candidate sets have sizes 2, 5, 1 and 2?كم عدد الجمل المرشحة لجملة من 4 كلمات أحجام مجموعات مرشحيها 2 و5 و1 و2؟

The product of the sizes: 2 × 5 × 1 × 2 = 20 sentences. In general the count grows as the product, which is why practical systems restrict the search, for example to one error per sentence.
حاصل ضرب الأحجام: 2 × 5 × 1 × 2 = 20 جملة. وبشكل عام ينمو العدد كحاصل ضرب، ولهذا تقيّد الأنظمة العملية البحث، مثلًا بخطأ واحد لكل جملة.

Recapالخلاصة

If you remember nothing elseإن لم تتذكر شيئاً آخر فتذكّر هذا

  • A real-word error is a typo that lands on another valid word: minuets for minutes, an for and, lave for leave, be for by.خطأ الكلمة الحقيقية هو خطأ مطبعي ينتج كلمة صحيحة أخرى: minuets بدل minutes، و an بدل and، و lave بدل leave، و be بدل by.
  • Kukich (1992) reports that 25 to 40% of spelling errors are real words, so ignoring them leaves a large share of errors untouched.يذكر Kukich (1992) أن 25 إلى 40% من الأخطاء الإملائية كلمات حقيقية، لذا فإن تجاهلها يترك نسبة كبيرة من الأخطاء دون معالجة.
  • Dictionary lookup passes every real-word error. Only context can reveal it, so detection becomes the hard part.البحث في القاموس يُمرر كل خطأ كلمة حقيقية. السياق وحده يكشفه، ولذلك يصبح الاكتشاف (detection) هو الجزء الصعب.
  • Non-word correction knows where the error is. Real-word correction does not, so every word in the sentence is a suspect.تصحيح الكلمات غير الموجودة (non-word) يعرف مكان الخطأ. أما تصحيح الكلمات الحقيقية فلا يعرفه، فتصبح كل كلمة في الجملة موضع اشتباه.
  • Candidate set for each word: the word itself, every single-edit neighbor that is a word, and its homophones.مجموعة المرشحين لكل كلمة: الكلمة نفسها، وكل جار على بعد تعديل واحد يكون كلمة صحيحة، وكلماتها المتجانسة صوتيًا (homophones).
  • The typed word stays in its own candidate set because most words are typed correctly.تبقى الكلمة المكتوبة ضمن مجموعة مرشحيها لأن معظم الكلمات تُكتب بشكل صحيح.
  • Choose the sentence W that maximizes P(X|W) P(W). P(W) alone overcorrects, because it ignores how unlikely the change was.اختر الجملة W التي تعظّم P(X|W) P(W). استخدام P(W) وحده يؤدي إلى الإفراط في التصحيح، لأنه يتجاهل مدى ندرة حدوث هذا التغيير.
  • The full search is the product of the candidate set sizes, which explodes. Part 07 tames it with the one-error assumption.البحث الكامل هو حاصل ضرب أحجام مجموعات المرشحين، وهو ينفجر عدديًا. الجزء 07 يروّضه بافتراض وجود خطأ واحد فقط.

Sourcesالمصادر