문장 및 단어 토크나이즈
토크나이즈는 NLP의 첫 단계로 매우 중요해요. 텍스트를 토큰이라 부르는 더 작은 단위로 분할하는 작업으로, 언어 데이터를 다루는 데 핵심입니다. 이번 과제에서는 뉴스 기사 일부를 문장과 단어 단위로 각각 토크나이즈해 보세요.
이 연습은 강의의 일부입니다
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)