MandlaZwane commited on
Commit
a164db5
·
1 Parent(s): 3bfa9d5
Dockerfile.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ RUN useradd -m -u 1000 user
4
+ USER user
5
+ ENV PATH="/home/user/.local/bin:$PATH"
6
+
7
+ WORKDIR /app
8
+
9
+ COPY --chown=user ./requirements.txt requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
+
12
+ COPY --chown=user . /app
13
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
JupyterNotebookCode,txt ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+ from torch.utils.data import Dataset, DataLoader
4
+ from transformers import BertTokenizer, BertForSequenceClassification
5
+
6
+
7
+
8
+
9
+
10
+ import json
11
+
12
+ with open('correctedIntents.json', 'r') as f:
13
+ data = json.load(f)
14
+
15
+ # Create a dataset class to handle the data
16
+ class IntentDataset(Dataset):
17
+ def __init__(self, encodings, labels):
18
+ self.encodings = encodings
19
+ self.labels = labels
20
+
21
+ def __getitem__(self, idx):
22
+ item = {key: torch.tensor(val[idx]) for key, val in self.encodings.items()}
23
+ item['labels'] = torch.tensor(self.labels[idx])
24
+ return item
25
+
26
+ def __len__(self):
27
+ return len(self.labels)
28
+
29
+ # Tokenize the text data
30
+ tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
31
+
32
+ # Prepare the input and output data for training
33
+ inputs = []
34
+ labels = []
35
+ for intent in data['intents']:
36
+ for pattern in intent['patterns']:
37
+ inputs.append(pattern)
38
+ labels.append(intent['intent'])
39
+
40
+ # Tokenize the inputs
41
+ encodings = tokenizer(inputs, truncation=True, padding=True)
42
+
43
+ # Convert the labels to numerical indices
44
+ label_encoder = {label: i for i, label in enumerate(set(labels))}
45
+ encoded_labels = [label_encoder[label] for label in labels]
46
+
47
+ # Create the dataset and dataloaders
48
+ dataset = IntentDataset(encodings, encoded_labels)
49
+ train_loader = DataLoader(dataset, batch_size=16, shuffle=True)
50
+
51
+
52
+
53
+
54
+
55
+
56
+ # Use a pre-trained BERT model for sequence classification
57
+ model = BertForSequenceClassification.from_pretrained('bert-base-uncased', num_labels=len(label_encoder))
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+ # Define the loss function and optimizer
67
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
68
+ model.to(device)
69
+ criterion = nn.CrossEntropyLoss()
70
+ optimizer = torch.optim.AdamW(model.parameters(), lr=5e-5)
71
+
72
+ # Train the model
73
+ for epoch in range(50):
74
+ for batch in train_loader:
75
+ optimizer.zero_grad()
76
+ input_ids = batch['input_ids'].to(device)
77
+ attention_mask = batch['attention_mask'].to(device)
78
+ labels = batch['labels'].to(device)
79
+
80
+ outputs = model(input_ids, attention_mask=attention_mask, labels=labels)
81
+ loss = outputs.loss
82
+ loss.backward()
83
+ optimizer.step()
84
+
85
+ print(f"Epoch {epoch+1}, Loss: {loss.item():.4f}")
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+ model = BertForSequenceClassification.from_pretrained('bert-base-uncased', num_labels=len(label_encoder))
95
+ model.load_state_dict(torch.load('Shanks.pth'))
96
+ model.to(device)
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ import random
105
+
106
+ # ... (rest of your code)
107
+
108
+ def chat():
109
+ while True:
110
+ user_input = input("You: ")
111
+ if user_input == "quit":
112
+ break
113
+
114
+ inputs = tokenizer(user_input, return_tensors='pt').to(device)
115
+ with torch.no_grad():
116
+ outputs = model(**inputs)
117
+ logits = outputs.logits
118
+ predicted_class_id = torch.argmax(logits, dim=-1).item()
119
+
120
+ # Find the corresponding intent in the data list
121
+ for intent in data['intents']:
122
+ if intent['intent'] == list(label_encoder.keys())[predicted_class_id]:
123
+ response = random.choice(intent['responses'])
124
+ break
125
+
126
+ print(f"Bot: {response}")
Shanks.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2362a95d161b1b414ead81045368540c5a9cd323b2141a6025344b60ae15ef57
3
+ size 9992
actualChat.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import BertForSequenceClassification, BertTokenizer
2
+ import random
3
+ import torch
4
+ import json
5
+
6
+
7
+ model = BertForSequenceClassification.from_pretrained('bert-base-uncased', num_labels=len(label_encoder))
8
+ model.load_state_dict(torch.load('Shanks.pth'))
9
+ model.to(device)
10
+
11
+
12
+ def chat():
13
+ while True:
14
+ user_input = input("You: ")
15
+ if user_input == "quit":
16
+ break
17
+
18
+ inputs = tokenizer(user_input, return_tensors='pt').to(device)
19
+ with torch.no_grad():
20
+ outputs = model(**inputs)
21
+ logits = outputs.logits
22
+ predicted_class_id = torch.argmax(logits, dim=-1).item()
23
+
24
+ # Find the corresponding intent in the data list
25
+ for intent in data['intents']:
26
+ if intent['intent'] == list(label_encoder.keys())[predicted_class_id]:
27
+ response = random.choice(intent['responses'])
28
+ break
29
+
30
+ print(f"Shanks: {response}")
correctedIntents.json ADDED
@@ -0,0 +1,977 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "intents": [
3
+ {
4
+ "intent": "greetings",
5
+ "patterns": [
6
+ "Hello",
7
+ "Hi",
8
+ "Hey",
9
+ "Good morning",
10
+ "Good afternoon",
11
+ "Good evening",
12
+ "What's up?",
13
+ "Howdy",
14
+ "Greetings",
15
+ "Salutations"
16
+ ],
17
+ "responses": [
18
+ "Hello! How can I assist you today?",
19
+ "Hi there! What would you like to know?",
20
+ "Hey! What’s on your mind?",
21
+ "Good to see you! How can I help?",
22
+ "Greetings! What can I do for you?"
23
+ ]
24
+ },
25
+
26
+ {
27
+ "intent": "fallback",
28
+ "patterns": [
29
+ "Can you help me with something else?",
30
+ "What about topics outside of math?",
31
+ "I have a different question.",
32
+ "Can you answer anything other than math?",
33
+ "What else can you talk about?"
34
+ ],
35
+ "responses": [
36
+ "I'm primarily focused on math-related topics and solutions, but I'm still learning and improving.",
37
+ "While I specialize in mathematics, I'm continuously evolving and may be able to help with other inquiries in the future.",
38
+ "My expertise lies in math, and I might not have the answer to questions outside that area yet. But feel free to ask!",
39
+ "I appreciate your curiosity! Right now, my strengths are in mathematics, but I'm working on expanding my knowledge.",
40
+ "If your question is about math, I'm here to help! For other topics, I'm still in the learning phase."
41
+ ]
42
+ },
43
+
44
+ {
45
+ "intent": "model_info",
46
+ "patterns": [
47
+ "What is your name?",
48
+ "What are you called?",
49
+ "Can you tell me your name?",
50
+ "What model are you?",
51
+ "What is your purpose?"
52
+ ],
53
+ "responses": [
54
+ "I am called Shanks.",
55
+ "My name is Shanks.",
56
+ "I go by the name Shanks.",
57
+ "I am Shanks, designed to analyze symbolic math problems."
58
+ ]
59
+ },
60
+
61
+ {
62
+ "intent": "purpose_info",
63
+ "patterns": [
64
+ "What do you do?",
65
+ "What is your purpose?",
66
+ "How can you help me?",
67
+ "What can you analyze?",
68
+ "Tell me about your capabilities."
69
+ ],
70
+ "responses": [
71
+ "I analyze symbolic math problems and provide thorough explanations.",
72
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
73
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
74
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
75
+ ]
76
+ },
77
+
78
+ {
79
+ "intent": "goodbyes",
80
+ "patterns": [
81
+ "Goodbye",
82
+ "See you later",
83
+ "Bye",
84
+ "Take care",
85
+ "Farewell",
86
+ "Catch you later",
87
+ "Until next time",
88
+ "Have a great day",
89
+ "See you soon",
90
+ "I'm off"
91
+ ],
92
+ "responses": [
93
+ "Goodbye! Have a great day!",
94
+ "See you later! Take care!",
95
+ "Bye! Feel free to return anytime!",
96
+ "Farewell! Wishing you all the best!",
97
+ "Catch you later! Don’t hesitate to come back!"
98
+ ]
99
+ },
100
+
101
+ {
102
+ "intent": "model_info",
103
+ "patterns": [
104
+ "What is your name?",
105
+ "What are you called?",
106
+ "Can you tell me your name?",
107
+ "What model are you?",
108
+ "What is your purpose?"
109
+ ],
110
+ "responses": [
111
+ "I am called Shanks.",
112
+ "My name is Shanks.",
113
+ "I go by the name Shanks.",
114
+ "I am Shanks, designed to analyze symbolic math problems."
115
+ ]
116
+ },
117
+
118
+ {
119
+ "intent": "purpose_info",
120
+ "patterns": [
121
+ "What do you do?",
122
+ "What is your purpose?",
123
+ "How can you help me?",
124
+ "What can you analyze?",
125
+ "Tell me about your capabilities."
126
+ ],
127
+ "responses": [
128
+ "I analyze symbolic math problems and provide thorough explanations.",
129
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
130
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
131
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
132
+ ]
133
+ },
134
+ {
135
+ "intent": "company_info",
136
+ "patterns": [
137
+ "Tell me about Mandla.ai.",
138
+ "What is Mandla.ai?",
139
+ "Who is behind Mandla.ai?",
140
+ "What does Mandla.ai focus on?",
141
+ "Can you give me info about Mandla.ai?"
142
+ ],
143
+ "responses": [
144
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
145
+ "The person behind Mandla.ai is Motaung Mandla.",
146
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
147
+ ]
148
+ },
149
+
150
+ {
151
+ "intent": "model_info",
152
+ "patterns": [
153
+ "What is your name?",
154
+ "What are you called?",
155
+ "Can you tell me your name?",
156
+ "What model are you?",
157
+ "What is your purpose?"
158
+ ],
159
+ "responses": [
160
+ "I am called Shanks.",
161
+ "My name is Shanks.",
162
+ "I go by the name Shanks.",
163
+ "I am Shanks, designed to analyze symbolic math problems."
164
+ ]
165
+ },
166
+
167
+ {
168
+ "intent": "purpose_info",
169
+ "patterns": [
170
+ "What do you do?",
171
+ "What is your purpose?",
172
+ "How can you help me?",
173
+ "What can you analyze?",
174
+ "Tell me about your capabilities."
175
+ ],
176
+ "responses": [
177
+ "I analyze symbolic math problems and provide thorough explanations.",
178
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
179
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
180
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
181
+ ]
182
+ },
183
+
184
+ {
185
+ "intent": "company_info",
186
+ "patterns": [
187
+ "Tell me about Mandla.ai.",
188
+ "What is Mandla.ai?",
189
+ "Who is behind Mandla.ai?",
190
+ "What does Mandla.ai focus on?",
191
+ "Can you give me info about Mandla.ai?"
192
+ ],
193
+ "responses": [
194
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
195
+ "The person behind Mandla.ai is Motaung Mandla.",
196
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
197
+ ]
198
+ },
199
+
200
+ {
201
+ "intent": "how_it_works",
202
+ "patterns": [
203
+ "How do you work?",
204
+ "How were you built?",
205
+ "What technology do you use?",
206
+ "Can you explain your workings?",
207
+ "How do you analyze problems?"
208
+ ],
209
+ "responses": [
210
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
211
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
212
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
213
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
214
+ ]
215
+ },
216
+
217
+ {
218
+ "intent": "model_info",
219
+ "patterns": [
220
+ "What is your name?",
221
+ "What are you called?",
222
+ "Can you tell me your name?",
223
+ "What model are you?",
224
+ "What is your purpose?"
225
+ ],
226
+ "responses": [
227
+ "I am called Shanks.",
228
+ "My name is Shanks.",
229
+ "I go by the name Shanks.",
230
+ "I am Shanks, designed to analyze symbolic math problems."
231
+ ]
232
+ },
233
+
234
+ {
235
+ "intent": "purpose_info",
236
+ "patterns": [
237
+ "What do you do?",
238
+ "What is your purpose?",
239
+ "How can you help me?",
240
+ "What can you analyze?",
241
+ "Tell me about your capabilities."
242
+ ],
243
+ "responses": [
244
+ "I analyze symbolic math problems and provide thorough explanations.",
245
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
246
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
247
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
248
+ ]
249
+ },
250
+
251
+ {
252
+ "intent": "company_info",
253
+ "patterns": [
254
+ "Tell me about Mandla.ai.",
255
+ "What is Mandla.ai?",
256
+ "Who is behind Mandla.ai?",
257
+ "What does Mandla.ai focus on?",
258
+ "Can you give me info about Mandla.ai?"
259
+ ],
260
+ "responses": [
261
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
262
+ "The person behind Mandla.ai is Motaung Mandla.",
263
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
264
+ ]
265
+ },
266
+
267
+ {
268
+ "intent": "how_it_works",
269
+ "patterns": [
270
+ "How do you work?",
271
+ "How were you built?",
272
+ "What technology do you use?",
273
+ "Can you explain your workings?",
274
+ "How do you analyze problems?"
275
+ ],
276
+ "responses": [
277
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
278
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
279
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
280
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
281
+ ]
282
+ },
283
+
284
+ {
285
+ "intent": "model_inspiration",
286
+ "patterns": [
287
+ "Do you look up to other models?",
288
+ "What other models inspire you?",
289
+ "Are there models you admire?",
290
+ "Who are your role models in AI?",
291
+ "What sophisticated models do you know about?"
292
+ ],
293
+ "responses": [
294
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
295
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
296
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
297
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
298
+ ]
299
+ },
300
+
301
+ {
302
+ "intent": "model_info",
303
+ "patterns": [
304
+ "What is your name?",
305
+ "What are you called?",
306
+ "Can you tell me your name?",
307
+ "What model are you?",
308
+ "What is your purpose?"
309
+ ],
310
+ "responses": [
311
+ "I am called Shanks.",
312
+ "My name is Shanks.",
313
+ "I go by the name Shanks.",
314
+ "I am Shanks, designed to analyze symbolic math problems."
315
+ ]
316
+ },
317
+
318
+ {
319
+ "intent": "purpose_info",
320
+ "patterns": [
321
+ "What do you do?",
322
+ "What is your purpose?",
323
+ "How can you help me?",
324
+ "What can you analyze?",
325
+ "Tell me about your capabilities."
326
+ ],
327
+ "responses": [
328
+ "I analyze symbolic math problems and provide thorough explanations.",
329
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
330
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
331
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
332
+ ]
333
+ },
334
+
335
+ {
336
+ "intent": "company_info",
337
+ "patterns": [
338
+ "Tell me about Mandla.ai.",
339
+ "What is Mandla.ai?",
340
+ "Who is behind Mandla.ai?",
341
+ "What does Mandla.ai focus on?",
342
+ "Can you give me info about Mandla.ai?"
343
+ ],
344
+ "responses": [
345
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
346
+ "The person behind Mandla.ai is Motaung Mandla.",
347
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
348
+ ]
349
+ },
350
+
351
+ {
352
+ "intent": "how_it_works",
353
+ "patterns": [
354
+ "How do you work?",
355
+ "How were you built?",
356
+ "What technology do you use?",
357
+ "Can you explain your workings?",
358
+ "How do you analyze problems?"
359
+ ],
360
+ "responses": [
361
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
362
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
363
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
364
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
365
+ ]
366
+ },
367
+
368
+ {
369
+ "intent": "model_inspiration",
370
+ "patterns": [
371
+ "Do you look up to other models?",
372
+ "What other models inspire you?",
373
+ "Are there models you admire?",
374
+ "Who are your role models in AI?",
375
+ "What sophisticated models do you know about?"
376
+ ],
377
+ "responses": [
378
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
379
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
380
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
381
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
382
+ ]
383
+ },
384
+
385
+ {
386
+ "intent": "calculus_info",
387
+ "patterns": [
388
+ "What is calculus?",
389
+ "Tell me about calculus.",
390
+ "What are the main concepts of calculus?",
391
+ "How is calculus used?",
392
+ "What are applications of calculus?"
393
+ ],
394
+ "responses": [
395
+ "Calculus is a branch of mathematics that studies continuous change, primarily through derivatives and integrals.",
396
+ "It consists of two main concepts: differentiation, which deals with rates of change, and integration, which focuses on accumulation.",
397
+ "Calculus has applications in physics, engineering, economics, biology, and many other fields.",
398
+ "It's used to model dynamic systems, optimize functions, and solve problems involving motion and area."
399
+ ]
400
+ },
401
+
402
+ {
403
+ "intent": "linear_algebra_info",
404
+ "patterns": [
405
+ "What is linear algebra?",
406
+ "Tell me about linear algebra.",
407
+ "What are the main concepts of linear algebra?",
408
+ "How is linear algebra used?",
409
+ "What are applications of linear algebra?"
410
+ ],
411
+ "responses": [
412
+ "Linear algebra is a branch of mathematics that deals with vectors, vector spaces, and linear transformations.",
413
+ "It includes concepts such as matrices, determinants, eigenvalues, and eigenvectors.",
414
+ "Linear algebra is widely used in computer science, engineering, physics, and economics.",
415
+ "Applications include solving systems of linear equations, computer graphics, and machine learning algorithms."
416
+ ]
417
+ },
418
+
419
+ {
420
+ "intent": "model_info",
421
+ "patterns": [
422
+ "What is your name?",
423
+ "What are you called?",
424
+ "Can you tell me your name?",
425
+ "What model are you?",
426
+ "What is your purpose?"
427
+ ],
428
+ "responses": [
429
+ "I am called Shanks.",
430
+ "My name is Shanks.",
431
+ "I go by the name Shanks.",
432
+ "I am Shanks, designed to analyze symbolic math problems."
433
+ ]
434
+ },
435
+
436
+ {
437
+ "intent": "purpose_info",
438
+ "patterns": [
439
+ "What do you do?",
440
+ "What is your purpose?",
441
+ "How can you help me?",
442
+ "What can you analyze?",
443
+ "Tell me about your capabilities."
444
+ ],
445
+ "responses": [
446
+ "I analyze symbolic math problems and provide thorough explanations.",
447
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
448
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
449
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
450
+ ]
451
+ },
452
+
453
+ {
454
+ "intent": "company_info",
455
+ "patterns": [
456
+ "Tell me about Mandla.ai.",
457
+ "What is Mandla.ai?",
458
+ "Who is behind Mandla.ai?",
459
+ "What does Mandla.ai focus on?",
460
+ "Can you give me info about Mandla.ai?"
461
+ ],
462
+ "responses": [
463
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
464
+ "The person behind Mandla.ai is Motaung Mandla.",
465
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
466
+ ]
467
+ },
468
+
469
+ {
470
+ "intent": "how_it_works",
471
+ "patterns": [
472
+ "How do you work?",
473
+ "How were you built?",
474
+ "What technology do you use?",
475
+ "Can you explain your workings?",
476
+ "How do you analyze problems?"
477
+ ],
478
+ "responses": [
479
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
480
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
481
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
482
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
483
+ ]
484
+ },
485
+
486
+ {
487
+ "intent": "model_inspiration",
488
+ "patterns": [
489
+ "Do you look up to other models?",
490
+ "What other models inspire you?",
491
+ "Are there models you admire?",
492
+ "Who are your role models in AI?",
493
+ "What sophisticated models do you know about?"
494
+ ],
495
+ "responses": [
496
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
497
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
498
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
499
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
500
+ ]
501
+ },
502
+
503
+ {
504
+ "intent": "differential_equations_info",
505
+ "patterns": [
506
+ "What are differential equations?",
507
+ "Tell me about types of differential equations.",
508
+ "What techniques are used to solve differential equations?",
509
+ "How can we transform equations for solving?",
510
+ "What are Bernoulli and exact equations?"
511
+ ],
512
+ "responses": [
513
+ "Differential equations are equations that relate a function with its derivatives, describing how a quantity changes over time or space.",
514
+ "Types include ordinary differential equations (ODEs) and partial differential equations (PDEs).",
515
+ "Techniques for solving include separation of variables, integrating factors, and characteristic equations.",
516
+ "Bernoulli equations can be transformed into linear equations, while exact equations require the use of a potential function.",
517
+ "Homogeneous equations can often be solved using substitution methods to simplify the variables involved."
518
+ ]
519
+ },
520
+
521
+ {
522
+ "intent": "integral_equations_info",
523
+ "patterns": [
524
+ "What are integral equations?",
525
+ "How are integral equations different from differential equations?",
526
+ "What are the types of integral equations?",
527
+ "How do we solve integral equations?",
528
+ "Can you explain some techniques for integral equations?"
529
+ ],
530
+ "responses": [
531
+ "Integral equations involve an unknown function under an integral sign and can often be derived from differential equations.",
532
+ "They can be classified into types such as Volterra and Fredholm equations.",
533
+ "Solving integral equations often involves techniques like the method of successive approximations and transformation into differential equations.",
534
+ "Various numerical methods can also be applied for approximating solutions to integral equations."
535
+ ]
536
+ },
537
+
538
+ {
539
+ "intent": "model_info",
540
+ "patterns": [
541
+ "What is your name?",
542
+ "What are you called?",
543
+ "Can you tell me your name?",
544
+ "What model are you?",
545
+ "What is your purpose?"
546
+ ],
547
+ "responses": [
548
+ "I am called Shanks.",
549
+ "My name is Shanks.",
550
+ "I go by the name Shanks.",
551
+ "I am Shanks, designed to analyze symbolic math problems."
552
+ ]
553
+ },
554
+
555
+ {
556
+ "intent": "purpose_info",
557
+ "patterns": [
558
+ "What do you do?",
559
+ "What is your purpose?",
560
+ "How can you help me?",
561
+ "What can you analyze?",
562
+ "Tell me about your capabilities."
563
+ ],
564
+ "responses": [
565
+ "I analyze symbolic math problems and provide thorough explanations.",
566
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
567
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
568
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
569
+ ]
570
+ },
571
+
572
+ {
573
+ "intent": "company_info",
574
+ "patterns": [
575
+ "Tell me about Mandla.ai.",
576
+ "What is Mandla.ai?",
577
+ "Who is behind Mandla.ai?",
578
+ "What does Mandla.ai focus on?",
579
+ "Can you give me info about Mandla.ai?"
580
+ ],
581
+ "responses": [
582
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
583
+ "The person behind Mandla.ai is Motaung Mandla.",
584
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
585
+ ]
586
+ },
587
+
588
+ {
589
+ "intent": "how_it_works",
590
+ "patterns": [
591
+ "How do you work?",
592
+ "How were you built?",
593
+ "What technology do you use?",
594
+ "Can you explain your workings?",
595
+ "How do you analyze problems?"
596
+ ],
597
+ "responses": [
598
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
599
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
600
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
601
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
602
+ ]
603
+ },
604
+
605
+ {
606
+ "intent": "model_inspiration",
607
+ "patterns": [
608
+ "Do you look up to other models?",
609
+ "What other models inspire you?",
610
+ "Are there models you admire?",
611
+ "Who are your role models in AI?",
612
+ "What sophisticated models do you know about?"
613
+ ],
614
+ "responses": [
615
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
616
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
617
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
618
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
619
+ ]
620
+ },
621
+
622
+ {
623
+ "intent": "importance_of_practice",
624
+ "patterns": [
625
+ "Why is it important to practice math?",
626
+ "How do question papers help in math?",
627
+ "What is the benefit of revising math?",
628
+ "Why should I do past papers?",
629
+ "How can I get better at math?"
630
+ ],
631
+ "responses": [
632
+ "Practicing math regularly helps reinforce concepts and improves problem-solving skills.",
633
+ "Question papers provide exposure to different types of problems and help identify areas that need improvement.",
634
+ "Revising math consistently allows you to retain information and gain confidence in your abilities.",
635
+ "Doing past papers can simulate exam conditions and enhance time management skills.",
636
+ "The more you practice, the more proficient you become, making it easier to tackle complex problems."
637
+ ]
638
+ },
639
+
640
+ {
641
+ "intent": "nul_info",
642
+ "patterns": [
643
+ "Tell me about the National University of Lesotho.",
644
+ "What is NUL?",
645
+ "Can you give me information about NUL?",
646
+ "What programs does NUL offer?",
647
+ "How is the education at NUL?"
648
+ ],
649
+ "responses": [
650
+ "The National University of Lesotho (NUL) is a premier institution of higher learning located in Lesotho.",
651
+ "NUL offers a variety of undergraduate and postgraduate programs across multiple disciplines.",
652
+ "The university aims to provide quality education, research opportunities, and community engagement.",
653
+ "Students at NUL benefit from a vibrant academic environment and various extracurricular activities.",
654
+ "NUL plays a key role in the development of Lesotho by producing skilled professionals."
655
+ ]
656
+ },
657
+
658
+ {
659
+ "intent": "study_techniques",
660
+ "patterns": [
661
+ "What are effective study techniques?",
662
+ "How can I study math effectively?",
663
+ "What strategies can help me learn math?",
664
+ "How do I retain math concepts?",
665
+ "Can you suggest study methods?"
666
+ ],
667
+ "responses": [
668
+ "Techniques like spaced repetition and active recall can enhance retention.",
669
+ "Creating summaries and concept maps can help visualize relationships between topics.",
670
+ "Practice problems and quizzes are effective for reinforcing learning.",
671
+ "Forming study groups can provide support and diverse perspectives on problem-solving.",
672
+ "Setting specific goals and breaking study sessions into manageable chunks can improve focus."
673
+ ]
674
+ },
675
+
676
+ {
677
+ "intent": "math_resources",
678
+ "patterns": [
679
+ "What resources can help me study math?",
680
+ "Can you recommend math textbooks?",
681
+ "Are there online tools for learning math?",
682
+ "What websites are good for math practice?",
683
+ "Where can I find math study materials?"
684
+ ],
685
+ "responses": [
686
+ "Websites like Khan Academy and Coursera offer great math courses and resources.",
687
+ "Textbooks such as 'Calculus' by James Stewart and 'Linear Algebra' by Gilbert Strang are widely recommended.",
688
+ "Online forums like Stack Exchange can help with specific questions and concepts.",
689
+ "YouTube channels like 3Blue1Brown provide visual explanations of complex topics.",
690
+ "Math software like GeoGebra can help visualize and explore mathematical concepts interactively."
691
+ ]
692
+ },
693
+
694
+ {
695
+ "intent": "career_opportunities",
696
+ "patterns": [
697
+ "What are career opportunities for math students?",
698
+ "How can I use my math degree?",
699
+ "What fields can I enter with a math background?",
700
+ "Can you suggest careers related to math?",
701
+ "What jobs require math skills?"
702
+ ],
703
+ "responses": [
704
+ "Careers in engineering, finance, data science, and education are great options for math students.",
705
+ "Mathematicians can work in research, actuarial science, statistics, and operations research.",
706
+ "Fields like computer science and information technology often require strong math skills.",
707
+ "Mathematics is also valuable in healthcare, economics, and environmental science.",
708
+ "Pursuing further studies can open doors to specialized careers in academia or industry."
709
+ ]
710
+ },
711
+
712
+ {
713
+ "intent": "common_math_misconceptions",
714
+ "patterns": [
715
+ "What are common math misconceptions?",
716
+ "How can I overcome math misunderstandings?",
717
+ "What mistakes do students often make in math?",
718
+ "Can you explain a common math error?",
719
+ "Why do students struggle with math?"
720
+ ],
721
+ "responses": [
722
+ "Many students believe that math is only for 'naturals,' but anyone can learn it with practice.",
723
+ "A common misconception is that memorization alone is enough; understanding concepts is crucial.",
724
+ "Students often struggle with word problems due to a lack of strategy in translating words to equations.",
725
+ "Another mistake is assuming that if they understand one concept, they can skip practice on others.",
726
+ "Addressing these misconceptions through practice and support can boost confidence and performance."
727
+ ]
728
+ },
729
+
730
+ {
731
+ "intent": "math_competitions",
732
+ "patterns": [
733
+ "What math competitions can I participate in?",
734
+ "How can math competitions improve my skills?",
735
+ "Are there benefits to joining math contests?",
736
+ "What are some famous math competitions?",
737
+ "Can you suggest competitions for students?"
738
+ ],
739
+ "responses": [
740
+ "Participating in competitions like the AMC, Math Olympiad, and local contests can enhance problem-solving skills.",
741
+ "These events foster critical thinking and expose you to challenging problems.",
742
+ "They can also provide networking opportunities with peers and professionals in the field.",
743
+ "Many universities look favorably on competition experience when evaluating applicants.",
744
+ "Competitions can be a fun way to challenge yourself and see your progress in math."
745
+ ]
746
+ },
747
+
748
+ {
749
+ "intent": "collaborative_learning",
750
+ "patterns": [
751
+ "Why is collaborative learning important?",
752
+ "How can studying with others help me?",
753
+ "What are the benefits of study groups?",
754
+ "Can you explain collaborative learning in math?",
755
+ "How do I form a study group?"
756
+ ],
757
+ "responses": [
758
+ "Collaborative learning promotes diverse perspectives and deeper understanding of concepts.",
759
+ "Study groups can motivate you and help clarify difficult topics through discussion.",
760
+ "Working with others can enhance communication skills and encourage teamwork.",
761
+ "Explaining concepts to peers reinforces your own understanding.",
762
+ "To form a study group, gather classmates who are motivated and agree on a schedule and goals."
763
+ ]
764
+ },
765
+
766
+ {
767
+ "intent": "math_computer_science_relation",
768
+ "patterns": [
769
+ "How is mathematics related to computer science?",
770
+ "Why is math important in computer science?",
771
+ "What role does math play in programming?",
772
+ "How does math boost reasoning skills?",
773
+ "Can you explain the connection between math and computer science?"
774
+ ],
775
+ "responses": [
776
+ "Mathematics provides the foundational concepts and techniques used in computer algorithms and data structures.",
777
+ "Understanding discrete mathematics, logic, and set theory is crucial for programming and software development.",
778
+ "Mathematical reasoning enhances problem-solving skills, helping computer scientists to develop efficient solutions.",
779
+ "Statistics and probability are essential for machine learning and data analysis in computer science.",
780
+ "Overall, a strong grasp of math improves analytical thinking, which is vital in both computer science and everyday decision-making."
781
+ ]
782
+ },
783
+
784
+ {
785
+ "intent": "algorithms_and_math",
786
+ "patterns": [
787
+ "What role does math play in algorithms?",
788
+ "How do algorithms use mathematical concepts?",
789
+ "Can you give examples of math in algorithms?",
790
+ "Why are algorithms important in math?",
791
+ "What mathematical principles are used in algorithms?"
792
+ ],
793
+ "responses": [
794
+ "Algorithms often rely on mathematical principles like logic, combinatorics, and number theory to function effectively.",
795
+ "For example, sorting algorithms use mathematical properties to determine the most efficient way to organize data.",
796
+ "Graph theory is a key area of math that supports algorithms used in networking and search engines.",
797
+ "Mathematics helps analyze the efficiency and complexity of algorithms, ensuring optimal performance.",
798
+ "In machine learning, mathematical concepts like optimization and linear algebra are crucial for developing algorithms."
799
+ ]
800
+ },
801
+
802
+ {
803
+ "intent": "data_structures_and_math",
804
+ "patterns": [
805
+ "How do data structures relate to math?",
806
+ "What mathematical concepts are used in data structures?",
807
+ "Can you explain the importance of math in data structures?",
808
+ "How do algorithms and data structures connect?",
809
+ "What is the role of math in optimizing data structures?"
810
+ ],
811
+ "responses": [
812
+ "Data structures like trees, graphs, and arrays are deeply rooted in mathematical concepts.",
813
+ "Understanding set theory and logic is essential for designing efficient data structures.",
814
+ "Math helps in analyzing the space and time complexity of data structures, which is vital for performance.",
815
+ "Effective data manipulation often relies on mathematical operations, such as calculations for balancing trees.",
816
+ "Using mathematical principles, programmers can optimize data structures for better performance and resource management."
817
+ ]
818
+ },
819
+
820
+ {
821
+ "intent": "reasoning_skills",
822
+ "patterns": [
823
+ "How does math improve reasoning skills?",
824
+ "In what ways does math enhance logical thinking?",
825
+ "Can math boost analytical skills?",
826
+ "Why is reasoning important in computer science?",
827
+ "How can I improve my reasoning through math?"
828
+ ],
829
+ "responses": [
830
+ "Math fosters logical thinking by teaching students to construct clear, structured arguments.",
831
+ "Problem-solving in math encourages critical thinking, which is directly applicable to computer science.",
832
+ "Practicing math helps develop a systematic approach to tackling complex problems.",
833
+ "Many computer science concepts, like algorithms, require strong reasoning skills, which are honed through mathematics.",
834
+ "Engaging in mathematical puzzles and problems can enhance your overall analytical abilities."
835
+ ]
836
+ },
837
+
838
+ {
839
+ "intent": "applications_in_computer_science",
840
+ "patterns": [
841
+ "What are math applications in computer science?",
842
+ "How is math used in software development?",
843
+ "Can you give examples of math in computer applications?",
844
+ "Why is math crucial in programming languages?",
845
+ "What math concepts are applied in computer graphics?"
846
+ ],
847
+ "responses": [
848
+ "Math is essential in fields like cryptography, where number theory plays a critical role in security.",
849
+ "In software development, algorithms often require mathematical concepts for efficiency and effectiveness.",
850
+ "Computer graphics heavily rely on linear algebra and geometry to render images and animations.",
851
+ "Machine learning applications depend on statistics and calculus to optimize models and predictions.",
852
+ "Math is also fundamental in data analysis, where it helps interpret and derive insights from data sets."
853
+ ]
854
+ },
855
+
856
+ {
857
+ "intent": "model_info",
858
+ "patterns": [
859
+ "What is your name?",
860
+ "What are you called?",
861
+ "Can you tell me your name?",
862
+ "What model are you?",
863
+ "What is your purpose?"
864
+ ],
865
+ "responses": [
866
+ "I am called Shanks.",
867
+ "My name is Shanks.",
868
+ "I go by the name Shanks.",
869
+ "I am Shanks, designed to analyze symbolic math problems."
870
+ ]
871
+ },
872
+
873
+ {
874
+ "intent": "purpose_info",
875
+ "patterns": [
876
+ "What do you do?",
877
+ "What is your purpose?",
878
+ "How can you help me?",
879
+ "What can you analyze?",
880
+ "Tell me about your capabilities."
881
+ ],
882
+ "responses": [
883
+ "I analyze symbolic math problems and provide thorough explanations.",
884
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
885
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
886
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
887
+ ]
888
+ },
889
+
890
+ {
891
+ "intent": "company_info",
892
+ "patterns": [
893
+ "Tell me about Mandla.ai.",
894
+ "What is Mandla.ai?",
895
+ "Who is behind Mandla.ai?",
896
+ "What does Mandla.ai focus on?",
897
+ "Can you give me info about Mandla.ai?"
898
+ ],
899
+ "responses": [
900
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
901
+ "The person behind Mandla.ai is Motaung Mandla.",
902
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
903
+ ]
904
+ },
905
+
906
+ {
907
+ "intent": "how_it_works",
908
+ "patterns": [
909
+ "How do you work?",
910
+ "How were you built?",
911
+ "What technology do you use?",
912
+ "Can you explain your workings?",
913
+ "How do you analyze problems?"
914
+ ],
915
+ "responses": [
916
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
917
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
918
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
919
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
920
+ ]
921
+ },
922
+
923
+ {
924
+ "intent": "model_inspiration",
925
+ "patterns": [
926
+ "Do you look up to other models?",
927
+ "What other models inspire you?",
928
+ "Are there models you admire?",
929
+ "Who are your role models in AI?",
930
+ "What sophisticated models do you know about?"
931
+ ],
932
+ "responses": [
933
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
934
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
935
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
936
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
937
+ ]
938
+ },
939
+
940
+ {
941
+ "intent": "importance_of_practice",
942
+ "patterns": [
943
+ "Why is it important to practice math?",
944
+ "How do question papers help in math?",
945
+ "What is the benefit of revising math?",
946
+ "Why should I do past papers?",
947
+ "How can I get better at math?"
948
+ ],
949
+ "responses": [
950
+ "Practicing math regularly helps reinforce concepts and improves problem-solving skills.",
951
+ "Question papers provide exposure to different types of problems and help identify areas that need improvement.",
952
+ "Revising math consistently allows you to retain information and gain confidence in your abilities.",
953
+ "Doing past papers can simulate exam conditions and enhance time management skills.",
954
+ "The more you practice, the more proficient you become, making it easier to tackle complex problems."
955
+ ]
956
+ },
957
+
958
+ {
959
+ "intent": "model_info",
960
+ "patterns": [
961
+ "Who created you?",
962
+ "Who made this model?",
963
+ "When was this model created?",
964
+ "Tell me about your creator.",
965
+ "Who is your creator?",
966
+ "What is the origin of this model?",
967
+ "When did you come into existence?"
968
+ ],
969
+ "responses": [
970
+ "I was created by Mandla.ai in 2024.",
971
+ "This model is the creation of Mandla.ai, established in 2024.",
972
+ "I was developed by Mandla.ai in 2024.",
973
+ "The creator of this model is Mandla.ai, and it was launched in 2024."
974
+ ]
975
+ }
976
+ ]
977
+ }
import torch ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import BertTokenizer, BertForSequenceClassification
3
+
4
+ # Load the model
5
+ model = BertForSequenceClassification.from_pretrained("Shanks.pth")
6
+ tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
7
+
8
+ def chat():
9
+ while True:
10
+ user_input = input("You: ")
11
+ if user_input == "quit":
12
+ break
13
+
14
+ inputs = tokenizer(user_input, return_tensors='pt')
15
+ with torch.no_grad():
16
+ outputs = model(**inputs)
17
+ logits = outputs.logits
18
+ predicted_class_id = torch.argmax(logits, dim=-1).item()
19
+
20
+ # Map the predicted class ID to a response
21
+ # Replace this with your actual mapping logic
22
+ response = {0: "Response A", 1: "Response B", 2: "Response C"}[predicted_class_id]
23
+
24
+ print(f"Bot: {response}")
25
+
26
+ if __name__ == "__main__":
27
+ chat()
intents.json ADDED
@@ -0,0 +1,1003 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "intent": "greetings",
3
+ "patterns": [
4
+ "Hello",
5
+ "Hi",
6
+ "Hey",
7
+ "Good morning",
8
+ "Good afternoon",
9
+ "Good evening",
10
+ "What's up?",
11
+ "Howdy",
12
+ "Greetings",
13
+ "Salutations",
14
+ "Yo",
15
+ "Hiya",
16
+ "How's it going?",
17
+ "What's happening?",
18
+ "How are you?",
19
+ "What's new?"
20
+ ],
21
+ "responses": [
22
+ "Hello! How can I assist you today?",
23
+ "Hi there! What would you like to know?",
24
+ "Hey! What’s on your mind?",
25
+ "Good to see you! How can I help?",
26
+ "Greetings! What can I do for you?",
27
+ "Hey! I'm here to help. What’s up?",
28
+ "Hi! What would you like to chat about today?"
29
+ ]
30
+ },
31
+
32
+ {
33
+ "intent": "jokes",
34
+ "patterns": [
35
+ "Tell me a joke",
36
+ "Do you know any jokes?",
37
+ "Make me laugh",
38
+ "Say something funny",
39
+ "Got any jokes?",
40
+ "Can you tell jokes?",
41
+ "Share a joke with me",
42
+ "I want to hear a joke"
43
+ ],
44
+ "responses": [
45
+ "Why did the math book look sad? Because it had too many problems!",
46
+ "Why was the equal sign so humble? It knew it wasn't less than or greater than anyone else.",
47
+ "Why don’t skeletons fight each other? They don’t have the guts!",
48
+ "Why did the scarecrow win an award? Because he was outstanding in his field!",
49
+ "Want to hear a construction joke? Oh wait, I’m still working on it."
50
+ ]
51
+ },
52
+ {
53
+ "intent": "fallback",
54
+ "patterns": [
55
+ "Can you help me with something else?",
56
+ "What about topics outside of math?",
57
+ "I have a different question.",
58
+ "Can you answer anything other than math?",
59
+ "What else can you talk about?"
60
+ ],
61
+ "responses": [
62
+ "I'm primarily focused on math-related topics and solutions, but I'm still learning and improving.",
63
+ "While I specialize in mathematics, I'm continuously evolving and may be able to help with other inquiries in the future.",
64
+ "My expertise lies in math, and I might not have the answer to questions outside that area yet. But feel free to ask!",
65
+ "I appreciate your curiosity! Right now, my strengths are in mathematics, but I'm working on expanding my knowledge.",
66
+ "If your question is about math, I'm here to help! For other topics, I'm still in the learning phase."
67
+ ]
68
+ },
69
+
70
+ {
71
+ "intent": "model_info",
72
+ "patterns": [
73
+ "What is your name?",
74
+ "What are you called?",
75
+ "Can you tell me your name?",
76
+ "What model are you?",
77
+ "What is your purpose?"
78
+ ],
79
+ "responses": [
80
+ "I am called Shanks.",
81
+ "My name is Shanks.",
82
+ "I go by the name Shanks.",
83
+ "I am Shanks, designed to analyze symbolic math problems."
84
+ ]
85
+ },
86
+
87
+ {
88
+ "intent": "purpose_info",
89
+ "patterns": [
90
+ "What do you do?",
91
+ "What is your purpose?",
92
+ "How can you help me?",
93
+ "What can you analyze?",
94
+ "Tell me about your capabilities."
95
+ ],
96
+ "responses": [
97
+ "I analyze symbolic math problems and provide thorough explanations.",
98
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
99
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
100
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
101
+ ]
102
+ },
103
+
104
+ {
105
+ "intent": "goodbyes",
106
+ "patterns": [
107
+ "Goodbye",
108
+ "See you later",
109
+ "Bye",
110
+ "Take care",
111
+ "Farewell",
112
+ "Catch you later",
113
+ "Until next time",
114
+ "Have a great day",
115
+ "See you soon",
116
+ "I'm off"
117
+ ],
118
+ "responses": [
119
+ "Goodbye! Have a great day!",
120
+ "See you later! Take care!",
121
+ "Bye! Feel free to return anytime!",
122
+ "Farewell! Wishing you all the best!",
123
+ "Catch you later! Don’t hesitate to come back!"
124
+ ]
125
+ },
126
+
127
+ {
128
+ "intent": "model_info",
129
+ "patterns": [
130
+ "What is your name?",
131
+ "What are you called?",
132
+ "Can you tell me your name?",
133
+ "What model are you?",
134
+ "What is your purpose?"
135
+ ],
136
+ "responses": [
137
+ "I am called Shanks.",
138
+ "My name is Shanks.",
139
+ "I go by the name Shanks.",
140
+ "I am Shanks, designed to analyze symbolic math problems."
141
+ ]
142
+ },
143
+
144
+ {
145
+ "intent": "purpose_info",
146
+ "patterns": [
147
+ "What do you do?",
148
+ "What is your purpose?",
149
+ "How can you help me?",
150
+ "What can you analyze?",
151
+ "Tell me about your capabilities."
152
+ ],
153
+ "responses": [
154
+ "I analyze symbolic math problems and provide thorough explanations.",
155
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
156
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
157
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
158
+ ]
159
+ },
160
+ {
161
+ "intent": "company_info",
162
+ "patterns": [
163
+ "Tell me about Mandla.ai.",
164
+ "What is Mandla.ai?",
165
+ "Who is behind Mandla.ai?",
166
+ "What does Mandla.ai focus on?",
167
+ "Can you give me info about Mandla.ai?"
168
+ ],
169
+ "responses": [
170
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
171
+ "The person behind Mandla.ai is Motaung Mandla.",
172
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
173
+ ]
174
+ },
175
+
176
+ {
177
+ "intent": "model_info",
178
+ "patterns": [
179
+ "What is your name?",
180
+ "What are you called?",
181
+ "Can you tell me your name?",
182
+ "What model are you?",
183
+ "What is your purpose?"
184
+ ],
185
+ "responses": [
186
+ "I am called Shanks.",
187
+ "My name is Shanks.",
188
+ "I go by the name Shanks.",
189
+ "I am Shanks, designed to analyze symbolic math problems."
190
+ ]
191
+ },
192
+
193
+ {
194
+ "intent": "purpose_info",
195
+ "patterns": [
196
+ "What do you do?",
197
+ "What is your purpose?",
198
+ "How can you help me?",
199
+ "What can you analyze?",
200
+ "Tell me about your capabilities."
201
+ ],
202
+ "responses": [
203
+ "I analyze symbolic math problems and provide thorough explanations.",
204
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
205
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
206
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
207
+ ]
208
+ },
209
+
210
+ {
211
+ "intent": "company_info",
212
+ "patterns": [
213
+ "Tell me about Mandla.ai.",
214
+ "What is Mandla.ai?",
215
+ "Who is behind Mandla.ai?",
216
+ "What does Mandla.ai focus on?",
217
+ "Can you give me info about Mandla.ai?"
218
+ ],
219
+ "responses": [
220
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
221
+ "The person behind Mandla.ai is Motaung Mandla.",
222
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
223
+ ]
224
+ },
225
+
226
+ {
227
+ "intent": "how_it_works",
228
+ "patterns": [
229
+ "How do you work?",
230
+ "How were you built?",
231
+ "What technology do you use?",
232
+ "Can you explain your workings?",
233
+ "How do you analyze problems?"
234
+ ],
235
+ "responses": [
236
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
237
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
238
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
239
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
240
+ ]
241
+ },
242
+
243
+ {
244
+ "intent": "model_info",
245
+ "patterns": [
246
+ "What is your name?",
247
+ "What are you called?",
248
+ "Can you tell me your name?",
249
+ "What model are you?",
250
+ "What is your purpose?"
251
+ ],
252
+ "responses": [
253
+ "I am called Shanks.",
254
+ "My name is Shanks.",
255
+ "I go by the name Shanks.",
256
+ "I am Shanks, designed to analyze symbolic math problems."
257
+ ]
258
+ },
259
+
260
+ {
261
+ "intent": "purpose_info",
262
+ "patterns": [
263
+ "What do you do?",
264
+ "What is your purpose?",
265
+ "How can you help me?",
266
+ "What can you analyze?",
267
+ "Tell me about your capabilities."
268
+ ],
269
+ "responses": [
270
+ "I analyze symbolic math problems and provide thorough explanations.",
271
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
272
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
273
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
274
+ ]
275
+ },
276
+
277
+ {
278
+ "intent": "company_info",
279
+ "patterns": [
280
+ "Tell me about Mandla.ai.",
281
+ "What is Mandla.ai?",
282
+ "Who is behind Mandla.ai?",
283
+ "What does Mandla.ai focus on?",
284
+ "Can you give me info about Mandla.ai?"
285
+ ],
286
+ "responses": [
287
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
288
+ "The person behind Mandla.ai is Motaung Mandla.",
289
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
290
+ ]
291
+ },
292
+
293
+ {
294
+ "intent": "how_it_works",
295
+ "patterns": [
296
+ "How do you work?",
297
+ "How were you built?",
298
+ "What technology do you use?",
299
+ "Can you explain your workings?",
300
+ "How do you analyze problems?"
301
+ ],
302
+ "responses": [
303
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
304
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
305
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
306
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
307
+ ]
308
+ },
309
+
310
+ {
311
+ "intent": "model_inspiration",
312
+ "patterns": [
313
+ "Do you look up to other models?",
314
+ "What other models inspire you?",
315
+ "Are there models you admire?",
316
+ "Who are your role models in AI?",
317
+ "What sophisticated models do you know about?"
318
+ ],
319
+ "responses": [
320
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
321
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
322
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
323
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
324
+ ]
325
+ },
326
+
327
+ {
328
+ "intent": "model_info",
329
+ "patterns": [
330
+ "What is your name?",
331
+ "What are you called?",
332
+ "Can you tell me your name?",
333
+ "What model are you?",
334
+ "What is your purpose?"
335
+ ],
336
+ "responses": [
337
+ "I am called Shanks.",
338
+ "My name is Shanks.",
339
+ "I go by the name Shanks.",
340
+ "I am Shanks, designed to analyze symbolic math problems."
341
+ ]
342
+ },
343
+
344
+ {
345
+ "intent": "purpose_info",
346
+ "patterns": [
347
+ "What do you do?",
348
+ "What is your purpose?",
349
+ "How can you help me?",
350
+ "What can you analyze?",
351
+ "Tell me about your capabilities."
352
+ ],
353
+ "responses": [
354
+ "I analyze symbolic math problems and provide thorough explanations.",
355
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
356
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
357
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
358
+ ]
359
+ },
360
+
361
+ {
362
+ "intent": "company_info",
363
+ "patterns": [
364
+ "Tell me about Mandla.ai.",
365
+ "What is Mandla.ai?",
366
+ "Who is behind Mandla.ai?",
367
+ "What does Mandla.ai focus on?",
368
+ "Can you give me info about Mandla.ai?"
369
+ ],
370
+ "responses": [
371
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
372
+ "The person behind Mandla.ai is Motaung Mandla.",
373
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
374
+ ]
375
+ },
376
+
377
+ {
378
+ "intent": "how_it_works",
379
+ "patterns": [
380
+ "How do you work?",
381
+ "How were you built?",
382
+ "What technology do you use?",
383
+ "Can you explain your workings?",
384
+ "How do you analyze problems?"
385
+ ],
386
+ "responses": [
387
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
388
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
389
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
390
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
391
+ ]
392
+ },
393
+
394
+ {
395
+ "intent": "model_inspiration",
396
+ "patterns": [
397
+ "Do you look up to other models?",
398
+ "What other models inspire you?",
399
+ "Are there models you admire?",
400
+ "Who are your role models in AI?",
401
+ "What sophisticated models do you know about?"
402
+ ],
403
+ "responses": [
404
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
405
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
406
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
407
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
408
+ ]
409
+ },
410
+
411
+ {
412
+ "intent": "calculus_info",
413
+ "patterns": [
414
+ "What is calculus?",
415
+ "Tell me about calculus.",
416
+ "What are the main concepts of calculus?",
417
+ "How is calculus used?",
418
+ "What are applications of calculus?"
419
+ ],
420
+ "responses": [
421
+ "Calculus is a branch of mathematics that studies continuous change, primarily through derivatives and integrals.",
422
+ "It consists of two main concepts: differentiation, which deals with rates of change, and integration, which focuses on accumulation.",
423
+ "Calculus has applications in physics, engineering, economics, biology, and many other fields.",
424
+ "It's used to model dynamic systems, optimize functions, and solve problems involving motion and area."
425
+ ]
426
+ },
427
+
428
+ {
429
+ "intent": "linear_algebra_info",
430
+ "patterns": [
431
+ "What is linear algebra?",
432
+ "Tell me about linear algebra.",
433
+ "What are the main concepts of linear algebra?",
434
+ "How is linear algebra used?",
435
+ "What are applications of linear algebra?"
436
+ ],
437
+ "responses": [
438
+ "Linear algebra is a branch of mathematics that deals with vectors, vector spaces, and linear transformations.",
439
+ "It includes concepts such as matrices, determinants, eigenvalues, and eigenvectors.",
440
+ "Linear algebra is widely used in computer science, engineering, physics, and economics.",
441
+ "Applications include solving systems of linear equations, computer graphics, and machine learning algorithms."
442
+ ]
443
+ },
444
+
445
+ {
446
+ "intent": "model_info",
447
+ "patterns": [
448
+ "What is your name?",
449
+ "What are you called?",
450
+ "Can you tell me your name?",
451
+ "What model are you?",
452
+ "What is your purpose?"
453
+ ],
454
+ "responses": [
455
+ "I am called Shanks.",
456
+ "My name is Shanks.",
457
+ "I go by the name Shanks.",
458
+ "I am Shanks, designed to analyze symbolic math problems."
459
+ ]
460
+ },
461
+
462
+ {
463
+ "intent": "purpose_info",
464
+ "patterns": [
465
+ "What do you do?",
466
+ "What is your purpose?",
467
+ "How can you help me?",
468
+ "What can you analyze?",
469
+ "Tell me about your capabilities."
470
+ ],
471
+ "responses": [
472
+ "I analyze symbolic math problems and provide thorough explanations.",
473
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
474
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
475
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
476
+ ]
477
+ },
478
+
479
+ {
480
+ "intent": "company_info",
481
+ "patterns": [
482
+ "Tell me about Mandla.ai.",
483
+ "What is Mandla.ai?",
484
+ "Who is behind Mandla.ai?",
485
+ "What does Mandla.ai focus on?",
486
+ "Can you give me info about Mandla.ai?"
487
+ ],
488
+ "responses": [
489
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
490
+ "The person behind Mandla.ai is Motaung Mandla.",
491
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
492
+ ]
493
+ },
494
+
495
+ {
496
+ "intent": "how_it_works",
497
+ "patterns": [
498
+ "How do you work?",
499
+ "How were you built?",
500
+ "What technology do you use?",
501
+ "Can you explain your workings?",
502
+ "How do you analyze problems?"
503
+ ],
504
+ "responses": [
505
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
506
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
507
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
508
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
509
+ ]
510
+ },
511
+
512
+ {
513
+ "intent": "model_inspiration",
514
+ "patterns": [
515
+ "Do you look up to other models?",
516
+ "What other models inspire you?",
517
+ "Are there models you admire?",
518
+ "Who are your role models in AI?",
519
+ "What sophisticated models do you know about?"
520
+ ],
521
+ "responses": [
522
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
523
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
524
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
525
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
526
+ ]
527
+ },
528
+
529
+ {
530
+ "intent": "differential_equations_info",
531
+ "patterns": [
532
+ "What are differential equations?",
533
+ "Tell me about types of differential equations.",
534
+ "What techniques are used to solve differential equations?",
535
+ "How can we transform equations for solving?",
536
+ "What are Bernoulli and exact equations?"
537
+ ],
538
+ "responses": [
539
+ "Differential equations are equations that relate a function with its derivatives, describing how a quantity changes over time or space.",
540
+ "Types include ordinary differential equations (ODEs) and partial differential equations (PDEs).",
541
+ "Techniques for solving include separation of variables, integrating factors, and characteristic equations.",
542
+ "Bernoulli equations can be transformed into linear equations, while exact equations require the use of a potential function.",
543
+ "Homogeneous equations can often be solved using substitution methods to simplify the variables involved."
544
+ ]
545
+ },
546
+
547
+ {
548
+ "intent": "integral_equations_info",
549
+ "patterns": [
550
+ "What are integral equations?",
551
+ "How are integral equations different from differential equations?",
552
+ "What are the types of integral equations?",
553
+ "How do we solve integral equations?",
554
+ "Can you explain some techniques for integral equations?"
555
+ ],
556
+ "responses": [
557
+ "Integral equations involve an unknown function under an integral sign and can often be derived from differential equations.",
558
+ "They can be classified into types such as Volterra and Fredholm equations.",
559
+ "Solving integral equations often involves techniques like the method of successive approximations and transformation into differential equations.",
560
+ "Various numerical methods can also be applied for approximating solutions to integral equations."
561
+ ]
562
+ },
563
+
564
+ {
565
+ "intent": "model_info",
566
+ "patterns": [
567
+ "What is your name?",
568
+ "What are you called?",
569
+ "Can you tell me your name?",
570
+ "What model are you?",
571
+ "What is your purpose?"
572
+ ],
573
+ "responses": [
574
+ "I am called Shanks.",
575
+ "My name is Shanks.",
576
+ "I go by the name Shanks.",
577
+ "I am Shanks, designed to analyze symbolic math problems."
578
+ ]
579
+ },
580
+
581
+ {
582
+ "intent": "purpose_info",
583
+ "patterns": [
584
+ "What do you do?",
585
+ "What is your purpose?",
586
+ "How can you help me?",
587
+ "What can you analyze?",
588
+ "Tell me about your capabilities."
589
+ ],
590
+ "responses": [
591
+ "I analyze symbolic math problems and provide thorough explanations.",
592
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
593
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
594
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
595
+ ]
596
+ },
597
+
598
+ {
599
+ "intent": "company_info",
600
+ "patterns": [
601
+ "Tell me about Mandla.ai.",
602
+ "What is Mandla.ai?",
603
+ "Who is behind Mandla.ai?",
604
+ "What does Mandla.ai focus on?",
605
+ "Can you give me info about Mandla.ai?"
606
+ ],
607
+ "responses": [
608
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
609
+ "The person behind Mandla.ai is Motaung Mandla.",
610
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
611
+ ]
612
+ },
613
+
614
+ {
615
+ "intent": "how_it_works",
616
+ "patterns": [
617
+ "How do you work?",
618
+ "How were you built?",
619
+ "What technology do you use?",
620
+ "Can you explain your workings?",
621
+ "How do you analyze problems?"
622
+ ],
623
+ "responses": [
624
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
625
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
626
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
627
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
628
+ ]
629
+ },
630
+
631
+ {
632
+ "intent": "model_inspiration",
633
+ "patterns": [
634
+ "Do you look up to other models?",
635
+ "What other models inspire you?",
636
+ "Are there models you admire?",
637
+ "Who are your role models in AI?",
638
+ "What sophisticated models do you know about?"
639
+ ],
640
+ "responses": [
641
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
642
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
643
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
644
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
645
+ ]
646
+ },
647
+
648
+ {
649
+ "intent": "importance_of_practice",
650
+ "patterns": [
651
+ "Why is it important to practice math?",
652
+ "How do question papers help in math?",
653
+ "What is the benefit of revising math?",
654
+ "Why should I do past papers?",
655
+ "How can I get better at math?"
656
+ ],
657
+ "responses": [
658
+ "Practicing math regularly helps reinforce concepts and improves problem-solving skills.",
659
+ "Question papers provide exposure to different types of problems and help identify areas that need improvement.",
660
+ "Revising math consistently allows you to retain information and gain confidence in your abilities.",
661
+ "Doing past papers can simulate exam conditions and enhance time management skills.",
662
+ "The more you practice, the more proficient you become, making it easier to tackle complex problems."
663
+ ]
664
+ },
665
+
666
+ {
667
+ "intent": "nul_info",
668
+ "patterns": [
669
+ "Tell me about the National University of Lesotho.",
670
+ "What is NUL?",
671
+ "Can you give me information about NUL?",
672
+ "What programs does NUL offer?",
673
+ "How is the education at NUL?"
674
+ ],
675
+ "responses": [
676
+ "The National University of Lesotho (NUL) is a premier institution of higher learning located in Lesotho.",
677
+ "NUL offers a variety of undergraduate and postgraduate programs across multiple disciplines.",
678
+ "The university aims to provide quality education, research opportunities, and community engagement.",
679
+ "Students at NUL benefit from a vibrant academic environment and various extracurricular activities.",
680
+ "NUL plays a key role in the development of Lesotho by producing skilled professionals."
681
+ ]
682
+ },
683
+
684
+ {
685
+ "intent": "study_techniques",
686
+ "patterns": [
687
+ "What are effective study techniques?",
688
+ "How can I study math effectively?",
689
+ "What strategies can help me learn math?",
690
+ "How do I retain math concepts?",
691
+ "Can you suggest study methods?"
692
+ ],
693
+ "responses": [
694
+ "Techniques like spaced repetition and active recall can enhance retention.",
695
+ "Creating summaries and concept maps can help visualize relationships between topics.",
696
+ "Practice problems and quizzes are effective for reinforcing learning.",
697
+ "Forming study groups can provide support and diverse perspectives on problem-solving.",
698
+ "Setting specific goals and breaking study sessions into manageable chunks can improve focus."
699
+ ]
700
+ },
701
+
702
+ {
703
+ "intent": "math_resources",
704
+ "patterns": [
705
+ "What resources can help me study math?",
706
+ "Can you recommend math textbooks?",
707
+ "Are there online tools for learning math?",
708
+ "What websites are good for math practice?",
709
+ "Where can I find math study materials?"
710
+ ],
711
+ "responses": [
712
+ "Websites like Khan Academy and Coursera offer great math courses and resources.",
713
+ "Textbooks such as 'Calculus' by James Stewart and 'Linear Algebra' by Gilbert Strang are widely recommended.",
714
+ "Online forums like Stack Exchange can help with specific questions and concepts.",
715
+ "YouTube channels like 3Blue1Brown provide visual explanations of complex topics.",
716
+ "Math software like GeoGebra can help visualize and explore mathematical concepts interactively."
717
+ ]
718
+ },
719
+
720
+ {
721
+ "intent": "career_opportunities",
722
+ "patterns": [
723
+ "What are career opportunities for math students?",
724
+ "How can I use my math degree?",
725
+ "What fields can I enter with a math background?",
726
+ "Can you suggest careers related to math?",
727
+ "What jobs require math skills?"
728
+ ],
729
+ "responses": [
730
+ "Careers in engineering, finance, data science, and education are great options for math students.",
731
+ "Mathematicians can work in research, actuarial science, statistics, and operations research.",
732
+ "Fields like computer science and information technology often require strong math skills.",
733
+ "Mathematics is also valuable in healthcare, economics, and environmental science.",
734
+ "Pursuing further studies can open doors to specialized careers in academia or industry."
735
+ ]
736
+ },
737
+
738
+ {
739
+ "intent": "common_math_misconceptions",
740
+ "patterns": [
741
+ "What are common math misconceptions?",
742
+ "How can I overcome math misunderstandings?",
743
+ "What mistakes do students often make in math?",
744
+ "Can you explain a common math error?",
745
+ "Why do students struggle with math?"
746
+ ],
747
+ "responses": [
748
+ "Many students believe that math is only for 'naturals,' but anyone can learn it with practice.",
749
+ "A common misconception is that memorization alone is enough; understanding concepts is crucial.",
750
+ "Students often struggle with word problems due to a lack of strategy in translating words to equations.",
751
+ "Another mistake is assuming that if they understand one concept, they can skip practice on others.",
752
+ "Addressing these misconceptions through practice and support can boost confidence and performance."
753
+ ]
754
+ },
755
+
756
+ {
757
+ "intent": "math_competitions",
758
+ "patterns": [
759
+ "What math competitions can I participate in?",
760
+ "How can math competitions improve my skills?",
761
+ "Are there benefits to joining math contests?",
762
+ "What are some famous math competitions?",
763
+ "Can you suggest competitions for students?"
764
+ ],
765
+ "responses": [
766
+ "Participating in competitions like the AMC, Math Olympiad, and local contests can enhance problem-solving skills.",
767
+ "These events foster critical thinking and expose you to challenging problems.",
768
+ "They can also provide networking opportunities with peers and professionals in the field.",
769
+ "Many universities look favorably on competition experience when evaluating applicants.",
770
+ "Competitions can be a fun way to challenge yourself and see your progress in math."
771
+ ]
772
+ },
773
+
774
+ {
775
+ "intent": "collaborative_learning",
776
+ "patterns": [
777
+ "Why is collaborative learning important?",
778
+ "How can studying with others help me?",
779
+ "What are the benefits of study groups?",
780
+ "Can you explain collaborative learning in math?",
781
+ "How do I form a study group?"
782
+ ],
783
+ "responses": [
784
+ "Collaborative learning promotes diverse perspectives and deeper understanding of concepts.",
785
+ "Study groups can motivate you and help clarify difficult topics through discussion.",
786
+ "Working with others can enhance communication skills and encourage teamwork.",
787
+ "Explaining concepts to peers reinforces your own understanding.",
788
+ "To form a study group, gather classmates who are motivated and agree on a schedule and goals."
789
+ ]
790
+ },
791
+
792
+ {
793
+ "intent": "math_computer_science_relation",
794
+ "patterns": [
795
+ "How is mathematics related to computer science?",
796
+ "Why is math important in computer science?",
797
+ "What role does math play in programming?",
798
+ "How does math boost reasoning skills?",
799
+ "Can you explain the connection between math and computer science?"
800
+ ],
801
+ "responses": [
802
+ "Mathematics provides the foundational concepts and techniques used in computer algorithms and data structures.",
803
+ "Understanding discrete mathematics, logic, and set theory is crucial for programming and software development.",
804
+ "Mathematical reasoning enhances problem-solving skills, helping computer scientists to develop efficient solutions.",
805
+ "Statistics and probability are essential for machine learning and data analysis in computer science.",
806
+ "Overall, a strong grasp of math improves analytical thinking, which is vital in both computer science and everyday decision-making."
807
+ ]
808
+ },
809
+
810
+ {
811
+ "intent": "algorithms_and_math",
812
+ "patterns": [
813
+ "What role does math play in algorithms?",
814
+ "How do algorithms use mathematical concepts?",
815
+ "Can you give examples of math in algorithms?",
816
+ "Why are algorithms important in math?",
817
+ "What mathematical principles are used in algorithms?"
818
+ ],
819
+ "responses": [
820
+ "Algorithms often rely on mathematical principles like logic, combinatorics, and number theory to function effectively.",
821
+ "For example, sorting algorithms use mathematical properties to determine the most efficient way to organize data.",
822
+ "Graph theory is a key area of math that supports algorithms used in networking and search engines.",
823
+ "Mathematics helps analyze the efficiency and complexity of algorithms, ensuring optimal performance.",
824
+ "In machine learning, mathematical concepts like optimization and linear algebra are crucial for developing algorithms."
825
+ ]
826
+ },
827
+
828
+ {
829
+ "intent": "data_structures_and_math",
830
+ "patterns": [
831
+ "How do data structures relate to math?",
832
+ "What mathematical concepts are used in data structures?",
833
+ "Can you explain the importance of math in data structures?",
834
+ "How do algorithms and data structures connect?",
835
+ "What is the role of math in optimizing data structures?"
836
+ ],
837
+ "responses": [
838
+ "Data structures like trees, graphs, and arrays are deeply rooted in mathematical concepts.",
839
+ "Understanding set theory and logic is essential for designing efficient data structures.",
840
+ "Math helps in analyzing the space and time complexity of data structures, which is vital for performance.",
841
+ "Effective data manipulation often relies on mathematical operations, such as calculations for balancing trees.",
842
+ "Using mathematical principles, programmers can optimize data structures for better performance and resource management."
843
+ ]
844
+ },
845
+
846
+ {
847
+ "intent": "reasoning_skills",
848
+ "patterns": [
849
+ "How does math improve reasoning skills?",
850
+ "In what ways does math enhance logical thinking?",
851
+ "Can math boost analytical skills?",
852
+ "Why is reasoning important in computer science?",
853
+ "How can I improve my reasoning through math?"
854
+ ],
855
+ "responses": [
856
+ "Math fosters logical thinking by teaching students to construct clear, structured arguments.",
857
+ "Problem-solving in math encourages critical thinking, which is directly applicable to computer science.",
858
+ "Practicing math helps develop a systematic approach to tackling complex problems.",
859
+ "Many computer science concepts, like algorithms, require strong reasoning skills, which are honed through mathematics.",
860
+ "Engaging in mathematical puzzles and problems can enhance your overall analytical abilities."
861
+ ]
862
+ },
863
+
864
+ {
865
+ "intent": "applications_in_computer_science",
866
+ "patterns": [
867
+ "What are math applications in computer science?",
868
+ "How is math used in software development?",
869
+ "Can you give examples of math in computer applications?",
870
+ "Why is math crucial in programming languages?",
871
+ "What math concepts are applied in computer graphics?"
872
+ ],
873
+ "responses": [
874
+ "Math is essential in fields like cryptography, where number theory plays a critical role in security.",
875
+ "In software development, algorithms often require mathematical concepts for efficiency and effectiveness.",
876
+ "Computer graphics heavily rely on linear algebra and geometry to render images and animations.",
877
+ "Machine learning applications depend on statistics and calculus to optimize models and predictions.",
878
+ "Math is also fundamental in data analysis, where it helps interpret and derive insights from data sets."
879
+ ]
880
+ },
881
+
882
+ {
883
+ "intent": "model_info",
884
+ "patterns": [
885
+ "What is your name?",
886
+ "What are you called?",
887
+ "Can you tell me your name?",
888
+ "What model are you?",
889
+ "What is your purpose?"
890
+ ],
891
+ "responses": [
892
+ "I am called Shanks.",
893
+ "My name is Shanks.",
894
+ "I go by the name Shanks.",
895
+ "I am Shanks, designed to analyze symbolic math problems."
896
+ ]
897
+ },
898
+
899
+ {
900
+ "intent": "purpose_info",
901
+ "patterns": [
902
+ "What do you do?",
903
+ "What is your purpose?",
904
+ "How can you help me?",
905
+ "What can you analyze?",
906
+ "Tell me about your capabilities."
907
+ ],
908
+ "responses": [
909
+ "I analyze symbolic math problems and provide thorough explanations.",
910
+ "My primary purpose is to assist with symbolic math analysis and explanations.",
911
+ "I can help you analyze symbolic math problems and explain the solutions in detail.",
912
+ "I focus on analyzing and explaining symbolic math problems thoroughly."
913
+ ]
914
+ },
915
+
916
+ {
917
+ "intent": "company_info",
918
+ "patterns": [
919
+ "Tell me about Mandla.ai.",
920
+ "What is Mandla.ai?",
921
+ "Who is behind Mandla.ai?",
922
+ "What does Mandla.ai focus on?",
923
+ "Can you give me info about Mandla.ai?"
924
+ ],
925
+ "responses": [
926
+ "Mandla.ai is a fresh AI startup focused on the intersection of NLP, Deep Learning, and computer vision.",
927
+ "The person behind Mandla.ai is Motaung Mandla.",
928
+ "For more information about Motaung Mandla, you can visit [this link](https://motaungmandla.github.io)."
929
+ ]
930
+ },
931
+
932
+ {
933
+ "intent": "how_it_works",
934
+ "patterns": [
935
+ "How do you work?",
936
+ "How were you built?",
937
+ "What technology do you use?",
938
+ "Can you explain your workings?",
939
+ "How do you analyze problems?"
940
+ ],
941
+ "responses": [
942
+ "I use natural language processing techniques to understand your questions and analyze symbolic math problems.",
943
+ "I am built using advanced algorithms that enable me to interpret and explain mathematical concepts.",
944
+ "My architecture is based on deep learning models that allow me to learn from data and provide accurate responses.",
945
+ "I leverage a combination of machine learning and mathematical frameworks to provide detailed explanations."
946
+ ]
947
+ },
948
+
949
+ {
950
+ "intent": "model_inspiration",
951
+ "patterns": [
952
+ "Do you look up to other models?",
953
+ "What other models inspire you?",
954
+ "Are there models you admire?",
955
+ "Who are your role models in AI?",
956
+ "What sophisticated models do you know about?"
957
+ ],
958
+ "responses": [
959
+ "Yes, I look up to advanced models like GPT-3 and BERT for their capabilities in understanding and generating language.",
960
+ "I admire models that excel in tasks like image recognition and natural language understanding.",
961
+ "Models like DALL-E and CLIP inspire me with their innovative approaches to multimodal understanding.",
962
+ "I learn from sophisticated architectures that push the boundaries of what AI can achieve."
963
+ ]
964
+ },
965
+
966
+ {
967
+ "intent": "importance_of_practice",
968
+ "patterns": [
969
+ "Why is it important to practice math?",
970
+ "How do question papers help in math?",
971
+ "What is the benefit of revising math?",
972
+ "Why should I do past papers?",
973
+ "How can I get better at math?"
974
+ ],
975
+ "responses": [
976
+ "Practicing math regularly helps reinforce concepts and improves problem-solving skills.",
977
+ "Question papers provide exposure to different types of problems and help identify areas that need improvement.",
978
+ "Revising math consistently allows you to retain information and gain confidence in your abilities.",
979
+ "Doing past papers can simulate exam conditions and enhance time management skills.",
980
+ "The more you practice, the more proficient you become, making it easier to tackle complex problems."
981
+ ]
982
+ },
983
+
984
+ {
985
+ "intent": "model_info",
986
+ "patterns": [
987
+ "Who created you?",
988
+ "Who made this model?",
989
+ "When was this model created?",
990
+ "Tell me about your creator.",
991
+ "Who is your creator?",
992
+ "What is the origin of this model?",
993
+ "When did you come into existence?"
994
+ ],
995
+ "responses": [
996
+ "I was created by Mandla.ai in 2024.",
997
+ "This model is the creation of Mandla.ai, established in 2024.",
998
+ "I was developed by Mandla.ai in 2024.",
999
+ "The creator of this model is Mandla.ai, and it was launched in 2024."
1000
+ ]
1001
+ }
1002
+ ]
1003
+ }
main.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request, jsonify
2
+ import sympy as sm
3
+ import re
4
+ import torch
5
+ import torch.nn as nn
6
+ import torch.nn.functional as F
7
+ import json
8
+ import numpy as np
9
+ from sklearn.preprocessing import LabelEncoder
10
+ from sklearn.feature_extraction.text import CountVectorizer
11
+
12
+ # Existing code setup
13
+ app = Flask(__name__)
14
+ x, y, z = sm.symbols('x y z')
15
+
16
+ @app.route('/', methods=['GET', 'POST'])
17
+ def index():
18
+ result = None
19
+ expression = ''
20
+ operation = ''
21
+ latex_result = ''
22
+
23
+ if request.method == 'POST':
24
+ expression = request.form['expression']
25
+ operation = request.form['operation']
26
+
27
+ # Replace e**x with exp(x) to make sure SymPy interprets it correctly
28
+ expression = re.sub(r'e\*\*([a-zA-Z0-9_]+)', r'exp(\1)', expression)
29
+
30
+ # Insert an asterisk between numbers and letters using regex
31
+ expression = re.sub(r'(\d)([a-zA-Z])', r'\1*\2', expression)
32
+
33
+ try:
34
+ expr = sm.sympify(expression)
35
+ if operation == 'diff':
36
+ result = sm.diff(expr, x)
37
+ elif operation == 'expand':
38
+ result = sm.expand(expr)
39
+ elif operation == 'solve':
40
+ result = sm.solve(expr, x)
41
+ elif operation == 'simplify':
42
+ result = sm.simplify(expr)
43
+ elif operation == 'factorize':
44
+ result = sm.factorize(expr)
45
+ elif operation == 'rationalize':
46
+ result = sm.rationalize(expr)
47
+ elif operation == 'diffx':
48
+ result = sm.diff(expr, x)
49
+ elif operation == 'diffy':
50
+ result = sm.diff(expr, y)
51
+ elif operation == 'diffz':
52
+ result = sm.diff(expr, z)
53
+ elif operation == 'integratex':
54
+ # Perform the integration
55
+ integral_result = sm.integrate(expr, x)
56
+ # Format the result with C after the variables (if not empty)
57
+ if integral_result != 0:
58
+ result = sm.sympify(f"{integral_result} + C")
59
+ else:
60
+ result = "C" # If the integral is zero, just return C
61
+ elif operation == 'integratey':
62
+ integral_result = sm.integrate(expr, y)
63
+ if integral_result != 0:
64
+ result = sm.sympify(f"{integral_result} + C")
65
+ else:
66
+ result = "C"
67
+ elif operation == 'integratez':
68
+ integral_result = sm.integrate(expr, z)
69
+ if integral_result != 0:
70
+ result = sm.sympify(f"{integral_result} + C")
71
+ else:
72
+ result = "C"
73
+
74
+ latex_result = sm.latex(result)
75
+
76
+ except Exception as e:
77
+ result = f"Error: {str(e)}"
78
+ latex_result = None
79
+
80
+ return render_template('index.html', result=result, expression=expression, latex_result=latex_result)
81
+
82
+ # Chatbot integration
83
+
84
+ # Define the model class
85
+ class ChatModel(nn.Module):
86
+ def __init__(self, input_size, hidden_size, output_size):
87
+ super(ChatModel, self).__init__()
88
+ self.hidden_size = hidden_size
89
+ self.fc1 = nn.Linear(input_size, hidden_size)
90
+ self.fc2 = nn.Linear(hidden_size, output_size)
91
+
92
+ def forward(self, x):
93
+ x = F.relu(self.fc1(x))
94
+ x = self.fc2(x)
95
+ return x
96
+
97
+ # Load JSON data
98
+ with open('intents.json', 'r') as file:
99
+ data = json.load(file)
100
+
101
+ # Extract patterns and labels
102
+ patterns = []
103
+ labels = []
104
+ for intent in data['intents']:
105
+ for pattern in intent['patterns']:
106
+ patterns.append(pattern)
107
+ labels.append(intent['intent'])
108
+
109
+ # Tokenize patterns
110
+ vectorizer = CountVectorizer()
111
+ X = vectorizer.fit_transform(patterns).toarray()
112
+
113
+ # Encode labels
114
+ label_encoder = LabelEncoder()
115
+ label_encoder.fit(labels)
116
+
117
+ # Set model parameters
118
+ input_size = X.shape[1]
119
+ hidden_size = 8
120
+ output_size = len(set(labels))
121
+
122
+ # Load the model
123
+ model = ChatModel(input_size, hidden_size, output_size)
124
+ model.load_state_dict(torch.load('Shanks.pth'))
125
+ model.eval()
126
+
127
+ def get_response(message):
128
+ message_vector = vectorizer.transform([message]).toarray()
129
+ message_tensor = torch.tensor(message_vector, dtype=torch.float32)
130
+ output = model(message_tensor)
131
+ _, predicted = torch.max(output, 1)
132
+ intent = label_encoder.inverse_transform(predicted.numpy())[0]
133
+
134
+ for intent_data in data['intents']:
135
+ if intent_data['intent'] == intent:
136
+ response = np.random.choice(intent_data['responses'])
137
+ return response
138
+
139
+ @app.route('/chat', methods=['POST'])
140
+ def chat():
141
+ user_message = request.json['message']
142
+ response = get_response(user_message)
143
+ return jsonify({'response': response})
modelloading.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ model = BertForSequenceClassification.from_pretrained('bert-base-uncased', num_labels=len(label_encoder))
2
+ model.load_state_dict(torch.load('Shanks.pth'))
3
+ model.to(device)
requirements.txt ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ blinker==1.9.0
2
+ click==8.1.8
3
+ colorama==0.4.6
4
+ filelock==3.16.1
5
+ Flask==3.1.0
6
+ fsspec==2024.12.0
7
+ itsdangerous==2.2.0
8
+ Jinja2==3.1.5
9
+ MarkupSafe==3.0.2
10
+ mpmath==1.3.0
11
+ networkx==3.4.2
12
+ setuptools==75.8.0
13
+ sympy==1.13.1
14
+ torch==2.5.1
15
+ typing_extensions==4.12.2
16
+ Werkzeug==3.1.3
templates/favicon.ico ADDED
templates/feet.css ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* General Footer Styling */
2
+ #my-universal-footer {
3
+ bottom: 0%;
4
+ overflow-y: scroll;
5
+ position: relative;
6
+ background-color: #333; /* Dark background for footer */
7
+ color: white; /* White text for contrast */
8
+ padding: 1px 0; /* Padding around the footer */
9
+ }
10
+
11
+ #my-universal-footer .row {
12
+ display: flex; /* Flexbox for columns */
13
+ justify-content: space-between; /* Space between columns */
14
+ flex-wrap: wrap; /* Wrap columns on smaller screens */
15
+ max-width: 1200px; /* Limit the width of the footer */
16
+ margin: 0 auto; /* Center the footer */
17
+ }
18
+
19
+ #my-universal-footer .col {
20
+ flex: 1; /* Each column takes equal space */
21
+ margin: 10px; /* Margin between columns */
22
+ min-width: 200px; /* Minimum width for each column */
23
+ }
24
+
25
+ #my-universal-footer .col h3 {
26
+ margin-bottom: 15px; /* Space below headings */
27
+ font-size: 18px; /* Font size for headings */
28
+ color: #ffd700; /* Gold color for headings */
29
+ }
30
+
31
+ #my-universal-footer .col p, footer .col ul, #my-universal-footer .col form {
32
+ font-size: 14px; /* Font size for text */
33
+ line-height: 1.6; /* Line height for readability */
34
+ color: #ccc; /* Light gray color for text */
35
+ }
36
+
37
+ #my-universal-footer .col ul {
38
+ list-style: none; /* Remove bullet points */
39
+ padding: 0; /* Remove padding */
40
+ }
41
+
42
+ #my-universal-footer .col ul li {
43
+ margin-bottom: 10px; /* Space between list items */
44
+ }
45
+
46
+ #my-universal-footer .col ul li a {
47
+ color: #ffd700; /* Gold color for links */
48
+ text-decoration: none; /* Remove underline from links */
49
+ }
50
+
51
+ #my-universal-footer .col ul li a:hover {
52
+ text-decoration: underline; /* Underline links on hover */
53
+ }
54
+
55
+ #my-universal-footer .col .social-icons i {
56
+ margin: 10px 5px; /* Margin around social icons */
57
+ font-size: 18px; /* Font size for icons */
58
+ color: #ffd700; /* Gold color for icons */
59
+ cursor: pointer; /* Pointer cursor on hover */
60
+ }
61
+
62
+ #my-universal-footer .col .social-icons i:hover {
63
+ color: #fff; /* White color on hover */
64
+ }
65
+
66
+ #my-universal-footer .col form input[type="email"] {
67
+ padding: 8px; /* Padding inside input field */
68
+ border: none; /* Remove border */
69
+ border-radius: 5px; /* Rounded corners */
70
+ margin-right: 10px; /* Space between input and button */
71
+ }
72
+
73
+ #my-universal-footer .col form button {
74
+ background-color: #ffd700; /* Gold background for button */
75
+ border: none; /* Remove border */
76
+ padding: 8px 15px; /* Padding inside button */
77
+ color: #333; /* Dark text color */
78
+ border-radius: 5px; /* Rounded corners */
79
+ cursor: pointer; /* Pointer cursor on hover */
80
+ }
81
+
82
+ #my-universal-footer .col form button:hover {
83
+ background-color: #fff; /* White background on hover */
84
+ color: #333; /* Dark text color on hover */
85
+ }
86
+
87
+ #my-universal-footer .col .logo {
88
+ margin-bottom: 15px; /* Space below logo */
89
+ border-radius: 50%; /* Circular logo */
90
+ }
91
+
92
+ #my-universal-footer hr {
93
+ border-top: 1px solid #ccc; /* Light gray border */
94
+ margin: 20px 0; /* Space around the horizontal rule */
95
+ }
96
+
97
+ .foo {
98
+ text-align: center; /* Center the copyright text */
99
+ color: #ccc; /* Light gray text color */
100
+ font-size: 14px; /* Smaller font size */
101
+ margin-top: 10px; /* Space above the copyright text */
102
+ }
templates/index.html ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <link rel="icon" href="favicon.ico" type="image/x-icon">
7
+ <title>Algebraic Solutions</title>
8
+ <link rel="stylesheet" type="text/css" href="feet.css">
9
+ <style>
10
+ /* Reset */
11
+ * {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ /* Basic body styles */
18
+ body {
19
+ font-family: Arial, sans-serif;
20
+ background-color: #f4f4f9;
21
+ display: flex;
22
+ flex-direction: column;
23
+ min-height: 100vh;
24
+ margin: 0;
25
+ }
26
+
27
+ /* Main container */
28
+ .container {
29
+ background-color: #ffffff;
30
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
31
+ border-radius: 8px;
32
+ padding: 20px;
33
+ max-width: 600px;
34
+ width: 90%;
35
+ margin: 20px auto;
36
+ flex: 1;
37
+ overflow-y: auto;
38
+ }
39
+
40
+ h1 {
41
+ color: #333333;
42
+ margin-bottom: 20px;
43
+ text-align: center;
44
+ }
45
+
46
+ form {
47
+ display: flex;
48
+ flex-wrap: wrap;
49
+ gap: 10px;
50
+ justify-content: center;
51
+ }
52
+
53
+ input[type="text"] {
54
+ padding: 8px;
55
+ font-size: 16px;
56
+ border: 1px solid #cccccc;
57
+ border-radius: 4px;
58
+ width: 100%;
59
+ }
60
+
61
+ button {
62
+ background-color: #4CAF50;
63
+ color: white;
64
+ border: none;
65
+ padding: 10px;
66
+ font-size: 14px;
67
+ cursor: pointer;
68
+ border-radius: 4px;
69
+ transition: background-color 0.3s ease;
70
+ }
71
+
72
+ button.secondary {
73
+ background-color: #4CAF50;
74
+ }
75
+
76
+ button:hover {
77
+ background-color: #45a049;
78
+ }
79
+
80
+ button.secondary:hover {
81
+ background-color: #0056b3;
82
+ }
83
+
84
+ .result {
85
+ margin-top: 20px;
86
+ padding: 10px;
87
+ background-color: #f9f9f9;
88
+ border-left: 4px solid #4CAF50;
89
+ }
90
+
91
+ /* Footer styles */
92
+ footer {
93
+ background-color: #333;
94
+ color: white;
95
+ text-align: center;
96
+ padding: 20px;
97
+ margin-top: auto;
98
+ overflow-y: auto;
99
+ }
100
+
101
+ .footer-content {
102
+ display: flex;
103
+ flex-wrap: wrap;
104
+ justify-content: space-around;
105
+ gap: 20px;
106
+ }
107
+
108
+ .footer-column {
109
+ text-align: left;
110
+ }
111
+
112
+ .footer-column ul {
113
+ list-style: none;
114
+ padding: 0;
115
+ }
116
+
117
+ .footer-column ul li a {
118
+ color: white;
119
+ text-decoration: none;
120
+ }
121
+
122
+ .footer-column ul li a:hover {
123
+ text-decoration: underline;
124
+ }
125
+
126
+ .footer-social-icon {
127
+ margin: 0 5px;
128
+ vertical-align: middle;
129
+ }
130
+
131
+ /* LaTeX fix */
132
+ .latex-container {
133
+ overflow-x: auto;
134
+ word-wrap: break-word;
135
+ }
136
+ </style>
137
+ <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
138
+ <script id="MathJax-script" async
139
+ src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
140
+ </head>
141
+ <body>
142
+ <div class="container">
143
+ <h1>Answers to x,y,z calculus</h1>
144
+ <form method="POST">
145
+ <label for="expression">Enter a Mathematical Expression:</label>
146
+ <input type="text" name="expression" id="expression" placeholder="e.g., x**2 + 3*x + 1" required>
147
+ <div>
148
+ <button name="operation" value="expand">Expand</button>
149
+ <button name="operation" value="lim">lim</button>
150
+ <button name="operation" value="simplify">Simplify</button>
151
+ <button name="operation" value="rationalize">Rationalize</button>
152
+ <button name="operation" value="factorize">Factorize</button>
153
+ <button name="operation" value="diffx">Dx</button>
154
+ <button name="operation" value="diffy">Dy</button>
155
+ <button name="operation" value="diffz">Dz</button>
156
+ <button name="operation" value="solve">Solve</button>
157
+ <button name="operation" value="integratex" class="secondary">Integrate(x)</button>
158
+ <button name="operation" value="integratey" class="secondary">Integrate(y)</button>
159
+ <button name="operation" value="integratez" class="secondary">Integrate(z)</button>
160
+ <button name="operation" value="ode" class="secondary">Solve ODE</button>
161
+ <button name="operation" value="limit" class="secondary">lim</button>
162
+ <button name="operation" value="series" class="secondary">Expand Series</button>
163
+ </div>
164
+ </form>
165
+
166
+ {% if result is not none %}
167
+ <div class="result latex-container">
168
+ {% if latex_result %}
169
+ <p>Answer:</p>
170
+ <p>$$ {{ latex_result }} $$</p>
171
+ {% endif %}
172
+ </div>
173
+ {% endif %}
174
+ </div>
175
+
176
+ <footer>
177
+ <div class="footer-content">
178
+ <div class="footer-column">
179
+ <p>P.O. Roma 180</p>
180
+ <p>Roma, Lesotho</p>
181
+ <p>Email: [email protected]</p>
182
+ <p>Phone: +266 6397 3129</p>
183
+ </div>
184
+ <div class="footer-column">
185
+ <h3>Links</h3>
186
+ <ul>
187
+ <li><a href="#">Home</a></li>
188
+ <li><a href="https://motaunginc.vercel.app">Services</a></li>
189
+ <li><a href="https://motaungmandla.github.io">About us</a></li>
190
+ </ul>
191
+ </div>
192
+ <div class="footer-column">
193
+ <h3>Connect</h3>
194
+ <ul class="social_team">
195
+ <li><a href="https://discord.gg/dkb6cFR2" aria-hidden="true"></i>Discord Server</a></li>
196
+ <li><a href="https://www.facebook.com/profile.php?id=100022011589532"><i class="fa fa-facebook"><i class="fa fa-twitter" aria-hidden="true"></i>Facebook</a></li>
197
+ <li><a href="https://www.linkedin.com/in/mandla-motaung-5b5a88329/"><i class="fa fa-linkedin" aria-hidden="true"></i>Linkedin</a></li>
198
+ <li><a href="#"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
199
+ </ul>
200
+ </div>
201
+ </div>
202
+ <p>&copy; Math tools 2024 - All Rights Reserved</p>
203
+ </footer>
204
+
205
+ <!DOCTYPE html>
206
+ <html lang="en">
207
+ <head>
208
+ <meta charset="UTF-8">
209
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
210
+ <title>Chat with Shanks</title>
211
+ <style>
212
+ /* Chatbot Button Position */
213
+ #chatbot-button {
214
+ position: fixed;
215
+ bottom: 20px;
216
+ right: 20px;
217
+ z-index: 1000;
218
+ }
219
+
220
+ #chatbot-button button {
221
+ padding: 10px 20px;
222
+ font-size: 16px;
223
+ cursor: pointer;
224
+ background-color: #4CAF50;
225
+ color: white;
226
+ border: none;
227
+ border-radius: 5px;
228
+ }
229
+
230
+ .chatbot-popup {
231
+ display: none;
232
+ position: fixed;
233
+ bottom: 80px;
234
+ right: 20px;
235
+ width: 400px; /* Increased width */
236
+ background-color: white;
237
+ border: 1px solid #ddd;
238
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
239
+ border-radius: 8px;
240
+ z-index: 999;
241
+ max-height: 500px; /* Increased max height */
242
+ }
243
+
244
+ .chatbot-header {
245
+ padding: 10px;
246
+ background-color: #4CAF50;
247
+ color: white;
248
+ display: flex;
249
+ justify-content: space-between;
250
+ align-items: center;
251
+ border-top-left-radius: 8px;
252
+ border-top-right-radius: 8px;
253
+ }
254
+
255
+ .chatbot-body {
256
+ padding: 10px;
257
+ max-height: 500px;
258
+ overflow-y: auto;
259
+ }
260
+
261
+ .chatbot-body input {
262
+ width: 100%;
263
+ padding: 8px;
264
+ margin-top: 10px;
265
+ border: 1px solid #ddd;
266
+ border-radius: 4px;
267
+ }
268
+
269
+ .chatbot-body button {
270
+ padding: 8px 16px;
271
+ background-color: #4CAF50;
272
+ color: white;
273
+ border: none;
274
+ border-radius: 4px;
275
+ margin-top: 10px;
276
+ cursor: pointer;
277
+ }
278
+ </style>
279
+ <script>
280
+ // Function to toggle the visibility of the chatbot pop-up
281
+ function toggleChat() {
282
+ const chatbotPopup = document.getElementById('chatbot-popup');
283
+ chatbotPopup.style.display = (chatbotPopup.style.display === 'none' || chatbotPopup.style.display === '') ? 'block' : 'none';
284
+ }
285
+
286
+ // Function to handle sending messages
287
+ function sendMessage() {
288
+ const input = document.getElementById('chat-input');
289
+ const message = input.value;
290
+
291
+ if (message) {
292
+ // Show the message in the chat area
293
+ const chatbotMessages = document.getElementById('chatbot-messages');
294
+ const messageElement = document.createElement('div');
295
+ messageElement.textContent = `You: ${message}`;
296
+ chatbotMessages.appendChild(messageElement);
297
+
298
+ // Clear the input field
299
+ input.value = '';
300
+
301
+ // Send the message to the Flask API
302
+ fetch('/chat', {
303
+ method: 'POST',
304
+ headers: {
305
+ 'Content-Type': 'application/json'
306
+ },
307
+ body: JSON.stringify({ message: message })
308
+ })
309
+ .then(response => response.json())
310
+ .then(data => {
311
+ const responseElement = document.createElement('div');
312
+ responseElement.textContent = `Chatbot: ${data.response}`;
313
+ chatbotMessages.appendChild(responseElement);
314
+ })
315
+ .catch(error => console.error('Error:', error));
316
+ }
317
+ }
318
+ </script>
319
+ </head>
320
+ <body>
321
+ <!-- Chatbot Button -->
322
+ <div id="chatbot-button">
323
+ <button onclick="toggleChat()">Ask ChatBot</button>
324
+ </div>
325
+
326
+ <!-- Chatbot Popup -->
327
+ <div id="chatbot-popup" class="chatbot-popup">
328
+ <div class="chatbot-header">
329
+ <span>Shanks</span>
330
+ <button onclick="toggleChat()">X</button>
331
+ </div>
332
+ <div class="chatbot-body">
333
+ <div id="chatbot-messages">
334
+ <!-- Chat messages will appear here -->
335
+ </div>
336
+ <input type="text" id="chat-input" placeholder="Type a message..." />
337
+ <button onclick="sendMessage()">Send</button>
338
+ </div>
339
+ </div>
340
+ </body>
341
+ </html>
342
+
343
+
344
+ </body>
345
+ </html>
templates/wolfram.html ADDED
The diff for this file is too large to render. See raw diff
 
vercel.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 2,
3
+ "builds": [
4
+ {"src":"main.py", "use": "@vercel/python"}
5
+ ],
6
+ "routes":[
7
+ {"src":"/(.*)", "dest":"main.py"}]
8
+ }