tanish78 commited on
Commit
0b5158c
·
verified ·
1 Parent(s): 4b843ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -42,12 +42,14 @@ categories_keywords = {
42
 
43
  def categorize_question(question):
44
  words = question.split()
45
-
 
46
  exclusion_words = {'is', 'please', 'not', 'resolved', 'problem', 'help', 'issue', 'webinar', 'office', 'leave', 'approved', 'notice', 'period'}
47
 
48
- if len(words) == 1:
 
49
  single_word = words[0].lower()
50
- # Check if the single word is in the Start of Conversation category
51
  if any(single_word in keyword for keyword in categories_keywords["Start of Conversation"]):
52
  return "Start of Conversation"
53
  else:
@@ -59,7 +61,7 @@ def categorize_question(question):
59
  return category
60
 
61
  # Secondary check for 'End of Conversation' category
62
- if "End of Conversation" in question.lower() and not any(exclusion_word in question.lower() for exclusion_word in exclusion_words):
63
  return "End of Conversation"
64
 
65
  return "Miscellaneous"
 
42
 
43
  def categorize_question(question):
44
  words = question.split()
45
+
46
+ # List of words to exclude from 'End of Conversation'
47
  exclusion_words = {'is', 'please', 'not', 'resolved', 'problem', 'help', 'issue', 'webinar', 'office', 'leave', 'approved', 'notice', 'period'}
48
 
49
+ # Check if the question has only one word
50
+ if len(words) == 1:
51
  single_word = words[0].lower()
52
+
53
  if any(single_word in keyword for keyword in categories_keywords["Start of Conversation"]):
54
  return "Start of Conversation"
55
  else:
 
61
  return category
62
 
63
  # Secondary check for 'End of Conversation' category
64
+ if "end of conversation" in question.lower() and not any(exclusion_word in question.lower() for exclusion_word in exclusion_words):
65
  return "End of Conversation"
66
 
67
  return "Miscellaneous"