Lecture 04 · Word Embeddings

المحاضرة 04 · تضمينات الكلمات (Word Embeddings)

Term-Document and Word-Word Matrices

مصفوفتا term-document وword-word

Slides 31–36 الشرائح 31–36 P2 SHOULD

The first real vectors. One matrix, two ways to read it, and the shape question the exam likes to ask.

أول متجهات حقيقية. مصفوفة واحدة، وطريقتان لقراءتها، وسؤال الأبعاد الذي يحب الامتحان أن يطرحه.

The term-document matrix

مصفوفة term-document

Slide 31. The construction is embarrassingly simple: pick some words, pick some documents, count how often each word occurs in each document.

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

The slide's example is four Shakespeare plays by four words. These are the actual figures on the slide.

مثال الشريحة هو أربع مسرحيات لشكسبير مقابل أربع كلمات. وهذه هي الأرقام الفعلية الموجودة على الشريحة.

As You Like ItTwelfth NightJulius CaesarHenry V
battle10713
good114806289
fool365814
wit201523

اقرأ الجدول هكذا: كل صف كلمة (battle وgood وfool وwit)، وكل عمود مسرحية، والخلية هي عدد مرات ظهور تلك الكلمة في تلك المسرحية. مثلاً fool تظهر 58 مرة في Twelfth Night ومرة واحدة فقط في Julius Caesar.

The caption on slide 31 is "Each document is represented by a vector of words." Read down the As You Like It column and you get [1, 114, 36, 20]. That four-number list is the document, as far as this model is concerned.

عنوان الشريحة 31 هو "Each document is represented by a vector of words." أي أن كل مستند يُمثَّل بمتجه من الكلمات. اقرأ عمود As You Like It من أعلى إلى أسفل فتحصل على [1, 114, 36, 20]. هذه القائمة ذات الأرقام الأربعة هي المستند نفسه، بقدر ما يعني هذا النموذج.

One matrix, two readings

مصفوفة واحدة وقراءتان

This is the key idea on the page, and it is the reason the same matrix shows up on four consecutive slides.

هذه هي الفكرة الأساسية في الصفحة، وهي السبب في ظهور المصفوفة نفسها في أربع شرائح متتالية.

As You Like It Twelfth Night Julius Caesar Henry V battle good fool wit 10713 114806289 365814 201523 COLUMN = a document vector. Twelfth Night = [0, 80, 58, 15] ROW = a word vector. fool = [36, 58, 1, 4]
Slides 31 and 34 are the same table with a different highlight. Columns give you documents, rows give you words.
الشريحتان 31 و34 هما الجدول نفسه مع تظليل مختلف. الأعمدة تعطيك المستندات، والصفوف تعطيك الكلمات.

الشريحتان 31 و34 هما الجدول نفسه مع تمييز مختلف: الأعمدة تعطيك مستندات، والصفوف تعطيك كلمات. في الرسم، العمود المميَّز هو متجه المستند Twelfth Night = [0, 80, 58, 15]، والصف المميَّز هو متجه الكلمة fool = [36, 58, 1, 4].

Read a COLUMN

اقرأ عموداً (COLUMN)

You get a document vector. Each dimension is a word count.

تحصل على متجه مستند (document vector). كل بُعد فيه هو عدد مرات ظهور كلمة.

Similar columns mean similar documents.

الأعمدة المتشابهة تعني مستندات متشابهة.

This is information retrieval. Turn the query into a vector too, then return the documents whose columns are closest to it.

هذا هو استرجاع المعلومات (information retrieval). حوّل الاستعلام أيضاً إلى متجه، ثم أعِد المستندات التي تكون أعمدتها الأقرب إليه.

Read a ROW

اقرأ صفاً (ROW)

You get a word vector. Each dimension is a document.

تحصل على متجه كلمة (word vector). كل بُعد فيه هو مستند.

Similar rows mean similar words.

الصفوف المتشابهة تعني كلمات متشابهة.

This is the leap on slide 34: "Words can be vectors too!!!" The same counts, read sideways, become a model of word meaning.

هذه هي القفزة في الشريحة 34: "Words can be vectors too!!!" أي أن الكلمات يمكن أن تكون متجهات أيضاً. العدّات نفسها، إذا قرأتها بالعرض، تصبح نموذجاً لمعنى الكلمة.

Visualising document vectors

تصوير متجهات المستندات

Slide 32 takes two of the four rows, fool and battle, and plots each play as a point in that 2D space. The exact coordinates on the slide are [fool, battle].

تأخذ الشريحة 32 صفّين من الصفوف الأربعة، fool وbattle، وترسم كل مسرحية كنقطة في هذا الفضاء ثنائي الأبعاد. والإحداثيات الدقيقة على الشريحة هي [fool, battle].

10 20 30 40 50 60 5 10 15 fool battle Henry V [4, 13] Julius Caesar [1, 7] As You Like It [36, 1] Twelfth Night [58, 0] histories: hug the battle axis comedies: run out along the fool axis
Slide 32. The two comedies point in nearly the same direction, and the two histories point in nearly the same direction. The two groups point in clearly different directions.
الشريحة 32. المسرحيتان الكوميديتان تشيران إلى الاتجاه نفسه تقريباً، والمسرحيتان التاريخيتان تشيران إلى الاتجاه نفسه تقريباً. والمجموعتان تشيران إلى اتجاهين مختلفين بوضوح.

الشريحة 32. المحور الأفقي هو fool والعمودي هو battle. الكوميديّتان (As You Like It [36, 1] وTwelfth Night [58, 0]) تمتدان على محور fool، والمسرحيتان التاريخيتان (Julius Caesar [1, 7] وHenry V [4, 13]) تلتصقان بمحور battle. فالكوميديّتان تشيران تقريباً إلى الاتجاه نفسه، والتاريخيتان كذلك، والمجموعتان تشيران إلى اتجاهين مختلفين بوضوح.

Worked reading of the plot قراءة محلولة للرسم

Slide 33's conclusion, in its own words: "Vectors are similar for the two comedies. But comedies are different than the other two. Comedies have more fools and wit and fewer battles."

خلاصة الشريحة 33 بكلماتها: "متجهات الكوميديّتين متشابهة، لكن الكوميديا تختلف عن المسرحيتين الأخريين. في الكوميديا حمقى (fools) وظُرف (wit) أكثر، ومعارك (battles) أقل."

Check it against the numbers. The comedies, As You Like It and Twelfth Night: fool = 36 and 58, wit = 20 and 15, battle = 1 and 0. The histories, Julius Caesar and Henry V: fool = 1 and 4, wit = 2 and 3, battle = 7 and 13. The genre is recoverable from four counts.

تحقّق من ذلك بالأرقام. الكوميديّتان As You Like It وTwelfth Night: fool = 36 و58، وwit = 20 و15، وbattle = 1 و0. والتاريخيتان Julius Caesar وHenry V: fool = 1 و4، وwit = 2 و3، وbattle = 7 و13. النوع الأدبي يمكن استرجاعه من أربع عدّات فقط.

That is why the slide is titled "Vectors are the basis of information retrieval." If documents of the same type land near each other in vector space, nearness in that space is a usable search engine.

ولهذا عنوان الشريحة "Vectors are the basis of information retrieval"، أي أن المتجهات أساس استرجاع المعلومات. فإذا وقعت المستندات من النوع نفسه قريبة من بعضها في فضاء المتجهات، فإن القُرب في هذا الفضاء يصلح محرّك بحث.

Words can be vectors too

الكلمات يمكن أن تكون متجهات أيضاً

Slide 34 flips the highlight from columns to rows and reads off two word vectors:

تقلب الشريحة 34 التمييز من الأعمدة إلى الصفوف، وتقرأ متجهَي كلمتين:

Nothing changed except the direction you read. The same matrix that powered document search is now a model of word meaning, exactly as Idea 1 from the previous page demanded.

لم يتغيّر شيء سوى اتجاه القراءة. المصفوفة نفسها التي شغّلت البحث في المستندات أصبحت الآن نموذجاً لمعنى الكلمة، تماماً كما طلبت الفكرة الأولى (Idea 1) في الصفحة السابقة.

The more common version: the word-word matrix

النسخة الأكثر شيوعاً: مصفوفة word-word

Slide 35, also called the term-context matrix. Documents are a crude notion of context. Shakespeare plays are tens of thousands of words long, so "occurs in the same play" is a very weak signal of shared meaning.

الشريحة 35، وتُسمّى أيضاً term-context matrix. المستندات مفهوم خشن للسياق. مسرحيات شكسبير طولها عشرات الآلاف من الكلمات، لذلك فإن "الظهور في المسرحية نفسها" إشارة ضعيفة جداً على المعنى المشترك.

So replace the columns. Instead of documents, the columns are context words, and a context is a small window around the target word (the standard choice is plus or minus 4 words).

لذلك نستبدل الأعمدة. بدلاً من المستندات تصبح الأعمدة كلمات سياق (context words)، والسياق نافذة صغيرة حول الكلمة الهدف (الاختيار المعتاد هو 4 كلمات قبلها و4 بعدها).

cell (i, j) = how often context word j occurred inside the window around word i

تقول الصيغة: الخلية (i, j) تساوي عدد مرات ظهور كلمة السياق j داخل النافذة المحيطة بالكلمة i.

The slide's principle: two words are similar in meaning if their context vectors are similar. It illustrates with four target words and four corpus snippets:

مبدأ الشريحة: تتشابه كلمتان في المعنى إذا تشابهت متجهات سياقهما. وتوضّح ذلك بأربع كلمات هدف وأربعة مقاطع من نص:

  is traditionally followed by   cherry        pie, a traditional dessert
         often mixed, such as   strawberry    rhubarb pie. Apple pie
computer peripherals and personal  digital    assistants. These devices usually
        a computer. This includes  information  available on the internet

في كل سطر الكلمة الهدف في المنتصف (cherry وstrawberry وdigital وinformation) وحولها سياقها. لاحظ أن cherry وstrawberry تحيط بهما كلمات مثل pie وdessert، بينما تحيط بـ digital وinformation كلمات مثل computer وinternet.

And here is the resulting matrix, with the slide's actual counts. The ... columns stand for the rest of the vocabulary, which is the point: this table is a tiny window onto something enormous.

وهذه هي المصفوفة الناتجة بالعدّات الفعلية من الشريحة. الأعمدة ... تمثّل بقية المفردات، وهذا هو المقصود: هذا الجدول نافذة صغيرة جداً على شيء ضخم.

aardvark...computerdataresultpiesugar...
cherry0...28944225...
strawberry0...0016019...
digital0...167016838554...
information0...33253982378513...

الخلايا المميّزة هي الأرقام الكبيرة: cherry مع pie 442، وstrawberry مع pie 60، وdigital مع computer وdata 1670 و1683، وinformation مع computer وdata 3325 و3982. وعمود aardvark كله أصفار.

Read it the way slide 35 wants. cherry and strawberry both load on pie and sugar and are near zero on computer and data. digital and information do the exact reverse. Two clusters fall out of raw counts, with no labels and no supervision.

اقرأها كما تريد الشريحة 35. cherry وstrawberry كلتاهما مرتفعتان على pie وsugar، وقريبتان من الصفر على computer وdata. وdigital وinformation تفعلان العكس تماماً. مجموعتان تخرجان من العدّات الخام، بلا تسميات ولا إشراف.

Slide 36 plots the second pair on the data and computer axes: digital = [1683, 1670] and information = [3982, 3325]. Note the shape of that picture. information is a much longer arrow than digital, because information is a more frequent word, but the two arrows point in almost the same direction. That mismatch between length and direction is exactly why the next topic is cosine similarity rather than raw distance.

ترسم الشريحة 36 الزوج الثاني على محورَي data وcomputer: digital = [1683, 1670] وinformation = [3982, 3325]. لاحظ شكل هذه الصورة. سهم information أطول بكثير من سهم digital لأن information كلمة أكثر تكراراً، لكن السهمين يشيران تقريباً إلى الاتجاه نفسه. وهذا التفاوت بين الطول والاتجاه هو بالضبط سبب أن الموضوع التالي هو cosine similarity لا المسافة الخام.

Term-document versus word-word

Term-document مقابل word-word

MatrixالمصفوفةRowsالصفوفColumnsالأعمدةShapeالأبعاد
Term-documentTerm-document|V| words|V| كلمةD documentsD مستند|V| × D
Word-word (term-context)Word-word (term-context)|V| words|V| كلمة|V| context words|V| كلمة سياق|V| × |V|

المصفوفة term-document صفوفها |V| كلمة وأعمدتها D مستند، فشكلها |V| × D. والمصفوفة word-word صفوفها |V| كلمة وأعمدتها |V| كلمة سياق، فشكلها |V| × |V| وهي مربّعة.

Term-documentTerm-documentWord-wordWord-word
What a column isما هو العمودA whole documentمستند كاملA context word from the vocabularyكلمة سياق من المفردات (vocabulary)
What a cell countsما تعدّه الخليةOccurrences of word i in document jمرات ظهور الكلمة i في المستند jOccurrences of word j in the context window of word iمرات ظهور الكلمة j في نافذة سياق الكلمة i
Size of the contextحجم السياقAn entire documentمستند بأكملهA small window, typically plus or minus 4 wordsنافذة صغيرة، عادةً ±4 كلمات
Dimensionality of a word vectorعدد أبعاد متجه الكلمةD, the number of documentsD، عدد المستندات|V|, the vocabulary size|V|، حجم المفردات
Primary useالاستخدام الرئيسيInformation retrieval, document similarityاسترجاع المعلومات (information retrieval)، وتشابه المستنداتWord similarity, word embeddingsتشابه الكلمات، وword embeddings
The lecture's verdictحكم المحاضرةThe original ideaالفكرة الأصلية"More common""More common" (الأكثر شيوعاً)

الجدول الثاني يقارن بينهما: في term-document العمود مستند كامل، والخلية تعدّ ظهور الكلمة i في المستند j، والسياق مستند كامل، وبُعد متجه الكلمة D، والاستخدام الأساسي استرجاع المعلومات وتشابه المستندات، وهي الفكرة الأصلية. وفي word-word العمود كلمة سياق من المفردات، والخلية تعدّ ظهور الكلمة j في نافذة الكلمة i، والسياق نافذة صغيرة (عادة 4 كلمات من كل جانب)، وبُعد متجه الكلمة |V|، والاستخدام الأساسي تشابه الكلمات وword embeddings، وحكم المحاضرة أنها "الأكثر شيوعاً".

Sparsity, again

التناثر (sparsity) مرة أخرى

A word-word matrix is |V| × |V|. For a realistic vocabulary of 50,000 words that is 2.5 billion cells, and almost every one of them is zero, because almost no pair of words ever occurs in the same small window. aardvark is the slide's joke: a whole column of zeros.

المصفوفة word-word شكلها |V| × |V|. ولمفردات واقعية من 50,000 كلمة يعني ذلك 2.5 مليار خلية، كلها تقريباً أصفار، لأن معظم أزواج الكلمات لا تظهر أبداً في النافذة الصغيرة نفسها. وaardvark هي نكتة الشريحة: عمود كامل من الأصفار.

Connect it to lecture 03 اربطها بالمحاضرة 03

You have seen this exact failure mode before. The bigram count matrix in the n-gram lecture is also |V| × |V| and also almost entirely zeros, which is why you needed smoothing and backoff.

رأيت هذه المشكلة نفسها من قبل. مصفوفة عدّ الثنائيات (bigram count matrix) في محاضرة n-gram شكلها أيضاً |V| × |V| وهي أيضاً أصفار تقريباً بالكامل، ولهذا احتجت إلى smoothing وbackoff.

Same shape, same sparsity, different fix. There you fixed it by redistributing probability mass (Laplace, Kneser-Ney). Here you fix it by reweighting and then shrinking the dimensions: tf-idf and PPMI reweight, word2vec replaces the long sparse vector with a short dense one. Sparse |V| × |V| counting is the problem that dense embeddings exist to solve.

الشكل نفسه، والتشتّت (sparsity) نفسه، والعلاج مختلف. هناك عالجته بـ إعادة توزيع كتلة الاحتمال (Laplace وKneser-Ney). وهنا تعالجه بـ إعادة الوزن ثم تقليص الأبعاد: tf-idf وPPMI تعيدان الوزن، وword2vec يستبدل المتجه الطويل المتشتّت بمتجه قصير كثيف. العدّ المتشتّت بحجم |V| × |V| هو المشكلة التي وُجدت dense embeddings لحلّها.

Window size: a preview worth banking now

حجم النافذة: لمحة مسبقة تستحق أن تحفظها الآن

The size of the context window is a knob, and it changes what kind of neighbour you get back. This comes up later in the lecture but it is cheap to learn here.

حجم نافذة السياق مقبض تتحكم به، وهو يغيّر نوع الجيران الذين تحصل عليهم. يأتي هذا لاحقاً في المحاضرة، لكن تعلّمه هنا رخيص.

Small window

نافذة صغيرة

Roughly plus or minus 1 or 2 words.

تقريباً كلمة أو كلمتان من كل جانب.

Gives syntactic, more similar neighbours. Nearest neighbours of Hogwarts come out as other schools, and nearest neighbours of a verb come out as other verbs of the same type.

تعطي جيراناً نحويين (syntactic)، أي أكثر تشابهاً (similar). أقرب جيران Hogwarts تخرج مدارس أخرى، وأقرب جيران فعلٍ ما تخرج أفعالاً أخرى من النوع نفسه.

Large window

نافذة كبيرة

Roughly plus or minus 5 or more words.

تقريباً 5 كلمات أو أكثر من كل جانب.

Gives topical, more related neighbours. Nearest neighbours of Hogwarts come out as Dumbledore and Malfoy: same topic, not the same kind of thing.

تعطي جيراناً موضوعيين (topical)، أي أكثر ارتباطاً (related). أقرب جيران Hogwarts تخرج Dumbledore وMalfoy: الموضوع نفسه، لا النوع نفسه من الأشياء.

Exam trap فخ امتحاني

Small window is SIMILAR, large window is RELATED. The intuition that trips people is backwards: a bigger window feels like it should give you a "better", tighter answer. It does not. A bigger window washes out syntax and leaves you with topic, which is the relatedness axis from page one.

النافذة الصغيرة تعطي SIMILAR، والنافذة الكبيرة تعطي RELATED. الحدس الذي يوقع الناس معكوس: تشعر أن النافذة الأكبر يجب أن تعطيك جواباً "أفضل" وأدقّ. لكنها لا تفعل. النافذة الأكبر تمحو النحو وتترك لك الموضوع، وهو محور الارتباط (relatedness) من الصفحة الأولى.

Second trap on this page: the shapes. A term-document matrix is |V| × D, not square. A word-word matrix is |V| × |V|, square. If a question asks for "the dimensionality of a word vector", the answer depends entirely on which matrix you are in: D for term-document, |V| for word-word.

الفخ الثاني في هذه الصفحة هو الأشكال. المصفوفة term-document شكلها |V| × D وليست مربّعة. والمصفوفة word-word شكلها |V| × |V| وهي مربّعة. فإذا سأل سؤال عن "the dimensionality of a word vector"، أي بُعد متجه الكلمة، فالجواب يعتمد كلياً على المصفوفة التي أنت فيها: D في term-document، و|V| في word-word.

What is still missing

ما الذي لا يزال ناقصاً

You can now build vectors. You still cannot compare them, and the raw counts are badly behaved: good has large counts in all four plays and therefore tells you nothing, while information dwarfs digital purely because it is a commoner word. The next pages fix both: cosine similarity for comparison, then tf-idf and PPMI for reweighting.

تستطيع الآن بناء المتجهات، لكنك ما زلت لا تستطيع مقارنتها، والعدّات الخام سيئة السلوك: good عدّاتها كبيرة في المسرحيات الأربع كلها فلا تخبرك بشيء، وinformation تتفوّق على digital لمجرد أنها كلمة أكثر شيوعاً. والصفحات التالية تعالج الأمرين: cosine similarity للمقارنة، ثم tf-idf وPPMI لإعادة الوزن.

Check yourself

اختبر نفسك

In a term-document matrix, what do you get by reading a single row?

في مصفوفة term-document، ماذا تحصل عليه عندما تقرأ صفاً واحداً؟

A. Rows are indexed by words and run across the documents, so the row for fool is [36, 58, 1, 4], a 4-dimensional word vector whose axes are the four plays. B is the column reading, which is the document vector and the basis of information retrieval. C describes the word-word matrix, a different matrix. D is wrong because these are raw counts and a row does not sum to 1.

الجواب A. الصفوف مفهرسة بالكلمات وتمتد عبر المستندات، فصف fool هو [36, 58, 1, 4]، أي متجه كلمة بأربعة أبعاد محاوره المسرحيات الأربع. والخيار B هو قراءة العمود، أي متجه المستند وأساس استرجاع المعلومات. والخيار C يصف مصفوفة word-word، وهي مصفوفة مختلفة. والخيار D خاطئ لأن هذه عدّات خام والصف لا يساوي مجموعه 1.

What is the shape of a word-word (term-context) matrix?

ما شكل مصفوفة word-word (term-context)؟

C. Both the rows and the columns are indexed by the vocabulary, so the matrix is square and enormous. A is the term-document matrix. D is the most seductive wrong answer: the window of plus or minus 4 controls which co-occurrences get counted, not how many columns exist. Every vocabulary item is still a potential context word, so there are |V| columns regardless of window size.

الجواب C. الصفوف والأعمدة كلاهما مفهرس بالمفردات، فالمصفوفة مربّعة وضخمة. والخيار A هو مصفوفة term-document. والخيار D هو الجواب الخاطئ الأكثر إغراءً: النافذة ذات 4 كلمات من كل جانب تتحكم في أيّ ظهورات مشتركة تُعدّ، لا في عدد الأعمدة. فكل كلمة في المفردات تبقى كلمة سياق محتملة، لذلك يوجد |V| عمود مهما كان حجم النافذة.

Using the slide's figures, why are As You Like It and Twelfth Night judged similar?

باستخدام أرقام الشريحة، لماذا يُحكم بأن As You Like It وTwelfth Night متشابهتان؟

B. Slide 33 says it directly: vectors are similar for the two comedies, and comedies have more fools and wit and fewer battles. Check it: fool is 36 and 58 against 1 and 4 for the histories; battle is 1 and 0 against 7 and 13. A is the trap, and it is instructive. good is high in all four plays (114, 80, 62, 89), so it is a poor discriminator and contributes almost nothing to telling the genres apart. Downweighting words like good is exactly the job tf-idf will do.

الجواب B. تقولها الشريحة 33 مباشرة: متجهات الكوميديّتين متشابهة، وفي الكوميديا حمقى وظُرف أكثر ومعارك أقل. تحقّق: fool هي 36 و58 مقابل 1 و4 في التاريخيتين، وbattle هي 1 و0 مقابل 7 و13. والخيار A هو الفخ، وهو مفيد: good مرتفعة في المسرحيات الأربع كلها (114 و80 و62 و89)، فهي مميِّز ضعيف ولا تساهم تقريباً في التفريق بين النوعين. وتقليل وزن كلمات مثل good هو بالضبط ما سيفعله tf-idf.

You enlarge the context window from plus or minus 2 words to plus or minus 10 words. What happens to the nearest neighbours you retrieve?

كبّرت نافذة السياق من كلمتين من كل جانب إلى 10 كلمات من كل جانب. ماذا يحدث لأقرب الجيران الذين تسترجعهم؟

D. Small windows capture syntactic and taxonomic neighbours (the similarity axis); large windows capture topical, associative neighbours (the relatedness axis). A is exactly backwards and is the common error. B is wrong because the matrix stays |V| × |V| regardless of window; only the cell values change. C is wrong too: a bigger window does fill in more non-zero cells, but the matrix remains overwhelmingly sparse, and "dense" in this course means short learned vectors like word2vec, not a count matrix with fewer zeros.

الجواب D. النوافذ الصغيرة تلتقط الجيران النحويين والتصنيفيين (محور التشابه similarity)، والنوافذ الكبيرة تلتقط الجيران الموضوعيين والترابطيين (محور الارتباط relatedness). والخيار A معكوس تماماً وهو الخطأ الشائع. والخيار B خاطئ لأن المصفوفة تبقى |V| × |V| مهما كانت النافذة، وإنما تتغير قيم الخلايا فقط. والخيار C خاطئ أيضاً: النافذة الأكبر تملأ فعلاً خلايا غير صفرية أكثر، لكن المصفوفة تبقى متشتّتة بأغلبية ساحقة، و"dense" في هذا المقرر تعني متجهات قصيرة مُتعلَّمة مثل word2vec، لا مصفوفة عدّ فيها أصفار أقل.

In the slide's word-word matrix, the cell for row digital, column data holds 1683. What does that number mean?

في مصفوفة word-word على الشريحة، الخلية في صف digital وعمود data قيمتها 1683. ماذا يعني هذا الرقم؟

A. Cell (i, j) counts how often context word j occurred in the window around target word i. B describes the term-document matrix, where the unit of context is a whole document rather than a few words. C confuses a count with a probability and also adds an ordering constraint; the window covers words on both sides, so the count is not directional like a bigram. D would be a row total, not a single cell. The cluster structure is the payoff here: digital and information both load heavily on computer and data, while cherry and strawberry load on pie and sugar.

الجواب A. الخلية (i, j) تعدّ كم مرة ظهرت كلمة السياق j في النافذة حول الكلمة الهدف i. والخيار B يصف مصفوفة term-document، حيث وحدة السياق مستند كامل لا بضع كلمات. والخيار C يخلط بين العدّ والاحتمال ويضيف أيضاً قيد ترتيب، بينما النافذة تغطي الكلمات من الجانبين فالعدّ ليس اتجاهياً مثل bigram. والخيار D سيكون مجموع الصف لا خلية واحدة. والمكسب هنا هو بنية المجموعات: digital وinformation كلتاهما مرتفعتان جداً على computer وdata، بينما cherry وstrawberry مرتفعتان على pie وsugar.