Majid Al-RaimiSpelling tasks and the two kinds of errorsمهام الإملاء ونوعا الأخطاء

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

Spelling tasks and the two kinds of errorsمهام الإملاء ونوعا الأخطاء

Where spelling correction shows up, detection versus correction, the non-word versus real-word split, how often people actually misspell, and the outline of how each kind of error is fixed.أين يظهر التصحيح الإملائي، والاكتشاف مقابل التصحيح، والتقسيم بين أخطاء الكلمات غير الموجودة وأخطاء الكلمات الحقيقية، وكم مرة يخطئ الناس فعلا في الإملاء، وخطوط عريضة لكيفية إصلاح كل نوع.

Conceptsالمفاهيم
6
Slidesالشرائح
1-8
Readingمدة القراءة
36 min36 دقيقة
Understoodما فهمته
0/6 conceptsمفاهيم

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

Spelling correction is the first NLP application most people ever met, and it is the cleanest place to learn the noisy channel model that the rest of this lecture builds. Before any probabilities appear, you need a sharp picture of the problem: what the system is asked to do, and what makes some errors easy and others nearly invisible.

The whole part is one argument. The task splits into detection and correction. How hard both are depends on a single question: does the error land outside the dictionary, or inside it? An error outside the dictionary is caught by simple lookup. An error inside the dictionary passes lookup untouched and can only be caught by reading the context. Everything else in this lecture (candidates, edit distance, priors, channel models, lattices) is machinery for answering that question well. For the exam, expect to classify errors, to say which ones a dictionary can detect, and to justify the design of each pipeline.

تصحيح الإملاء هو أول تطبيق من تطبيقات معالجة اللغات الطبيعية (NLP) يصادفه معظم الناس، وهو أوضح مكان لتعلّم نموذج القناة المشوشة (noisy channel model) الذي تبني عليه بقية هذه المحاضرة. وقبل أن تظهر أي احتمالات، تحتاج إلى صورة حادة للمشكلة: ما المطلوب من النظام أن يفعله، وما الذي يجعل بعض الأخطاء سهلة وبعضها شبه خفي.

هذا الجزء كله حجة واحدة. تنقسم المهمة إلى كشف وتصحيح، وصعوبة كل منهما تتوقف على سؤال واحد: هل يقع الخطأ خارج القاموس أم داخله؟ الخطأ الواقع خارج القاموس يُكتشف بمجرد البحث فيه. أما الخطأ الواقع داخل القاموس فيمرّ من البحث دون أن يُمسّ، ولا يمكن اكتشافه إلا بقراءة السياق. وكل ما يأتي بعد ذلك في هذه المحاضرة (المرشحون candidates، ومسافة التحرير edit distance، والاحتمالات المسبقة priors، ونماذج القناة channel models، والشبكات lattices) هو أدوات للإجابة عن هذا السؤال إجابة جيدة. وفي الاختبار، توقّع أن يُطلب منك تصنيف الأخطاء، وتحديد ما يستطيع القاموس كشفه منها، وتبرير تصميم كل مسار.

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

  1. Split spelling work into detection and correction, and place autocorrect, a single suggestion and a suggestion list on a ladder of confidence.تقسيم عمل الإملاء إلى كشف وتصحيح، ووضع التصحيح التلقائي (autocorrect) والاقتراح الواحد وقائمة الاقتراحات على سلّم الثقة.
  2. Classify any misspelling as a non-word error or a real-word error, and split real-word errors into typographical and cognitive.تصنيف أي خطأ إملائي على أنه خطأ كلمة غير موجودة (non-word error) أو خطأ كلمة حقيقية (real-word error)، وتقسيم أخطاء الكلمات الحقيقية إلى أخطاء طباعية (typographical) وأخطاء معرفية (cognitive).
  3. Explain why dictionary lookup detects non-word errors and is blind to real-word errors.شرح لماذا يكشف البحث في القاموس أخطاء الكلمات غير الموجودة، ولماذا لا يرى أخطاء الكلمات الحقيقية إطلاقا.
  4. Read published error rates as properties of the input condition, from 1 to 2% for careful retyping to 26% for web queries.قراءة معدلات الأخطاء المنشورة على أنها خصائص لظروف الإدخال، من 1 إلى 2% عند إعادة الكتابة بعناية حتى 26% في استعلامات البحث على الويب.
  5. Outline the two correction pipelines, and say why the real-word candidate set must contain the typed word itself.عرض الخطوط العامة لمسارَي التصحيح، وبيان لماذا يجب أن تحتوي مجموعة المرشحين لأخطاء الكلمات الحقيقية على الكلمة المكتوبة نفسها.

Look at three screenshots from the lecture before reading any definitions. Each one shows a different system doing a different job, and together they already contain the whole taxonomy of this part.

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

  • Microsoft Word underlines the sentence This is bigger then that ofcourse. It flags then and offers the single fix than. That is remarkable: then is a perfectly good English word, so Word could only have caught it by reading bigger ... that around it. It also flags ofcourse, which is not a word at all; the writer simply left out a space.يضع Microsoft Word خطا تحت الجملة This is bigger then that ofcourse. فهو يعلّم then ويعرض إصلاحا واحدا هو than. وهذا لافت للنظر: then كلمة إنجليزية صحيحة تماما، فلم يكن بإمكان Word أن يكتشفها إلا بقراءة bigger ... that من حولها. ويعلّم أيضا ofcourse، وهي ليست كلمة أصلا؛ فالكاتب ببساطة نسي مسافة.
  • A web search engine receives natural langage processing and answers Showing results for natural language processing, with a link to search the original instead. langage is not an English word, so the engine knew something was wrong and was confident enough to act on its fix.محرك بحث على الويب يستقبل natural langage processing فيجيب Showing results for natural language processing (أي: تُعرض نتائج natural language processing)، مع رابط للبحث عن النص الأصلي بدلا من ذلك. كلمة langage ليست كلمة إنجليزية، لذلك عرف المحرك أن هناك خطأ، وكان واثقا بما يكفي ليطبّق إصلاحه مباشرة.
  • A phone keyboard shows I will check it ther and offers three buttons: there, the, they. It is sure ther is wrong but not sure what was meant, so it hands the choice back to the user.لوحة مفاتيح الهاتف تعرض I will check it ther وتقدّم ثلاثة أزرار: there وthe وthey. فهي متأكدة أن ther خاطئة، لكنها غير متأكدة مما كان مقصودا، لذلك تعيد قرار الاختيار إلى المستخدم.

Notice the two separate questions each tool answers. First: is there an error here at all? Second: what was intended, and how sure am I? The second question also decides how the fix is shown: replaced silently, offered once, or offered as a list. And notice the difference between the errors themselves. langage, ther and ofcourse are not words. then is a word, just the wrong one. That difference is the spine of the rest of the part.

لاحظ السؤالين المنفصلين اللذين تجيب عنهما كل أداة. الأول: هل يوجد خطأ هنا أصلا؟ الثاني: ما الذي كان مقصودا، وما مدى تأكدي؟ والسؤال الثاني يحدد أيضا طريقة عرض الإصلاح: يُستبدل بصمت، أو يُعرض مرة واحدة، أو يُعرض كقائمة. ولاحظ أيضا الفرق بين الأخطاء نفسها. langage وther وofcourse ليست كلمات. أما then فهي كلمة، لكنها الكلمة الخطأ. وهذا الفرق هو العمود الفقري لبقية هذا الجزء.

Recall

Which of the four errors in the slide 3 screenshots would a pure word-list checker miss, and why?أيّ الأخطاء الأربعة في لقطات الشريحة 3 سيفوت مدققا يعتمد على قائمة الكلمات فقط، ولماذا؟

Only then for than. The other three (ofcourse, langage, ther) are not in any English word list, so lookup flags them. then is a valid word, so lookup passes it; only the comparative context bigger ... that shows it is wrong.

فقط then بدلا من than. الثلاثة الأخرى (ofcourse وlangage وther) غير موجودة في أي قائمة كلمات إنجليزية، لذلك يعلّمها البحث في القاموس. أما then فكلمة صحيحة، فيمرّرها البحث؛ والذي يكشف أنها خاطئة هو سياق المقارنة bigger ... that وحده.

Type hte on a phone and it becomes the before you look up. Type ther and you get three buttons instead. Both systems detected the error. They differ in how much they trusted their correction.

اكتب hte على الهاتف فتتحول إلى the قبل أن ترفع نظرك. واكتب ther فتحصل بدلا من ذلك على ثلاثة أزرار. كلا النظامين اكتشف الخطأ، والفرق بينهما هو مقدار ثقتهما في التصحيح.

This is the first split. Spelling error detection decides whether a token is misspelled and nothing more; the red underline is detection. Spelling error correction proposes what the writer meant. Detection can exist without correction (a plain underline), but correction always needs detection first, because you cannot fix what you did not notice.

هذا هو التقسيم الأول. Spelling error detection (كشف الخطأ الإملائي) يقرر هل الكلمة مكتوبة خطأ أم لا، ولا شيء أكثر من ذلك؛ والخط الأحمر تحت الكلمة هو الكشف. أما Spelling error correction (تصحيح الخطأ الإملائي) فيقترح ما كان الكاتب يقصده. يمكن أن يوجد الكشف دون تصحيح (خط تحت الكلمة فقط)، لكن التصحيح يحتاج دائما إلى الكشف أولا، لأنك لا تستطيع إصلاح ما لم تلاحظه.

Correction comes in three strengths, and they form a ladder:

يأتي التصحيح بثلاث درجات من القوة، وهي تشكّل سلّما:

  1. Autocorrect: replace the word without asking, as hte to the, or as the search engine does when it runs natural language processing straight away and leaves only a Search instead for link back. Only safe when the system is very confident, because a wrong silent change is worse than no change.Autocorrect (التصحيح التلقائي): استبدال الكلمة دون سؤال، كما في hte إلى the، أو كما يفعل محرك البحث حين يشغّل البحث عن natural language processing مباشرة ولا يترك إلا رابط Search instead for للعودة إلى النص الأصلي. وهو آمن فقط حين يكون النظام واثقا جدا، لأن التغيير الصامت الخاطئ أسوأ من عدم التغيير.
  2. Suggest a correction: show one fix and let the user accept it, as Word does when its right-click menu offers than above Ignore.اقتراح تصحيح: عرض إصلاح واحد وترك المستخدم يقبله، كما يفعل Word حين تعرض قائمة النقر بالزر الأيمن than فوق خيار Ignore (تجاهل).
  3. Suggestion list: show several fixes ranked by likelihood, as the keyboard does with there, the, they. Used when the top candidates are close.قائمة اقتراحات: عرض عدة إصلاحات مرتبة حسب الاحتمال، كما تفعل لوحة المفاتيح مع there وthe وthey. وتُستخدم حين تكون المرشحات الأولى متقاربة.
The more confident the system is in its top candidate, the more it is allowed to act on its ownكلما زادت ثقة النظام في المرشح الأول، زاد ما يُسمح له بفعله من تلقاء نفسه

Why hte is safe to autocorrect and ther is not: hte has one overwhelmingly likely source, the most frequent word in English, one swap away. ther sits one edit away from there, the, they, then and her, several of them very common. The lecture returns to this policy at the end as the Confidence ladder, once you can compute the confidence it depends on.

لماذا يكون التصحيح التلقائي لـhte آمنا ولـther غير آمن: لـhte مصدر واحد مرجّح بفارق ساحق، وهو أكثر الكلمات تكرارا في الإنجليزية، على بُعد تبديل واحد. أما ther فتقع على بُعد تعديل واحد من there وthe وthey وthen وher، وكثير منها شائع جدا. وتعود المحاضرة إلى هذه السياسة في نهايتها باسم Confidence ladder (سلّم الثقة)، بعد أن تصبح قادرا على حساب الثقة التي تعتمد عليها.

Take three slips. Someone types graffe for giraffe. Someone types there when they meant three. Someone writes piece in a sentence about a peace treaty. All three are spelling errors, and they are three different problems.

خذ ثلاث زلات. شخص يكتب graffe بدلا من giraffe. وشخص يكتب there وهو يقصد three. وشخص يكتب piece في جملة عن معاهدة peace (سلام). الثلاثة كلها أخطاء إملائية، لكنها ثلاث مشكلات مختلفة.

Where the error lands decides everythingالمكان الذي يقع فيه الخطأ يحدد كل شيء

graffe is a Non-word error: the typed string is not in the dictionary. That one fact makes it easy to detect, since any lookup fails. there and piece are real-word errors: the slip happened to land on another valid word. Lookup succeeds, so the error is invisible to it. The only evidence left is that the word does not fit its neighbours: I bought there tickets is odd English, I bought three tickets is not.

graffe هي Non-word error (خطأ كلمة غير موجودة): النص المكتوب ليس في القاموس. وهذه الحقيقة وحدها تجعل كشفه سهلا، لأن أي بحث في القاموس سيفشل. أما there وpiece فهما real-word errors (أخطاء كلمات حقيقية): وقعت الزلة صدفة على كلمة صحيحة أخرى. فالبحث في القاموس ينجح، ولذلك يكون الخطأ خفيا عنه. والدليل الوحيد الباقي هو أن الكلمة لا تتلاءم مع جاراتها: I bought there tickets إنجليزية غريبة، أما I bought three tickets فليست كذلك.

Dictionary lookup flags graffe but lets there and piece through; only context can catch thoseالبحث في القاموس يعلّم graffe لكنه يمرّر there وpiece؛ والسياق وحده يستطيع اكتشافهما

Two ways to land on the wrong wordطريقتان للوقوع على الكلمة الخطأ

Real-word errors split again by what went wrong in the writer:

تنقسم أخطاء الكلمات الحقيقية مرة أخرى بحسب ما الذي أخفق عند الكاتب:

  • A Typographical error is a slip of the fingers. The writer knows how to spell three; two keys were pressed in the wrong order and produced there. These errors look like keyboard accidents: one letter inserted, dropped, swapped or replaced, often by a neighbouring key.Typographical error (الخطأ الطباعي) زلة أصابع. الكاتب يعرف كيف يتهجى three، لكنه ضغط مفتاحين بترتيب خاطئ فنتجت there. وتبدو هذه الأخطاء كحوادث لوحة مفاتيح: حرف واحد يُدرج أو يُحذف أو يُبدَّل موضعه أو يُستبدل، وكثيرا ما يكون ذلك بمفتاح مجاور.
  • A Cognitive error is a slip of knowledge. The writer believes piece is how the word for the absence of war is spelled. The typical case is a Homophone: words that sound the same and are spelled differently, such as piece and peace, too and two. These errors are close in sound, not necessarily close in letters.Cognitive error (الخطأ المعرفي) زلة معرفة. الكاتب يعتقد أن piece هي تهجئة الكلمة التي تعني غياب الحرب. والحالة النموذجية هي Homophone (الكلمات المتجانسة صوتيا): كلمات تُنطق بالطريقة نفسها وتُكتب بشكل مختلف، مثل piece وpeace، وtoo وtwo. هذه الأخطاء قريبة في الصوت، وليست بالضرورة قريبة في الحروف.

The split is not just labels. It tells you where to look for the intended word. For a typo, search words a few keystrokes away. For a cognitive error, search words that sound alike. Slide 8 builds exactly those two searches.

هذا التقسيم ليس مجرد تسميات، بل يخبرك أين تبحث عن الكلمة المقصودة. في الخطأ الطباعي، ابحث في الكلمات التي تبعد بضع ضغطات مفاتيح. وفي الخطأ المعرفي، ابحث في الكلمات المتشابهة في النطق. والشريحة 8 تبني هذين البحثين بالضبط.

QuestionالسؤالNon-word errorخطأ كلمة غير موجودة (non-word error)Real-word errorخطأ كلمة حقيقية (real-word error)
Typed token is in the dictionary?هل الكلمة المكتوبة موجودة في القاموس؟NoلاYesنعم
Detectable by dictionary lookup?هل يمكن كشفه بالبحث في القاموس؟Yes, by definitionنعم، بحكم التعريفNo, lookup says it is fineلا، البحث يقول إنها سليمة
Needs context to detect?هل يحتاج كشفه إلى السياق؟NoلاYes, the surrounding words are the only evidenceنعم، الكلمات المحيطة هي الدليل الوحيد
Examplesأمثلةgraffe for giraffe, hte for the, langagegraffe بدلا من giraffe، وhte بدلا من the، وlangagethere for three, piece for peace, then for thanthere بدلا من three، وpiece بدلا من peace، وthen بدلا من than
Which words are checked?ما الكلمات التي تُفحص؟Only the flagged tokensالكلمات المعلَّمة فقطEvery word in the sentenceكل كلمة في الجملة
Candidate set includes the typed word?هل تتضمن مجموعة المرشحين الكلمة المكتوبة؟No, it is known to be wrongلا، فمن المعروف أنها خاطئةYes, the typed word may be rightنعم، فقد تكون الكلمة المكتوبة صحيحة
Non-word versus real-word errorsأخطاء الكلمات غير الموجودة مقابل أخطاء الكلمات الحقيقية

Worked exampleمثال محلول

How much a dictionary-only checker missesكم يفوّت المدقق الذي يعتمد على القاموس وحده

  1. Take the textbook's estimateخذ تقدير الكتاب المقرر

    Studies summarised by Kukich and quoted in Jurafsky and Martin put real-word errors at 25% to 40% of all spelling errors.

    الدراسات التي لخّصها Kukich ونقلها Jurafsky وMartin تقدّر أخطاء الكلمات الحقيقية بنسبة 25% إلى 40% من جميع الأخطاء الإملائية.

  2. Apply it to 100 errorsطبّقه على 100 خطأ

    Out of 100 misspellings in a document, between 25 and 40 are valid words.

    من بين 100 خطأ إملائي في مستند ما، يكون ما بين 25 و40 منها كلمات صحيحة.

  3. Ask what lookup catchesاسأل ماذا يكتشف البحث في القاموس

    Lookup flags only the non-words: 60 to 75 of the 100.

    البحث يعلّم الكلمات غير الموجودة فقط: من 60 إلى 75 من أصل 100.

  4. Resultالنتيجة

    Even with a perfect dictionary, a lookup-only checker has a detection recall of at most 60% to 75%. The missing quarter or more is exactly the real-word class.
    حتى مع قاموس مثالي، يكون استدعاء الكشف (detection recall) للمدقق الذي يعتمد على البحث وحده 60% إلى 75% في أحسن الأحوال. والربع المفقود أو أكثر هو بالضبط فئة أخطاء الكلمات الحقيقية.
SimulatorمحاكيError-type sorter: which kind of misspelling is this?مصنِّف أنواع الأخطاء: ما نوع هذا الخطأ الإملائي؟

We saw a graffe at the zoo.

Ask two questions: is the typed token in the dictionary, and did the fingers slip or did the writer not know the spelling?اسأل سؤالين: هل الكلمة المكتوبة موجودة في القاموس؟ وهل انزلقت الأصابع، أم أن الكاتب لا يعرف التهجئة الصحيحة؟

Example1 / 8
Score0 / 0

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

A student writes 'a peace of cake' when they meant 'a piece of cake'. What kind of error is it?كتب طالب 'a peace of cake' وهو يقصد 'a piece of cake'. ما نوع هذا الخطأ؟

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

Which kind of error can dictionary lookup never detect, however large the dictionary is?أي نوع من الأخطاء لا يستطيع البحث في القاموس كشفه أبدا، مهما كان القاموس كبيرا؟

How common are spelling errors? The lecture lists five numbers from 1% to 26%. They are not contradictory measurements of one quantity. Each one describes a different way of typing.

ما مدى شيوع الأخطاء الإملائية؟ تسرد المحاضرة خمسة أرقام من 1% إلى 26%. وهي ليست قياسات متناقضة لكمية واحدة، بل كل رقم منها يصف طريقة مختلفة في الكتابة.

Published error rates, ordered by input condition; the spread is about the setting, not the typistمعدلات الأخطاء المنشورة مرتبة حسب ظروف الإدخال؛ والتفاوت سببه الظروف، لا الشخص الذي يكتب
  • 26% of web queries contain an error (Wang et al., 2003). Queries are typed fast, with no review, and full of names and rare terms.26% من استعلامات البحث على الويب تحتوي على خطأ (Wang et al., 2003). فالاستعلامات تُكتب بسرعة، دون مراجعة، وهي مليئة بالأسماء والمصطلحات النادرة.
  • 13% when people retype text without using backspace (Whitelaw et al., 2009). The paper measured 10.8% misspelled tokens for 25 English typists and 12.5% for German, typing at a normal pace and avoiding backspace and delete.13% حين يعيد الناس كتابة نص دون استخدام زر المسح backspace (Whitelaw et al., 2009). قاست الورقة 10.8% من الكلمات المكتوبة خطأ لدى 25 كاتبا بالإنجليزية، و12.5% بالألمانية، وهم يكتبون بسرعة عادية ويتجنبون زرَّي backspace وdelete.
  • 7% errors made and then corrected, and 2% left uncorrected, when retyping on a phone-sized organizer (Soukoreff and MacKenzie, 2003).7% أخطاء ارتُكبت ثم صُحّحت، و2% بقيت دون تصحيح، عند إعادة الكتابة على منظِّم شخصي بحجم الهاتف (Soukoreff and MacKenzie, 2003).
  • 1% to 2% for careful retyping of printed text on a normal keyboard (Kane and Wobbrock, 2007; Grudin, 1983).من 1% إلى 2% عند إعادة كتابة نص مطبوع بعناية على لوحة مفاتيح عادية (Kane and Wobbrock, 2007؛ Grudin, 1983).

Read the list as a set of input conditions: device size, speed, whether errors may be fixed, and when they are counted. Take away backspace and the rate rises because nothing gets fixed. Shrink the keyboard and fingers land on neighbouring keys. Count errors before the user fixes them, and you see the 7%; count after, and only the 2% that survived. The same person can produce all of these numbers in one afternoon.

اقرأ القائمة على أنها مجموعة من ظروف الإدخال: حجم الجهاز، والسرعة، وهل يُسمح بإصلاح الأخطاء، ومتى تُحسب. انزع زر المسح فيرتفع المعدل لأن شيئا لا يُصلَح. صغّر لوحة المفاتيح فتقع الأصابع على المفاتيح المجاورة. احسب الأخطاء قبل أن يصلحها المستخدم فترى 7%؛ واحسبها بعد ذلك فلا ترى إلا 2% التي نجت من الإصلاح. والشخص نفسه يمكن أن ينتج كل هذه الأرقام في عصر يوم واحد.

Worked exampleمثال محلول

Why per-query and per-word rates look so differentلماذا يبدو المعدل لكل استعلام مختلفا جدا عن المعدل لكل كلمة

  1. Assume a per-word rateافترض معدلا لكل كلمة

    Suppose each word in a query is misspelled independently with probability p = 0.10.

    لنفترض أن كل كلمة في الاستعلام تُكتب خطأ باستقلال عن غيرها باحتمال p = 0.10.

  2. Compute the chance a 3-word query is cleanاحسب احتمال أن يكون استعلام من 3 كلمات خاليا من الأخطاء

    (1−p)3=0.93=0.729(1-p)^3 = 0.9^3 = 0.729

    (1−p)3=0.93=0.729(1-p)^3 = 0.9^3 = 0.729

  3. Take the complementخذ الاحتمال المكمّل

    1−0.729=0.2711 - 0.729 = 0.271, so about 27% of queries contain at least one error.

    1−0.729=0.2711 - 0.729 = 0.271، إذن نحو 27% من الاستعلامات تحتوي على خطأ واحد على الأقل.

  4. Resultالنتيجة

    A per-word rate near 10% and a per-query rate near 26% are compatible. Always check the unit of a rate (character, word, query) before comparing it with another. This is an illustration of the arithmetic, not a claim about how Wang et al. counted.
    معدل لكل كلمة قريب من 10% ومعدل لكل استعلام قريب من 26% متوافقان. تحقّق دائما من وحدة المعدل (حرف، كلمة، استعلام) قبل مقارنته بمعدل آخر. وهذا توضيح للحساب، وليس ادعاء عن الطريقة التي عدّ بها Wang et al. الأخطاء.

Recall

Why is it wrong to say that 26% and 1 to 2% contradict each other?لماذا من الخطأ القول إن 26% و1 إلى 2% يتناقضان؟

They measure different input conditions (hurried web queries against careful retyping of printed text) and often different units (whole queries against words or characters). The spread is explained by the setting and the counting, not by different kinds of people.

لأنهما يقيسان ظروف إدخال مختلفة (استعلامات ويب مكتوبة على عجل مقابل إعادة كتابة نص مطبوع بعناية)، وكثيرا ما يقيسان بوحدات مختلفة (استعلامات كاملة مقابل كلمات أو حروف). والتفاوت تفسّره الظروف وطريقة العدّ، لا اختلاف أنواع الناس.

Back to graffe. A dictionary says it is not a word, so it is an error. Now what should replace it: giraffe, gaffe, graf, grail, craft?

لنعد إلى graffe. القاموس يقول إنها ليست كلمة، إذن هي خطأ. والآن، ما الذي يجب أن يحل محلها: giraffe أم gaffe أم graf أم grail أم craft؟

Detection: anything not in the dictionaryالكشف: كل ما ليس في القاموس

For non-word errors, detection is a lookup. Any token not in the dictionary is flagged. The slide adds that the larger the dictionary the better, and modern systems indeed use huge word lists harvested from the web, so that names, product names and new words are not flagged as errors.

في أخطاء الكلمات غير الموجودة، الكشف مجرد بحث في القاموس: تُعلَّم أي كلمة غير موجودة فيه. وتضيف الشريحة أنه كلما كبر القاموس كان أفضل، والأنظمة الحديثة تستخدم فعلا قوائم كلمات ضخمة مجموعة من الويب، حتى لا تُعلَّم الأسماء وأسماء المنتجات والكلمات الجديدة على أنها أخطاء.

Correction: generate, then chooseالتصحيح: ولّد ثم اختر

Correction has two steps. Candidate generation produces the real words that are similar to the error, usually all dictionary words within one or two edits. Then the system ranks them and picks the best, in one of two ways:

للتصحيح خطوتان. Candidate generation (توليد المرشحين) ينتج الكلمات الحقيقية المشابهة للخطأ، وعادة تكون كل كلمات القاموس التي تبعد تعديلا واحدا أو تعديلين. ثم يرتّبها النظام ويختار أفضلها بإحدى طريقتين:

  • Shortest weighted edit distance. Use Edit distance from the previous lecture, but weight each edit by how plausible it is: swapping two adjacent letters, or hitting a neighbouring key, should cost less than an arbitrary substitution. giraffe is one insertion from graffe; grail needs two substitutions and a deletion.أقصر مسافة تحرير موزونة. استخدم Edit distance (مسافة التحرير) من المحاضرة السابقة، لكن زِن كل تعديل بحسب معقوليته: تبديل حرفين متجاورين، أو ضغط مفتاح مجاور، يجب أن يكلّف أقل من استبدال عشوائي. giraffe تبعد إدراجا واحدا عن graffe؛ أما grail فتحتاج إلى استبدالين وحذف واحد.
  • Highest noisy channel probability. Score each candidate by how likely that word is to have been typed as graffe, times how common the word is. This is the Noisy channel model, the subject of the next part.أعلى احتمال في القناة المشوشة. قيّم كل مرشح بمدى احتمال أن تكون تلك الكلمة قد كُتبت على شكل graffe، مضروبا في مدى شيوع الكلمة. وهذا هو Noisy channel model (نموذج القناة المشوشة)، موضوع الجزء التالي.
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)
Preview: pick the candidate w that best explains the typed string xلمحة: اختر المرشح w الذي يفسر السلسلة المكتوبة x على أفضل وجه

The noisy channel is the stronger choice because it also uses frequency: gaffe and giraffe are both one edit from graffe, and only probabilities can say which one people actually mean more often.

القناة المشوشة هي الخيار الأقوى لأنها تستخدم التكرار أيضا: gaffe وgiraffe كلتاهما تبعد تعديلا واحدا عن graffe، والاحتمالات وحدها هي التي تستطيع أن تقول أيّهما يقصدها الناس فعلا أكثر.

Recall

State the non-word pipeline in two lines.اذكر مسار أخطاء الكلمات غير الموجودة في سطرين.

Detection: flag any token not in the dictionary. Correction: generate dictionary words similar to the error, then choose the one with the smallest weighted edit distance or the highest noisy channel probability.

الكشف: علّم أي كلمة غير موجودة في القاموس. التصحيح: ولّد كلمات من القاموس مشابهة للخطأ، ثم اختر صاحبة أصغر مسافة تحرير موزونة أو أعلى احتمال في القناة المشوشة.

Now take I bought there tickets. Nothing is flagged, because every word is in the dictionary. Which word should the system even look at?

خذ الآن I bought there tickets. لا شيء يُعلَّم، لأن كل كلمة موجودة في القاموس. فأي كلمة يجب أن ينظر إليها النظام أصلا؟

All of them. Since a Real-word error cannot be detected by lookup, real-word correction folds detection and correction into one step and runs it on every word w in the sentence. For each word it builds a Candidate set from three sources:

كلها. فبما أن Real-word error (خطأ الكلمة الحقيقية) لا يمكن كشفه بالبحث في القاموس، فإن تصحيح الكلمات الحقيقية يدمج الكشف والتصحيح في خطوة واحدة ويطبّقها على كل كلمة w في الجملة. ولكل كلمة يبني Candidate set (مجموعة المرشحين) من ثلاثة مصادر:

  1. Words with similar pronunciation, which catches cognitive errors: peace for piece, two and to for too.كلمات متشابهة في النطق، وهي تلتقط الأخطاء المعرفية: peace بدلا من piece، وtwo وto بدلا من too.
  2. Words with similar spelling, which catches typographical errors: three and where for there.كلمات متشابهة في التهجئة، وهي تلتقط الأخطاء الطباعية: three وwhere بدلا من there.
  3. The word w itself.الكلمة w نفسها.

Then it chooses the best candidate in context, either with the Noisy channel model (now with a language model that looks at the neighbouring words) or with a Confusion-set classifier trained for one confusable pair such as there and three.

ثم يختار أفضل مرشح في ضوء السياق، إما باستخدام Noisy channel model (وهذه المرة مع نموذج لغوي ينظر إلى الكلمات المجاورة)، وإما باستخدام Confusion-set classifier (مصنِّف مجموعة الالتباس) مدرَّب على زوج واحد من الكلمات التي يُخلط بينها مثل there وthree.

Why the typed word must stay in the raceلماذا يجب أن تبقى الكلمة المكتوبة في السباق

The third source is the important one. Almost every word in normal text is correct. If the candidate set for there held only three, where and their, the system would be forced to change a word in every position of every sentence. Keeping w lets it answer the detection question: if w wins, there was no error. In over there, there wins; in bought there tickets, three should win. Later the lecture gives the typed word its own probability, P(w|w), the Probability of no error.

المصدر الثالث هو الأهم. فكل كلمة تقريبا في النص العادي صحيحة. لو احتوت مجموعة المرشحين لـthere على three وwhere وtheir فقط، لاضطر النظام إلى تغيير كلمة في كل موضع من كل جملة. إبقاء w يسمح له بالإجابة عن سؤال الكشف: إذا فازت w فلم يكن هناك خطأ. في over there تفوز there؛ وفي bought there tickets يجب أن تفوز three. ولاحقا تعطي المحاضرة الكلمة المكتوبة احتمالها الخاص P(w|w)، وهو Probability of no error (احتمال عدم وجود خطأ).

Recall

Name the three sources of the real-word candidate set and the error type each one targets.سمِّ المصادر الثلاثة لمجموعة المرشحين في أخطاء الكلمات الحقيقية، ونوع الخطأ الذي يستهدفه كل منها.

Similar pronunciation targets cognitive (homophone) errors. Similar spelling targets typographical errors. The word itself covers the most common case: no error at all.

التشابه في النطق يستهدف الأخطاء المعرفية (الكلمات المتجانسة صوتيا). والتشابه في التهجئة يستهدف الأخطاء الطباعية. والكلمة نفسها تغطي الحالة الأكثر شيوعا: عدم وجود خطأ على الإطلاق.

Recapالخلاصة

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

  • Spelling work has two tasks: detection (is this token wrong?) and correction (what was meant?). Correction is delivered as autocorrect, one suggestion or a suggestion list, depending on confidence.لعمل الإملاء مهمتان: الكشف (هل هذه الكلمة خاطئة؟) والتصحيح (ماذا كان المقصود؟). ويُقدَّم التصحيح بثلاث صور حسب درجة الثقة: تصحيح تلقائي، أو اقتراح واحد، أو قائمة اقتراحات.
  • A non-word error lands outside the dictionary (graffe for giraffe), so lookup detects it.خطأ الكلمة غير الموجودة يقع خارج القاموس (graffe بدلا من giraffe)، لذلك يكشفه البحث في القاموس.
  • A real-word error lands on another valid word, so lookup is blind to it. Typographical: a finger slip (there for three). Cognitive: the writer picks the wrong spelling of a sound (piece for peace, too for two).خطأ الكلمة الحقيقية يقع على كلمة صحيحة أخرى، لذلك لا يراه البحث في القاموس. الطباعي: زلة أصابع (there بدلا من three). المعرفي: يختار الكاتب تهجئة خاطئة لصوت ما (piece بدلا من peace، وtoo بدلا من two).
  • Error rates run from 1 to 2% for careful retyping to 26% for web queries. The spread comes from the input condition (device, speed, whether backspace is allowed, whether errors are counted before or after fixing), not from the typist.تتراوح معدلات الأخطاء من 1 إلى 2% عند إعادة الكتابة بعناية حتى 26% في استعلامات الويب. وهذا التفاوت سببه ظروف الإدخال (الجهاز، والسرعة، والسماح بزر المسح backspace أو منعه، وهل تُحسب الأخطاء قبل إصلاحها أم بعده)، لا الشخص الذي يكتب.
  • Non-word pipeline: flag tokens not in the dictionary, generate similar real words, pick by smallest weighted edit distance or highest noisy channel probability.مسار الكلمات غير الموجودة: علّم الكلمات غير الموجودة في القاموس، ثم ولّد كلمات حقيقية مشابهة، ثم اختر صاحبة أصغر مسافة تحرير موزونة (weighted edit distance) أو أعلى احتمال في نموذج القناة المشوشة (noisy channel).
  • Real-word pipeline: for every word w, gather candidates by similar spelling and similar pronunciation, add w itself, pick by noisy channel or a classifier. Keeping w lets the system decide the word was right.مسار الكلمات الحقيقية: لكل كلمة w اجمع مرشحين متشابهين في التهجئة ومتشابهين في النطق، وأضف w نفسها، ثم اختر بنموذج القناة المشوشة أو بمصنِّف (classifier). إبقاء w يسمح للنظام بأن يقرر أن الكلمة كانت صحيحة.

Sourcesالمصادر