dynamic-learning-model 1.0__tar.gz → 1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dynamic_learning_model-1.0/dynamic_learning_model.egg-info → dynamic_learning_model-1.1}/PKG-INFO +2 -2
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/README.md +1 -1
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/dlm/DLM.py +70 -80
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1/dynamic_learning_model.egg-info}/PKG-INFO +2 -2
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/setup.py +1 -1
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/LICENSE +0 -0
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/dlm/__init__.py +0 -0
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/dynamic_learning_model.egg-info/SOURCES.txt +0 -0
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/dynamic_learning_model.egg-info/dependency_links.txt +0 -0
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/dynamic_learning_model.egg-info/requires.txt +0 -0
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/dynamic_learning_model.egg-info/top_level.txt +0 -0
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/pyproject.toml +0 -0
- {dynamic_learning_model-1.0 → dynamic_learning_model-1.1}/setup.cfg +0 -0
{dynamic_learning_model-1.0/dynamic_learning_model.egg-info → dynamic_learning_model-1.1}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dynamic-learning-model
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1
|
|
4
4
|
Summary: A Dynamic Learning Model for processing NLP queries using hybrid AI and reasoning.
|
|
5
5
|
Home-page: https://github.com/VigneshT24/Dynamic_Learning_Model
|
|
6
6
|
Author: Vignesh Thondikulam
|
|
@@ -46,7 +46,7 @@ Whether you're building a student support bot, a domain-specific assistant, or a
|
|
|
46
46
|
|
|
47
47
|
* This model uses SpaCy, SQLite, & NLTK for many of its functions
|
|
48
48
|
|
|
49
|
-
NOTICE:
|
|
49
|
+
NOTICE: This is a public package, to install it, run: **pip install dynamic-learning-model**
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|

|
|
@@ -16,7 +16,7 @@ Whether you're building a student support bot, a domain-specific assistant, or a
|
|
|
16
16
|
|
|
17
17
|
* This model uses SpaCy, SQLite, & NLTK for many of its functions
|
|
18
18
|
|
|
19
|
-
NOTICE:
|
|
19
|
+
NOTICE: This is a public package, to install it, run: **pip install dynamic-learning-model**
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|

|
|
@@ -21,7 +21,6 @@ class DLM:
|
|
|
21
21
|
__tone = None # sentimental tone of user query
|
|
22
22
|
__trainingPwd = "371507" # password to enter training mode
|
|
23
23
|
__mode = None # either "training", "commercial", or "experimental"
|
|
24
|
-
__singlePassthrough = True # used to prevent multiple iterations of training prompt
|
|
25
24
|
__unsure_while_thinking = False # if uncertain while thinking, then it will let the user know that
|
|
26
25
|
__nlp_similarity_value = None # saves the similarity value by doing SpaCy calculation (for debugging)
|
|
27
26
|
__special_stripped_query = None # saves query without any special words for reduced interference while vector calculating
|
|
@@ -259,11 +258,15 @@ class DLM:
|
|
|
259
258
|
"quarter": 0.25, "quarters": 0.25
|
|
260
259
|
}
|
|
261
260
|
|
|
262
|
-
def __init__(self, db_filename): # initializes SQL database & SpaCy NLP
|
|
261
|
+
def __init__(self, mode, db_filename="dlm_database.db"): # initializes SQL database & SpaCy NLP
|
|
263
262
|
"""
|
|
264
263
|
Initialize the Dynamic-Learning Model (DLM) chatbot.
|
|
265
264
|
|
|
266
265
|
Parameters:
|
|
266
|
+
mode (str): The access mode. Options:
|
|
267
|
+
't' for Training mode,
|
|
268
|
+
'c' for Commercial mode,
|
|
269
|
+
'e' for Experimental mode.
|
|
267
270
|
db_filename (str): The SQLite database file used to train and retrieve
|
|
268
271
|
question-answer-category triples.
|
|
269
272
|
|
|
@@ -271,13 +274,76 @@ class DLM:
|
|
|
271
274
|
- Loads the SpaCy NLP model ('en_core_web_lg').
|
|
272
275
|
- Loads Better-Profanity for profane phrase sensing.
|
|
273
276
|
- Connects to the specified SQLite database file.
|
|
277
|
+
- Set appropriate mode value
|
|
278
|
+
- Verify login information based on mode
|
|
274
279
|
- Ensures the required table structure exists (creates if missing).
|
|
275
280
|
"""
|
|
276
281
|
self.__nlp = spacy.load("en_core_web_lg")
|
|
277
282
|
profanity.load_censor_words()
|
|
278
283
|
self.__filename = db_filename
|
|
284
|
+
self.__mode = mode
|
|
285
|
+
self.__login_verification(self.__mode)
|
|
279
286
|
self.__create_table_if_missing()
|
|
280
287
|
|
|
288
|
+
def __login_verification(self, mode): # no return, void
|
|
289
|
+
"""
|
|
290
|
+
Verify and initialize the selected access mode (Training, Commercial, or Experimental).
|
|
291
|
+
|
|
292
|
+
Parameters:
|
|
293
|
+
mode (str): The access mode. Options are:
|
|
294
|
+
't' - Training mode (requires password and shows training guidelines)
|
|
295
|
+
'c' - Commercial mode (no training features, read-only usage)
|
|
296
|
+
'e' - Experimental mode (enables reasoning features, no DB writes)
|
|
297
|
+
|
|
298
|
+
Behavior:
|
|
299
|
+
- If mode is 't', prompts for a password and displays mandatory training instructions.
|
|
300
|
+
- If mode is 'c', enters Commercial mode without training privileges.
|
|
301
|
+
- If mode is 'e', proceeds with Experimental mode with reasoning capabilities.
|
|
302
|
+
"""
|
|
303
|
+
if mode.lower() == "t":
|
|
304
|
+
password = input("Enter the password to enter Training Mode: ")
|
|
305
|
+
while password != self.__trainingPwd:
|
|
306
|
+
password = input(
|
|
307
|
+
"Password is incorrect, try again or type 'stop' to enter in commercial mode instead: ")
|
|
308
|
+
if password.lower() == "stop":
|
|
309
|
+
self.__mode = "commercial"
|
|
310
|
+
print("\n")
|
|
311
|
+
self.__loadingAnimation("Logging in as Commercial User", 0.6)
|
|
312
|
+
print("\n")
|
|
313
|
+
break
|
|
314
|
+
if password == self.__trainingPwd:
|
|
315
|
+
# trainers must understand these rules as DLM can generate bad responses if these instructions are neglected
|
|
316
|
+
print(
|
|
317
|
+
f"\n\n{'\033[31m'}MAKE SURE TO UNDERSTAND THE FOLLOWING ANSWER FORMAT EXPECTED FOR EACH CATEGORY FOR THE BOT TO LEARN ACCURATELY:{'\033[0m'}\n")
|
|
318
|
+
print("*'yesno': Make sure to start your answer responses with \"yes\" or \"no\" ONLY")
|
|
319
|
+
print(
|
|
320
|
+
"*'process': Each answer must have three steps for your responses, separated by \";\" (semicolon)")
|
|
321
|
+
print(
|
|
322
|
+
"*'definition': Make sure to not mention the WORD/PHRASE to be defined & always start your response here with \"the\" only")
|
|
323
|
+
print("*'deadline': Only include the deadline date, as an example, \"March 31st 2025\"")
|
|
324
|
+
print("*'location': Mention the location only, nothing else. For example, \"The FAFSA.Gov website\"")
|
|
325
|
+
print("*'generic': Format doesn't matter for this, give your answer in any comprehensive format")
|
|
326
|
+
print(
|
|
327
|
+
"*'eligibility': Make sure to ONLY start the response with a pronoun like \"you\", \"they\", \"he\", \"she\", etc\n\n")
|
|
328
|
+
|
|
329
|
+
confirmation = input(
|
|
330
|
+
"Make sure to understand and note these instructions somewhere as the generated responses would get corrupt otherwise.\nType 'Y' if you understood: ")
|
|
331
|
+
while confirmation.lower() != "y": # trainers must understand the instructions above
|
|
332
|
+
confirmation = input(
|
|
333
|
+
"You cannot proceed to train without understanding the instructions aforementioned. Type 'Y' to continue: ")
|
|
334
|
+
self.__mode = "training"
|
|
335
|
+
print("\n")
|
|
336
|
+
self.__loadingAnimation("Logging in as Trainer", 0.6)
|
|
337
|
+
print("\n")
|
|
338
|
+
elif mode.lower() == "c":
|
|
339
|
+
self.__mode = "commercial"
|
|
340
|
+
self.__loadingAnimation("Logging in as Commercial User", 0.6)
|
|
341
|
+
print("Ask Non-Computational Queries (switch to experimental for computational queries)")
|
|
342
|
+
else:
|
|
343
|
+
self.__mode = "experimental"
|
|
344
|
+
self.__loadingAnimation("Logging in as Experimental", 0.6)
|
|
345
|
+
print("Ask Computational Problems (Arithmetics or Conversions)")
|
|
346
|
+
|
|
281
347
|
def __create_table_if_missing(self): # no return, void
|
|
282
348
|
"""
|
|
283
349
|
Ensure the existence of the 'knowledge_base' table in the SQLite database; create or modify it if necessary.
|
|
@@ -1188,76 +1254,11 @@ class DLM:
|
|
|
1188
1254
|
conn.commit()
|
|
1189
1255
|
conn.close()
|
|
1190
1256
|
|
|
1191
|
-
def
|
|
1192
|
-
"""
|
|
1193
|
-
Verify and initialize the selected access mode (Training, Commercial, or Experimental).
|
|
1194
|
-
|
|
1195
|
-
Parameters:
|
|
1196
|
-
mode (str): The access mode. Options are:
|
|
1197
|
-
't' - Training mode (requires password and shows training guidelines)
|
|
1198
|
-
'c' - Commercial mode (no training features, read-only usage)
|
|
1199
|
-
'e' - Experimental mode (enables reasoning features, no DB writes)
|
|
1200
|
-
|
|
1201
|
-
Behavior:
|
|
1202
|
-
- If mode is 't', prompts for a password and displays mandatory training instructions.
|
|
1203
|
-
- If mode is 'c', enters Commercial mode without training privileges.
|
|
1204
|
-
- If mode is 'e', proceeds with Experimental mode with reasoning capabilities.
|
|
1205
|
-
"""
|
|
1206
|
-
if mode.lower() == "t":
|
|
1207
|
-
password = input("Enter the password to enter Training Mode: ")
|
|
1208
|
-
while password != self.__trainingPwd:
|
|
1209
|
-
password = input(
|
|
1210
|
-
"Password is incorrect, try again or type 'stop' to enter in commercial mode instead: ")
|
|
1211
|
-
if password.lower() == "stop":
|
|
1212
|
-
self.__mode = "commercial"
|
|
1213
|
-
print("\n")
|
|
1214
|
-
self.__loadingAnimation("Logging in as Commercial User", 0.6)
|
|
1215
|
-
print("\n")
|
|
1216
|
-
break
|
|
1217
|
-
if password == self.__trainingPwd:
|
|
1218
|
-
# trainers must understand these rules as DLM can generate bad responses if these instructions are neglected
|
|
1219
|
-
print(
|
|
1220
|
-
f"\n\n{'\033[31m'}MAKE SURE TO UNDERSTAND THE FOLLOWING ANSWER FORMAT EXPECTED FOR EACH CATEGORY FOR THE BOT TO LEARN ACCURATELY:{'\033[0m'}\n")
|
|
1221
|
-
print("*'yesno': Make sure to start your answer responses with \"yes\" or \"no\" ONLY")
|
|
1222
|
-
print(
|
|
1223
|
-
"*'process': Each answer must have three steps for your responses, separated by \";\" (semicolon)")
|
|
1224
|
-
print(
|
|
1225
|
-
"*'definition': Make sure to not mention the WORD/PHRASE to be defined & always start your response here with \"the\" only")
|
|
1226
|
-
print("*'deadline': Only include the deadline date, as an example, \"March 31st 2025\"")
|
|
1227
|
-
print("*'location': Mention the location only, nothing else. For example, \"The FAFSA.Gov website\"")
|
|
1228
|
-
print("*'generic': Format doesn't matter for this, give your answer in any comprehensive format")
|
|
1229
|
-
print(
|
|
1230
|
-
"*'eligibility': Make sure to ONLY start the response with a pronoun like \"you\", \"they\", \"he\", \"she\", etc\n\n")
|
|
1231
|
-
|
|
1232
|
-
confirmation = input(
|
|
1233
|
-
"Make sure to understand and note these instructions somewhere as the generated responses would get corrupt otherwise.\nType 'Y' if you understood: ")
|
|
1234
|
-
while confirmation.lower() != "y": # trainers must understand the instructions above
|
|
1235
|
-
confirmation = input(
|
|
1236
|
-
"You cannot proceed to train without understanding the instructions aforementioned. Type 'Y' to continue: ")
|
|
1237
|
-
self.__mode = "training"
|
|
1238
|
-
print("\n")
|
|
1239
|
-
self.__loadingAnimation("Logging in as Trainer", 0.6)
|
|
1240
|
-
print("\n")
|
|
1241
|
-
elif mode.lower() == "c":
|
|
1242
|
-
self.__mode = "commercial"
|
|
1243
|
-
self.__loadingAnimation("Logging in as Commercial User", 0.6)
|
|
1244
|
-
print("Ask Non-Computational Queries (switch to experimental for computational queries)")
|
|
1245
|
-
else:
|
|
1246
|
-
self.__mode = "experimental"
|
|
1247
|
-
self.__loadingAnimation("Logging in as Experimental", 0.6)
|
|
1248
|
-
print("Ask Computational Problems (Arithmetics or Conversions)")
|
|
1249
|
-
|
|
1250
|
-
def ask(self, mode): # no return, void
|
|
1257
|
+
def ask(self, query): # no return, void
|
|
1251
1258
|
"""
|
|
1252
1259
|
Handle a full user interaction loop with the DLM bot.
|
|
1253
1260
|
NOTICE: To make the bot run continuously, implement a loop in your program
|
|
1254
1261
|
|
|
1255
|
-
Parameters:
|
|
1256
|
-
mode (str): The access mode. Options:
|
|
1257
|
-
't' for Training mode,
|
|
1258
|
-
'c' for Commercial mode,
|
|
1259
|
-
'e' for Experimental mode.
|
|
1260
|
-
|
|
1261
1262
|
Behavior:
|
|
1262
1263
|
- Prompts the user for input.
|
|
1263
1264
|
- Detects tone, filters input, searches knowledge base.
|
|
@@ -1266,18 +1267,7 @@ class DLM:
|
|
|
1266
1267
|
- If in training mode and answer is incorrect or not found, prompts user to teach the bot.
|
|
1267
1268
|
- In experimental mode, performs reasoning or arithmetic without using database.
|
|
1268
1269
|
"""
|
|
1269
|
-
|
|
1270
|
-
self.__login_verification(mode)
|
|
1271
|
-
self.__singlePassthrough = False
|
|
1272
|
-
|
|
1273
|
-
if self.__mode == "training":
|
|
1274
|
-
print("\nTRAINING MODE")
|
|
1275
|
-
elif self.__mode == "commercial":
|
|
1276
|
-
print("\n\nCOMMERCIAL MODE")
|
|
1277
|
-
else:
|
|
1278
|
-
print("\n\nEXPERIMENTAL MODE") # for experimental, there are no data saving in DB
|
|
1279
|
-
self.__query = input("DLM Bot here, ask away: ")
|
|
1280
|
-
|
|
1270
|
+
self.__query = query
|
|
1281
1271
|
while self.__query is None or self.__query == "":
|
|
1282
1272
|
self.__query = input("Empty input is unacceptable. Please enter something: ")
|
|
1283
1273
|
|
{dynamic_learning_model-1.0 → dynamic_learning_model-1.1/dynamic_learning_model.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dynamic-learning-model
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1
|
|
4
4
|
Summary: A Dynamic Learning Model for processing NLP queries using hybrid AI and reasoning.
|
|
5
5
|
Home-page: https://github.com/VigneshT24/Dynamic_Learning_Model
|
|
6
6
|
Author: Vignesh Thondikulam
|
|
@@ -46,7 +46,7 @@ Whether you're building a student support bot, a domain-specific assistant, or a
|
|
|
46
46
|
|
|
47
47
|
* This model uses SpaCy, SQLite, & NLTK for many of its functions
|
|
48
48
|
|
|
49
|
-
NOTICE:
|
|
49
|
+
NOTICE: This is a public package, to install it, run: **pip install dynamic-learning-model**
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|

|
|
@@ -5,7 +5,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name='dynamic-learning-model',
|
|
8
|
-
version='1.
|
|
8
|
+
version='1.1',
|
|
9
9
|
author='Vignesh Thondikulam',
|
|
10
10
|
author_email='vignesh.tho2006@gmail.com',
|
|
11
11
|
description='A Dynamic Learning Model for processing NLP queries using hybrid AI and reasoning.',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|