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')