File tree Expand file tree Collapse file tree
utilities/AI-Resume-Analyzer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44from nltk .tokenize import word_tokenize
55from nltk .util import ngrams
66
7- # Ensure NLTK downloads happen at the top level so they're available,
8- # but can be verified inside main or when running.
9- nltk .download ('punkt' )
10- nltk .download ('stopwords' )
7+
8+ def _ensure_nltk_resources () -> None :
9+ """Download NLTK resources only if not already present."""
10+ resources = {
11+ 'punkt' : 'tokenizers/punkt' ,
12+ 'punkt_tab' : 'tokenizers/punkt_tab' ,
13+ 'stopwords' : 'corpora/stopwords' ,
14+ }
15+ for name , path in resources .items ():
16+ try :
17+ nltk .data .find (path )
18+ except LookupError :
19+ nltk .download (name , quiet = True )
20+
1121
1222def analyze_resume (resume_text : str ) -> dict :
23+ _ensure_nltk_resources ()
24+
1325 resume = resume_text .lower ()
1426
1527 # NLP processing
@@ -117,6 +129,7 @@ def analyze_resume(resume_text: str) -> dict:
117129 "all_skills" : skills ,
118130 }
119131
132+
120133def main () -> None :
121134 print ("=== 🤖 AI Resume Analyzer (Advanced NLP Version) ===" )
122135
@@ -159,5 +172,6 @@ def main() -> None:
159172 # Final
160173 print ("\n 🚀 Analysis Completed" )
161174
175+
162176if __name__ == "__main__" :
163177 main ()
You can’t perform that action at this time.
0 commit comments