वाक्य और शब्द टोकनाइज़ेशन
NLP में टोकनाइज़ेशन पहला और अहम कदम है। इसमें टेक्स्ट को छोटे-छोटे हिस्सों (tokens) में बाँटा जाता है, जो भाषा-सम्बंधी डेटा पर काम करने की कुंजी है। आपका कार्य एक समाचार लेख के छोटे अंश को वाक्यों और शब्दों — दोनों में टोकनाइज़ करना है।
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Natural Language Processing (NLP)
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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)