ICS 582Lecture 02المحاضرة 02Part 01الجزء 01
What counts as a wordما الذي يُعد كلمة
Why a word is not a universal unit, the difference between tokens and types, how corpus vocabularies compare, and the preprocessing decisions every tokenizer must make.لماذا الكلمة ليست وحدة عالمية، والفرق بين الرموز (tokens) والأنواع (types)، وكيف تُقارن مفردات المدونات، وقرارات المعالجة المسبقة التي يجب أن يتخذها كل مُقسِّم (tokenizer).
- Conceptsالمفاهيم
- 4
- Slidesالشرائح
- 1-10
- Readingمدة القراءة
- 24 min24 دقيقة
Why this part mattersلماذا يهمّ هذا الجزء
Every count, probability, embedding table and cost estimate in NLP starts from a decision about what a unit is. Before a language model can predict the next token, before a retrieval system can index a document, and before Zipf or Heaps can be plotted, someone has to say where one unit ends and the next begins.
This part makes that decision visible. It starts from a sentence that has no single word count, gives you the two definitions every later formula depends on (token and type), reads one famous table of corpus sizes, and finishes with the checklist of preprocessing choices a tokenizer must make. Your research pipeline will fix a tokenization policy once, and every N, |V| and sequence length downstream inherits it. Exams ask for token and type counts under a stated policy and for the consequences of each preprocessing choice.
كل عدّ، وكل احتمال، وكل جدول تضمينات (embedding table)، وكل تقدير للتكلفة في معالجة اللغات الطبيعية يبدأ من قرار حول ماهية الوحدة. قبل أن يتنبأ نموذج اللغة بالوحدة النصية التالية، وقبل أن يفهرس نظام الاسترجاع مستندًا، وقبل أن نرسم قانون Zipf أو Heaps، لا بد أن يحدد أحدٌ أين تنتهي وحدة وأين تبدأ التي تليها.
هذا الجزء يجعل ذلك القرار مرئيًا. يبدأ من جملة ليس لها عدد كلمات واحد، ثم يعطيك التعريفين اللذين تعتمد عليهما كل صيغة لاحقة (الوحدة النصية token والنوع type)، ثم يقرأ جدولًا شهيرًا لأحجام المدونات، وينتهي بقائمة اختيارات المعالجة المسبقة التي يجب أن يحسمها أي مقطِّع (tokenizer). ستثبّت سلسلة المعالجة في بحثك سياسة تقطيع مرة واحدة، وكل N و|V| وطول تسلسل بعدها يرث تلك السياسة. الاختبارات تطلب عدد الوحدات النصية والأنواع وفق سياسة محددة، وتطلب نتائج كل اختيار من اختيارات المعالجة المسبقة.
By the end you canفي نهاية هذا الجزء ستستطيع
- State the token and type definitions and compute N and |V| for a given string under a stated policy for case and punctuation.أن تذكر تعريفَي الوحدة النصية (token) والنوع (type)، وتحسب N و|V| لنص معطى وفق سياسة محددة للتعامل مع حالة الأحرف وعلامات الترقيم.
- Explain why the same sentence has 16 or 18 tokens and 14 or 16 types depending on the policy, and why speech transcripts may keep uh and main-.أن تشرح لماذا تحتوي الجملة نفسها على 16 أو 18 وحدة نصية و14 أو 16 نوعًا بحسب السياسة المتبعة، ولماذا قد تُبقي نصوص الكلام المفرّغ على uh وmain-.
- Read the SLP3 corpus table, compute the type to token ratio, and explain both the falling ratio and the Switchboard genre effect.أن تقرأ جدول المدونات في SLP3، وتحسب نسبة الأنواع إلى الوحدات النصية، وتشرح سبب انخفاض هذه النسبة وأثر النوع الأدبي في Switchboard.
- Name the four preprocessing decisions and the four ambiguous boundaries, with one downstream consequence each, and state the Penn Treebank convention.أن تسمّي قرارات المعالجة المسبقة الأربعة والحدود الملتبسة الأربعة مع نتيجة لاحقة واحدة لكل منها، وأن تذكر اصطلاح Penn Treebank.
The whole lecture answers one question: what unit does a model operate on, and how do we get from raw bytes to that unit? Everything else is a stop on the way. The roadmap has eight stops, and it is worth holding the shape in mind because the lecture overview page mirrors it exactly.
المحاضرة كلها تجيب عن سؤال واحد: ما الوحدة التي يعمل عليها النموذج، وكيف ننتقل من البايتات الخام إلى تلك الوحدة؟ وكل ما عدا ذلك محطة على الطريق. خريطة الطريق فيها ثماني محطات، ومن المفيد أن تبقي شكلها في ذهنك لأن صفحة نظرة عامة على المحاضرة تعكسها تمامًا.
- Words, with Zipf and Heaps. How to count units, and the two laws that govern how frequency and vocabulary behave as a corpus grows.الكلمات، مع قانونَي Zipf وHeaps. كيف نعدّ الوحدات، والقانونان اللذان يحكمان سلوك التكرار والمفردات كلما كبرت المدونة.
- Morphemes. The meaningful parts inside a word, which explain why walk, walks and walked are one lemma but three types.المورفيمات (Morphemes). الأجزاء ذات المعنى داخل الكلمة، وهي التي تفسر لماذا تكون walk وwalks وwalked أصلًا معجميًا (lemma) واحدًا لكنها ثلاثة أنواع (types).
- Corpora. Where the text comes from, and why genre, domain and time shift every count in this part.المدونات النصية (Corpora). من أين يأتي النص، ولماذا يغيّر النوع الأدبي والمجال والزمن كل رقم في هذا الجزء.
- Unicode. How characters become bytes, so that a tokenizer can promise to represent any script without an unknown symbol.يونيكود (Unicode). كيف تتحول الحروف إلى بايتات، حتى يستطيع المقطِّع (tokenizer) أن يضمن تمثيل أي نظام كتابة دون رمز مجهول.
- Tokenization with BPE. The algorithm that learns its own units from data instead of trusting spaces.التقطيع (Tokenization) باستخدام BPE. الخوارزمية التي تتعلم وحداتها بنفسها من البيانات بدلًا من الوثوق بالمسافات.
- Sentence segmentation. The period that ends a sentence versus the period inside Dr. or U.S.تقسيم الجمل (Sentence segmentation). النقطة التي تنهي الجملة مقابل النقطة الموجودة داخل Dr. أو U.S.
- Regular expressions. The pattern language behind pre-tokenizers, cleaners and feature extractors.التعبيرات النمطية (Regular expressions). لغة الأنماط التي تقوم عليها مراحل ما قبل التقطيع (pre-tokenizers) وأدوات تنظيف النص ومستخرجات السمات.
- Minimum edit distance. A distance between strings that scores spelling correction and speech recognizers alike.أدنى مسافة تحرير (Minimum edit distance). مقياس للمسافة بين سلسلتين نصيتين يُستخدم لتقييم التصحيح الإملائي وأنظمة التعرف على الكلام على حد سواء.
The first stop carries Zipf's law and Heaps' law. The second is the Morpheme. The third is the Corpus. The fourth turns a Code point into UTF-8 bytes. The fifth is Tokenization and byte-pair encoding. Then come Sentence segmentation, the Regular expression and, finally, Minimum edit distance. This part covers only the opening of the first stop, but it sets the vocabulary every later part reuses.
المحطة الأولى تحمل Zipf's law (قانون Zipf) وHeaps' law (قانون Heaps). والثانية هي المورفيم (morpheme). والثالثة هي المدونة النصية (corpus). والرابعة تحوّل نقطة الترميز (code point) إلى بايتات UTF-8. والخامسة هي التقطيع (tokenization) وترميز أزواج البايتات (byte-pair encoding). ثم يأتي تقسيم الجمل (sentence segmentation)، والتعبير النمطي (regular expression)، وأخيرًا أدنى مسافة تحرير (minimum edit distance). هذا الجزء يغطي بداية المحطة الأولى فقط، لكنه يضع المفردات التي يعيد كل جزء لاحق استخدامها.
The seven learning goals on slide 3 map onto the same stops: know why a word is not a universal unit, distinguish types from tokens and explain why vocabulary keeps growing, know what morphemes are, explain Unicode and byte-level processing, describe BPE and tokenizer design choices, use regular expressions, and compute minimum edit distance with dynamic programming. The first two goals are this part.
أهداف التعلم السبعة في الشريحة 3 ترتبط بالمحطات نفسها: أن تعرف لماذا ليست الكلمة وحدة عالمية، وأن تميّز الأنواع (types) من الوحدات النصية (tokens) وتشرح لماذا تستمر المفردات في النمو، وأن تعرف ما المورفيمات، وأن تشرح Unicode والمعالجة على مستوى البايت، وأن تصف BPE وخيارات تصميم المقطِّع، وأن تستخدم التعبيرات النمطية، وأن تحسب أدنى مسافة تحرير بالبرمجة الديناميكية (dynamic programming). الهدفان الأولان هما موضوع هذا الجزء.
Recall
Name the eight stops of the lecture roadmap in order.اذكر محطات خريطة طريق المحاضرة الثماني بالترتيب.
Count the words in this sentence before reading on: They picnicked by the pool, then lay back on the grass and looked at the stars. Most people say sixteen. Some say eighteen. Both are right, and the reason they can both be right is the subject of this concept.
عُدّ الكلمات في هذه الجملة قبل أن تكمل القراءة: They picnicked by the pool, then lay back on the grass and looked at the stars. معظم الناس يقولون ست عشرة. وبعضهم يقول ثماني عشرة. كلاهما صحيح، وسبب إمكان صحة الإجابتين معًا هو موضوع هذا المفهوم.
Worked exampleمثال محلول
Counting the picnic sentence three waysعدّ جملة النزهة بثلاث طرق
Split on spacesالتقسيم عند المسافات
Sixteen pieces: They, picnicked, by, the, pool,, then, lay, back, on, the, grass, and, looked, at, the, stars. The comma and the period ride along inside the pieces they touch.ست عشرة قطعة: They، picnicked، by، the، pool,، then، lay، back، on، the، grass، and، looked، at، the، stars. الفاصلة والنقطة تبقيان ملتصقتين بالقطعتين اللتين تلامسانهما.Give punctuation its own placeامنح علامات الترقيم مكانًا مستقلًا
Cut the comma off pool and the period off stars. Now there are eighteen units. Jurafsky and Martin note that large language models generally count punctuation as separate words, so eighteen is the modern default rather than a quirk.افصل الفاصلة عن pool والنقطة عن stars. الآن أصبح لدينا ثماني عشرة وحدة. ويلاحظ Jurafsky وMartin أن نماذج اللغة الكبيرة تعدّ علامات الترقيم عمومًا كلمات منفصلة، لذلك فإن ثماني عشرة هي الافتراض الحديث وليست حالة شاذة.Collapse repeatsادمج المتكررات
the occurs three times. Counting each distinct item once gives fourteen distinct words without punctuation, or sixteen if the comma and the period are counted as distinct items too.تظهر the ثلاث مرات. عدّ كل عنصر مميز مرة واحدة يعطي أربع عشرة كلمة مميزة دون علامات الترقيم، أو ست عشرة إذا عُدّت الفاصلة والنقطة عنصرين مميزين أيضًا.Lowercaseتحويل الأحرف إلى صغيرة
Folding They to they changes nothing here, because no other they appears. In another sentence it would merge two distinct items into one.تحويل They إلى they لا يغيّر شيئًا هنا، لأنه لا توجد they أخرى في الجملة. أما في جملة أخرى فقد يدمج عنصرين مميزين في عنصر واحد.Four answers, one sentenceأربع إجابات، جملة واحدة
The sentence never changed. The counting policy did.Policyالسياسة Tokens Nالوحدات النصية N Types |V|الأنواع |V| Whitespace onlyالمسافات فقط 1616 1414 Punctuation splitفصل علامات الترقيم 1818 1616 The picnic sentence under two counting policiesجملة النزهة وفق سياستين للعدّ الجملة لم تتغير. الذي تغيّر هو سياسة العدّ.Policyالسياسة Tokens Nالوحدات النصية N Types |V|الأنواع |V| Whitespace onlyالمسافات فقط 1616 1414 Punctuation splitفصل علامات الترقيم 1818 1616 The picnic sentence under two counting policiesجملة النزهة وفق سياستين للعدّ
In many writing systems spaces suggest boundaries, but a space is only a suggestion. The moment you want a number, you have to decide what to do with everything that a space does not settle, and each decision is tied to what the text is for. Splitting text into units is Tokenization, and the resulting units are tokens. Jurafsky and Martin put it plainly: how we define words depends on the task. The table below pairs each question from the slide with a task that answers yes and a task that answers no.
في كثير من أنظمة الكتابة توحي المسافات بالحدود، لكن المسافة مجرد إيحاء. فبمجرد أن تريد رقمًا، عليك أن تقرر ماذا تفعل بكل ما لا تحسمه المسافة، وكل قرار مرتبط بالغرض من النص. تقسيم النص إلى وحدات هو التقطيع (tokenization)، والوحدات الناتجة هي الوحدات النصية (tokens). ويقولها Jurafsky وMartin بوضوح: طريقة تعريفنا للكلمات تعتمد على المهمة. الجدول أدناه يقرن كل سؤال من الشريحة بمهمة تجيب بنعم ومهمة تجيب بلا.
| Questionالسؤال | A task that says yesمهمة تجيب بنعم | A task that says noمهمة تجيب بلا |
|---|---|---|
| Is punctuation its own token?هل علامة الترقيم وحدة نصية مستقلة؟ | Language models and parsers, where a period or a question mark carries meaningنماذج اللغة والمحللات النحوية، حيث تحمل النقطة أو علامة الاستفهام معنى | Bag-of-words retrieval, where punctuation only adds noiseالاسترجاع بحقيبة الكلمات (bag-of-words)، حيث لا تضيف علامات الترقيم إلا ضوضاء |
| Do we lowercase?هل نحوّل الأحرف إلى صغيرة؟ | Information retrieval, where a query rarely matches the case of the documentاسترجاع المعلومات، حيث نادرًا ما يطابق الاستعلام حالة الأحرف في المستند | Named entity recognition and part-of-speech tagging, where a capital is evidenceالتعرف على الكيانات المسماة ووسم أقسام الكلام، حيث يكون الحرف الكبير دليلًا |
| How do we treat numbers, URLs, emojis, hashtags?كيف نتعامل مع الأرقام والروابط والرموز التعبيرية والوسوم؟ | Social media analysis keeps #NLP and emojis whole because they carry sentimentتحليل وسائل التواصل الاجتماعي يُبقي #NLP والرموز التعبيرية كاملة لأنها تحمل المشاعر | A grammar checker may replace every number by one placeholderمدقق القواعد قد يستبدل كل رقم بعنصر نائب واحد |
| Do we keep disfluencies?هل نُبقي على تعثرات الكلام؟ | Speech recognition, where uh predicts a restart and identifies the speakerالتعرف على الكلام، حيث تتنبأ uh بإعادة البدء وتساعد على تحديد هوية المتحدث | Parsing and translation, which want the fluent sentence underneathالتحليل النحوي والترجمة، اللذان يريدان الجملة السليمة الكامنة تحتها |
Speech: where the units fall apartالكلام المنطوق: حيث تتفكك الوحدات
Written text at least offers spaces. A transcript of spontaneous speech offers something stranger. Consider the utterance I do uh main- mainly business data processing. There is a broken-off word, main-, which Jurafsky and Martin call a fragment, and a filler, uh, which they call a filled pause. Together these are a Disfluency. Should a tokenizer keep them?
النص المكتوب يقدم المسافات على الأقل. أما تفريغ الكلام العفوي فيقدم شيئًا أغرب. تأمل العبارة I do uh main- mainly business data processing. فيها كلمة مبتورة هي main-، يسميها Jurafsky وMartin جزءًا مبتورًا (fragment)، وفيها حشوة هي uh، يسميانها وقفة مملوءة (filled pause). ومعًا يشكلان ما يسمى تعثر الكلام (disfluency). فهل ينبغي للمقطِّع أن يحتفظ بهما؟
For speech recognition the answer is yes, and for a reason that surprises people: fillers help predict the upcoming word, because they signal that the speaker is restarting the clause or idea, and they are a cue to speaker identification. Clark and Fox Tree went further and argued that uh and um are conventional English words: uh announces an expected minor delay, um a major one. A parser or a translation system, on the other hand, wants the fluent sentence underneath, so it drops them. The Switchboard portion of the Penn Treebank release is explicitly annotated for disfluencies, so this decision is built into a real corpus, not a thought experiment.
بالنسبة للتعرف على الكلام فالإجابة نعم، ولسبب يفاجئ الناس: الحشوات تساعد على التنبؤ بالكلمة القادمة، لأنها تشير إلى أن المتحدث يعيد بدء الجملة أو الفكرة، كما أنها دليل يساعد على تحديد هوية المتحدث. وذهب Clark وFox Tree أبعد من ذلك، فقالا إن uh وum كلمتان إنجليزيتان متعارف عليهما: uh تعلن عن تأخير بسيط متوقع، وum عن تأخير كبير. أما المحلل النحوي (parser) أو نظام الترجمة فيريد الجملة السليمة الكامنة تحتها، لذلك يحذفهما. والجزء الخاص بـ Switchboard في إصدار Penn Treebank موسوم صراحة بتعثرات الكلام، فهذا القرار مبني داخل مدونة حقيقية، وليس تجربة ذهنية.
Languages with no spaces at allلغات بلا مسافات على الإطلاق
The space is a convention of some scripts, not of language. Chinese, Japanese and Thai are written without spaces between words, so there is no orthographic word to count. Jurafsky and Martin give a Chinese sentence about Yao Ming reaching the finals and show that its units depend on which standard you adopt. Chinese words average only 1.5 to 1.9 characters, so the character is often the practical unit, and the question "how many words?" simply has no answer until a segmentation standard is chosen.
المسافة عُرف في بعض أنظمة الكتابة، وليست من طبيعة اللغة. فالصينية واليابانية والتايلاندية تُكتب دون مسافات بين الكلمات، فلا توجد كلمة إملائية لنعدّها. ويعرض Jurafsky وMartin جملة صينية عن وصول Yao Ming إلى النهائيات، ويبيّنان أن وحداتها تعتمد على المعيار الذي تعتمده. متوسط طول الكلمة الصينية 1.5 إلى 1.9 حرف فقط، لذلك يكون الحرف في الغالب هو الوحدة العملية، والسؤال «كم كلمة؟» ببساطة لا جواب له حتى يُختار معيار للتقسيم.
One Chinese sentence, three counts (SLP3 section 2.1)جملة صينية واحدة، ثلاثة أعداد (SLP3، القسم 2.1)
- Chinese Treebank standardمعيار Chinese Treebank
- 3 words3 كلمات
- Peking University standardمعيار جامعة بكين (Peking University)
- 5 words5 كلمات
- Charactersالحروف
- 7 units7 وحدات
Recall
How many tokens and types does the picnic sentence have without punctuation, and with it?كم عدد الوحدات النصية (tokens) والأنواع (types) في جملة النزهة دون علامات الترقيم، وكم عددها معها؟
Recall
Give two reasons Jurafsky and Martin give for keeping uh and um in speech recognition.اذكر سببين يقدمهما Jurafsky وMartin للإبقاء على uh وum في التعرف على الكلام.
Quick checkاختبار سريع
Which of these is a reason a speech recognizer keeps the filler uh while a parser drops it?أيٌّ من الآتي سببٌ لاحتفاظ نظام التعرف على الكلام بالحشوة uh بينما يحذفها المحلل النحوي؟
Once a policy is fixed, two numbers describe any text. Take Hamlet's to be or not to be. Six units are written down in order. Only four different ones appear, because to and be each occur twice. Those two numbers have names, and the whole of corpus statistics is built on them.
بمجرد تثبيت السياسة، يصف أي نص رقمان. خذ عبارة هاملت to be or not to be. هناك ست وحدات مكتوبة بالترتيب. ولا يظهر منها إلا أربع مختلفة، لأن to وbe تتكرر كل منهما مرتين. لهذين الرقمين اسمان، وعليهما يقوم علم إحصاءات المدونات كله.
A Token is one occurrence of a unit in running text, and the total count of tokens is written N. A Type is a distinct vocabulary item, and the number of types is the size of the Vocabulary, written |V|. So to be or not to be has N = 6 tokens and |V| = 4 types: to, be, or, not. The two are tied together by a bookkeeping identity: every token belongs to exactly one type, so the type counts add up to the token count.
الوحدة النصية (token) هي ظهور واحد لوحدة في النص الجاري، ويُرمز لإجمالي عدد الوحدات النصية بـ N. والنوع (type) هو عنصر مفردات مميز، وعدد الأنواع هو حجم المفردات (vocabulary) ويُرمز له بـ |V|. إذن to be or not to be فيها N = 6 وحدات نصية و|V| = 4 أنواع: to، be، or، not. ويربط بينهما تطابق محاسبي: كل وحدة نصية تنتمي إلى نوع واحد بالضبط، لذلك يساوي مجموع أعداد الأنواع عدد الوحدات النصية.
Try it yourself. The counter below applies a tokenization policy to a sentence and recomputes both numbers live. Start with the picnic sentence, switch on punctuation splitting and watch N go from 16 to 18. Then load the Apple sentence and flip lowercase: N stays put while |V| drops, because Apple and apple have become one type. That asymmetry is the whole lesson of the next concept in miniature.
جرّبها بنفسك. العدّاد أدناه يطبق سياسة تقطيع على جملة ويعيد حساب الرقمين مباشرة. ابدأ بجملة النزهة، وفعّل فصل علامات الترقيم، وراقب N ينتقل من 16 إلى 18. ثم حمّل جملة Apple وفعّل تحويل الأحرف إلى صغيرة: يبقى N كما هو بينما ينخفض |V|، لأن Apple وapple أصبحتا نوعًا واحدًا. هذا اللاتماثل هو درس المفهوم التالي كله في صورة مصغرة.
16 tokens, 14 types
- They×1
- picnicked×1
- by×1
- the×3
- pool,×1
- then×1
- lay×1
- back×1
- on×1
- grass×1
- and×1
- looked×1
- at×1
- stars.×1
Punctuation and clitic tokens are teal, the <NUM> placeholder is in the accent color. Watch both counts change as you flip each policy.رموز علامات الترقيم والملحقات باللون الأخضر المزرق، والبديل <NUM> باللون المميز. راقب تغيّر العددين كلما بدّلت أي سياسة.
Five corpora, one tableخمس مدونات، جدول واحد
Jurafsky and Martin collect rough counts for several English corpora, and the lecture reproduces their table. Two columns are on the slide. The two on the right are computed here: types per thousand tokens, and its reciprocal, tokens per type. Read those computed columns first, because they tell a story the raw counts hide.
يجمع Jurafsky وMartin أعدادًا تقريبية لعدة مدونات إنجليزية، والمحاضرة تعيد عرض جدولهما. عمودان موجودان في الشريحة. أما العمودان على اليمين فمحسوبان هنا: عدد الأنواع لكل ألف وحدة نصية، ومقلوبه، أي عدد الوحدات النصية لكل نوع. اقرأ هذين العمودين المحسوبين أولًا، لأنهما يرويان قصة تخفيها الأعداد الخام.
| Corpusالمدونة | Genreالنوع الأدبي | Types |V|الأنواع |V| | Tokens Nالوحدات النصية N | Types per 1,000 tokensالأنواع لكل 1,000 وحدة نصية | Tokens per typeالوحدات النصية لكل نوع |
|---|---|---|---|---|---|
| ShakespeareShakespeare | Plays and poemsمسرحيات وقصائد | 31 thousand31 ألفًا | 884 thousand884 ألفًا | 35.135.1 | 28.528.5 |
| Brown corpusمدونة Brown | 15 written genres, 196115 نوعًا أدبيًا مكتوبًا، 1961 | 38 thousand38 ألفًا | 1 millionمليون واحد | 38.038.0 | 26.326.3 |
| SwitchboardSwitchboard | Telephone conversationمحادثات هاتفية | 20 thousand20 ألفًا | 2.4 million2.4 مليون | 8.38.3 | 120120 |
| COCACOCA | 8 balanced genres8 أنواع أدبية متوازنة | 2 million2 مليون | 440 million440 مليونًا | 4.54.5 | 220220 |
| Google n-gramsGoogle n-grams | Web textنصوص الويب | 13 million13 مليونًا | 1 trillion1 تريليون | 0.0130.013 | 76,92376,923 |
Down the table, N grows by six orders of magnitude while |V| grows by less than three. The ratio of types to tokens falls from about 35 per thousand for Shakespeare to about 0.013 per thousand for the Google corpus. This is the first preview of Heaps' law: vocabulary grows without bound but sublinearly, |V| = k N^β with β between 0 and 1, and Jurafsky and Martin report values from 0.44 to 0.56 or higher, so vocabulary goes up a little faster than the square root of the text length. Part 02 fits that law properly; here it is enough to see the bend.
بالنزول في الجدول، يكبر N بست مراتب عشرية بينما يكبر |V| بأقل من ثلاث. وتنخفض نسبة الأنواع إلى الوحدات النصية (type to token ratio) من نحو 35 لكل ألف في شكسبير إلى نحو 0.013 لكل ألف في مدونة Google. وهذه أول لمحة عن قانون Heaps: المفردات تنمو بلا حد لكن بمعدل أبطأ من الخطي، |V| = k N^β حيث β بين 0 و1، ويذكر Jurafsky وMartin قيمًا من 0.44 إلى 0.56 أو أعلى، أي أن المفردات تزداد أسرع قليلًا من الجذر التربيعي لطول النص. الجزء 02 يطابق هذا القانون على البيانات بشكل كامل؛ وهنا يكفي أن ترى الانحناء.
Now read across rows instead of down. Brown has one million tokens and 38 thousand types. Switchboard has more than twice as many tokens and only 20 thousand types, fewer even than Shakespeare with a third of Switchboard's tokens. Size alone cannot explain that. Switchboard is about 2,400 telephone conversations among 543 speakers on about 70 everyday topics, and casual conversation reuses a small everyday vocabulary. Brown samples 500 texts across 15 written genres, and Shakespeare's plays reach for coinages and archaic forms. This is the point of slide 6: even within one language, genre and domain shift the vocabulary, so |V| depends on the Corpus, not only on N.
اقرأ الآن عبر الصفوف بدلًا من النزول. في Brown مليون وحدة نصية و38 ألف نوع. وفي Switchboard أكثر من ضعف عدد الوحدات النصية لكن 20 ألف نوع فقط، أي أقل حتى من شكسبير الذي لديه ثلث وحدات Switchboard النصية. الحجم وحده لا يفسر ذلك. فـ Switchboard يضم نحو 2,400 محادثة هاتفية بين 543 متحدثًا حول نحو 70 موضوعًا يوميًا، والمحادثة العفوية تعيد استخدام مفردات يومية قليلة. أما Brown فيأخذ عينات من 500 نص عبر 15 نوعًا أدبيًا مكتوبًا، ومسرحيات شكسبير تلجأ إلى الكلمات المبتكرة والصيغ القديمة. هذه هي فكرة الشريحة 6: حتى داخل اللغة الواحدة، يغيّر النوع الأدبي والمجال المفردات، لذلك يعتمد |V| على المدونة (corpus)، وليس على N وحده.
Why the vocabulary never stops growingلماذا لا تتوقف المفردات عن النمو
The falling ratio and the endless growth have the same cause. Function words like the and of are seen early and then only repeat. Content words keep arriving. Slide 8 lists where they come from, and each source is a reason your model will meet a word it has never seen.
للنسبة المتناقصة والنمو الذي لا ينتهي سبب واحد. الكلمات الوظيفية مثل the وof تُرى مبكرًا ثم تتكرر فقط. أما كلمات المحتوى فتستمر في الوصول. والشريحة 8 تذكر مصادرها، وكل مصدر منها سبب لأن يصادف نموذجك كلمة لم يرها من قبل.
- Proper names and new products: every person, place, company and gadget is a type, and new ones appear every day.أسماء العلم والمنتجات الجديدة: كل شخص ومكان وشركة وجهاز هو نوع (type)، وتظهر أسماء جديدة كل يوم.
- Creative spellings and typos: cooool, gr8 and every misspelling is a fresh type under a wordform policy.التهجئات الإبداعية والأخطاء الإملائية: cooool وgr8 وكل خطأ إملائي هو نوع جديد في ظل سياسة تعتمد صيغة الكلمة (wordform).
- Code-switching: speakers mix languages within one utterance, so an English corpus carries Spanish, Hindi or Arabic types as well.التناوب اللغوي (Code-switching): يخلط المتحدثون اللغات داخل عبارة واحدة، لذلك تحمل المدونة الإنجليزية أنواعًا إسبانية أو هندية أو عربية أيضًا.
- Morphology: walk, walks, walked and walking are four wordform types but one Lemma. Inflection multiplies surface forms, and morphologically rich languages multiply them far more.الصرف: walk وwalks وwalked وwalking أربعة أنواع من حيث صيغة الكلمة لكنها أصل معجمي واحد (lemma). والتصريف (inflection) يضاعف الصيغ السطحية، واللغات الغنية صرفيًا تضاعفها أكثر بكثير.
- Compounding and multiword expressions: New York and ice cream behave as single lexical units but span a space. Sag and colleagues called multiword expressions a pain in the neck for NLP, and Jurafsky and Martin note that tokenizing them needs a dictionary and is tied up with named entity recognition.التركيب والتعبيرات متعددة الكلمات: New York وice cream تتصرفان كوحدتين معجميتين مفردتين لكنهما تمتدان عبر مسافة. وقد وصف Sag وزملاؤه التعبيرات متعددة الكلمات بأنها مصدر إزعاج كبير لمعالجة اللغات الطبيعية (a pain in the neck for NLP)، ويلاحظ Jurafsky وMartin أن تقطيعها يحتاج إلى قاموس ومرتبط بالتعرف على الكيانات المسماة (named entity recognition).
The consequence is that out-of-vocabulary words are unavoidable under any word-level policy. However large the training corpus, tomorrow's text contains a name or a typo that is not in V. That is the problem subword tokenization solves later in this lecture, by building rare words out of pieces that are in the vocabulary.
والنتيجة أن الكلمات خارج المفردات (out-of-vocabulary) أمر لا مفر منه في أي سياسة على مستوى الكلمة. فمهما كبرت مدونة التدريب، سيحتوي نص الغد على اسم أو خطأ إملائي غير موجود في V. وهذه هي المشكلة التي يحلها التقطيع إلى أجزاء الكلمات (subword) لاحقًا في هذه المحاضرة، ببناء الكلمات النادرة من قطع موجودة في المفردات.
Recall
Define token and type, then give N and |V| for 'to be or not to be'.عرّف الوحدة النصية (token) والنوع (type)، ثم أعطِ N و|V| لعبارة 'to be or not to be'.
Recall
Why does Switchboard have fewer types than Shakespeare despite almost three times as many tokens?لماذا يحتوي Switchboard على أنواع أقل من شكسبير رغم أن وحداته النصية تقارب ثلاثة أضعاف؟
Quick checkاختبار سريع
Counting punctuation as tokens and ignoring case, what are N and |V| for 'to be, or not to be.'?إذا عددنا علامات الترقيم وحدات نصية وتجاهلنا حالة الأحرف، فما قيمتا N و|V| لعبارة 'to be, or not to be.'؟
Quick checkاختبار سريع
Switchboard has almost three times Shakespeare's tokens but fewer types. What explains this?في Switchboard ما يقارب ثلاثة أضعاف الوحدات النصية لدى شكسبير لكن أنواعًا أقل. ما الذي يفسر ذلك؟
Quick checkاختبار سريع
The vocabulary size |V| of a model is best described as a property of which of these?أفضل وصف لحجم المفردات |V| لنموذج ما أنه خاصية لأيٍّ مما يلي؟
Every policy in this part has been described in words. Here is one written down as rules and run on a real sentence. The Penn Treebank convention is the standard for parsed corpora of English, and Jurafsky and Martin use this example to show its output.
كل سياسة في هذا الجزء وُصفت بالكلمات حتى الآن. وهنا سياسة مكتوبة كقواعد ومطبقة على جملة حقيقية. اصطلاح Penn Treebank هو المعيار للمدونات الإنجليزية المحللة نحويًا، ويستخدم Jurafsky وMartin هذا المثال لعرض مخرجاته.
Worked exampleمثال محلول
Penn Treebank tokenization of one sentenceتقطيع جملة واحدة وفق Penn Treebank
Inputالمدخل
"The San Francisco-based restaurant," they said, "doesn't charge $10"."The San Francisco-based restaurant," they said, "doesn't charge $10".Separate all punctuationافصل جميع علامات الترقيم
Each quotation mark, comma and the final period becomes its own token, so restaurant," turns into restaurant, , and ".كل علامة تنصيص وكل فاصلة والنقطة الأخيرة تصبح وحدة نصية مستقلة، لذلك تتحول restaurant," إلى restaurant و, و".Keep hyphenated words togetherأبقِ الكلمات الموصولة بشرطة معًا
Francisco-based stays one token. The convention treats a hyphenated compound as a unit.تبقى Francisco-based وحدة نصية واحدة. فالاصطلاح يعامل المركب الموصول بشرطة كوحدة واحدة.Split cliticsافصل اللواحق المتصلة
doesn't becomes does and n't. Marcus and colleagues describe this in the original Treebank paper: contractions and the Anglo-Saxon genitive of nouns are automatically split into their component morphemes, so children's becomes children and 's, and won't becomes the odd pair wo and n't.تصبح doesn't وحدتين: does وn't. ويصف Marcus وزملاؤه ذلك في ورقة Treebank الأصلية: صيغ الاختصار وحالة الملكية الأنجلوساكسونية للأسماء (Anglo-Saxon genitive) تُفصل تلقائيًا إلى مورفيماتها المكوّنة، لذلك تصبح children's وحدتين: children و's، وتصبح won't الزوج الغريب wo وn't.Separate the currency signافصل رمز العملة
$10 becomes $ and 10.تصبح $10 وحدتين: $ و10.Outputالمخرج
" The San Francisco-based restaurant , " they said , " does n't charge $ 10 " . That is N = 18 tokens and |V| = 14 types, because the four quotation marks are one type and the two commas are one type." The San Francisco-based restaurant , " they said , " does n't charge $ 10 " . أي N = 18 وحدة نصية و|V| = 14 نوعًا، لأن علامات التنصيص الأربع نوع واحد، والفاصلتين نوع واحد.
The four decisionsالقرارات الأربعة
The worked example silently made four decisions, and slide 9 names them. Each has options, each helps some task and each hurts another. The table is the answer to the exam question "list four preprocessing decisions and one downstream consequence of each".
اتخذ المثال المحلول أربعة قرارات بصمت، والشريحة 9 تسمّيها. لكل قرار خيارات، وكل قرار يفيد مهمة ويضر بأخرى. والجدول هو الإجابة عن سؤال الاختبار «اذكر أربعة قرارات للمعالجة المسبقة ونتيجة لاحقة واحدة لكل منها».
| Decisionالقرار | Optionsالخيارات | Helpsيفيد | Hurtsيضر |
|---|---|---|---|
| Case foldingتوحيد حالة الأحرف (case folding) | Keep case, lowercase everything, or truecaseالإبقاء على حالة الأحرف، أو تحويل كل شيء إلى أحرف صغيرة، أو استعادة الحالة الصحيحة (truecasing) | Retrieval recall: a query for apple matches Appleتحسين الاستدعاء في الاسترجاع: الاستعلام عن apple يطابق Apple | Named entity recognition: Apple, Bush, the Fed and General Motors lose their capital evidenceالتعرف على الكيانات المسماة: تفقد Apple وBush وthe Fed وGeneral Motors دليل الحرف الكبير |
| Punctuationعلامات الترقيم | Attach to the word, separate it, or drop itإلصاقها بالكلمة، أو فصلها، أو حذفها | Parsers and sentence segmenters, which read commas and periods as structureالمحللات النحوية ومقسِّمات الجمل، التي تقرأ الفواصل والنقاط على أنها بنية | Dropping loses question marks and quotes; naive splitting breaks m.p.h., Ph.D., $45.55 and 01/02/06الحذف يُضيع علامات الاستفهام والتنصيص؛ والفصل الساذج يكسر m.p.h. وPh.D. و$45.55 و01/02/06 |
| Normalizationالتطبيع (normalization) | Accents, precomposed versus decomposed letters, curly versus straight quotes, hyphen versus dashعلامات التشكيل، والحروف المركّبة مسبقًا مقابل المفككة، وعلامات التنصيص المنحنية مقابل المستقيمة، والشرطة الواصلة مقابل الشرطة الطويلة | Matching and a compact vocabulary: one quote type, not fourالمطابقة ومفردات مدمجة: نوع واحد من علامات التنصيص بدلًا من أربعة | Meaningful distinctions vanish, such as accented pairs in French or a minus sign versus a hyphenتختفي فروق ذات معنى، مثل أزواج الحروف المشكّلة في الفرنسية أو علامة الطرح مقابل الشرطة الواصلة |
| Numbersالأرقام | Keep raw, map to <NUM>, or segment into digit chunksالإبقاء عليها خامًا، أو استبدالها بـ <NUM>، أو تقسيمها إلى مجموعات من الأرقام | <NUM> shrinks |V|; digit chunks let a model generalize arithmetic<NUM> يقلص |V|؛ ومجموعات الأرقام تتيح للنموذج تعميم الحساب | Raw numbers make every price a new type; <NUM> throws away magnitudeالأرقام الخام تجعل كل سعر نوعًا جديدًا؛ و<NUM> يُضيع المقدار |
Case folding is the most tempting shortcut. Manning, Raghavan and Schütze observe that for information retrieval, lowercasing everything often remains the most practical solution, and in the same breath list what it destroys: proper nouns distinguished only by case, such as General Motors, the Fed against fed, and Bush against bush. Their alternative is truecasing, restoring the likely original case with a classifier. Jurafsky and Martin add that for other tasks capitalization is a useful feature and is retained, so some teams keep a cased and an uncased model side by side.
توحيد حالة الأحرف (Case folding) هو الاختصار الأكثر إغراءً. ويلاحظ Manning وRaghavan وSchütze أن تحويل كل شيء إلى أحرف صغيرة يظل في الغالب الحل الأكثر عملية لاسترجاع المعلومات، ويذكرون في الوقت نفسه ما يدمّره: أسماء العلم التي لا يميزها إلا حالة الأحرف، مثل General Motors، وthe Fed مقابل fed، وBush مقابل bush. والبديل عندهم هو استعادة الحالة الصحيحة (truecasing)، أي استرجاع حالة الأحرف الأصلية المرجحة باستخدام مصنِّف. ويضيف Jurafsky وMartin أن حالة الأحرف في مهام أخرى سمة مفيدة فيُحتفظ بها، لذلك تحتفظ بعض الفرق بنموذج يراعي حالة الأحرف (cased) وآخر لا يراعيها (uncased) جنبًا إلى جنب.
Normalization is the quiet one. A Unicode normalization form decides whether the precomposed letter Ç at U+00C7 and the sequence C plus combining cedilla are the same type. Unicode Standard Annex 15 defines four forms, NFC, NFD, NFKC and NFKD, and the same logic applies to four kinds of quotation mark and three kinds of dash that a keyboard and a word processor scatter through any corpus. Skip it and your vocabulary silently holds several copies of the same word.
التطبيع هو القرار الصامت. فصيغة تطبيع يونيكود (Unicode normalization) تقرر هل الحرف المركّب مسبقًا Ç عند U+00C7 والتسلسل C مع علامة السيديا المركِّبة (combining cedilla) نوع واحد أم لا. ويعرّف الملحق القياسي 15 ليونيكود (Unicode Standard Annex 15) أربع صيغ هي NFC وNFD وNFKC وNFKD، والمنطق نفسه ينطبق على أربعة أشكال من علامات التنصيص وثلاثة أشكال من الشرطات تنثرها لوحة المفاتيح ومعالج النصوص في أي مدونة. تجاهله، وستحمل مفرداتك بصمت عدة نسخ من الكلمة نفسها.
Numbers show the trade-off most sharply. Kept raw, every price and every year is a new type and |V| explodes. Mapped to a single <NUM> placeholder, the vocabulary shrinks but the model can no longer tell 12 from 12,000. Modern tokenizers pick a middle path: Jurafsky and Martin describe the GPT-4o tokenizer chunking numbers into groups of up to three digits, so magnitude survives as a sequence of small pieces.
الأرقام تُظهر المفاضلة بأوضح صورة. إذا أُبقيت خامًا، يصبح كل سعر وكل سنة نوعًا جديدًا ويتضخم |V|. وإذا استُبدلت كلها بعنصر نائب واحد <NUM>، تتقلص المفردات لكن النموذج لا يعود قادرًا على التمييز بين 12 و12,000. والمقطِّعات الحديثة تختار طريقًا وسطًا: يصف Jurafsky وMartin مقطِّع GPT-4o الذي يقسم الأرقام إلى مجموعات من ثلاثة أرقام كحد أقصى، فيبقى المقدار محفوظًا كتسلسل من القطع الصغيرة.
The four ambiguous boundariesالحدود الملتبسة الأربعة
Even after the four decisions are made, some characters refuse to settle. Slide 10 collects them. In each case the same character is a boundary in one context and part of a unit in another, and a tokenizer has to pick a default and accept the errors it causes.
حتى بعد اتخاذ القرارات الأربعة، تبقى بعض الحروف عصيّة على الحسم. والشريحة 10 تجمعها. في كل حالة يكون الحرف نفسه حدًا في سياق وجزءًا من وحدة في سياق آخر، وعلى المقطِّع أن يختار افتراضًا ويتقبل الأخطاء التي يسببها.
| Boundaryالحد | Exampleمثال | Treebank defaultافتراض Treebank | Alternativeالبديل |
|---|---|---|---|
| Hyphensالشرطات الواصلة | state-of-the-artstate-of-the-art | Keep the hyphenated word together as one tokenإبقاء الكلمة الموصولة بشرطة معًا كوحدة نصية واحدة | Split into state, of, the, art so each piece is a known typeتقسيمها إلى state وof وthe وart حتى تكون كل قطعة نوعًا معروفًا |
| Abbreviationsالاختصارات | U.S., Dr., e.g.U.S., Dr., e.g. | Keep the internal periods; the trailing period is ambiguous with a sentence endالإبقاء على النقاط الداخلية؛ أما النقطة الأخيرة فملتبسة مع نهاية الجملة | Strip periods entirely, at the cost of merging US the country with us the pronounحذف النقاط كليًا، على حساب دمج US (الدولة) مع us (الضمير) |
| Cliticsاللواحق المتصلة (clitics) | we'll, I'm, possessive 'swe'll، I'm، علامة الملكية 's | Split off the clitic: we 'll, I 'm, children 's, does n't, wo n'tفصل اللاحقة المتصلة: we 'll، I 'm، children 's، does n't، wo n't | Keep the contraction whole, so doesn't and does not are unrelated typesإبقاء الاختصار كاملًا، فتصبح doesn't وdoes not نوعين لا علاقة بينهما |
| Social mediaوسائل التواصل الاجتماعي | #NLP, @user, URLs#NLP، @user، الروابط (URLs) | Splits # and @ off their word and breaks a URL at its colon, slashes and question markيفصل # و@ عن كلمتيهما ويقسم الرابط عند النقطتين الرأسيتين والشرطات المائلة وعلامة الاستفهام | A social-media tokenizer keeps hashtags, handles and URLs whole with dedicated patternsمقطِّع وسائل التواصل الاجتماعي يُبقي الوسوم وأسماء المستخدمين والروابط كاملة بأنماط مخصصة |
A Clitic is the trickiest of the four because the apostrophe is three-way ambiguous. Jurafsky and Martin point out that it marks the genitive (the book's cover), quotation ('The other class', she said) and the contracted clitic (we'll, I'm). Hyphens run from co-education, where the pieces are meaningless alone, to Hewlett-Packard, where each is a name, and Manning and colleagues show there is no rule that suits both. Abbreviation periods will return as the central problem of Sentence segmentation later in the lecture. Social media adds hashtags, handles and URLs that should be kept whole, since #NLP or a web address split at its punctuation is worthless. A Treebank-style tokenizer will not do this by itself: it pads # and @ with spaces and breaks a URL at its colon, so a social-media pipeline adds hashtag, handle and URL patterns in front of it.
اللاحقة المتصلة (clitic) هي الأصعب بين الأربعة لأن الفاصلة العليا (apostrophe) ملتبسة على ثلاثة أوجه. يشير Jurafsky وMartin إلى أنها تدل على الملكية (the book's cover)، وعلى الاقتباس ('The other class', she said)، وعلى اللاحقة المتصلة المختصرة (we'll، I'm). والشرطات الواصلة تتراوح من co-education، حيث لا معنى للقطع منفردة، إلى Hewlett-Packard، حيث كل قطعة اسم، ويبيّن Manning وزملاؤه أنه لا توجد قاعدة تناسب الحالتين. ونقاط الاختصارات ستعود كمشكلة محورية في تقسيم الجمل (sentence segmentation) لاحقًا في المحاضرة. وتضيف وسائل التواصل الاجتماعي الوسوم (hashtags) وأسماء المستخدمين (handles) والروابط (URLs) التي يجب الإبقاء عليها كاملة، لأن #NLP أو عنوان الويب إذا قُسّم عند علامات ترقيمه يصبح بلا قيمة. والمقطِّع على نمط Treebank لن يفعل ذلك من تلقاء نفسه: فهو يحيط # و@ بمسافات ويقسم الرابط عند النقطتين الرأسيتين، لذلك تضيف سلسلة معالجة وسائل التواصل الاجتماعي أنماطًا للوسوم وأسماء المستخدمين والروابط قبله.
Recall
Under the Penn Treebank convention, tokenize 'doesn't' and 'children's'.وفق اصطلاح Penn Treebank، قطّع 'doesn't' و'children's'.
Quick checkاختبار سريع
Which preprocessing decision helps information retrieval but hurts named entity recognition?أي قرار من قرارات المعالجة المسبقة يفيد استرجاع المعلومات لكنه يضر بالتعرف على الكيانات المسماة؟
Recapالخلاصة
If you remember nothing elseإن لم تتذكر شيئاً آخر فتذكّر هذا
- A word is not a natural unit: the picnic sentence has 16 or 18 tokens and 14 or 16 types depending on the punctuation policy.الكلمة ليست وحدة طبيعية: جملة النزهة فيها 16 أو 18 وحدة نصية (token) و14 أو 16 نوعًا (type) بحسب سياسة التعامل مع علامات الترقيم.
- Token = one occurrence (N); type = one distinct item (|V|); 'to be or not to be' is N = 6, |V| = 4.الوحدة النصية (token) = ظهور واحد (N)؛ النوع (type) = عنصر مميز واحد (|V|)؛ عبارة 'to be or not to be' فيها N = 6 و|V| = 4.
- Speech adds fragments (main-) and filled pauses (uh, um); speech recognizers keep them, parsers drop them.يضيف الكلام المنطوق أجزاء كلمات مبتورة (main-) ووقفات مملوءة (uh وum)؛ أنظمة التعرف على الكلام تُبقيها، والمحللات النحوية (parsers) تحذفها.
- Chinese, Japanese and Thai have no orthographic words; the same Chinese sentence can be 3, 5 or 7 units.الصينية واليابانية والتايلاندية لا توجد فيها كلمات إملائية مفصولة بمسافات؛ فالجملة الصينية نفسها قد تُعدّ 3 أو 5 أو 7 وحدات.
- Types grow with tokens but sublinearly (Heaps: |V| = k N^beta, beta about 0.5); the type to token ratio falls from 3.5% (Shakespeare) to 0.0013% (Google n-grams).تنمو الأنواع مع نمو الوحدات النصية لكن بمعدل أبطأ من الخطي (قانون Heaps: |V| = k N^beta، وbeta تقارب 0.5)؛ وتنخفض نسبة الأنواع إلى الوحدات من 3.5% (شكسبير) إلى 0.0013% (Google n-grams).
- Genre matters as much as size: Switchboard has 2.4 million tokens but only 20 thousand types.النوع الأدبي مهم بقدر الحجم: Switchboard فيه 2.4 مليون وحدة نصية لكن 20 ألف نوع فقط.
- Vocabulary is hard because of names, new products, typos, code-switching, morphology and multiword expressions; OOV is unavoidable.المفردات صعبة بسبب أسماء العلم، والمنتجات الجديدة، والأخطاء الإملائية، والتناوب اللغوي (code-switching)، والصرف، والتعبيرات متعددة الكلمات؛ لذلك فالكلمات خارج المفردات (OOV) أمر لا مفر منه.
- Four preprocessing decisions: case folding, punctuation, normalization, numbers. Four ambiguous boundaries: hyphens, abbreviations, clitics, social media.قرارات المعالجة المسبقة الأربعة: توحيد حالة الأحرف (case folding)، وعلامات الترقيم، والتطبيع (normalization)، والأرقام. والحدود الملتبسة الأربعة: الشرطات الواصلة، والاختصارات، واللواحق المتصلة (clitics)، ووسائل التواصل الاجتماعي.
- Penn Treebank convention: separate punctuation, keep hyphenated words, split clitics and possessives (doesn't -> does n't, children's -> children 's).اصطلاح Penn Treebank: افصل علامات الترقيم، وأبقِ الكلمات الموصولة بشرطة معًا، وافصل اللواحق المتصلة وعلامة الملكية (doesn't -> does n't، وchildren's -> children 's).
- |V| is a property of the corpus plus the tokenization policy, never of the language alone.|V| خاصية للمدونة مع سياسة التقطيع (tokenization)، وليست أبدًا خاصية للغة وحدها.
Sourcesالمصادر
- Speech and Language Processing, 3rd edition draft, chapter 2: Words and TokensBookJurafsky and Martin, StanfordDraft of August 19, 2026. Sections 2.1 (words, types, Fig. 2.1, Heaps), 2.5 (corpora), 2.8 (Penn Treebank tokenization)مسودة 19 أغسطس 2026. الأقسام 2.1 (الكلمات، والأنواع، والشكل 2.1، وقانون Heaps)، و2.5 (المدونات)، و2.8 (التقطيع وفق Penn Treebank)(opens in a new tab)(يفتح في تبويب جديد)
- Words and Tokens lecture slidesDocsJurafsky and Martin, StanfordSource of the 31 thousand Shakespeare figure reproduced on slide 7مصدر رقم 31 ألف نوع لشكسبير المعروض في الشريحة 7(opens in a new tab)(يفتح في تبويب جديد)
- Building a Large Annotated Corpus of English: The Penn TreebankPaperComputational Linguistics 19(2), 1993, Marcus, Santorini and MarcinkiewiczFootnote 8: contractions and the genitive split into component morphemesالحاشية 8: صيغ الاختصار وحالة الملكية تُفصل إلى مورفيماتها المكوّنة(opens in a new tab)(يفتح في تبويب جديد)
- nltk.tokenize.treebank: TreebankWordTokenizerDocsNLTK Projectdon't becomes do n't, punctuation separatedتصبح don't وحدتين do وn't، وتُفصل علامات الترقيم(opens in a new tab)(يفتح في تبويب جديد)
- Introduction to Information Retrieval, section 2.2.1: TokenizationBookManning, Raghavan and Schütze, Cambridge University PressToken and type definitions, O'Neill, hyphens from co-education to Hewlett-Packardتعريفا الوحدة النصية والنوع، ومثال O'Neill، والشرطات الواصلة من co-education إلى Hewlett-Packard(opens in a new tab)(يفتح في تبويب جديد)
- Introduction to Information Retrieval, section 2.2.3: Capitalization and case-foldingBookManning, Raghavan and Schütze, Cambridge University PressGeneral Motors, the Fed, Bush; truecasing; lowercasing remains the most practical solution for IRGeneral Motors وthe Fed وBush؛ واستعادة الحالة الصحيحة (truecasing)؛ والتحويل إلى أحرف صغيرة يظل الحل الأكثر عملية لاسترجاع المعلومات(opens in a new tab)(يفتح في تبويب جديد)
- Using uh and um in spontaneous speakingPaperCognition 84(1), 2002, Clark and Fox Treeuh signals a minor delay, um a major one; both are conventional English wordsuh تشير إلى تأخير بسيط وum إلى تأخير كبير؛ وكلتاهما كلمة إنجليزية متعارف عليها(opens in a new tab)(يفتح في تبويب جديد)
- Multiword Expressions: A Pain in the Neck for NLPPaperCICLing 2002, Sag, Baldwin, Bond, Copestake and FlickingerWords with spaces such as San Francisco as one analysis of multiword expressionsالكلمات التي تحتوي مسافات مثل San Francisco بوصفها أحد أساليب تحليل التعبيرات متعددة الكلمات(opens in a new tab)(يفتح في تبويب جديد)
- Switchboard-1 Release 2DocsLinguistic Data Consortium, LDC97S62About 2,400 two-sided telephone conversations, 543 speakers, about 70 topicsنحو 2,400 محادثة هاتفية ثنائية الطرف، و543 متحدثًا، ونحو 70 موضوعًا(opens in a new tab)(يفتح في تبويب جديد)
- Treebank-3DocsLinguistic Data Consortium, LDC99T42The Switchboard portion is dysfluency-annotatedالجزء الخاص بـ Switchboard موسوم بتعثرات الكلام(opens in a new tab)(يفتح في تبويب جديد)
- Web 1T 5-gram Version 1, readmeDocsLinguistic Data Consortium, LDC2006T131,024,908,267,229 tokens, 13,588,391 unigrams; unigram cutoff 200, n-gram cutoff 401,024,908,267,229 وحدة نصية، و13,588,391 كلمة مفردة (unigram)؛ حد القطع للكلمات المفردة 200، وللـ n-grams 40(opens in a new tab)(يفتح في تبويب جديد)
- Natural Language Processing with Python, chapter 2: Accessing Text CorporaBookBird, Klein and Loper, NLTK ProjectBrown corpus: 1961, 500 sources, 15 genres, the first million-word electronic corpusمدونة Brown: عام 1961، و500 مصدر، و15 نوعًا أدبيًا، وهي أول مدونة إلكترونية بحجم مليون كلمة(opens in a new tab)(يفتح في تبويب جديد)
- Unicode Standard Annex #15: Unicode Normalization FormsDocsUnicode ConsortiumNFC, NFD, NFKC, NFKD; canonical equivalence of U+00C7 and C plus combining cedillaNFC وNFD وNFKC وNFKD؛ والتكافؤ القانوني (canonical equivalence) بين U+00C7 والحرف C مع علامة السيديا المركِّبة(opens in a new tab)(يفتح في تبويب جديد)
- Corpus of Contemporary American English (COCA)DocsEnglish-Corpora.orgThe 440 million figure is the older size SLP3 uses; the current corpus is about 1 billion words, 1990 to 2019رقم 440 مليونًا هو الحجم الأقدم الذي يستخدمه SLP3؛ أما المدونة الحالية فنحو مليار كلمة، من 1990 إلى 2019(opens in a new tab)(يفتح في تبويب جديد)