Linguistische Annotationen vorhersagen
Jetzt kannst du eines von spaCys vortrainierten Modulpaketen ausprobieren und dir die Vorhersagen in Aktion ansehen. Probiere es gern mit deinem eigenen Text aus! Das kleine englische Modell ist bereits als Variable nlp verfügbar.
Um herauszufinden, was ein Tag oder Label bedeutet, kannst du spacy.explain in der IPython-Shell aufrufen. Zum Beispiel: spacy.explain('PROPN') oder spacy.explain('GPE').
Diese Übung ist Teil des Kurses
Fortgeschrittenes NLP mit spaCy
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
text = "It’s official: Apple is the first U.S. public company to reach a $1 trillion market value"
# Process the text
doc = ____
for token in doc:
# Get the token text, part-of-speech tag and dependency label
token_text = ____.____
token_pos = ____.____
token_dep = ____.____
# This is for formatting only
print('{:<12}{:<10}{:<10}'.format(token_text, token_pos, token_dep))