Bwrite commited on
Commit
5b6a879
·
verified ·
1 Parent(s): a480c86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -26
app.py CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  import nltk
2
  import re
3
  import random
@@ -10,30 +16,11 @@ import gradio as gr
10
  warnings.filterwarnings('ignore')
11
 
12
  # Download required NLTK data
13
- try:
14
- nltk.data.find('tokenizers/punkt')
15
- except LookupError:
16
- nltk.download('punkt')
17
-
18
- try:
19
- nltk.data.find('tokenizers/punkt_tab')
20
- except LookupError:
21
- nltk.download('punkt_tab')
22
-
23
- try:
24
- nltk.data.find('corpora/wordnet')
25
- except LookupError:
26
- nltk.download('wordnet')
27
-
28
- try:
29
- nltk.data.find('corpora/stopwords')
30
- except LookupError:
31
- nltk.download('stopwords')
32
-
33
- try:
34
- nltk.data.find('corpora/omw-1.4')
35
- except LookupError:
36
- nltk.download('omw-1.4')
37
 
38
  from nltk.stem import WordNetLemmatizer
39
  from nltk.corpus import stopwords
@@ -141,7 +128,7 @@ class BOUESTIChatbot:
141
 
142
  # Documents for Screening
143
  'screening_documents': [
144
- "'O' Level results (WAEC, NECO, or NABTEB).",
145
  'JAMB UTME result slip.',
146
  'JAMB admission letter',
147
  'Birth certificate or age declaration.',
@@ -176,7 +163,7 @@ class BOUESTIChatbot:
176
  "I can help you with questions about BOUESTI admissions, programs, fees, and general information. Could you please ask about one of these topics?"
177
  ],
178
  'screening_documents': [
179
- 'The Documents Required for Screening are: \n1. O'Level results (WAEC, NECO, or NABTEB).\n2. JAMB UTME result slip.\n3. JAMB admission letter\n4. Birth certificate or age declaration.\n5. Passport photographs.\n6. Local Government Identification.\n7. Bio-data form\n8. School fees payment receipt\n9. For Direct Entry, additional documents including A-Level results, HND certificates, or transcripts are required'
180
  ]
181
  }
182
 
@@ -239,6 +226,8 @@ class BOUESTIChatbot:
239
  r'\bhelp guide\b',
240
  r'\bshow.*guide\b'
241
  ]
 
 
242
  }
243
 
244
  self.vectorizer = TfidfVectorizer(tokenizer=self.tokenize, lowercase=True)
@@ -460,6 +449,7 @@ class BOUESTIChatbot:
460
  response += f"{i}. {doc}\n"
461
  return response
462
 
 
463
  def generate_response(self, user_input):
464
  """Generate response based on user input"""
465
  intent = self.detect_intent(user_input)
 
1
+ # BOUESTI Virtual Assistant Chatbot
2
+ # Bamidele Olumilua University of Education, Science, and Technology, Ikere Ekiti
3
+
4
+ # Install required packages
5
+ !pip install nltk scikit-learn gradio
6
+
7
  import nltk
8
  import re
9
  import random
 
16
  warnings.filterwarnings('ignore')
17
 
18
  # Download required NLTK data
19
+ nltk.download('punkt')
20
+ nltk.download('punkt_tab')
21
+ nltk.download('wordnet')
22
+ nltk.download('stopwords')
23
+ nltk.download('omw-1.4')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  from nltk.stem import WordNetLemmatizer
26
  from nltk.corpus import stopwords
 
128
 
129
  # Documents for Screening
130
  'screening_documents': [
131
+ 'OLevel results (WAEC, NECO, or NABTEB).',
132
  'JAMB UTME result slip.',
133
  'JAMB admission letter',
134
  'Birth certificate or age declaration.',
 
163
  "I can help you with questions about BOUESTI admissions, programs, fees, and general information. Could you please ask about one of these topics?"
164
  ],
165
  'screening_documents': [
166
+ 'The Documents Required for Screening are: \n1. OLevel results (WAEC, NECO, or NABTEB).\n2. JAMB UTME result slip.\n3. JAMB admission letter\n4. Birth certificate or age declaration.\n5. Passport photographs.\n6. Local Government Identification.\n7. Bio-data form\n8. School fees payment receipt\n9. For Direct Entry, additional documents including A-Level results, HND certificates, or transcripts are required'
167
  ]
168
  }
169
 
 
226
  r'\bhelp guide\b',
227
  r'\bshow.*guide\b'
228
  ]
229
+
230
+
231
  }
232
 
233
  self.vectorizer = TfidfVectorizer(tokenizer=self.tokenize, lowercase=True)
 
449
  response += f"{i}. {doc}\n"
450
  return response
451
 
452
+
453
  def generate_response(self, user_input):
454
  """Generate response based on user input"""
455
  intent = self.detect_intent(user_input)