File size: 483 Bytes
78cabf4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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")