أساسيات تحليل التبعية
شاهد كيف تترابط الكلمات في الجملة
أساسيات تحليل التبعية درس مجاني في NLP Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في NLP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة NLP Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Beyond Single Tags
POS tags name each word's job, but not how words connect. Dependency parsing reveals which word depends on which, building a sentence map. 🔗
Sentences as Trees
A parser arranges words into a tree. One word becomes the root, and every other word hangs off it through a labeled link.
The Root Verb
The root is usually the main verb that anchors the sentence. In The cat chased the mouse, the root is chased.
Heads and Children
Every word has a head, the word it attaches to. The words attached to it are its children, forming the branches of the tree.
Read the Relation
Each link has a label, the dependency relation. A subject is tagged nsubj, while a direct object is tagged dobj.
spaCy Parses Free
The same model that tags words also parses them. After nlp(), every token already carries its dependency information, ready to read.
doc = nlp("The cat chased the mouse")Read dep_ and head
Use token.dep_ for the relation and token.head for the word it attaches to. Together they describe the token's place in the tree.
for t in doc:
print(t.text, t.dep_, t.head.text)Find the Subject
To get who does the action, look for the token whose dep_ equals nsubj. That word is the grammatical subject of the verb.
subj = [t.text for t in doc if t.dep_ == "nsubj"]Explain a Relation
Unsure what a label means? Pass it to spacy.explain() and get a clear description, just like you did for POS tags.
print(spacy.explain("dobj"))Visualize the Tree
Render the parse with displacy. Set the style to dep and it draws labeled arrows from each head to its children.
from spacy import displacy
displacy.render(doc, style="dep")Why Parsing Matters
Dependencies unlock real meaning, like linking an action to its actor and target. This structure powers extraction, search, and question answering.
Quick Check
Recall how subjects are marked in a parse.
Recap
You saw sentences as trees of heads and children, read dep_ in spaCy, and drew the parse with displacy. Now you can map how words relate. 🎉
الأسئلة الشائعة
هل درس «أساسيات تحليل التبعية» مجاني؟
نعم — نص درس «أساسيات تحليل التبعية» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة NLP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة NLP Academy 4 دروس في المجموع.
ماذا ستتعلم في «أساسيات تحليل التبعية»؟
شاهد كيف تترابط الكلمات في الجملة تتمرن على NLP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ NLP Academy؟
لا تُشترط خبرة سابقة. NLP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «أساسيات تحليل التبعية»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس NLP Academy هذا؟
نعم. كل درس في NLP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- الأسماء والأفعال ولماذا تهم الوسوم
- وسم الكلمات باستخدام spaCy
- استخراج العبارات وفق نمط الوسم
- أساسيات تحليل التبعية