LoslegenKostenlos loslegen

Doc container in spaCy

The first step of a spaCy text processing pipeline is to convert a given text string into a Doc container, which stores the processed text. In this exercise, you'll practice loading a spaCy model, creating an nlp() object, creating a Doc container and processing a text string that is available for you.

en_core_web_sm model is already downloaded.

Diese Übung ist Teil des Kurses

Natural Language Processing with spaCy

Kurs anzeigen

Anleitung zur Übung

  • Load en_core_web_sm and create an nlp object.
  • Create a doc container of the text string.
  • Create a list containing the text of each tokens in the doc container.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Load en_core_web_sm and create an nlp object
nlp = spacy.____(____)

# Create a Doc container for the text object
doc = ____(____)

# Create a list containing the text of each token in the Doc container
print([____ for ____ in ____])
Code bearbeiten und ausführen