Aan de slagGa gratis aan de slag

Predicting named entities in context

Models are statistical and not always right. Whether their predictions are correct depends on the training data and the text you're processing. Let's take a look at an example. The small English model is available as the variable nlp.

Deze oefening maakt deel uit van de cursus

Advanced NLP with spaCy

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

text = "New iPhone X release date leaked as Apple reveals pre-orders by mistake"

# Process the text
doc = ____

# Iterate over the entities
for ____ in ____.____:
    # print the entity text and label
    print(____.____, ____.____)
Code bewerken en uitvoeren