وسم الكلمات باستخدام spaCy
اقرأ وسوم POS والوسوم التفصيلية
وسم الكلمات باستخدام spaCy درس مجاني في NLP Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في NLP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة NLP Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
spaCy Tags for You
You do not have to label words by hand. spaCy reads a sentence and assigns a part of speech to every token automatically. ⚡
Load a Model
First load a trained model. The small English model en_core_web_sm knows how to tag, parse, and recognize entities right away.
import spacy
nlp = spacy.load("en_core_web_sm")Process Your Text
Call nlp() on a string to get a Doc. The Doc holds every token along with the tags spaCy has already worked out for you.
doc = nlp("The cat sleeps quietly")Loop Over Tokens
A Doc is iterable, so you can walk through it token by token. Each token is a rich object carrying its text and grammatical info.
for token in doc:
print(token.text)Read the Coarse Tag
Every token has a pos_ attribute holding its universal tag, such as NOUN or VERB. The trailing underscore gives you the readable string.
for token in doc:
print(token.text, token.pos_)The Fine-Grained Tag
For more detail, read token.tag_. It gives a precise label like VBZ for a present-tense verb, beyond the broad pos_ category.
print(doc[2].text, doc[2].tag_)Explain Any Tag
Forgot what a code means? Call spacy.explain() with a tag and it returns a plain-English description you can read instantly.
print(spacy.explain("VBZ"))Tags Come From Context
spaCy decides each tag from the whole sentence, not a lookup table. That is why book can be tagged NOUN or VERB depending on how you use it.
Filter by Part of Speech
Once tags exist, filtering is easy. Keep only tokens whose pos_ equals VERB to collect every action word in the text.
verbs = [t.text for t in doc if t.pos_ == "VERB"]Tagging Is Fast
spaCy tags thousands of words per second, so you can run it over large documents without waiting. It is built for real production work.
One Model, Many Tasks
The same loaded model also handles parsing and entities. Tagging is just one part of spaCy's full pipeline running on each Doc.
Quick Check
Recall how spaCy exposes part-of-speech labels.
Recap
You loaded a model, processed text, and read both pos_ and tag_ for each token. spaCy turns raw sentences into tagged words in just a few lines. 🎉
الأسئلة الشائعة
هل درس «وسم الكلمات باستخدام spaCy» مجاني؟
نعم — نص درس «وسم الكلمات باستخدام spaCy» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة NLP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة NLP Academy 4 دروس في المجموع.
ماذا ستتعلم في «وسم الكلمات باستخدام spaCy»؟
اقرأ وسوم POS والوسوم التفصيلية تتمرن على NLP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ NLP Academy؟
لا تُشترط خبرة سابقة. NLP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «وسم الكلمات باستخدام spaCy»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس NLP Academy هذا؟
نعم. كل درس في NLP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- الأسماء والأفعال ولماذا تهم الوسوم
- وسم الكلمات باستخدام spaCy
- استخراج العبارات وفق نمط الوسم
- أساسيات تحليل التبعية