File size: 309 Bytes
ae6e30d |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import nltk
import os
# Define the path where 'punkt' will be saved
punkt_path = os.path.join('nltk_data', 'tokenizers', 'punkt')
# Create directories if they don't exist
os.makedirs(punkt_path, exist_ok=True)
# Download 'punkt' to the specified directory
nltk.download('punkt', download_dir='nltk_data')
|