0Pricing
NLP Academy · Lektion

Ein Modell laden und ein Doc verarbeiten

Text mit einem Aufruf durch nlp() verarbeiten

Ein Modell laden und ein Doc verarbeiten ist eine kostenlose NLP Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des NLP Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der NLP Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Install First

Before you load anything, you download a model once. The en_core_web_sm model is small, fast, and perfect for getting started.

python -m spacy download en_core_web_sm

Load the Model

You bring spaCy to life with spacy.load. It reads the model from disk and hands you an nlp object ready to process text.

import spacy
nlp = spacy.load("en_core_web_sm")

What nlp Is

That nlp object is your whole pipeline wrapped up. Calling it on text runs every stage: tokenizer, tagger, parser, and entity recognizer.

Process Some Text

To analyze a sentence, just call nlp() on a string. The result is a Doc, a rich container holding all the analysis.

doc = nlp("Apple is hiring in Berlin.")

One Call Does It All

That single call already ran tokenizing, tagging, and parsing. The Doc now carries every result, so you never repeat the work.

Loop Over Tokens

A Doc behaves like a sequence, so you can loop through it. Each item you get back is a Token with its own attributes.

for token in doc:
    print(token.text)

Read Token Text

The raw word lives in token.text. It is exactly the surface string spaCy found while splitting your sentence.

Load Once, Reuse

Loading a model is slow, so do it once at startup. Then reuse the same nlp object for every document you process.

Process Many Docs

For lots of texts, use nlp.pipe. It batches them efficiently and is far faster than calling nlp() in a plain loop.

for doc in nlp.pipe(texts):
    print(len(doc))

Disable for Speed

Need only tokens? You can disable unused components when loading to skip work and run even faster.

nlp = spacy.load("en_core_web_sm", disable=["parser"])

Blank Pipelines

You can also start from spacy.blank for a tokenizer-only pipeline. It is handy when you want to build everything yourself.

nlp = spacy.blank("en")

Quick Check

What do you get back from calling nlp() on a string?

Recap

You install a model, load it once with spacy.load, then call nlp() to get a Doc. One call runs the whole pipeline and you reuse it everywhere. 🎯

Häufig gestellte Fragen

Ist die Lektion „Ein Modell laden und ein Doc verarbeiten“ kostenlos?

Ja — der vollständige Text von „Ein Modell laden und ein Doc verarbeiten“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des NLP Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der NLP Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Ein Modell laden und ein Doc verarbeiten“?

Text mit einem Aufruf durch nlp() verarbeiten Du übst NLP Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um NLP Academy zu starten?

Keine Vorkenntnisse erforderlich. NLP Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.

Wie lange dauert die Lektion „Ein Modell laden und ein Doc verarbeiten“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser NLP Academy-Lektion Code schreiben und ausführen?

Ja. Jede NLP Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Warum spaCy für reale Projekte geeignet ist
  2. Ein Modell laden und ein Doc verarbeiten
  3. Tokens, Spans und Doc-Objekte
  4. Die Pipeline anpassen
← Zurück zu NLP Academy