パイプラインをカスタマイズする
コンポーネントを追加、無効化、並べ替えする
「パイプラインをカスタマイズする」はCoddyKit上の無料NLP Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これは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時間対応のAIチューター)、NLP Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 NLP Academyコースには全4レッスンが含まれています。
「パイプラインをカスタマイズする」で何を学びますか?
コンポーネントを追加、無効化、並べ替えする ブラウザで直接実行するハンズオンコードでNLP Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
NLP Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのNLP Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「パイプラインをカスタマイズする」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このNLP Academyレッスンでコードを書いて実行できますか?
はい。すべてのNLP Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- 実プロジェクトで spaCy を使う理由
- モデルを読み込み Doc を処理する
- トークン、Span、Doc オブジェクト
- パイプラインをカスタマイズする