BaşlayınÜcretsiz Başlayın

Eşleşme kalıpları yazma

Bu egzersizde, farklı token öznitelikleri ve operatörleri kullanarak daha karmaşık eşleşme kalıpları yazmayı pratik yapacaksın. Bir matcher zaten başlatıldı ve matcher değişkeni olarak kullanılabilir.

Bu egzersiz

spaCy ile İleri Düzey NLP

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

doc = nlp("After making the iOS update you won't notice a radical system-wide redesign: nothing like the aesthetic upheaval we got with iOS 7. Most of iOS 11's furniture remains the same as in iOS 10. But you will discover some tweaks once you delve a little deeper.")

# Write a pattern for full iOS versions ("iOS 7", "iOS 11", "iOS 10")
pattern = [{'TEXT': ____}, {'IS_DIGIT': ____}]

# Add the pattern to the matcher and apply the matcher to the doc
matcher.add('IOS_VERSION_PATTERN', None, pattern)
matches = matcher(doc)
print('Total matches found:', len(matches))

# Iterate over the matches and print the span text
for match_id, start, end in matches:
    print('Match found:', doc[start:end].text)
Kodu Düzenle ve Çalıştır