LoslegenKostenlos loslegen

Creating training data (2)

Let's use the match patterns we've created in the previous exercise to bootstrap a set of training examples. The nlp object has already been created for you and the Matcher with the added patterns pattern1 and pattern2 is available as the variable matcher. A list of sentences is available as the variable TEXTS.

Diese Übung ist Teil des Kurses

Advanced NLP with spaCy

Kurs anzeigen

Interaktive Übung

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

# Create a Doc object for each text in TEXTS
for ____ in ____:
    # Find the matches in the doc
    matches = ____(____)
    
    # Get a list of (start, end, label) tuples of matches in the text
    entities = [(____, ____, 'GADGET') for ____, ____, ____ in matches]
    print(doc.text, entities)    
Code bearbeiten und ausführen