Majid Al-RaimiReference sheetالورقة المرجعية

ICS 582Lecture 01المحاضرة 01Referenceالمرجع

Reference sheetالورقة المرجعية

Introduction to natural language processing compressed onto one page: the definitions, formulas and numbers to have in your head before a quiz or exam.محاضرة «مقدمة في معالجة اللغات الطبيعية (NLP)» مضغوطة في صفحة واحدة: التعريفات والمعادلات والأرقام التي يجب أن تكون حاضرة في ذهنك قبل الاختبار القصير أو الامتحان.

Definition, goals and namesالتعريف والأهداف والأسماء

Define NLP by its goal, not its tool. The definition has survived two complete changes of technique. Part 01: What is NLP

عرّف NLP بغايتها لا بأداتها. لقد صمد هذا التعريف أمام تغيّرين كاملين في التقنية. الجزء 01: ما هي NLP

Slide 4, verbatim structureالشريحة 4، بنيتها كما وردت

NLP (slide 4)NLP (الشريحة 4)
A branch of artificial intelligence concerned with interactions between computers and human language.فرع من الذكاء الاصطناعي يُعنى بالتفاعل بين الحواسيب واللغة البشرية.
Three goals, in slide orderثلاثة أهداف، بترتيب الشريحة
Enabling human-machine communication; improving human-human communication; or simply doing useful processing of text or speech.تمكين التواصل بين الإنسان والآلة؛ وتحسين التواصل بين الإنسان والإنسان؛ أو ببساطة إجراء معالجة مفيدة للنص أو الكلام.
Three other names, in slide orderثلاثة أسماء أخرى، بترتيب الشريحة
Computational linguistics (linguistics side, the ACL); speech and language processing (speech is in scope, the textbook title); human language technology (engineering side, systems that ship).اللسانيات الحاسوبية (computational linguistics، الجانب اللساني، جمعية ACL)؛ ومعالجة الكلام واللغة (speech and language processing، الكلام المنطوق داخل نطاق المجال، وهو عنوان الكتاب المقرر)؛ وتقنية اللغة البشرية (human language technology، الجانب الهندسي، أنظمة تُطرح للاستخدام).
Newest labelأحدث تسمية
Language modeling, which the 3rd edition calls the most recent name of the field, not a replacement for it.نمذجة اللغة (language modeling)، وتسميها الطبعة الثالثة أحدث اسم للمجال، لا بديلًا عنه.
NameالاسمFacetالوجهWhat it stressesما يركز عليهAnchorالمرجع
Computational linguisticsاللسانيات الحاسوبية (Computational linguistics)LinguisticsاللسانياتLanguage as object of study, computation as methodاللغة موضوعًا للدراسة، والحوسبة منهجًاACL, founded 1962 as AMTCL, renamed 1968جمعية ACL، تأسست عام 1962 باسم AMTCL، وتغيّر اسمها عام 1968
Speech and language processingمعالجة الكلام واللغة (Speech and language processing)SpeechالكلامSpoken language belongs to the fieldاللغة المنطوقة جزء من المجالTitle of Jurafsky and Martinعنوان كتاب Jurafsky and Martin
Human language technologyتقنية اللغة البشرية (Human language technology)EngineeringالهندسةDeployable systems, not theoryأنظمة قابلة للنشر، لا نظريةSearch engines, assistants, filtersمحركات البحث، والمساعدات، والمرشِّحات
Three names, three facetsثلاثة أسماء، ثلاثة أوجه

The Venn and the AI subfieldsمخطط Venn وفروع الذكاء الاصطناعي

Slide 5: NLP at the intersection of linguistics, computer science and AI, with an ellipsis for mathematics. Slide 6: five AI subfields, deep learning indented under machine learning. Part 01: What is NLP

الشريحة 5: تقع NLP عند تقاطع اللسانيات وعلوم الحاسب والذكاء الاصطناعي، مع علامة حذف (...) تشير إلى الرياضيات. الشريحة 6: خمسة فروع للذكاء الاصطناعي، والتعلم العميق (deep learning) مُزاح تحت تعلم الآلة (machine learning). الجزء 01: ما هي NLP

DisciplineالتخصصContributionالإسهامExampleمثال
LinguisticsاللسانياتThe object: levels of description, grammar, the idea of ambiguityالموضوع: مستويات الوصف، والقواعد النحوية، وفكرة الغموضWhat counts as a word; five readings of a sentenceما الذي يُعد كلمة؛ والقراءات الخمس لجملة واحدة
Computer scienceعلوم الحاسبAlgorithms and data structures: search, dynamic programming, classifiersالخوارزميات وبنى البيانات: البحث، والبرمجة الديناميكية، والمصنِّفاتViterbi, a vocabulary hash table, a spam classifierخوارزمية Viterbi، وجدول تجزئة (hash table) للمفردات، ومصنِّف للرسائل المزعجة (spam)
Artificial intelligenceالذكاء الاصطناعيLearning from data, representing knowledge, choosing the most probable readingالتعلم من البيانات، وتمثيل المعرفة، واختيار القراءة الأكثر احتمالًاWeights trained from reported mailأوزان مدرَّبة من الرسائل المُبلَّغ عنها
The ellipsisعلامة الحذف (...)Mathematics (probability and statistics), plus signal processing and psychologyالرياضيات (الاحتمالات والإحصاء)، إضافة إلى معالجة الإشارات وعلم النفسLinear algebra, vector spaces, acousticsالجبر الخطي، والفضاءات المتجهية، والصوتيات
What each parent discipline gives NLPما يقدمه كل تخصص أم إلى NLP
SubfieldالفرعStudiesيدرسTouches NLP throughيلامس NLP عبر
Natural language processingمعالجة اللغات الطبيعية (NLP)Human languageاللغة البشريةThe subject of this courseموضوع هذا المقرر
Knowledge representation and deductionتمثيل المعرفة والاستنتاجStoring facts and drawing conclusionsتخزين الحقائق واستخلاص النتائجQuestion answering over a knowledge graph (Taj Mahal: monument or musician)الإجابة عن الأسئلة فوق رسم معرفي (Taj Mahal: معلم أثري أم موسيقي)
Machine learning (deep learning inside it)تعلم الآلة (ومنه التعلم العميق)Learning behaviour from dataتعلم السلوك من البياناتSupplies almost every modern NLP modelيوفّر تقريبًا كل نموذج حديث في NLP
Computer visionالرؤية الحاسوبيةImages and videoالصور والفيديوImage captioning, OCRتوليد أوصاف الصور (image captioning)، والتعرف الضوئي على الحروف (OCR)
RoboticsالروبوتاتPerceiving and acting physicallyالإدراك والفعل في العالم الماديFollowing natural language instructions (SayCan)اتباع تعليمات مكتوبة باللغة الطبيعية (SayCan)
Five AI subfields on slide 6 and where each touches NLPفروع الذكاء الاصطناعي الخمسة في الشريحة 6 وأين يلامس كل منها NLP
CompanyالشركةProductالمنتجGoal servedالهدف الذي يخدمه
GoogleGoogleSearch (BERT), Translateالبحث (BERT)، وTranslateHuman-machine, human-humanالتواصل بين الإنسان والآلة، وبين الإنسان والإنسان
AppleAppleSiriSiriHuman-machineالتواصل بين الإنسان والآلة
MicrosoftMicrosoftTranslatorTranslatorHuman-humanالتواصل بين الإنسان والإنسان
Twitter (now X)Twitter (الآن X)Feed ranking and moderationترتيب الخلاصة والإشراف على المحتوىUseful processingمعالجة مفيدة
AmazonAmazonAlexaAlexaHuman-machineالتواصل بين الإنسان والآلة
Facebook (Meta)Facebook (Meta)NLLB translationترجمة NLLBHuman-humanالتواصل بين الإنسان والإنسان
GrammarlyGrammarlyWriting assistantمساعد كتابةUseful processingمعالجة مفيدة
Slide 2 logos sorted by goalشعارات الشريحة 2 مصنفة بحسب الهدف

Machine translationالترجمة الآلية (MT)

Two modes, sorted by who owns the final text. Camera and conversation translation wrap MT inside OCR, speech recognition and speech synthesis. Part 02: Applications

نمطان، مصنفان بحسب من يملك النص النهائي. ترجمة الكاميرا وترجمة المحادثة تغلّفان MT داخل التعرف الضوئي على الحروف (OCR) والتعرف على الكلام وتوليد الكلام. الجزء 02: التطبيقات

ModeالنمطWho produces the final textمن ينتج النص النهائيTypical useالاستخدام المعتادSlide exampleمثال الشريحة
Fully automaticآلي بالكاملThe systemالنظامInformation access, gistingالوصول إلى المعلومات، وفهم الفكرة العامة (gisting)Google Translate rendering the NLP definition in ArabicGoogle Translate يترجم تعريف NLP إلى العربية
Assisted, post-editingبمساعدة، تحرير لاحق (post-editing)The human, fixing a machine draftالإنسان، بتصحيح مسودة الآلةLocalisation, documentationالتوطين (localisation)، والتوثيقNot pictured; the common industrial workflowغير معروض في الشريحة؛ وهو سير العمل الصناعي الشائع
Assisted, interactive predictionبمساعدة، تنبؤ تفاعلي (interactive prediction)The human, accepting or amending predicted suffixesالإنسان، بقبول اللواحق المتنبأ بها أو تعديلهاProfessional news, legal, medical textالنصوص الإخبارية والقانونية والطبية الاحترافيةThe ranked list under the typed word lebaneseالقائمة المرتبة تحت الكلمة المكتوبة lebanese
Modes of machine translation (slide 7)أنماط الترجمة الآلية (الشريحة 7)

Interactive CAT (Barrachina et al., 2009): the human validates a prefix, the system proposes the best or n-best suffix. The list under lebanese is an n-best set; suffered and exposed are two readings of the Arabic verb تعرض.

الترجمة التفاعلية بمساعدة الحاسب (Interactive CAT، Barrachina et al., 2009): يعتمد الإنسان بادئة (prefix)، ويقترح النظام أفضل لاحقة (suffix) أو أفضل n لواحق (n-best). القائمة تحت lebanese هي مجموعة n-best؛ وsuffered وexposed قراءتان للفعل العربي تعرض.

ProductالمنتجChainالسلسلةFailure it inheritsالإخفاق الذي يرثه
Camera translationترجمة الكاميراOCR, then MT, then render the overlayOCR، ثم MT، ثم رسم الترجمة فوق الصورةA wrong letter becomes a wrong wordحرف خاطئ يصبح كلمة خاطئة
Conversation modeوضع المحادثةSpeech recognition, then MT, then speech synthesisالتعرف على الكلام، ثم MT، ثم توليد الكلامA misheard word is translated faithfullyكلمة أسيء سماعها تُترجم بأمانة
AI OverviewAI OverviewRetrieve, then prompt, then generate, then citeالاسترجاع، ثم بناء الموجّه (prompt)، ثم التوليد، ثم الإحالة إلى المصادرFluent text that is not faithful to the sourcesنص سلس لكنه غير وفي للمصادر
Aspect sentimentالمشاعر على مستوى الجوانبAspect extraction, then polarity classificationاستخراج الجانب، ثم تصنيف القطبيةRight polarity on the wrong targetقطبية صحيحة على هدف خاطئ
Products that are pipelines, and where each one breaksمنتجات هي في الحقيقة خطوط معالجة، وأين ينكسر كل منها

Slide 8 counts (historical)أعداد الشريحة 8 (تاريخية)

Google Translate, typingالكتابة في Google Translate
103 languages103 لغة
Google Translate, offlineGoogle Translate دون اتصال
52 languages52 لغة
Google Translate, instant cameraالكاميرا الفورية في Google Translate
30 languages30 لغة
Google Translate, camera photosصور الكاميرا في Google Translate
37 languages37 لغة
Google Translate, conversationالمحادثة في Google Translate
32 languages32 لغة
Skype Translator, voiceالصوت في Skype Translator
7 languages7 لغات
Skype Translator, chatالدردشة في Skype Translator
more than 50 languagesأكثر من 50 لغة
Todayاليوم
Google added 110 languages on 27 June 2024 (about 243 total, help pages say over 200). Skype retired 5 May 2025.أضافت Google عدد 110 لغات في 27 يونيو 2024 (نحو 243 لغة إجمالًا، وصفحات المساعدة تقول أكثر من 200). وأُوقف Skype في 5 مايو 2025.

Question answering: extract or generateالإجابة عن الأسئلة: استخراج أم توليد

Slide 9 is a knowledge graph card. Slide 10 is retrieval-augmented generation on the same query, several years apart. Part 02: Applications

الشريحة 9 بطاقة من رسم معرفي (knowledge graph). والشريحة 10 توليد معزز بالاسترجاع (retrieval-augmented generation) على الاستعلام نفسه، بفارق عدة سنوات بينهما. الجزء 02: التطبيقات

How the answer box answers 'how heavy is our planet'كيف يجيب مربع الإجابة عن 'how heavy is our planet'

1. Word sense disambiguation1. توضيح معنى الكلمة
"heavy" is read as mass, not the sense in heavy rain or heavy traffic.تُقرأ "heavy" بمعنى الكتلة، لا بالمعنى الذي في heavy rain أو heavy traffic.
2. Entity resolution2. تحديد الكيان
"our planet" is mapped to the knowledge graph node Earth (things, not strings).تُربط عبارة "our planet" بالعقدة Earth في الرسم المعرفي (أشياء لا سلاسل نصية، things, not strings).
3. Fact retrieval3. استرجاع الحقيقة
(Earth, mass) returns 5.972 × 10^24 kg, a value information extraction once pulled from text.الزوج (Earth, mass) يعيد 5.972 × 10^24 kg، وهي قيمة استخرجها استخراج المعلومات (information extraction) من النص في وقت ما.
a^=LLM(prompt(q,  retrieve(q,k)))\hat{a} = \text{LLM}\big(\text{prompt}(q,\; \text{retrieve}(q, k))\big)
Retrieval-augmented generation: retrieve the top k passages, build a prompt, generate, citeالتوليد المعزز بالاسترجاع: استرجع أفضل k مقطعًا، وابنِ الموجّه (prompt)، وولّد، واستشهد بالمصادر
PropertyالخاصيةAnswer box (slide 9)مربع الإجابة (الشريحة 9)AI Overview (slide 10)AI Overview (الشريحة 10)
OutputالمخرجOne field, rendered as a cardحقل واحد يُعرض على شكل بطاقةA paragraph with headings and citationsفقرة بعناوين وإحالات إلى المصادر
SourceالمصدرA knowledge graph entryمُدخل في رسم معرفيRetrieved pages fed to an LLMصفحات مسترجعة تُغذّى إلى نموذج لغوي كبير (LLM)
Core stepsالخطوات الأساسيةSense disambiguation, entity resolution, lookupتوضيح المعنى، وتحديد الكيان، ثم البحثRetrieval, prompt construction, generationالاسترجاع، وبناء الموجّه، والتوليد
Provenanceمصدر المعلومة (provenance)Implicit, the graph itselfضمني، هو الرسم نفسهExplicit citation chipsشارات إحالة صريحة
Main failureالإخفاق الرئيسيA stale or missing factحقيقة قديمة أو مفقودةFluent but unfaithful text (hallucination)نص سلس لكنه غير وفي (هلوسة، hallucination)
Cost per queryالتكلفة لكل استعلامA lookupعملية بحث واحدةA large model inferenceاستدلال بنموذج كبير
Answer box versus AI Overviewمربع الإجابة مقابل AI Overview
PlanetالكوكبSlide valueقيمة الشريحةEarth massesبكتل الأرضNASA valueقيمة NASA
Earthالأرض5.972 × 10^24 kg5.972 × 10^24 kg115.9722 × 10^24 kg5.9722 × 10^24 kg
Marsالمريخ6.39 × 10^23 kg6.39 × 10^23 kg0.1070.1076.4169 × 10^23 kg6.4169 × 10^23 kg
Venusالزهرة4.867 × 10^24 kg4.867 × 10^24 kg0.8150.8154.8673 × 10^24 kg4.8673 × 10^24 kg
Jupiterالمشتري1.898 × 10^27 kg1.898 × 10^27 kg317.8317.81.89813 × 10^27 kg1.89813 × 10^27 kg
Slide 9 masses checked against NASAكتل الشريحة 9 مقارنة بقيم NASA

Ratios from the slide's own numbers: 6.39 / 59.72 = 0.107, 4.867 / 5.972 = 0.815, 1898 / 5.972 = 317.8. A hallucination is a response not faithful to the facts of the world; fluency is a property of the generator, faithfulness of the grounding.

النسب محسوبة من أرقام الشريحة نفسها: 6.39 / 59.72 = 0.107، 4.867 / 5.972 = 0.815، 1898 / 5.972 = 317.8. الهلوسة (hallucination) استجابة غير وفية لحقائق العالم؛ الطلاقة خاصية في المولّد، أما الوفاء للحقائق فخاصية في الإسناد إلى المصادر (grounding).

Spelling: non-word versus real-word errorsالإملاء: أخطاء الكلمات غير الموجودة (non-word) مقابل أخطاء الكلمات الحقيقية (real-word)

A dictionary catches the first kind. Only context catches the second. Part 02: Applications

القاموس يلتقط النوع الأول. ولا يلتقط النوع الثاني إلا السياق. الجزء 02: التطبيقات

Non-word errorخطأ كلمة غير موجودةReal-word errorخطأ كلمة حقيقية
Example on slide 11المثال في الشريحة 11ofcourseofcoursethen for thanthen بدل than
Underline in Wordالتسطير في WordRed (spelling)أحمر (إملاء)Blue (grammar)أزرق (قواعد)
Detected byيُكتشف عبرDictionary lookup, no contextالبحث في القاموس، دون سياقContext: a language model or a grammar ruleالسياق: نموذج لغة أو قاعدة نحوية
Share of all spelling errorsالنسبة من كل الأخطاء الإملائيةThe remainderالباقي25 to 40 percentمن 25 إلى 40 بالمئة
Noisy channel term that decidesالحد الحاسم في القناة المشوشة (noisy channel)Channel model prefers a nearby common wordنموذج القناة يفضّل كلمة شائعة قريبةLanguage model P(w) in context does the workنموذج اللغة P(w) في السياق هو الذي يحسم
Slide 11, the two underlinesالشريحة 11، التسطيران
w^=arg⁡max⁡w∈VP(x∣w) P(w)\hat{w} = \arg\max_{w \in V} P(x \mid w)\, P(w)
Noisy channel: channel model (how likely this typo given w) times language model (how likely w here)القناة المشوشة: نموذج القناة (ما احتمال هذا الخطأ بمعلومية w) مضروبًا في نموذج اللغة (ما احتمال w هنا)
  • Candidates V are kept within Damerau-Levenshtein distance 1; most errors are a single-letter change.تُحصر الكلمات المرشحة V ضمن مسافة Damerau-Levenshtein قدرها 1؛ فمعظم الأخطاء تغيير في حرف واحد.
  • For then versus than, P(x | w) is high either way, so P(w) in "bigger ___ that" decides.في حالة then مقابل than، تكون P(x | w) مرتفعة في الحالتين، لذلك فإن P(w) في السياق "bigger ___ that" هي التي تحسم.

Information extraction and sentimentاستخراج المعلومات وتحليل المشاعر

Template filling: slots are copied from the text or inferred from it. Temporal normalization anchors relative expressions to the document date. Part 02: Applications

ملء القوالب (template filling): تُنسخ الخانات (slots) من النص أو تُستنتج منه. والتطبيع الزمني (temporal normalization) يربط التعبيرات النسبية بتاريخ الوثيقة. الجزء 02: التطبيقات

SlotالخانةValueالقيمةCopied or inferredمنسوخ أم مستنتج
EventالحدثCurriculum mtgCurriculum mtgCopied from the subject line, abbreviatedمنسوخ من سطر الموضوع، مختصرًا
DateالتاريخJan-16-2012Jan-16-2012Inferred: header date January 15, 2012 plus one dayمستنتج: تاريخ الترويسة January 15, 2012 زائد يوم واحد
Startالبداية10:00am10:00amInferred: range split, morning assumedمستنتج: تقسيم النطاق، مع افتراض أنه صباحًا
Endالنهاية11:30am11:30amInferred: range split, morning assumedمستنتج: تقسيم النطاق، مع افتراض أنه صباحًا
WhereالمكانGates 159Gates 159Copied: a location named entityمنسوخ: كيان مسمى يدل على مكان
The five slots on slide 12الخانات الخمس في الشريحة 12
tomorrow=anchor+1 day=2012-01-15+1=2012-01-16\text{tomorrow} = \text{anchor} + 1\ \text{day} = 2012\text{-}01\text{-}15 + 1 = 2012\text{-}01\text{-}16
Relative date resolved against the email headerتاريخ نسبي يُحدَّد بالرجوع إلى ترويسة البريد الإلكتروني
SentenceالجملةCue wordsكلمات الدلالةPolarityالقطبية
nice and compact to carry!nice and compact to carry!nice, compactnice, compactPositiveإيجابية
small and light, unlike heavy, bulky professional camerassmall and light, unlike heavy, bulky professional camerassmall, light versus heavy, bulkysmall, light مقابل heavy, bulkyPositiveإيجابية
feels flimsy, is plastic and very light in weightfeels flimsy, is plastic and very light in weightflimsy, plastic, delicateflimsy, plastic, delicateNegativeسلبية
Slide 13: three opinions on the aspect size and weightالشريحة 13: ثلاثة آراء حول جانب الحجم والوزن

Four ways to build NLPأربع طرق لبناء NLP

One axis: how much of the knowledge of language a human writes versus how much the data supplies. Part 03: How NLP is done

محور واحد: كم من المعرفة باللغة يكتبه الإنسان مقابل كم منها توفره البيانات. الجزء 03: كيف تُنجز NLP

ApproachالمنهجHuman writesما يكتبه الإنسانData suppliesما توفره البياناتStrengthنقطة القوةWeaknessنقطة الضعف
Rule-basedالقائم على القواعد (Rule-based)Grammars, lexicons, regexes, finite-state machinesقواعد نحوية، ومعاجم، وتعابير نمطية (regexes)، وآلات حالات منتهيةNothingلا شيءPrecise, inspectable, no training dataدقيق، وقابل للفحص، ولا يحتاج بيانات تدريبBrittle, every phenomenon needs a ruleهش، فكل ظاهرة تحتاج قاعدة
Classical MLتعلم الآلة الكلاسيكي (Classical ML)Feature templates, choice of modelقوالب السمات (feature templates)، واختيار النموذجThe weightsالأوزانRobust, probabilisticمتين، واحتماليNeeds labels and hand-designed featuresيحتاج بيانات معنونة وسمات مصممة يدويًا
End-to-end deep learningالتعلم العميق من الطرف إلى الطرف (end-to-end)Architecture and lossالبنية ودالة الخسارةRepresentations and weightsالتمثيلات والأوزانHighest accuracy, no feature engineeringأعلى دقة، ولا حاجة لهندسة السماتLarge data and compute, hard to inspectيحتاج بيانات وحوسبة ضخمة، ويصعب فحصه
Hybridالهجين (Hybrid)Normalisation rules, constraints, checksقواعد التطبيع، والقيود، والفحوصThe learned coreالنواة المتعلَّمةPractical, safe, works when data is scarceعملي، وآمن، ويعمل حين تشح البياناتTwo systems to maintainنظامان يجب صيانتهما
The four approaches on slide 15المناهج الأربعة في الشريحة 15

Dates to knowتواريخ يجب معرفتها

7 January 19547 يناير 1954
Georgetown-IBM demonstration: 250 words, six grammar rules.عرض Georgetown-IBM: 250 كلمة وست قواعد نحوية.
1966
ELIZA: a cascade of regex substitutions (rule-based).ELIZA: سلسلة من الاستبدالات بالتعابير النمطية (regex)، أي نظام قائم على القواعد.
1965 to early 1990s1965 إلى أوائل التسعينيات
Symbolic era (Jurafsky and Martin, Figure 1.6).العصر الرمزي (Jurafsky and Martin, Figure 1.6).
1975 to 19851975 إلى 1985
Jelinek's IBM speech group starts the statistical turn.مجموعة Jelinek للكلام في IBM تبدأ التحول الإحصائي.
Late 1980s to 2017أواخر الثمانينيات إلى 2017
Empiricist era: naive Bayes, HMM, CRF (2001).العصر التجريبي: naive Bayes وHMM وCRF (2001).
2014, 2017, 20192014 و2017 و2019
seq2seq, the Transformer, prompting. GPT-2 tokenizer: regex pre-tokenizer plus learned BPE merges.seq2seq، ثم Transformer، ثم التوجيه بالموجّهات (prompting). مقطِّع GPT-2: مقطِّع أولي بالتعابير النمطية (regex pre-tokenizer) مع عمليات دمج BPE متعلَّمة.

The text pipelineخط معالجة النص (pipeline)

Three cuts, each a decision that a rule or a model makes and can get wrong. Part 03: How NLP is done

ثلاثة تقطيعات، كل منها قرار تتخذه قاعدة أو نموذج، وقد يخطئ فيه. الجزء 03: كيف تُنجز NLP

CutالتقطيعStepالخطوةWhere it goes wrongموضع الخطأ
Paragraphs to sentencesمن الفقرات إلى الجملSentence boundary disambiguationتوضيح حدود الجمل (sentence boundary disambiguation)The period is ambiguous: Dr., 3.14, or Inc. ending a sentence (both at once)النقطة غامضة: Dr.، أو 3.14، أو Inc. في نهاية جملة (الأمران معًا)
Sentences to wordsمن الجمل إلى الكلماتTokenizationالتقطيع إلى وحدات (tokenization)Clitics ('s, n't, Arabic b and w), hyphens, numbers, no spaces in Chinese, Japanese, Thaiالسوابق واللواحق المتصلة ('s وn't، وb وw في العربية)، والشرطات، والأرقام، وغياب المسافات في الصينية واليابانية والتايلندية
Words to morphologyمن الكلمات إلى الصرفStemming or lemmatizationالتجذيع (stemming) أو التأصيل المعجمي (lemmatization)Porter: experiments to experi. Lemmatizer: are to bePorter: experiments إلى experi. المؤصِّل المعجمي: are إلى be
Slide 16 pipelineخط المعالجة في الشريحة 16

Worked sentence, Penn Treebank convention: "Dr. Ahmad's students are running experiments." gives 8 tokens (Dr. / Ahmad / 's / students / are / running / experiments / .), 2 Porter stems that are not words (ar, experi) and 1 lemma no suffix rule reaches (be).

جملة محلولة وفق اصطلاح Penn Treebank: الجملة "Dr. Ahmad's students are running experiments." تعطي 8 وحدات (tokens) هي (Dr. / Ahmad / 's / students / are / running / experiments / .)، و2 من جذوع Porter ليستا كلمتين حقيقيتين (ar، experi)، و1 أصل معجمي (lemma) لا تصل إليه أي قاعدة لحذف اللواحق (be).

StemmingالتجذيعLemmatizationالتأصيل المعجمي
MethodالطريقةChops suffixes by ruleيقص اللواحق بالقواعدLooks up the dictionary form with a vocabulary and morphological analysisيبحث عن صيغة القاموس باستخدام المفردات والتحليل الصرفي
OutputالمخرجMay be a non-wordقد لا يكون كلمة حقيقيةAlways a real word, the lemmaكلمة حقيقية دائمًا، هي الأصل المعجمي (lemma)
NeedsيحتاجOnly the rulesالقواعد فقطA lexicon, often the part of speechمعجمًا، وغالبًا قسم الكلام
Exampleمثالexperiments to experi, are to arexperiments إلى experi، وare إلى arexperiments to experiment, are to beexperiments إلى experiment، وare إلى be
Over-stemmingالإفراط في التجذيع (over-stemming)university and universal both to universuniversity وuniversal كلاهما إلى universNot applicableلا ينطبق
UseالاستخدامSearch indexingفهرسة البحثAnything shown to people or fed to a parserأي شيء يُعرض على الناس أو يُمرَّر إلى محلل نحوي
Stemming versus lemmatizationالتجذيع مقابل التأصيل المعجمي

Levels of linguistic knowledgeمستويات المعرفة اللغوية

Order from sound to discourse. Speech enters through phonetics and phonology, text through orthography, and both meet at morphology. Part 03: How NLP is done

رتّبها من الصوت إلى الخطاب. الكلام المنطوق يدخل عبر علم الأصوات (phonetics) وعلم النظام الصوتي (phonology)، والنص المكتوب يدخل عبر الإملاء ونظام الكتابة (orthography)، ويلتقي الاثنان عند الصرف (morphology). الجزء 03: كيف تُنجز NLP

LevelالمستوىUnitالوحدةInputالمُدخلExample taskمهمة مثال
Phoneticsعلم الأصوات (Phonetics)Phone (speech sound)الصوت الكلامي (phone)Speech onlyالكلام فقطSpeech recognition front endالواجهة الأمامية للتعرف على الكلام
Phonologyعلم النظام الصوتي (Phonology)Phonemeالفونيم (phoneme)Speech onlyالكلام فقطPronunciation modellingنمذجة النطق
Orthographyالإملاء ونظام الكتابة (Orthography)Character, code pointالحرف، ونقطة الترميز (code point)Text onlyالنص فقطUnicode handling, script normalisationالتعامل مع Unicode، وتطبيع نظام الكتابة
Morphologyالصرف (Morphology)Morphemeالمورفيم (morpheme)BothكلاهماStemming, lemmatization, subword tokenizationالتجذيع، والتأصيل المعجمي، والتقطيع إلى وحدات جزئية (subword tokenization)
Lexicalالمعجمي (Lexical)Lexeme and its sensesالوحدة المعجمية (lexeme) ومعانيهاBothكلاهماWord sense disambiguation (heavy on slide 9)توضيح معنى الكلمة (heavy في الشريحة 9)
Syntaxالنحو (Syntax)Phrase, sentenceالعبارة، والجملةBothكلاهماParsing, PP attachment (slide 21)التحليل النحوي (parsing)، وارتباط شبه الجملة الحرفية (PP attachment، الشريحة 21)
Semanticsالدلالة (Semantics)Propositionالقضية (proposition)BothكلاهماSemantic role labelling, question answeringوسم الأدوار الدلالية، والإجابة عن الأسئلة
Pragmaticsالتداولية (Pragmatics)Utterance in contextالقول في سياقه (utterance)BothكلاهماResolving tomorrow (slide 12), dialogueحسم tomorrow (الشريحة 12)، والحوار
Discourseالخطاب (Discourse)Multi-sentence textنص متعدد الجملBothكلاهماCoreference resolutionحل الإحالة المشتركة (coreference resolution)
Slide 17, complete listالشريحة 17، القائمة الكاملة

Ambiguityالغموض (ambiguity)

Most or all NLP tasks resolve ambiguity at one of the levels above. The marks are in the level column, not the glosses. Part 04: Why NLP is hard

معظم مهام NLP، إن لم تكن كلها، تحسم الغموض في أحد المستويات السابقة. الدرجات في عمود المستوى، لا في الشروح. الجزء 04: لماذا NLP صعبة

ReadingالقراءةGlossالمعنىLevel of ambiguityمستوى الغموض
11I cooked waterfowl for herطهوتُ لها طيرًا مائيًا (بطة)Part of speech and word senseقسم الكلام ومعنى الكلمة
22I cooked waterfowl belonging to herطهوتُ طيرًا مائيًا يخصهاSyntactic, and part of speech of herنحوي، وقسم الكلام لكلمة her
33I created the plaster duck she ownsصنعتُ البطة الجصية التي تملكهاWord sense of makeمعنى الكلمة make
44I caused her to quickly lower her headجعلتُها تخفض رأسها بسرعةPart of speech of duck and syntacticقسم الكلام لكلمة duck، ونحوي
55I turned her into a duckحوّلتُها إلى بطةSyntactic (ditransitive make)نحوي (make متعدٍّ إلى مفعولين، ditransitive)
Bonus, speech onlyإضافية، في الكلام المنطوق فقطeye / maid instead of I / madeeye / maid بدل I / madePhoneticصوتي
Five readings of 'I made her duck' (Jurafsky and Martin, 2000 and 2009, chapter 1)خمس قراءات لجملة 'I made her duck' (Jurafsky and Martin، طبعتا 2000 و2009، الفصل 1)
BracketingالتقويسAttachmentالارتباطMeaningالمعنى
[saw [the man [with a telescope]]][saw [the man [with a telescope]]]Inside the noun phraseداخل العبارة الاسميةThe man has the telescopeالرجل هو من يحمل التلسكوب
[saw [the man] [with a telescope]][saw [the man] [with a telescope]]To the verb phraseبالعبارة الفعليةI used the telescope to see himاستخدمتُ التلسكوب لأراه
saw as the cutting verbsaw بمعنى فعل النشر بالمنشارLexical, stacked on topمعجمي، يُضاف فوق الغموضين السابقينI am sawing the manأنا أنشر الرجل بالمنشار
'I saw the man with a telescope': PP attachment (slide 21)'I saw the man with a telescope': ارتباط شبه الجملة الحرفية (الشريحة 21)

Both parses are grammatical, so grammar alone cannot choose. The two common structural ambiguities in English are attachment and coordination (old men and women). A crash blossom is a real headline whose compressed syntax admits a garden-path reading; named after Violinist Linked to JAL Crash Blossoms (Japan Today, August 2009), popularised by Ben Zimmer in January 2010.

كلا التحليلين صحيح نحويًا، لذلك لا يستطيع النحو وحده أن يختار. الغموضان البنيويان الشائعان في الإنجليزية هما الارتباط (attachment) والعطف (coordination) كما في old men and women. و"زهرة التحطم" (crash blossom) عنوان صحفي حقيقي يسمح تركيبه المضغوط بقراءة مضلِّلة (garden-path)؛ سُمّيت على اسم العنوان Violinist Linked to JAL Crash Blossoms (Japan Today، August 2009)، ونشر المصطلحَ Ben Zimmer في January 2010.

HeadlineالعنوانGarden-path readingالقراءة المضلِّلةAmbiguous word and typeالكلمة الغامضة ونوع الغموض
Violinist Linked to JAL Crash BlossomsViolinist Linked to JAL Crash BlossomsA species called crash blossomsنوع من الأزهار يُدعى crash blossomsblossoms: verb or noun; compound segmentationblossoms: فعل أم اسم؛ وتقسيم الاسم المركب
Teacher Strikes Idle KidsTeacher Strikes Idle KidsA teacher hits lazy childrenمعلم يضرب أطفالًا كسالىstrikes: noun or verb, which flips idlestrikes: اسم أم فعل، وهذا يقلب دور idle
Red Tape Holds Up New BridgesRed Tape Holds Up New BridgesTape robs or supports the bridgesشريط أحمر يسطو على الجسور أو يسندهاholds up: phrasal verb senseholds up: معنى الفعل المركب (phrasal verb)
Hospitals Are Sued by 7 Foot DoctorsHospitals Are Sued by 7 Foot DoctorsDoctors seven feet tallأطباء طولهم سبعة أقدام[7 [foot doctors]] versus [[7 foot] doctors][7 [foot doctors]] مقابل [[7 foot] doctors]
Juvenile Court to Try Shooting DefendantJuvenile Court to Try Shooting DefendantThe court will attempt to shoot himالمحكمة ستحاول إطلاق النار عليهtry: sense; shooting: part of speechtry: المعنى؛ وshooting: قسم الكلام
Local High School Dropouts Cut in HalfLocal High School Dropouts Cut in HalfStudents were bisectedالطلاب شُطروا نصفينcut in half: literal or figurative; world knowledgecut in half: حرفي أم مجازي؛ ومعرفة بالعالم
Slide 22 headlines: garden path and the ambiguous wordعناوين الشريحة 22: القراءة المضلِّلة والكلمة الغامضة

Six more reasons, and the tools for progressستة أسباب أخرى، وأدوات التقدم

Beyond ambiguity, six cards on slide 23, each defeating a named subproblem. Slide 24 lists three tools and three disciplines. Part 04: Why NLP is hard

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

DifficultyالصعوبةSlide exampleمثال الشريحةWhat it defeatsما الذي تُفشلهArabic counterpartالمقابل في العربية
Non-standard textالنص غير المعياريGuys plz d/l the lettr Ive written 2 Jeff GaspinGuys plz d/l the lettr Ive written 2 Jeff GaspinNormalisationالتطبيع (normalisation)Diglossia: MSA versus dialect, Arabizi (3ala)الازدواجية اللغوية (diglossia): الفصحى (MSA) مقابل اللهجة، والعربيزي (3ala)
Segmentationالتقسيم (Segmentation)the New York-New Haven Railroadthe New York-New Haven RailroadTokenization, named entity recognitionالتقطيع إلى وحدات، والتعرف على الكيانات المسماةClitics: w + b + al + qalam as one wordالسوابق واللواحق المتصلة: w + b + al + qalam (وبالقلم) كلمة واحدة
Idiomsالتعابير الاصطلاحية (Idioms)dark horse, get cold feet, throw in the toweldark horse, get cold feet, throw in the towelCompositional semantics, translationالدلالة التركيبية، والترجمةon my eye, meaning gladlyعلى عيني، بمعنى بكل سرور
Neologismsالكلمات المستحدثة (Neologisms)unfriend, Retweet, Malware, Webinarunfriend, Retweet, Malware, WebinarClosed vocabularies (OOV words)المفردات المغلقة (كلمات خارج المفردات، OOV)Loanword verbs such as to save a fileأفعال مستعارة مثل "سيّف الملف" بمعنى to save a file
World knowledgeالمعرفة بالعالمMary and Sue are sisters / are mothersMary and Sue are sisters / are mothersCommonsense reasoningالاستدلال بالحس السليمSame in every languageهي نفسها في كل لغة
Tricky entity namesأسماء الكيانات المربكةA Bug's Life, Let It Be, the for geneA Bug's Life, Let It Be, the for geneNamed entity recognitionالتعرف على الكيانات المسماةNo capital letters, every name looks commonلا توجد حروف كبيرة، فكل اسم يبدو كلمة عادية
Slide 23 with the Arabic counterpartالشريحة 23 مع المقابل في العربية
  • Three tools: knowledge of language, knowledge about the world, a way to combine knowledge sources.ثلاث أدوات: المعرفة باللغة، والمعرفة بالعالم، وطريقة للجمع بين مصادر المعرفة.
  • Three disciplines: computer science (search, classifiers, dynamic programming), mathematics (probability, linear algebra), linguistics (levels and categories).ثلاثة تخصصات: علوم الحاسب (البحث، والمصنِّفات classifiers، والبرمجة الديناميكية)، والرياضيات (الاحتمالات، والجبر الخطي)، واللسانيات (المستويات والفئات).
  • A bigger dictionary fixes neither idioms (non-compositional meaning) nor neologisms (open vocabulary). The fixes are structural: multiword units, and subword models.القاموس الأكبر لا يعالج التعابير الاصطلاحية (idioms، معناها غير تركيبي) ولا الكلمات المستحدثة (neologisms، المفردات مفتوحة). الحلول بنيوية: وحدات متعددة الكلمات (multiword units)، ونماذج الوحدات الجزئية (subword models).
ApproachالمنهجKnowledge of language fromمصدر المعرفة باللغةWorld knowledge fromمصدر المعرفة بالعالمCombined byطريقة الجمع
Rule-basedالقائم على القواعدHand-written grammars and lexiconsقواعد نحوية ومعاجم مكتوبة يدويًاHand-written facts and ontologiesحقائق وأنطولوجيات مكتوبة يدويًاOrder of rule firingترتيب تفعيل القواعد
Machine learningتعلم الآلةAnnotated corporaمدونات نصية معنونة (annotated corpora)Whatever the features encodeما تُرمّزه السمات أيًا كانA classifier weighs featuresمصنِّف يوازن بين السمات
End-to-end deep learningالتعلم العميق من الطرف إلى الطرفRaw textنص خامAbsorbed implicitly from huge corporaتُمتص ضمنيًا من مدونات نصية ضخمةOne network mixes everythingشبكة واحدة تمزج كل شيء
HybridالهجينRules plus learned componentsقواعد مع مكونات متعلَّمةRules, knowledge bases, learned partsقواعد، وقواعد معرفة، وأجزاء متعلَّمةA pipeline or a voteخط معالجة أو تصويت
The four approaches as four ways to combine the knowledge sourcesالمناهج الأربعة بوصفها أربع طرق للجمع بين مصادر المعرفة

Numbers worth memorisingأرقام تستحق الحفظ

Figures quoted across the four partsأرقام مذكورة عبر الأجزاء الأربعة

Vocabulary by age 20حجم المفردات عند سن 20
30,000 to 100,000 words, about 7 to 10 a day, mostly from reading.من 30,000 إلى 100,000 كلمة، أي نحو 7 إلى 10 كلمات يوميًا، معظمها من القراءة.
Real-word spelling errorsأخطاء الكلمات الحقيقية
25 to 40 percent of all spelling errors are valid words in the wrong place.من 25 إلى 40 بالمئة من كل الأخطاء الإملائية كلمات صحيحة في غير موضعها.
LLM hallucination, legal questionsهلوسة LLM في الأسئلة القانونية
69 to 88 percent of the time, and models are poorly calibrated.من 69 إلى 88 بالمئة من الحالات، والنماذج ضعيفة المعايرة (poorly calibrated).
BERT in Search (2019)BERT في البحث (2019)
Helps one in 10 English searches.يساعد في عملية بحث واحدة من كل 10 عمليات بحث بالإنجليزية.
NLLB
200 languages.200 لغة.
Chinese word lengthطول الكلمة الصينية
Roughly 1.5 to 1.9 characters; no orthographic word boundaries.نحو 1.5 إلى 1.9 حرف؛ ولا توجد حدود للكلمات في نظام الكتابة.
Earth mass in poundsكتلة الأرض بالأرطال
5.972 × 10^24 kg × 2.20462 lb/kg ≈ 1.317 × 10^25 lb, the 13.1 septillion pounds of slide 10.5.972 × 10^24 kg × 2.20462 lb/kg ≈ 1.317 × 10^25 lb، أي 13.1 سبتيليون رطل (septillion pounds) المذكورة في الشريحة 10.

Slide errataأخطاء الشرائح

Answer with the corrected fact, and name the slide if a question depends on it. Part 04: Why NLP is hard

أجب بالمعلومة المصححة، واذكر رقم الشريحة إذا كان السؤال يعتمد عليها. الجزء 04: لماذا NLP صعبة

What the slides get wrong, or leave datedما تخطئ فيه الشرائح أو ما صار قديمًا فيها

Slide 1الشريحة 1
Footer reads ICS472, the undergraduate twin. Same slides, same content for ICS 582.التذييل يقول ICS472، وهو المقرر التوأم في المرحلة الجامعية. الشرائح نفسها والمحتوى نفسه لمقرر ICS 582.
Slide 2الشريحة 2
Dated logos: the Twitter bird (X since 24 July 2023) and Facebook (now Meta). A snapshot, not an error.شعارات قديمة: طائر Twitter (أصبح X منذ 24 يوليو 2023) وFacebook (الآن Meta). لقطة من زمنها، لا خطأ.
Slide 6الشريحة 6
Says knowledge representation and deduction. The standard phrase is knowledge representation and reasoning; deduction is one kind of reasoning.تقول knowledge representation and deduction. العبارة المعيارية هي knowledge representation and reasoning؛ والاستنتاج (deduction) نوع واحد من أنواع الاستدلال (reasoning).
Slide 8الشريحة 8
Language counts are from an old app page, and Skype Translator was retired on 5 May 2025. Learn the categories, not the numbers.أعداد اللغات مأخوذة من صفحة قديمة للتطبيق، وقد أُوقف Skype Translator في 5 مايو 2025. احفظ الفئات لا الأرقام.
Slide 9الشريحة 9
Mars shows 6.39 × 10^23 kg; NASA lists 6.4169 × 10^23 kg. Google's stale fact, not the lecturer's; a live example of staleness.يظهر المريخ بقيمة 6.39 × 10^23 kg؛ بينما تذكر NASA القيمة 6.4169 × 10^23 kg. الحقيقة القديمة من Google لا من المحاضر؛ وهي مثال حي على تقادم المعلومات.
Slide 12الشريحة 12
Jan-16-2012 does not contradict the January 15 header. Tomorrow is anchor plus one day. No error.التاريخ Jan-16-2012 لا يناقض ترويسة January 15. كلمة tomorrow تعني نقطة الإسناد زائد يوم واحد. لا خطأ هنا.
Slide 13الشريحة 13
The screenshot covers the middle of the second and third review bullets. Full sentences are in the PDF text layer.لقطة الشاشة تغطي منتصف النقطتين الثانية والثالثة من المراجعات. الجمل الكاملة موجودة في طبقة النص داخل ملف PDF.
Slide 16الشريحة 16
{parsing, tokenization} sits on the sentences-to-words arrow. Tokenization does that alone; parsing builds structure over existing tokens. Also reads pragmatcs.تقع {parsing, tokenization} على سهم "من الجمل إلى الكلمات". التقطيع إلى وحدات (tokenization) يقوم بذلك وحده؛ أما التحليل النحوي (parsing) فيبني بنية فوق وحدات موجودة. وفيها أيضًا الخطأ الإملائي pragmatcs.
Slide 17الشريحة 17
Pragmatcs again. The rings omit the lexical level and orthography; read the stack as the complete list and the rings as the speech-first view.الخطأ Pragmatcs مرة أخرى. الحلقات تُسقط المستوى المعجمي ونظام الكتابة (orthography)؛ اقرأ المكدس على أنه القائمة الكاملة، والحلقات على أنها منظور يبدأ من الكلام المنطوق.
Slide 25الشريحة 25
Prentice-Hall 2020 does not exist. Editions: 2000 and 2009 (ISBN 978-0-13-187321-6); the 3rd edition is a free online draft (19 August 2026) whose chapter 1 no longer contains the duck sentence.لا توجد طبعة Prentice-Hall 2020. الطبعات: 2000 و2009 (ISBN 978-0-13-187321-6)؛ والطبعة الثالثة مسودة مجانية على الإنترنت (19 أغسطس 2026) لم يعد فصلها الأول يحتوي جملة duck.