varshakolanu commited on
Commit
b6fc742
·
verified ·
1 Parent(s): 2b053f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -6,15 +6,11 @@ import re
6
  # Download required NLTK resources
7
  try:
8
  nltk.data.find('sentiment/vader_lexicon.zip')
9
- except nltk.downloader.DownloadError:
10
- nltk.download('vader_lexicon')
11
  except LookupError:
12
  nltk.download('vader_lexicon')
13
 
14
  try:
15
  nltk.data.find('tokenizers/punkt/english.pickle')
16
- except nltk.downloader.DownloadError:
17
- nltk.download('punkt')
18
  except LookupError:
19
  nltk.download('punkt')
20
 
@@ -62,10 +58,10 @@ def calculate_scores(work_completion, delay_reports, incident_logs):
62
  communication_score -= delay_reports.lower().count(keyword) * 10
63
 
64
  # Basic Sentiment Analysis (Optional - Requires NLTK Download)
65
- # analyzer = SentimentIntensityAnalyzer()
66
- # vs = analyzer.polarity_scores(work_completion + " " + delay_reports + " " + incident_logs)
67
- # sentiment_score = vs['compound']
68
- # communication_score += sentiment_score * 10 # Adjust weight as needed
69
 
70
  # Ensure scores are within 0-100 range
71
  quality_score = max(0, min(quality_score, 100))
 
6
  # Download required NLTK resources
7
  try:
8
  nltk.data.find('sentiment/vader_lexicon.zip')
 
 
9
  except LookupError:
10
  nltk.download('vader_lexicon')
11
 
12
  try:
13
  nltk.data.find('tokenizers/punkt/english.pickle')
 
 
14
  except LookupError:
15
  nltk.download('punkt')
16
 
 
58
  communication_score -= delay_reports.lower().count(keyword) * 10
59
 
60
  # Basic Sentiment Analysis (Optional - Requires NLTK Download)
61
+ analyzer = SentimentIntensityAnalyzer()
62
+ vs = analyzer.polarity_scores(work_completion + " " + delay_reports + " " + incident_logs)
63
+ sentiment_score = vs['compound']
64
+ communication_score += sentiment_score * 10 # Adjust weight as needed
65
 
66
  # Ensure scores are within 0-100 range
67
  quality_score = max(0, min(quality_score, 100))