tanish78 commited on
Commit
b5a9e7d
·
verified ·
1 Parent(s): 34d2248

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -26
app.py CHANGED
@@ -11,36 +11,50 @@ import plotly.express as px
11
  from PIL import Image
12
 
13
  categories_keywords = {
14
- 'Application Status': ['application', 'applied', 'update on my application', 'result of my application', 'selected', 'selection process', 'apply', 'fellow', 'lesson plan', 'status of my application', 'application update', 'application status', 'applied for'],
15
- 'Volunteering': ['volunteering', 'volunteer', 'volunteering certificate', 'resume my volunteering', 'volunteering journey', 'volunteering with TFI', 'volunteering opportunities', 'volunteer work', 'volunteer program'],
16
- 'Certificates': ['certificate', 'certificates', 'certificate of completion', 'volunteer certificate', 'issue certificate'],
17
- 'Job Opportunities': ['job', 'vacancy', 'Talent Acquisition Executive job', 'opportunity', 'job opening', 'job position', 'career opportunities'],
18
- 'Surveys and Forms': ['survey', 'form', 'fill out the survey', 'application form', 'survey link', 'survey form', 'form submission'],
19
- 'General Queries': ['query', 'queries', 'questions', 'feedback', 'loved', 'overwhelming', 'general question', 'inquiry', 'query about'],
20
- 'Spam': ['free recharge', 'offer', 'click the link', 'https'],
21
- 'Rescheduling and Postponing': ['reschedule', 'postpone', 'cancellation', 'date', 'time slot', 'change date', 'change time', 'reschedule appointment'],
22
- 'Contact and Communication Issues': ['call', 'phone', 'contact', 'not received', 'contact support', 'phone call', 'call back', 'internet'],
23
- 'Email and Credentials Issues': ['email', 'credentials', 'received', 'email issue', 'email problem', 'credential issue', 'login problem'],
24
- 'Timing and Scheduling': ['session', 'time', 'interview', 'baje', 'schedule time', 'meeting time', 'appointment time'],
25
- 'Salary and Benefits': ['salary', 'increment', 'accommodation', 'training period', 'reside', 'stipend', 'pay', 'wage', 'salary details', 'benefits information'],
26
- 'Technical Issues': ['network issues', 'zoom meeting', 'passcode', 'technical', 'issue','technical problem', 'system issue', 'technical support'],
27
- 'Complaint Handling': ['help', 'i need help', 'Help me', 'complaint', 'issue is unresolved', 'unsatisfied', 'bad experience'],
28
- 'End of Conversation': ['thanks', 'thankss', 'thank u', 'thank you', 'ok', 'okay', 'done', 'joining', 'sounds good', 'goodbye', 'end chat', 'end'],
29
- 'Miscellaneous': []
 
 
 
 
 
 
 
 
30
  }
31
 
32
-
33
  def categorize_question(question):
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  for category, keywords in categories_keywords.items():
35
- for keyword in keywords:
36
- if keyword.lower() in question.lower():
37
- # Check if the question is one word and belongs to 'End of Conversation'
38
- if category == 'End of Conversation':
39
- return category
40
- # If not 'End of Conversation', return the matched category
41
- if category != 'End of Conversation':
42
- return category
43
- return 'Miscellaneous'
44
 
45
 
46
 
 
11
  from PIL import Image
12
 
13
  categories_keywords = {
14
+ "Application Status": ["application status", "application", "status", "submitted", "processing", "pending", "approval", "rejected", "accepted"],
15
+ "Volunteering": ["volunteer", "volunteering", "help out", "assist", "volunteer work", "volunteer opportunities"],
16
+ "Certificates": ["certificate", "certificates", "completion", "certification", "accreditation", "proof", "document", "certified"],
17
+ "Job Opportunities": ["job", "opportunity", "career", "vacancy", "position", "employment", "hiring", "recruitment", "internship"],
18
+ "Surveys and Forms": ["survey", "form", "forms", "questionnaire", "feedback form", "response", "fill out", "submission"],
19
+ "General Queries": ["hello", "hi", "help", "general", "query", "question", "info", "information", "inquiry", "ask"],
20
+ "Spam": ["spam", "unsubscribe", "remove", "stop", "junk", "block", "opt-out"],
21
+ "Rescheduling and Postponing": ["reschedule", "postpone", "delay", "change date", "new time", "rearrange", "shift", "adjust timing"],
22
+ "Contact and Communication Issues": ["contact", "communicate", "communication", "reach out", "phone", "email", "address", "details"],
23
+ "Email and Credentials Issues": ["email", "credentials", "login", "password", "access", "username", "account", "verification", "reset"],
24
+ "Timing and Scheduling": ["timing", "schedule", "scheduling", "time", "appointment", "availability", "calendar", "book", "slot"],
25
+ "Salary and Benefits": ["salary", "benefits", "pay", "compensation", "wages", "earnings", "package", "remuneration", "incentives"],
26
+ "Technical Issues": ["technical", "issue", "problem", "error", "bug", "glitch", "fix", "troubleshoot", "support"],
27
+ "End of Conversation": ["bye", "thank you", "thanks", "goodbye", "see you", "later", "end", "close", "sign off"],
28
+ "Start of Conversation": ["start", "begin", "hello", "hi", "initiate", "greet", "greeting", "open", "commence"],
29
+ "Feedback": ["feedback", "comments", "review", "opinion", "suggestion", "critique", "rating"],
30
+ "Event Inquiries": ["event", "webinar", "meeting", "conference", "session", "seminar", "workshop", "invitation"],
31
+ "Payment Issues": ["payment", "billing", "transaction", "charge", "fee", "invoice", "refund", "receipt"],
32
+ "Registration Issues": ["registration", "register", "sign up", "enroll", "join", "signup", "enrollment"],
33
+ "Service Requests": ["service", "support", "request", "assistance", "help", "aid", "maintenance"],
34
+ "Account Issues": ["account", "profile", "update", "activation", "deactivation", "credentials", "reset"],
35
+ "Product Information": ["product", "service", "details", "info", "information", "specifications", "features"],
36
+ "Order Status": ["order", "status", "tracking", "shipment", "delivery", "purchase", "dispatch"],
37
+ "Miscellaneous": ["miscellaneous", "other", "various", "random", "general", "unknown", "unsorted"]
38
  }
39
 
 
40
  def categorize_question(question):
41
+ # Split the question into words
42
+ words = question.split()
43
+
44
+ # Check if the question has only one word
45
+ if len(words) == 1:
46
+ single_word = words[0].lower()
47
+ # Check if the single word is in the Start of Conversation category
48
+ if any(single_word in keyword for keyword in categories_keywords["Start of Conversation"]):
49
+ return "Start of Conversation"
50
+ else:
51
+ return "End of Conversation"
52
+
53
+ # Categorization of other queries
54
  for category, keywords in categories_keywords.items():
55
+ if any(keyword.lower() in question.lower() for keyword in keywords):
56
+ return category
57
+ return "Miscellaneous"
 
 
 
 
 
 
58
 
59
 
60