تخصيص المسار
أضف المكوّنات وعطّلها وأعد ترتيبها
تخصيص المسار درس مجاني في NLP Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في NLP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة NLP Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
A Stack of Steps
A spaCy pipeline is just an ordered list of components. Text flows through each one, gaining tags, parses, and entities along the way.
See What Is Loaded
Check the active steps with nlp.pipe_names. It lists every component in order, so you always know what is running.
print(nlp.pipe_names)Disable for Speed
Skip work you do not need with disable. Turning off the parser when you only want entities makes processing noticeably faster.
nlp = spacy.load("en_core_web_sm", disable=["parser"])Disable Temporarily
For a quick run, use select_pipes as a context manager. It switches components off, then restores them when the block ends.
with nlp.select_pipes(disable=["ner"]):
doc = nlp(text)Add Your Own Step
You extend the pipeline with add_pipe. spaCy ships ready-made components like sentencizer that you can drop right in.
nlp.add_pipe("sentencizer")Control the Order
Position matters. With first or before, you place a component exactly where it needs to run in the sequence.
nlp.add_pipe("sentencizer", first=True)Write a Custom Component
You can register your own logic as a component. A simple function takes a Doc, tweaks it, and returns it for the next step.
@spacy.Language.component("my_step")
def my_step(doc):
return docPlug It In
Once registered, add your component by name. From then on it runs automatically every time you call nlp().
nlp.add_pipe("my_step", last=True)Remove a Step
Changed your mind? remove_pipe takes a component out cleanly, leaving the rest of the pipeline untouched.
nlp.remove_pipe("my_step")Reorder Components
You can shuffle steps later too. Combining remove and add lets you reorder the pipeline until the flow is exactly right.
Why It All Matters
Customizing the pipeline keeps spaCy lean and tailored. You run only what your task needs, plus any logic unique to your domain.
Quick Check
How do you add a component to a spaCy pipeline?
Recap
You inspect steps with pipe_names, drop work with disable, and shape the flow using add_pipe and remove_pipe. The pipeline bends to fit your task. 🛠️
الأسئلة الشائعة
هل درس «تخصيص المسار» مجاني؟
نعم — نص درس «تخصيص المسار» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 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 في المشاريع الحقيقية
- تحميل نموذج ومعالجة مستند
- الرموز والمقاطع وكائنات Doc
- تخصيص المسار