0Pricing
NLP Academy · درس

تكرار المصطلح والتكرار العكسي للمستند

نصفا الدرجة

تكرار المصطلح والتكرار العكسي للمستند درس مجاني في NLP Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في NLP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة NLP Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Two Halves of One Score

TF-IDF is built from two pieces that multiply together: term frequency and inverse document frequency. Each half fixes a different weakness of raw counts.

Term Frequency, Plainly

Term frequency measures how often a word appears inside one document. More mentions of a word suggest that document leans toward that topic.

Normalizing TF

We often divide a word's count by the document length. This normalization stops long documents from looking important just because they have more words.

count = 3
doc_length = 50
tf = count / doc_length
print(round(tf, 3))

TF Alone Isn't Enough

By itself, term frequency still rewards filler words that appear a lot. We need a second factor to punish words that show up everywhere.

Document Frequency

Document frequency counts how many documents contain a word at all. A high document frequency means the word is common across your whole collection.

Flip It: Inverse

We want rare words to score high, so we invert that count. Inverse document frequency rises when a word appears in few documents and falls when it is everywhere.

The Log Tames It

IDF uses a logarithm so the values do not explode for very rare words. The log keeps the scale smooth and comparable across terms.

import math
total_docs = 1000
docs_with_word = 10
idf = math.log(total_docs / docs_with_word)
print(round(idf, 3))

Multiply Them Together

The final score is simply TF times IDF. A word wins only if it is frequent here and rare elsewhere, which is exactly the combination we wanted.

tf = 0.06
idf = 4.6
tfidf = tf * idf
print(round(tfidf, 3))

What Scores High

A topic word like neuroscience in one article gets a high score. A word like the gets crushed because its IDF is nearly zero.

What Scores Low

Words appearing in almost every document earn tiny weights. TF-IDF automatically demotes this background noise without any manual stopword list.

Why It Works So Well

TF-IDF balances local importance against global rarity in one clean formula. That balance is why this weighting stayed a search and text staple for decades. ⭐

Quick Check

What does the inverse document frequency part actually reward?

Recap

TF measures local frequency, IDF rewards global rarity, and their product is TF-IDF. Together they spotlight words that truly define a document. ✅

الأسئلة الشائعة

هل درس «تكرار المصطلح والتكرار العكسي للمستند» مجاني؟

نعم — نص درس «تكرار المصطلح والتكرار العكسي للمستند» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة NLP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة NLP Academy 4 دروس في المجموع.

ماذا ستتعلم في «تكرار المصطلح والتكرار العكسي للمستند»؟

نصفا الدرجة تتمرن على NLP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ NLP Academy؟

لا تُشترط خبرة سابقة. NLP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.

كم من الوقت يستغرق درس «تكرار المصطلح والتكرار العكسي للمستند»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس NLP Academy هذا؟

نعم. كل درس في NLP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. مشكلة التعدادات الخام
  2. تكرار المصطلح والتكرار العكسي للمستند
  3. ‏TF-IDF باستخدام scikit-learn
  4. العثور على أهم الكلمات
← العودة إلى NLP Academy