import nltk import os # Make sure NLTK data directory exists nltk_data_dir = os.path.expanduser('~/nltk_data') os.makedirs(nltk_data_dir, exist_ok=True) # Check if punkt tokenizer already exists punkt_dir = os.path.join(nltk_data_dir, 'tokenizers', 'punkt') if not os.path.exists(punkt_dir): print("Downloading NLTK punkt tokenizer...") nltk.download('punkt', quiet=False) else: print("NLTK punkt tokenizer already exists") print("NLTK setup complete")