Personalizzare la pipeline
Aggiungere, disabilitare e riordinare i componenti
Personalizzare la pipeline è una lezione NLP Academy gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento NLP Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso NLP Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
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. 🛠️
Domande Frequenti
La lezione «Personalizzare la pipeline» è gratuita?
Sì — il testo completo di «Personalizzare la pipeline» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso NLP Academy, passa a CoddyKit PRO. Il corso NLP Academy include 4 lezioni in totale.
Cosa imparerò in «Personalizzare la pipeline»?
Aggiungere, disabilitare e riordinare i componenti Eserciti NLP Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare NLP Academy?
Non è richiesta alcuna esperienza precedente. NLP Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.
Quanto tempo richiede la lezione «Personalizzare la pipeline»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione NLP Academy?
Sì. Ogni lezione NLP Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Perché spaCy è adatto ai progetti reali
- Caricare un modello ed elaborare un Doc
- Token, Span e oggetti Doc
- Personalizzare la pipeline