Cümle ve kelime tokenizasyonu
Tokenizasyon, NLP'de önemli bir ilk adımdır. Metni, dil verileriyle çalışmanın anahtarı olan belirteçler (token) adı verilen daha küçük birimlere ayırmayı içerir. Görevin, bir haber makalesinden bir parçayı hem cümlelere hem de kelimelere ayırmaktır.
Bu egzersiz, kursun bir parçasıdır
Python ile Natural Language Processing (NLP)
Uygulamalı etkileşimli egzersiz
Bu egzersizi bu örnek kodu tamamlayarak deneyin.
# Import nltk
____
# Download the punkt_tab package
____
text = """
The stock market saw a significant dip today. Experts believe the downturn may continue.
However, many investors are optimistic about future growth.
"""
# Tokenize the text into sentences
sentences = ____
print(sentences)