tanish78 commited on
Commit
7b5aba0
·
verified ·
1 Parent(s): 18b6d3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -29,21 +29,18 @@ categories_keywords = {
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
-
47
  def preprocess_data(df):
48
  df.rename(columns={'Question Asked': 'texts'}, inplace=True)
49
  df['texts'] = df['texts'].astype(str).str.lower()
 
29
  'Miscellaneous': []
30
  }
31
 
 
32
  def categorize_question(question):
33
+
34
+ for keyword in categories_keywords['End of Conversation']:
35
+ if keyword.lower() in question.lower():
36
+ return 'End of Conversation'
37
  for category, keywords in categories_keywords.items():
38
  for keyword in keywords:
39
  if keyword.lower() in question.lower():
40
+ return category
 
 
 
 
 
41
  return 'Miscellaneous'
42
 
43
 
 
44
  def preprocess_data(df):
45
  df.rename(columns={'Question Asked': 'texts'}, inplace=True)
46
  df['texts'] = df['texts'].astype(str).str.lower()