Omkar008 commited on
Commit
3b52a97
·
verified ·
1 Parent(s): b748bd2

Update core/init_nlp.py

Browse files
Files changed (1) hide show
  1. core/init_nlp.py +10 -9
core/init_nlp.py CHANGED
@@ -13,14 +13,14 @@ def initialize_nlp():
13
  # nltk.data.path.append(str(nltk_data_path))
14
 
15
  # # Download NLTK resources
16
- # nltk_resources = [
17
- # 'maxent_ne_chunker',
18
- # 'words',
19
- # 'treebank',
20
- # 'maxent_treebank_pos_tagger',
21
- # 'punkt',
22
- # 'averaged_perceptron_tagger'
23
- # ]
24
 
25
  # for resource in nltk_resources:
26
  # nltk.downloader.download(resource, download_dir=str(nltk_data_path) ,quiet=True)
@@ -29,7 +29,8 @@ def initialize_nlp():
29
  # spacy.load(settings.SPACY_MODEL)
30
  spacy.load("en_core_web_sm")
31
  en_core_web_sm.load()
32
-
 
33
  print("NLP resources initialized successfully.")
34
 
35
  # Global variables to store initialized resources
 
13
  # nltk.data.path.append(str(nltk_data_path))
14
 
15
  # # Download NLTK resources
16
+ nltk_resources = [
17
+ 'maxent_ne_chunker',
18
+ 'words',
19
+ 'treebank',
20
+ 'maxent_treebank_pos_tagger',
21
+ 'punkt',
22
+ 'averaged_perceptron_tagger'
23
+ ]
24
 
25
  # for resource in nltk_resources:
26
  # nltk.downloader.download(resource, download_dir=str(nltk_data_path) ,quiet=True)
 
29
  # spacy.load(settings.SPACY_MODEL)
30
  spacy.load("en_core_web_sm")
31
  en_core_web_sm.load()
32
+ for resource in nltk_resources:
33
+ nltk.download(nltk_resources)
34
  print("NLP resources initialized successfully.")
35
 
36
  # Global variables to store initialized resources